Ejemplo n.º 1
0
class PageTab(QWidget):
    # args: can undo / can redo
    undoChanged = pyqtSignal(bool, bool)

    def __init__(self, doc: AbstractPage, parent=None):
        super().__init__(parent)
        self.view = SchView()
        self.doc = doc
        self.ctrl = Controller(doc=self.doc, view=self.view)
        self.view.setCtrl(self.ctrl)
        self.doc.undoStack.canUndoChanged.connect(self._onUndoChanged)
        self.doc.undoStack.canRedoChanged.connect(self._onUndoChanged)
        layout = QVBoxLayout()
        layout.addWidget(self.view)
        self.setLayout(layout)

    @pyqtSlot(bool)
    def _onUndoChanged(self):
        self.undoChanged.emit(self.canUndo(), self.canRedo())

    def canUndo(self):
        return self.doc.undoStack.canUndo()

    def canRedo(self):
        return self.doc.undoStack.canRedo()

    def undo(self):
        self.doc.undo()

    def redo(self):
        self.doc.redo()
Ejemplo n.º 2
0
class PageTab(QWidget):
    # args: can undo / can redo
    undoChanged = pyqtSignal(bool, bool)

    def __init__(self, doc: AbstractPage, parent=None):
        super().__init__(parent)
        self.view = SchView()
        self.doc = doc
        self.ctrl = Controller(doc=self.doc, view=self.view)
        self.view.setCtrl(self.ctrl)
        self.doc.undoStack.canUndoChanged.connect(self._onUndoChanged)
        self.doc.undoStack.canRedoChanged.connect(self._onUndoChanged)
        layout = QVBoxLayout()
        layout.addWidget(self.view)
        self.setLayout(layout)

    @pyqtSlot(bool)
    def _onUndoChanged(self):
        self.undoChanged.emit(self.canUndo(), self.canRedo())

    def canUndo(self):
        return self.doc.undoStack.canUndo()

    def canRedo(self):
        return self.doc.undoStack.canRedo()

    def undo(self):
        self.doc.undo()

    def redo(self):
        self.doc.redo()
Ejemplo n.º 3
0
 def __init__(self, doc: AbstractPage, parent=None):
     super().__init__(parent)
     self.view = SchView()
     self.doc = doc
     self.ctrl = Controller(doc=self.doc, view=self.view)
     self.view.setCtrl(self.ctrl)
     self.doc.undoStack.canUndoChanged.connect(self._onUndoChanged)
     self.doc.undoStack.canRedoChanged.connect(self._onUndoChanged)
     layout = QVBoxLayout()
     layout.addWidget(self.view)
     self.setLayout(layout)
Ejemplo n.º 4
0
 def __init__(self, doc: AbstractPage, parent=None):
     super().__init__(parent)
     self.view = SchView()
     self.doc = doc
     self.ctrl = Controller(doc=self.doc, view=self.view)
     self.view.setCtrl(self.ctrl)
     self.doc.undoStack.canUndoChanged.connect(self._onUndoChanged)
     self.doc.undoStack.canRedoChanged.connect(self._onUndoChanged)
     layout = QVBoxLayout()
     layout.addWidget(self.view)
     self.setLayout(layout)