diff --git a/setup.py b/setup.py index cee767d..72cff78 100644 --- a/setup.py +++ b/setup.py @@ -48,7 +48,8 @@ setup(name='sloth', description='The Sloth Labeling Tool', author='CV:HCI Research Group', url='http://cvhci.anthropomatik.kit.edu', + requires=['importlib', 'okapy'], packages=packages, data_files=data_files, - scripts=['sloth/bin/labeltool.py'] + scripts=['sloth/bin/sloth'] ) diff --git a/sloth/__init__.py b/sloth/__init__.py index e69de29..2e47f9e 100644 --- a/sloth/__init__.py +++ b/sloth/__init__.py @@ -0,0 +1,5 @@ +APP_NAME = """labeltool""" +ORGANIZATION_NAME = """CV:HCI Research Group""" +ORGANIZATION_DOMAIN = """cvhci.anthropomatik.kit.edu""" +VERSION = """0.1""" + diff --git a/sloth/bin/sloth b/sloth/bin/sloth new file mode 100755 index 0000000..0659abc --- /dev/null +++ b/sloth/bin/sloth @@ -0,0 +1,17 @@ +#!/usr/bin/env python +import sys +from PyQt4.QtGui import QApplication +from sloth.gui import MainWindow +from sloth import APP_NAME, ORGANIZATION_NAME, ORGANIZATION_DOMAIN + +if __name__ == '__main__': + app = QApplication(sys.argv) + app.setOrganizationName(ORGANIZATION_NAME) + app.setOrganizationDomain(ORGANIZATION_DOMAIN) + app.setApplicationName(APP_NAME) + + wnd = MainWindow(sys.argv[1:]) + wnd.show() + + sys.exit(app.exec_()) + diff --git a/sloth/gui/__init__.py b/sloth/gui/__init__.py index e69de29..57f0e8f 100644 --- a/sloth/gui/__init__.py +++ b/sloth/gui/__init__.py @@ -0,0 +1 @@ +from labeltool import MainWindow diff --git a/sloth/bin/labeltool.py b/sloth/gui/labeltool.py similarity index 94% rename from sloth/bin/labeltool.py rename to sloth/gui/labeltool.py index d22f7ee..a114322 100755 --- a/sloth/bin/labeltool.py +++ b/sloth/gui/labeltool.py @@ -1,8 +1,5 @@ #!/usr/bin/python import sys, os -INSTALLDIR=os.path.join(os.path.dirname(__file__), '../gui') -sys.path.append(INSTALLDIR) - import functools, importlib from optparse import OptionParser from PyQt4.QtGui import * @@ -15,11 +12,9 @@ from sloth.annotations.container import AnnotationContainerFactory, AnnotationCo from sloth.gui.annotationscene import * from sloth.gui.frameviewer import * from sloth.conf import config +from sloth import APP_NAME, ORGANIZATION_NAME, ORGANIZATION_DOMAIN, VERSION -APP_NAME = """labeltool""" -ORGANIZATION_NAME = """CV:HCI Research Group""" -ORGANIZATION_DOMAIN = """cvhci.anthropomatik.kit.edu""" -__version__ = """0.1""" +GUIDIR=os.path.join(os.path.dirname(__file__)) class MainWindow(QMainWindow): def __init__(self, argv, parent=None): @@ -51,7 +46,7 @@ class MainWindow(QMainWindow): def parseCommandLineOptions(self, argv): usage = "Usage: %prog [-c config.py] [annotation_file]" - version = "%prog " + __version__ + version = "%prog " + VERSION parser = OptionParser(usage=usage, version=version) parser.add_option("-c", "--config", action="store", type="string", default="", help="Configuration file.") @@ -82,7 +77,7 @@ class MainWindow(QMainWindow): ### GUI/Application setup ###___________________________________________________________________________________________ def setupGui(self): - self.ui = uic.loadUi(os.path.join(INSTALLDIR, "labeltool.ui"), self) + self.ui = uic.loadUi(os.path.join(GUIDIR, "labeltool.ui"), self) self.scene = AnnotationScene(items=config.ITEMS, inserters=config.INSERTERS) self.view = GraphicsView(self) @@ -308,17 +303,4 @@ class MainWindow(QMainWindow):
For more details, visit our homepage: %s""" % (APP_NAME, __version__, ORGANIZATION_DOMAIN, ORGANIZATION_DOMAIN)) -def main(): - app = QApplication(sys.argv) - app.setOrganizationName(ORGANIZATION_NAME) - app.setOrganizationDomain(ORGANIZATION_DOMAIN) - app.setApplicationName(APP_NAME) - - wnd = MainWindow(sys.argv[1:]) - wnd.show() - - return app.exec_() - -if __name__ == '__main__': - sys.exit(main())