def __init__(self): QtGui.QMainWindow.__init__(self) self.setAcceptDrops(True) self.dropped.connect(self.importAsLayer) self.project = Project(self) self.toolsWidget = ToolsWidget(self.project) self.optionsWidget = OptionsWidget(self.project) self.paletteWidget = PaletteWidget(self.project) self.onionSkinWidget = OnionSkinWidget(self.project) self.timelineWidget = TimelineWidget(self.project) self.scene = Scene(self.project) self.updateTitle() self.project.updateTitleSign.connect(self.updateTitle) ### layout ##################################################### self.setDockNestingEnabled(True) self.setCentralWidget(self.scene) QtGui.QApplication.setOrganizationName("pixeditor") QtGui.QApplication.setApplicationName("pixeditor") settings = QtCore.QSettings() settings.beginGroup("mainWindow") try: lock = bool(int(settings.value("lock"))) except TypeError: lock = True toolsDock = Dock(self.toolsWidget, "tools", lock) toolsDock.setObjectName("toolsDock") self.addDockWidget(QtCore.Qt.LeftDockWidgetArea, toolsDock) self.scene.coords=toolsDock.widget().coords optionsDock = Dock(self.optionsWidget, "options", lock) optionsDock.setObjectName("optionsDock") self.addDockWidget(QtCore.Qt.RightDockWidgetArea, optionsDock) paletteDock = Dock(self.paletteWidget, "palette", lock) paletteDock.setObjectName("paletteDock") self.addDockWidget(QtCore.Qt.RightDockWidgetArea, paletteDock) onionSkinDock = Dock(self.onionSkinWidget, "onion skin", lock) onionSkinDock.setObjectName("onionSkinDock") self.addDockWidget(QtCore.Qt.RightDockWidgetArea, onionSkinDock) timelineDock = Dock(self.timelineWidget, "timeline", lock) timelineDock.setObjectName("timelineDock") self.addDockWidget(QtCore.Qt.BottomDockWidgetArea, timelineDock) ### File menu ### menubar = self.menuBar() openAction = QtGui.QAction('Open', self) openAction.triggered.connect(self.openAction) saveAsAction = QtGui.QAction('Save as', self) saveAsAction.triggered.connect(self.saveAsAction) saveAction = QtGui.QAction('Save', self) saveAction.triggered.connect(self.saveAction) saveAction.setShortcut('Ctrl+S') importNewAction = QtGui.QAction('Import as new', self) importNewAction.triggered.connect(self.importAsNewAction) importLayerAction = QtGui.QAction('Import as layer', self) importLayerAction.triggered.connect(self.importAsLayerAction) exportAction = QtGui.QAction('Export', self) exportAction.triggered.connect(self.exportAction) exportAction.setShortcut('Ctrl+E') exitAction = QtGui.QAction('Exit', self) exitAction.triggered.connect(self.close) exitAction.setShortcut('Ctrl+Q') fileMenu = menubar.addMenu('File') fileMenu.addAction(openAction) fileMenu.addAction(saveAsAction) fileMenu.addAction(saveAction) fileMenu.addSeparator() fileMenu.addAction(importNewAction) fileMenu.addAction(importLayerAction) fileMenu.addAction(exportAction) fileMenu.addSeparator() fileMenu.addAction(exitAction) ### Edit menu ### undoAction = QtGui.QAction('Undo', self) undoAction.triggered.connect(self.project.undo) undoAction.setShortcut('Ctrl+Z') redoAction = QtGui.QAction('Redo', self) redoAction.triggered.connect(self.project.redo) redoAction.setShortcut('Ctrl+Y') cutAction = QtGui.QAction('Cut', self) cutAction.triggered.connect(self.timelineWidget.cut) cutAction.setShortcut('Ctrl+X') copyAction = QtGui.QAction('Copy', self) copyAction.triggered.connect(self.timelineWidget.copy) copyAction.setShortcut('Ctrl+C') pasteAction = QtGui.QAction('Paste', self) pasteAction.triggered.connect(self.timelineWidget.paste) pasteAction.setShortcut('Ctrl+V') editMenu = menubar.addMenu('Edit') editMenu.addAction(undoAction) editMenu.addAction(redoAction) editMenu.addSeparator() editMenu.addAction(cutAction) editMenu.addAction(copyAction) editMenu.addAction(pasteAction) ### project menu ### newAction = QtGui.QAction('New', self) newAction.triggered.connect(self.newAction) cropAction = QtGui.QAction('Crop', self) cropAction.triggered.connect(self.cropAction) resizeAction = QtGui.QAction('Resize', self) resizeAction.triggered.connect(self.resizeAction) replacePaletteAction = QtGui.QAction('replace palette', self) replacePaletteAction.triggered.connect(self.replacePaletteAction) prefAction = QtGui.QAction('Background', self) prefAction.triggered.connect(self.backgroundAction) projectMenu = menubar.addMenu('Project') projectMenu.addAction(newAction) projectMenu.addAction(cropAction) projectMenu.addAction(resizeAction) projectMenu.addAction(replacePaletteAction) projectMenu.addAction(prefAction) ### resources menu ### savePaletteAction = QtGui.QAction('save current palette', self) savePaletteAction.triggered.connect(self.savePaletteAction) savePenAction = QtGui.QAction('save custom pen', self) savePenAction.triggered.connect(self.savePenAction) reloadResourcesAction = QtGui.QAction('reload resources', self) reloadResourcesAction.triggered.connect(self.reloadResourcesAction) resourcesMenu = menubar.addMenu('Resources') resourcesMenu.addAction(savePaletteAction) resourcesMenu.addAction(savePenAction) resourcesMenu.addAction(reloadResourcesAction) ### view menu ### viewMenu = menubar.addMenu('View') dockWidgets = self.findChildren(QtGui.QDockWidget) for dock in dockWidgets: viewMenu.addAction(dock.toggleViewAction()) viewMenu.addSeparator() self.lockLayoutWidget = QtGui.QAction('Lock Layout', self) self.lockLayoutWidget.setCheckable(True) self.lockLayoutWidget.setChecked(lock) self.lockLayoutWidget.toggled.connect(self.lockLayoutAction) viewMenu.addAction(self.lockLayoutWidget) ### shortcuts ### QtGui.QShortcut(QtCore.Qt.Key_Left, self, lambda : self.selectFrame(-1)) QtGui.QShortcut(QtCore.Qt.Key_Right, self, lambda : self.selectFrame(1)) QtGui.QShortcut(QtCore.Qt.Key_Up, self, lambda : self.selectLayer(-1)) QtGui.QShortcut(QtCore.Qt.Key_Down, self, lambda : self.selectLayer(1)) QtGui.QShortcut(QtCore.Qt.Key_Space, self, self.timelineWidget.playPauseClicked) QtGui.QShortcut(QtCore.Qt.Key_1, self, toolsDock.widget().penClicked) QtGui.QShortcut(QtCore.Qt.Key_2, self, toolsDock.widget().pipetteClicked) QtGui.QShortcut(QtCore.Qt.Key_3, self, toolsDock.widget().fillClicked) QtGui.QShortcut(QtCore.Qt.Key_4, self, toolsDock.widget().moveClicked) QtGui.QShortcut(QtCore.Qt.Key_5, self, toolsDock.widget().selectClicked) self.hiddenDock = [] QtGui.QShortcut(QtCore.Qt.Key_Tab, self, self.hideDock) QtGui.QShortcut(QtCore.Qt.Key_E, self, self.project.changeColor) ### settings ### try: self.restoreGeometry(settings.value("geometry")) except TypeError: pass # no geometry to restore so leave as is try: self.restoreState(settings.value("windowState")) except TypeError: pass # no state to restore so leave as is settings.endGroup() self.show()
def __init__(self): QtGui.QMainWindow.__init__(self) self.setAcceptDrops(True) self.dropped.connect(self.importAsLayer) self.project = Project(self) self.toolsWidget = ToolsWidget(self.project) self.optionsWidget = OptionsWidget(self.project) self.paletteWidget = PaletteWidget(self.project) self.onionSkinWidget = OnionSkinWidget(self.project) self.timelineWidget = TimelineWidget(self.project) self.scene = Scene(self.project) self.updateTitle() self.project.updateTitleSign.connect(self.updateTitle) ### layout ##################################################### self.setDockNestingEnabled(True) self.setCentralWidget(self.scene) QtGui.QApplication.setOrganizationName("pixeditor") QtGui.QApplication.setApplicationName("pixeditor") settings = QtCore.QSettings() settings.beginGroup("mainWindow") try: lock = bool(int(settings.value("lock"))) except TypeError: lock = True toolsDock = Dock(self.toolsWidget, "tools", lock) toolsDock.setObjectName("toolsDock") self.addDockWidget(QtCore.Qt.LeftDockWidgetArea, toolsDock) optionsDock = Dock(self.optionsWidget, "options", lock) optionsDock.setObjectName("optionsDock") self.addDockWidget(QtCore.Qt.RightDockWidgetArea, optionsDock) paletteDock = Dock(self.paletteWidget, "palette", lock) paletteDock.setObjectName("paletteDock") self.addDockWidget(QtCore.Qt.RightDockWidgetArea, paletteDock) onionSkinDock = Dock(self.onionSkinWidget, "onion skin", lock) onionSkinDock.setObjectName("onionSkinDock") self.addDockWidget(QtCore.Qt.RightDockWidgetArea, onionSkinDock) timelineDock = Dock(self.timelineWidget, "timeline", lock) timelineDock.setObjectName("timelineDock") self.addDockWidget(QtCore.Qt.BottomDockWidgetArea, timelineDock) ### File menu ### menubar = self.menuBar() openAction = QtGui.QAction('Open', self) openAction.triggered.connect(self.openAction) saveAsAction = QtGui.QAction('Save as', self) saveAsAction.triggered.connect(self.saveAsAction) saveAction = QtGui.QAction('Save', self) saveAction.triggered.connect(self.saveAction) saveAction.setShortcut('Ctrl+S') importNewAction = QtGui.QAction('Import as new', self) importNewAction.triggered.connect(self.importAsNewAction) importLayerAction = QtGui.QAction('Import as layer', self) importLayerAction.triggered.connect(self.importAsLayerAction) exportAction = QtGui.QAction('Export', self) exportAction.triggered.connect(self.exportAction) exportAction.setShortcut('Ctrl+E') exitAction = QtGui.QAction('Exit', self) exitAction.triggered.connect(self.close) exitAction.setShortcut('Ctrl+Q') fileMenu = menubar.addMenu('File') fileMenu.addAction(openAction) fileMenu.addAction(saveAsAction) fileMenu.addAction(saveAction) fileMenu.addSeparator() fileMenu.addAction(importNewAction) fileMenu.addAction(importLayerAction) fileMenu.addAction(exportAction) fileMenu.addSeparator() fileMenu.addAction(exitAction) ### Edit menu ### undoAction = QtGui.QAction('Undo', self) undoAction.triggered.connect(self.project.undo) undoAction.setShortcut('Ctrl+Z') redoAction = QtGui.QAction('Redo', self) redoAction.triggered.connect(self.project.redo) redoAction.setShortcut('Ctrl+Y') cutAction = QtGui.QAction('Cut', self) cutAction.triggered.connect(self.timelineWidget.cut) cutAction.setShortcut('Ctrl+X') copyAction = QtGui.QAction('Copy', self) copyAction.triggered.connect(self.timelineWidget.copy) copyAction.setShortcut('Ctrl+C') pasteAction = QtGui.QAction('Paste', self) pasteAction.triggered.connect(self.timelineWidget.paste) pasteAction.setShortcut('Ctrl+V') editMenu = menubar.addMenu('Edit') editMenu.addAction(undoAction) editMenu.addAction(redoAction) editMenu.addSeparator() editMenu.addAction(cutAction) editMenu.addAction(copyAction) editMenu.addAction(pasteAction) ### project menu ### newAction = QtGui.QAction('New', self) newAction.triggered.connect(self.newAction) cropAction = QtGui.QAction('Crop', self) cropAction.triggered.connect(self.cropAction) resizeAction = QtGui.QAction('Resize', self) resizeAction.triggered.connect(self.resizeAction) replacePaletteAction = QtGui.QAction('replace palette', self) replacePaletteAction.triggered.connect(self.replacePaletteAction) prefAction = QtGui.QAction('Background', self) prefAction.triggered.connect(self.backgroundAction) projectMenu = menubar.addMenu('Project') projectMenu.addAction(newAction) projectMenu.addAction(cropAction) projectMenu.addAction(resizeAction) projectMenu.addAction(replacePaletteAction) projectMenu.addAction(prefAction) ### resources menu ### savePaletteAction = QtGui.QAction('save current palette', self) savePaletteAction.triggered.connect(self.savePaletteAction) savePenAction = QtGui.QAction('save custom pen', self) savePenAction.triggered.connect(self.savePenAction) reloadResourcesAction = QtGui.QAction('reload resources', self) reloadResourcesAction.triggered.connect(self.reloadResourcesAction) resourcesMenu = menubar.addMenu('Resources') resourcesMenu.addAction(savePaletteAction) resourcesMenu.addAction(savePenAction) resourcesMenu.addAction(reloadResourcesAction) ### view menu ### viewMenu = menubar.addMenu('View') dockWidgets = self.findChildren(QtGui.QDockWidget) for dock in dockWidgets: viewMenu.addAction(dock.toggleViewAction()) viewMenu.addSeparator() self.lockLayoutWidget = QtGui.QAction('Lock Layout', self) self.lockLayoutWidget.setCheckable(True) self.lockLayoutWidget.setChecked(lock) self.lockLayoutWidget.toggled.connect(self.lockLayoutAction) viewMenu.addAction(self.lockLayoutWidget) ### shortcuts ### QtGui.QShortcut(QtCore.Qt.Key_Left, self, lambda : self.selectFrame(-1)) QtGui.QShortcut(QtCore.Qt.Key_Right, self, lambda : self.selectFrame(1)) QtGui.QShortcut(QtCore.Qt.Key_Up, self, lambda : self.selectLayer(-1)) QtGui.QShortcut(QtCore.Qt.Key_Down, self, lambda : self.selectLayer(1)) QtGui.QShortcut(QtCore.Qt.Key_Space, self, self.timelineWidget.playPauseClicked) QtGui.QShortcut(QtCore.Qt.Key_1, self, toolsDock.widget().penClicked) QtGui.QShortcut(QtCore.Qt.Key_2, self, toolsDock.widget().pipetteClicked) QtGui.QShortcut(QtCore.Qt.Key_3, self, toolsDock.widget().fillClicked) QtGui.QShortcut(QtCore.Qt.Key_4, self, toolsDock.widget().moveClicked) QtGui.QShortcut(QtCore.Qt.Key_5, self, toolsDock.widget().selectClicked) self.hiddenDock = [] QtGui.QShortcut(QtCore.Qt.Key_Tab, self, self.hideDock) QtGui.QShortcut(QtCore.Qt.Key_E, self, self.project.changeColor) ### settings ### try: self.restoreGeometry(settings.value("geometry")) except TypeError: pass # no geometry to restore so leave as is try: self.restoreState(settings.value("windowState")) except TypeError: pass # no state to restore so leave as is settings.endGroup() self.show()
def __init__(self): QMainWindow.__init__(self) QApplication.setOrganizationName("z-uo") QApplication.setApplicationName("pixeditor") self.colorDialog = QColorDialog() self.colorDialog.setOptions(QColorDialog.NoButtons) #self.colorDialog.hide() self.project = Project(self) self.rgbWidget = RgbSlidersWidget(self) self.rgbWidget.colorChanged.connect(self.project.setColor) self.project.colorChanged.connect(lambda widget=self: widget.rgbWidget.setColor(QColor(widget.project.colorTable[widget.project.color]))) self.hsvWidget = HsvSlidersWidget(self) self.hsvWidget.colorChanged.connect(self.project.setColor) self.project.colorChanged.connect(lambda widget=self: widget.hsvWidget.setColor(QColor(widget.project.colorTable[widget.project.color]))) self.hslWidget = HslSlidersWidget(self) self.hslWidget.colorChanged.connect(self.project.setColor) self.project.colorChanged.connect(lambda widget=self: widget.hslWidget.setColor(QColor(widget.project.colorTable[widget.project.color]))) self.cmykWidget = CmykSlidersWidget(self) self.cmykWidget.colorChanged.connect(self.project.setColor) self.project.colorChanged.connect(lambda widget=self: widget.cmykWidget.setColor(QColor(widget.project.colorTable[widget.project.color]))) self.contextWidget = ContextWidget(self.project) self.optionsWidget = OptionsWidget(self.project) self.paletteWidget = PaletteWidget(self.project) self.timelineWidget = TimelineWidget(self.project) self.scene = Scene(self.project) self.toolsWidget = ToolWidget(self) self.updateTitle() self.project.updateTitleSign.connect(self.updateTitle) self.setCentralWidget(self.scene) self.setDockNestingEnabled(True) toolsDock = QDockWidget("Tools") toolsDock.setWidget(self.toolsWidget) toolsDock.setObjectName("toolsDock") self.addDockWidget(Qt.LeftDockWidgetArea, toolsDock) contextDock = QDockWidget("Context") contextDock.setWidget(self.contextWidget) contextDock.setObjectName("contextDock") self.addDockWidget(Qt.LeftDockWidgetArea, contextDock) optionsDock = QDockWidget("Options") optionsDock.setWidget(self.optionsWidget) optionsDock.setObjectName("optionsDock") self.addDockWidget(Qt.LeftDockWidgetArea, optionsDock) paletteDock = QDockWidget("Palette") paletteDock.setWidget(self.paletteWidget) paletteDock.setObjectName("paletteDock") self.addDockWidget(Qt.LeftDockWidgetArea, paletteDock) #colorDialogDock = QDockWidget("Color Dialog") #colorDialogDock.setWidget(self.colorDialog) #colorDialogDock.setObjectName("colorDialog") #self.addDockWidget(Qt.LeftDockWidgetArea, colorDialogDock) rgbDock = QDockWidget("RGB") rgbDock.setWidget(self.rgbWidget) rgbDock.setObjectName("rgbDock") self.addDockWidget(Qt.LeftDockWidgetArea, rgbDock) hsvDock = QDockWidget("HSV") hsvDock.setWidget(self.hsvWidget) hsvDock.setObjectName("hsvDock") self.addDockWidget(Qt.LeftDockWidgetArea, hsvDock) hslDock = QDockWidget("HSL") hslDock.setWidget(self.hslWidget) hslDock.setObjectName("hslDock") self.addDockWidget(Qt.LeftDockWidgetArea, hslDock) cmykDock = QDockWidget("CMYK") cmykDock.setWidget(self.cmykWidget) cmykDock.setObjectName("cmykDock") self.addDockWidget(Qt.LeftDockWidgetArea, cmykDock) self.tabifyDockWidget(rgbDock, hsvDock) self.tabifyDockWidget(hsvDock, hslDock) self.tabifyDockWidget(hslDock, cmykDock) hsvDock.close() cmykDock.close() rgbDock.raise_() timelineDock = Dock("Timeline") timelineDock.setWidget(self.timelineWidget) timelineDock.setObjectName("timelineDock") timelineDock.setFeatures(QDockWidget.DockWidgetVerticalTitleBar | QDockWidget.AllDockWidgetFeatures) self.addDockWidget(Qt.BottomDockWidgetArea, timelineDock) ### Toolbar ### toolActions = QActionGroup(self) toolActions.setExclusive(True) penToolAction = QAction(QIcon("icons/tool_pen.png"), "&Pen", toolActions) penToolAction.setCheckable(True) penToolAction.setChecked(True) penToolAction.triggered.connect(self.penToolAction) pipetteToolAction = QAction(QIcon("icons/tool_pipette.png"), "P&ipette", toolActions) pipetteToolAction.setCheckable(True) pipetteToolAction.triggered.connect(self.pipetteToolAction) fillToolAction = QAction(QIcon("icons/tool_fill.png"), "&Fill", toolActions) fillToolAction.setCheckable(True) fillToolAction.triggered.connect(self.fillToolAction) moveToolAction = QAction(QIcon("icons/tool_move.png"), "&Move", toolActions) moveToolAction.setCheckable(True) moveToolAction.triggered.connect(self.moveToolAction) selectToolAction = QAction(QIcon("icons/tool_select.png"), "&Select", toolActions) selectToolAction.setCheckable(True) selectToolAction.triggered.connect(self.selectToolAction) toolbar = QToolBar("Tools") toolbar.addAction(penToolAction) toolbar.addAction(pipetteToolAction) toolbar.addAction(fillToolAction) toolbar.addAction(moveToolAction) toolbar.addAction(selectToolAction) toolbar.setObjectName("toolsToolbar") #self.addToolBar(toolbar) penToolAction.setShortcut('1') pipetteToolAction.setShortcut('2') fillToolAction.setShortcut('3') moveToolAction.setShortcut('4') selectToolAction.setShortcut('5') self.toolsWidget.addAction(penToolAction) self.toolsWidget.addAction(pipetteToolAction) self.toolsWidget.addAction(fillToolAction) self.toolsWidget.addAction(moveToolAction) self.toolsWidget.addAction(selectToolAction) ### File menu ### menubar = self.menuBar() newAction = QAction('&New', self) newAction.triggered.connect(self.newAction) openAction = QAction('&Open', self) openAction.triggered.connect(self.openAction) openAction.setShortcut(QKeySequence.Open) saveAsAction = QAction('Save &as', self) saveAsAction.triggered.connect(self.saveAsAction) saveAsAction.setShortcut(QKeySequence.SaveAs) saveAction = QAction('&Save', self) saveAction.triggered.connect(self.saveAction) saveAction.setShortcut(QKeySequence.Save) importNewAction = QAction('&Import as new', self) importNewAction.triggered.connect(self.importAsNewAction) importLayerAction = QAction('I&mport as layer', self) importLayerAction.triggered.connect(self.importAsLayerAction) exportAction = QAction('&Export', self) exportAction.triggered.connect(self.exportAction) exportAction.setShortcut('Ctrl+E') exitAction = QAction('E&xit', self) exitAction.triggered.connect(self.exitAction) exitAction.setShortcut(QKeySequence.Quit) fileMenu = menubar.addMenu('&File') fileMenu.addAction(newAction) fileMenu.addAction(openAction) fileMenu.addAction(saveAsAction) fileMenu.addAction(saveAction) fileMenu.addSeparator() fileMenu.addAction(importNewAction) fileMenu.addAction(importLayerAction) fileMenu.addAction(exportAction) fileMenu.addSeparator() fileMenu.addAction(exitAction) ### Edit menu ### undoAction = QAction('&Undo', self) undoAction.triggered.connect(self.project.undo) undoAction.setShortcut(QKeySequence.Undo) redoAction = QAction('&Redo', self) redoAction.triggered.connect(self.project.redo) redoAction.setShortcut(QKeySequence.Redo) cutAction = QAction('&Cut', self) cutAction.triggered.connect(self.timelineWidget.cut) cutAction.setShortcut(QKeySequence.Cut) copyAction = QAction('C&opy', self) copyAction.triggered.connect(self.timelineWidget.copy) copyAction.setShortcut(QKeySequence.Copy) pasteAction = QAction('&Paste', self) pasteAction.triggered.connect(self.timelineWidget.paste) pasteAction.setShortcut(QKeySequence.Paste) editMenu = menubar.addMenu('&Edit') editMenu.addAction(undoAction) editMenu.addAction(redoAction) editMenu.addSeparator() editMenu.addAction(cutAction) editMenu.addAction(copyAction) editMenu.addAction(pasteAction) ### tools menu ### toolsMenu = menubar.addMenu('&Tools') toolsMenu.addAction(penToolAction) toolsMenu.addAction(pipetteToolAction) toolsMenu.addAction(fillToolAction) toolsMenu.addAction(moveToolAction) toolsMenu.addAction(selectToolAction) ### view menu ### viewMenu = menubar.addMenu('&View') toolbars = self.findChildren(QToolBar) for toolbar in toolbars: viewMenu.addAction(toolbar.toggleViewAction()) viewMenu.addSeparator() dockWidgets = self.findChildren(QDockWidget) for dock in dockWidgets: viewMenu.addAction(dock.toggleViewAction()) viewMenu.addSeparator() self.lockLayoutAction = QAction('&Lock Layout', self) self.lockLayoutAction.setCheckable(True) self.lockLayoutAction.triggered.connect(lambda checked, widget=self: widget.setLayoutLocked(checked)) viewMenu.addAction(self.lockLayoutAction) ### project menu ### cropAction = QAction('&Crop', self) cropAction.triggered.connect(self.cropAction) resizeAction = QAction('&Resize', self) resizeAction.triggered.connect(self.resizeAction) replacePaletteAction = QAction('Replace &palette', self) replacePaletteAction.triggered.connect(self.replacePaletteAction) prefAction = QAction('&Background', self) prefAction.triggered.connect(self.backgroundAction) projectMenu = menubar.addMenu('&Project') projectMenu.addAction(cropAction) projectMenu.addAction(resizeAction) projectMenu.addSeparator() projectMenu.addAction(replacePaletteAction) projectMenu.addSeparator() projectMenu.addAction(prefAction) ### resources menu ### savePaletteAction = QAction('Save current &palette', self) savePaletteAction.triggered.connect(self.savePaletteAction) savePenAction = QAction('Save &custom pen', self) savePenAction.triggered.connect(self.savePenAction) reloadResourcesAction = QAction('&Reload resources', self) reloadResourcesAction.triggered.connect(self.reloadResourcesAction) resourcesMenu = menubar.addMenu('&Resources') resourcesMenu.addAction(savePaletteAction) resourcesMenu.addAction(savePenAction) resourcesMenu.addSeparator() resourcesMenu.addAction(reloadResourcesAction) ### shortcuts ### shortcut = QShortcut(self) shortcut.setKey(Qt.Key_Left) shortcut.activated.connect(lambda: self.selectFrame(-1)) shortcut2 = QShortcut(self) shortcut2.setKey(Qt.Key_Right) shortcut2.activated.connect(lambda: self.selectFrame(1)) shortcut3 = QShortcut(self) shortcut3.setKey(Qt.Key_Up) shortcut3.activated.connect(lambda: self.selectLayer(-1)) shortcut4 = QShortcut(self) shortcut4.setKey(Qt.Key_Down) shortcut4.activated.connect(lambda: self.selectLayer(1)) shortcut5 = QShortcut(self) shortcut5.setKey(Qt.Key_Space) shortcut5.activated.connect(self.timelineWidget.playPauseClicked) ### settings ### self.readSettings() self.show()