def __init__(self, parent=None): QtGui.QMainWindow.__init__(self, parent) self.setMinimumSize(500, 400) self.showMaximized() self.setWindowTitle("Second Nature") self.setWindowFlags(QtCore.Qt.Window) self.setAttribute(QtCore.Qt.WA_DeleteOnClose) self.logger = sn_logger self.__applets = [] self.__extInitialised = False # -- main menu bar -- self._mainMenuBar = QtGui.QMenuBar(self) self._projectMenu = self._mainMenuBar.addMenu("&Project") self.setMenuBar(self._mainMenuBar) # -- project menu -- qpm = QActiveProjectManager() self._projectMenu.addAction(qpm.get_action_new()) self._projectMenu.addAction(qpm.get_action_open()) self._projectMenu.addAction(qpm.get_action_save()) self._projectMenu.addAction(qpm.get_action_close()) # -- a default central widget-- self.__centralStack = QtGui.QStackedWidget(self) # -- status bar -- self._statusBar = QtGui.QStatusBar(self) self._layoutMode = QtGui.QComboBox(self) self._statusBar.addPermanentWidget(self._layoutMode) self._layoutMode.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents) self.__currentLayout = None self._statusBar.setStyleSheet("QStatusBar{background-color: " +\ "qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, "+\ "stop:0 rgba(135,135,135,255), " +\ "stop:0.1 rgba(175,175,175,255), " +\ "stop:1 rgba(200, 200, 200, 255));}") # -- add all those guys to the main window (self) -- self.setMenuBar(self._mainMenuBar) self.setStatusBar(self._statusBar) self.setCentralWidget(self.__centralStack) self.__projMan = ProjectManager() if not self.__projMan.has_active_project(): self.__projMan.new_active_project("New Project") # -- connections -- self.__projMan.active_project_changed.connect(self.__on_active_project_set) AppletFactoryManager().applet_created.connect(self.add_applet) LayoutManager().item_list_changed.connect(self.__onLayoutListChanged) self._layoutMode.activated[int].connect(self.__onLayoutChosen) self._layoutMode.currentIndexChanged[int].connect(self.__onLayoutChosen)
def __init__(self, parent=None): QtGui.QStandardItemModel.__init__(self, parent) self.__projMan = ProjectManager() self.__docItemMap = {} self.__activeProjItem = None self.itemChanged.connect(self.__on_item_changed) self.__projMan.active_project_changed.connect(self.set_active_project) self.__activeProj = None activePrj = self.__projMan.get_active_project() if activePrj: self.set_active_project(activePrj)
def _new_0(self): data = self.new() if data.registerable: ProjectManager().add_data_to_active_project(data) return data
def __init__(self, mimetype): self.mimetype = mimetype self.projMan = ProjectManager()
def _open_url_0(self, parsedUrl): data = self.open_url(parsedUrl) if data.registerable: ProjectManager().add_data_to_active_project(data) return data
def getPlaceHolder(self): proj = ProjectManager().get_active_project() return AppletSpace(proj)