Exemple #1
0
    def setUp(self):
        self.stack = CommandStack()
        self.undo_manager = UndoManager()
        self.stack.undo_manager = self.undo_manager
        self.undo_manager.active_stack = self.stack

        self.command = SimpleCommand()
Exemple #2
0
def add_macro(stack, num_commands=2):
    command = SimpleCommand()
    stack.begin_macro("Increment n times")
    try:
        for i in range(num_commands):
            stack.push(command)
    finally:
        stack.end_macro()
 def test_merge_after_undo(self):
     with self.assert_n_commands_pushed(self.stack, 2):
         self.stack.push(self.command)
         command = MergeableCommand()
         self.stack.push(command)
         command = SimpleCommand()
         self.stack.push(command)
         self.stack.undo()
         command = MergeableCommand()
         with self.assertTraitChanges(self.stack.undo_manager,
                                      'stack_updated',
                                      count=1):
             self.stack.push(command)
Exemple #4
0
    def setUp(self):
        self.stack = CommandStack()
        undo_manager = UndoManager()
        self.stack.undo_manager = undo_manager

        self.command = SimpleCommand()