def startEditorNew(self): if -1 in self.editors: self.editors[-1].activateWindow() else: e = Editor({'id': -1}) self._setEditorStaggerPos(e) self.editors[-1] = e e.closed.connect(self.onEditorClose) e.show()
def startEditor(self, idx=None): dic = self.diaryList.getDiaryDict(idx or self.diaryList.currentIndex()) id_ = dic['id'] if id_ in self.editors: self.editors[id_].activateWindow() else: e = Editor(dic) self._setEditorStaggerPos(e) self.editors[id_] = e e.closed.connect(self.onEditorClose) pre, next_ = lambda: self._editorMove( -1), lambda: self._editorMove(1) e.preSc.activated.connect(pre) e.quickPreSc.activated.connect(pre) e.nextSc.activated.connect(next_) e.quickNextSc.activated.connect(next_) e.show()