Exemplo n.º 1
0
 def toolbar(self, title, actions=None):
     toolbar = ToolBar(title)
     toolbar.setObjectName(u'%sToolBar' % title)
     toolbar.setMovable(False)
     toolbar.setFixedHeight(32)
     toolbar.setIconSize(QSize(30, 30))
     toolbar.setToolButtonStyle(Qt.ToolButtonIconOnly)
     if actions:
         addActions(toolbar, actions)
     self.addToolBar(Qt.TopToolBarArea, toolbar)
     return toolbar
Exemplo n.º 2
0
 def setupMenus(self):
     labelMenu = QMenu()
     # noinspection PyUnresolvedReferences
     addActions(labelMenu, (editLabel, delBox))
     self.menus = Struct(file=self.menu('&File'),
                         edit=self.menu('&Edit'),
                         view=self.menu('&View'),
                         machine_learning=self.menu('&Machine Learning'),
                         help=self.menu('&Help'),
                         recentFiles=QMenu('Open &Recent'),
                         labelList=labelMenu)
     # noinspection PyUnresolvedAttribute
     self.menus.file.aboutToShow.connect(self.updateFileMenu)
Exemplo n.º 3
0
    def setupCanvasWidget(self):
        action = partial(newAction, self)
        # Create and add a widget for showing current label items
        self.canvas = Canvas(parent=self)
        self.canvas.zoomRequest.connect(self.zoomRequest)
        self.canvas.setDrawingShapeToSquare(
            self.settings.get(SETTING_DRAW_SQUARE, False))
        self.canvas.scrollRequest.connect(self.scrollRequest)

        self.canvas.newShape.connect(self.newShape)
        self.canvas.shapeMoved.connect(self.setDirty)
        self.canvas.selectionChanged.connect(self.shapeSelectionChanged)
        self.canvas.drawingPolygon.connect(self.toggleDrawingSensitive)
        # Custom context menu for the canvas widget:
        # noinspection PyUnresolvedReferences
        addActions(self.canvas.menus[0], self.actions.beginnerContext)
        addActions(self.canvas.menus[1],
                   (action('&Copy here', self.copyShape),
                    action('&Move here', self.moveShape)))
Exemplo n.º 4
0
 def populateMenus(self):
     labels = self.dock.toggleViewAction()
     labels.setText(getStr('showHide'))
     labels.setShortcut('Ctrl+Shift+L')
     # noinspection PyUnresolvedReferences
     addActions(self.menus.file,
                (openFile, self.menus.recentFiles, openDir, changeSaveDir,
                 impVideo, openAnnotation, saveFile, changeFormat, saveAs,
                 closeFile, resetAll, close))
     # noinspection PyUnresolvedReferences
     addActions(self.menus.help, (showTutorialDialog, showInfo))
     # noinspection PyUnresolvedReferences
     addActions(self.menus.view,
                (self.autoSaving, self.singleClassMode,
                 self.displayLabelOption, labels, advancedMode, None,
                 prevImg, nextImg, None, hideAll, showAll, None, zoomIn,
                 zoomOut, zoomOrg, None, setFitWin, setFitWidth))
     # noinspection PyUnresolvedReferences
     addActions(self.menus.machine_learning,
                (commitAnnotatedFrames, trainModel, visualize, None))
Exemplo n.º 5
0
 def populateModeActions(self):
     if self.beginner():
         tool, menu = self.actions.beginner, self.actions.beginnerContext
     else:
         tool, menu = self.actions.advanced, self.actions.advancedContext
     self.tools.clear()
     addActions(self.tools, tool)
     self.canvas.menus[0].clear()
     addActions(self.canvas.menus[0], menu)
     self.menus.edit.clear()
     actions = (self.actions.create,) if self.beginner() \
         else (self.actions.setCreateMode, self.actions.setEditMode,
               self.actions.verifyImg)
     addActions(self.menus.edit, actions + self.actions.editMenu)
Exemplo n.º 6
0
 def menu(self, title, actions=None):
     menu = self.menuBar().addMenu(title)
     if actions:
         addActions(menu, actions)
     return menu
Exemplo n.º 7
0
 def setAdvanced(self):
     self.tools.clear()
     addActions(self.tools, self.actions.advanced)
Exemplo n.º 8
0
 def setBeginner(self):
     self.tools.clear()
     addActions(self.tools, self.actions.beginner)