class _EventManager(QtCore.QObject): GlobalRefresh = QtCore.Signal() ProjectOfInterest = QtCore.Signal(str) FolderOfInterest = QtCore.Signal(str) JobOfInterest = QtCore.Signal(str) LayerOfInterest = QtCore.Signal(str) TaskOfInterest = QtCore.Signal(str, str) # taskId, optional jobId ClusterOfInterest = QtCore.Signal(str) NodeOfInterest = QtCore.Signal(str)
def setWorkspace(self, name): if name == self.__active: return if self.__settings: self.saveState(close=True) self.__active = name self.__settings = QtCore.QSettings("plow", "ws_%s" % name) self.btn.setText(name) winstate = self.__settings.value("main::windowState") if winstate: self.parent().restoreState(winstate) panelNames = self.__settings.value("main::openPanelNames") panelTypes = self.__settings.value("main::openPanelTypes") if panelNames: for name, ptype in zip(panelNames, panelTypes): p = self.createPanel(ptype, name, True) self.parent().restoreDockWidget(p) p.show()
def __init__(self, appname, workspace): QtGui.QMainWindow.__init__(self, None) self.resize(1024, 800) self.__default_workspace = workspace self.setDockOptions(self.AnimatedDocks | self.AllowNestedDocks | self.AllowTabbedDocks | self.VerticalTabs) self.session = QtGui.QSessionManager(self) self.settings = QtCore.QSettings("plow", appname) self.workspace = WorkspaceManager(self) LOGGER.debug("Using settings file %s", self.settings.fileName()) spacer = QtGui.QWidget() spacer.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) # Only has workspace and search self.toolbar_top = QtGui.QToolBar(self) self.toolbar_top.setObjectName("Toolbar") self.toolbar_top.addWidget(spacer) self.toolbar_top.toggleViewAction().setDisabled(True) self.workspace.addWorkspaceSelectionMenu(self.toolbar_top) self.addToolBar(QtCore.Qt.TopToolBarArea, self.toolbar_top) # Setup menu bar menubar = QtGui.QMenuBar() self.workspace.addPanelCreationMenu(menubar) menu_window = menubar.addMenu("Window") menu_window.addAction("New Window") menu_window.addSeparator() self.setMenuBar(menubar) self.restoreApplicationState()
class DefaultConfig(object): # Default window size Size = QtCore.QSize(800, 600)
def getSettings(name, scope=QtCore.QSettings.UserScope, parent=None): settings = QtCore.QSettings(QtCore.QSettings.NativeFormat, scope, "plow", name, parent) return settings