Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def populateModeActions(self):
tool, menu = self.actions.tool, self.actions.menu
self.tools.clear()
utils.addActions(self.tools, tool)
self.canvas.menus[0].clear()
utils.addActions(self.canvas.menus[0], menu)
self.menus.edit.clear()
actions = (
self.actions.createMode,
self.actions.createRectangleMode,
self.actions.createCircleMode,
self.actions.createLineMode,
self.actions.createPointMode,
self.actions.createLineStripMode,
self.actions.editMode,
)
utils.addActions(self.menus.edit, actions + self.actions.editMenu)
def menu(self, title, actions=None):
menu = self.menuBar().addMenu(title)
if actions:
utils.addActions(menu, actions)
return menu
onShapesPresent=(saveAs, hideAll, showAll),
)
self.canvas.edgeSelected.connect(self.canvasShapeEdgeSelected)
self.canvas.vertexSelected.connect(self.actions.removePoint.setEnabled)
self.menus = utils.struct(
file=self.menu(self.tr('&File')),
edit=self.menu(self.tr('&Edit')),
view=self.menu(self.tr('&View')),
help=self.menu(self.tr('&Help')),
recentFiles=QtWidgets.QMenu(self.tr('Open &Recent')),
labelList=labelMenu,
)
utils.addActions(
self.menus.file,
(
open_,
openNextImg,
openPrevImg,
opendir,
self.menus.recentFiles,
save,
saveAs,
saveAuto,
changeOutputDir,
saveWithImageData,
close,
deleteFile,
None,
quit,
def populateModeActions(self):
tool, menu = self.actions.tool, self.actions.menu
self.tools.clear()
utils.addActions(self.tools, tool)
self.canvas.menus[0].clear()
utils.addActions(self.canvas.menus[0], menu)
self.menus.edit.clear()
actions = (
self.actions.createMode,
self.actions.createRectangleMode,
self.actions.createCircleMode,
self.actions.createLineMode,
self.actions.createPointMode,
self.actions.createLineStripMode,
self.actions.editMode,
)
utils.addActions(self.menus.edit, actions + self.actions.editMenu)
tool, menu = self.actions.tool, self.actions.menu
self.tools.clear()
utils.addActions(self.tools, tool)
self.canvas.menus[0].clear()
utils.addActions(self.canvas.menus[0], menu)
self.menus.edit.clear()
actions = (
self.actions.createMode,
self.actions.createRectangleMode,
self.actions.createCircleMode,
self.actions.createLineMode,
self.actions.createPointMode,
self.actions.createLineStripMode,
self.actions.editMode,
)
utils.addActions(self.menus.edit, actions + self.actions.editMenu)
def toolbar(self, title, actions=None):
toolbar = ToolBar(title)
toolbar.setObjectName('%sToolBar' % title)
# toolbar.setOrientation(Qt.Vertical)
toolbar.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)
if actions:
utils.addActions(toolbar, actions)
self.addToolBar(Qt.LeftToolBarArea, toolbar)
return toolbar
showAll,
None,
zoomIn,
zoomOut,
zoomOrg,
None,
fitWindow,
fitWidth,
None,
),
)
self.menus.file.aboutToShow.connect(self.updateFileMenu)
# Custom context menu for the canvas widget:
utils.addActions(self.canvas.menus[0], self.actions.menu)
utils.addActions(
self.canvas.menus[1],
(
action('&Copy here', self.copyShape),
action('&Move here', self.moveShape),
),
)
self.tools = self.toolbar('Tools')
# Menu buttons on Left
self.actions.tool = (
open_,
opendir,
openNextImg,
openPrevImg,
save,
None,
zoomIn,
zoomOut,
zoomOrg,
None,
fitWindow,
fitWidth,
None,
),
)
self.menus.file.aboutToShow.connect(self.updateFileMenu)
# Custom context menu for the canvas widget:
utils.addActions(self.canvas.menus[0], self.actions.menu)
utils.addActions(
self.canvas.menus[1],
(
action('&Copy here', self.copyShape),
action('&Move here', self.moveShape),
),
)
self.tools = self.toolbar('Tools')
# Menu buttons on Left
self.actions.tool = (
open_,
opendir,
openNextImg,
openPrevImg,
save,
deleteFile,