mirror of
https://github.com/wassname/sloth.git
synced 2026-07-06 05:16:56 +08:00
setup gui in core labeltool object
This commit is contained in:
@@ -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_())
|
||||
|
||||
|
||||
+14
-3
@@ -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
|
||||
###___________________________________________________________________________________________
|
||||
|
||||
Reference in New Issue
Block a user