Exemplo n.º 1
0
    def test_ne(self):
        tc1 = CommandSet()
        tc1.enableCmd(1)

        tc2 = CommandSet()
        tc2.enableCmd(2)

        assert tc1 != tc2
Exemplo n.º 2
0
    def test_disableCommand(self):
        tc = CommandSet()
        tc.enableCmd(1)
        tc.enableCmd(2)
        tc.disableCmd(1)

        assert tc.has(2)
        assert not tc.has(1)
Exemplo n.º 3
0
    def test_eq(self):
        tc1 = CommandSet()
        tc1.enableCmd(1)

        tc2 = CommandSet()
        tc2.enableCmd(1)

        assert tc1 == tc2
Exemplo n.º 4
0
    def setCmdState(self, command, enable):
        s = CommandSet()

        s += command
        if enable and (self.state & sfActive):
            self.enableCommands(s)
        else:
            self.disableCommands(s)
Exemplo n.º 5
0
    def __getCommands(self):
        wc = CommandSet()
        wc += cmCascade

        for c in CommandCodes:
            wc += c.value

        wc -= CommandCodes.cmAbout
        wc -= CommandCodes.cmCreate
        wc -= CommandCodes.cmUpdate
        return wc
Exemplo n.º 6
0
    def test_ConstuctorFromInstance(self):
        tc = CommandSet()
        tc.enableCmd(1)

        tc2 = CommandSet(tc)

        assert tc2 == tc

        tc.enableCmd(2)

        assert tc2 != tc
Exemplo n.º 7
0
    def setState(self, state, enable):
        """
        First calls `super().setState(state, enable)`. Then, if `state` is
        equal to `sfSelected`, activates or deactivates the window and all
        its subviews using a call to `setState(sfActive, enable)`, and calls
        `enableCommands()` or `disableCommands()` for `cmNext`, `cmPrev`,
        `cmResize`, `cmClose` and `cmZoom`.

        :param state: State to modify
        :param enable: Enable or disable
        """
        super().setState(state, enable)

        windowCommands = CommandSet()

        if state & sfSelected:
            self.setState(sfActive, enable)
            if self.frame:
                self.frame.setState(sfActive, enable)

            windowCommands += cmNext
            windowCommands += cmPrev

            if self.flags & (wfGrow | wfMove):
                windowCommands += cmResize

            if self.flags & wfClose:
                windowCommands += cmClose

            if self.flags & wfZoom:
                windowCommands += cmZoom

            if enable:
                View.enableCommands(windowCommands)
            else:
                View.disableCommands(windowCommands)
Exemplo n.º 8
0
    def __init__(self):
        super().__init__()
        ts = CommandSet()
        ts.enableCmd(cmSave)
        ts.enableCmd(cmSaveAs)
        ts.enableCmd(cmCut)
        ts.enableCmd(cmCopy)
        ts.enableCmd(cmPaste)
        ts.enableCmd(cmClear)
        ts.enableCmd(cmUndo)
        ts.enableCmd(cmFind)
        ts.enableCmd(cmReplace)
        ts.enableCmd(cmSearchAgain)
        self.disableCommands(ts)

        self.editorDialog = self.doEditorDialog
        self.clipWindow = self.openEditor(None, False)
Exemplo n.º 9
0
 def test_has(self):
     tc = CommandSet()
     tc.enableCmd(1)
     assert tc.has(1)
Exemplo n.º 10
0
 def test_enableCommand(self):
     tc = CommandSet()
     tc.enableCmd(1)
Exemplo n.º 11
0
 def test_isEmpty(self):
     tc = CommandSet()
     assert tc.isEmpty()
Exemplo n.º 12
0
 def test_Constructor(self):
     tc = CommandSet()