Example #1
0
    def __init__(self, iconDirectory, widgetToFocus, parent=None,
                 flags=Qt.WindowFlags()):
        """
        TOWRITE

        :param `iconDirectory`: TOWRITE
        :type `iconDirectory`: QString
        :param `widgetToFocus`: TOWRITE
        :type `widgetToFocus`: `QWidget`_
        :param `parent`: Pointer to a parent widget instance.
        :type `parent`: `QWidget`_
        :param `flags`: TOWRITE
        :type `flags`: Qt.WindowFlags
        """
        super(UndoEditor, self).__init__(parent, flags)

        self.iconDir = iconDirectory
        self.iconSize = 16
        self.setMinimumSize(100, 100)

        self.undoGroup = QUndoGroup(self)
        self.undoView = QUndoView(self.undoGroup, self)
        self.undoView.setEmptyLabel(self.tr("New"))
        self.undoView.setCleanIcon(QIcon(self.iconDir + os.sep + "new.png")) # TODO: new.png for new drawings, open.png for opened drawings, save.png for saved/cleared drawings?

        self.setWidget(self.undoView)
        self.setWindowTitle(self.tr("History"))
        self.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea)

        self.setFocusProxy(widgetToFocus)
        self.undoView.setFocusProxy(widgetToFocus)
Example #2
0
    def __init__(self,
                 iconDirectory,
                 widgetToFocus,
                 parent=None,
                 flags=Qt.WindowFlags()):
        """
        TOWRITE

        :param `iconDirectory`: TOWRITE
        :type `iconDirectory`: QString
        :param `widgetToFocus`: TOWRITE
        :type `widgetToFocus`: QWidget
        :param `parent`: TOWRITE
        :type `parent`: QWidget
        :param `flags`: TOWRITE
        :type `flags`: Qt.WindowFlags
        """
        super(UndoEditor, self).__init__(parent, flags)

        self.iconDir = iconDirectory
        self.iconSize = 16
        self.setMinimumSize(100, 100)

        self.undoGroup = QUndoGroup(self)
        self.undoView = QUndoView(self.undoGroup, self)
        self.undoView.setEmptyLabel(self.tr("New"))
        self.undoView.setCleanIcon(
            QIcon(self.iconDir + os.sep + "new.png")
        )  # TODO: new.png for new drawings, open.png for opened drawings, save.png for saved/cleared drawings?

        self.setWidget(self.undoView)
        self.setWindowTitle(self.tr("History"))
        self.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea)

        self.setFocusProxy(widgetToFocus)
        self.undoView.setFocusProxy(widgetToFocus)
Example #3
0
class UndoEditor(QDockWidget):
    """
    Subclass of `QDockWidget`_

    TOWRITE

    .. sphinx_generate_methods_summary::
       UndoEditor
    """
    def __init__(self,
                 iconDirectory,
                 widgetToFocus,
                 parent=None,
                 flags=Qt.WindowFlags()):
        """
        TOWRITE

        :param `iconDirectory`: TOWRITE
        :type `iconDirectory`: QString
        :param `widgetToFocus`: TOWRITE
        :type `widgetToFocus`: `QWidget`_
        :param `parent`: Pointer to a parent widget instance.
        :type `parent`: `QWidget`_
        :param `flags`: TOWRITE
        :type `flags`: Qt.WindowFlags
        """
        super(UndoEditor, self).__init__(parent, flags)

        self.iconDir = iconDirectory
        self.iconSize = 16
        self.setMinimumSize(100, 100)

        self.undoGroup = QUndoGroup(self)
        self.undoView = QUndoView(self.undoGroup, self)
        self.undoView.setEmptyLabel(self.tr("New"))
        self.undoView.setCleanIcon(
            QIcon(self.iconDir + os.sep + "new.png")
        )  # TODO: new.png for new drawings, open.png for opened drawings, save.png for saved/cleared drawings?

        self.setWidget(self.undoView)
        self.setWindowTitle(self.tr("History"))
        self.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea)

        self.setFocusProxy(widgetToFocus)
        self.undoView.setFocusProxy(widgetToFocus)

    def addStack(self, stack):
        """
        TOWRITE

        :param `stack`: TOWRITE
        :type `stack`: `QUndoStack`_
        """
        self.undoGroup.addStack(stack)

    def canUndo(self):
        """TOWRITE"""
        return self.undoGroup.canUndo()

    def canRedo(self):
        """TOWRITE"""
        return self.undoGroup.canRedo()

    def undoText(self):
        """TOWRITE"""
        return self.undoGroup.undoText()

    def redoText(self):
        """TOWRITE"""
        return self.undoGroup.redoText()

    def undo(self):
        """TOWRITE"""
        self.undoGroup.undo()

    def redo(self):
        """TOWRITE"""
        self.undoGroup.redo()
Example #4
0
class UndoEditor(QDockWidget):
    """
    Subclass of `QDockWidget`_

    TOWRITE

    .. sphinx_generate_methods_summary::
       UndoEditor
    """
    def __init__(self, iconDirectory, widgetToFocus, parent=None,
                 flags=Qt.WindowFlags()):
        """
        TOWRITE

        :param `iconDirectory`: TOWRITE
        :type `iconDirectory`: QString
        :param `widgetToFocus`: TOWRITE
        :type `widgetToFocus`: `QWidget`_
        :param `parent`: Pointer to a parent widget instance.
        :type `parent`: `QWidget`_
        :param `flags`: TOWRITE
        :type `flags`: Qt.WindowFlags
        """
        super(UndoEditor, self).__init__(parent, flags)

        self.iconDir = iconDirectory
        self.iconSize = 16
        self.setMinimumSize(100, 100)

        self.undoGroup = QUndoGroup(self)
        self.undoView = QUndoView(self.undoGroup, self)
        self.undoView.setEmptyLabel(self.tr("New"))
        self.undoView.setCleanIcon(QIcon(self.iconDir + os.sep + "new.png")) # TODO: new.png for new drawings, open.png for opened drawings, save.png for saved/cleared drawings?

        self.setWidget(self.undoView)
        self.setWindowTitle(self.tr("History"))
        self.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea)

        self.setFocusProxy(widgetToFocus)
        self.undoView.setFocusProxy(widgetToFocus)


    def addStack(self, stack):
        """
        TOWRITE

        :param `stack`: TOWRITE
        :type `stack`: `QUndoStack`_
        """
        self.undoGroup.addStack(stack)

    def canUndo(self):
        """TOWRITE"""
        return self.undoGroup.canUndo()

    def canRedo(self):
        """TOWRITE"""
        return self.undoGroup.canRedo()

    def undoText(self):
        """TOWRITE"""
        return self.undoGroup.undoText()

    def redoText(self):
        """TOWRITE"""
        return self.undoGroup.redoText()

    def undo(self):
        """TOWRITE"""
        self.undoGroup.undo()

    def redo(self):
        """TOWRITE"""
        self.undoGroup.redo()