From bf970c235fb541563a3e45c075de404d9a31af4f Mon Sep 17 00:00:00 2001 From: Martin Baeuml Date: Wed, 29 Jun 2011 15:10:40 +0200 Subject: [PATCH] setup gui in core labeltool object --- sloth/bin/sloth | 5 ----- sloth/core/labeltool.py | 17 ++++++++++++++--- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/sloth/bin/sloth b/sloth/bin/sloth index fab991a..5000459 100755 --- a/sloth/bin/sloth +++ b/sloth/bin/sloth @@ -1,7 +1,6 @@ #!/usr/bin/env python import sys from PyQt4.QtGui import QApplication -from sloth.gui import MainWindow from sloth.core.labeltool import LabelTool from sloth import APP_NAME, ORGANIZATION_NAME, ORGANIZATION_DOMAIN @@ -14,9 +13,5 @@ if __name__ == '__main__': labeltool = LabelTool() labeltool.execute_from_commandline(sys.argv) - wnd = MainWindow(labeltool) - labeltool._mainwindow = wnd - wnd.show() - sys.exit(app.exec_()) diff --git a/sloth/core/labeltool.py b/sloth/core/labeltool.py index 12c9245..e3f6f92 100755 --- a/sloth/core/labeltool.py +++ b/sloth/core/labeltool.py @@ -15,6 +15,7 @@ from sloth.core.cli import LaxOptionParser, BaseCommand from sloth.core.utils import import_callable from sloth import VERSION from sloth.core.commands import get_commands +from sloth.gui import MainWindow import logging LOG = logging.getLogger(__name__) @@ -156,6 +157,13 @@ class LabelTool(QObject): else: self.clearAnnotations() + # Setup GUI + self._mainwindow = MainWindow(self) + self._mainwindow.show() + + # Load plugins + self.loadPlugins(config.PLUGINS) + def fetch_command(self, subcommand): """ Tries to fetch the given subcommand, printing a message with the @@ -192,9 +200,6 @@ class LabelTool(QObject): # Instatiate container factory self.container_factory_ = AnnotationContainerFactory(config.CONTAINERS) - # Load plugins - self.loadPlugins(config.PLUGINS) - def loadPlugins(self, plugins): self.plugins_ = [] for plugin in plugins: @@ -339,6 +344,12 @@ class LabelTool(QObject): self._model._root.appendFileItem(fileitem) + ### + ### GUI functions + ###___________________________________________________________________________________________ + def mainWindow(self): + return self._mainwindow + ### ### PropertyEditor functions ###___________________________________________________________________________________________