~ubuntu-branches/ubuntu/utopic/python-apptools/utopic

« back to all changes in this revision

Viewing changes to apptools/undo/i_undo_manager.py

  • Committer: Bazaar Package Importer
  • Author(s): Varun Hiremath
  • Date: 2011-07-08 23:55:50 UTC
  • mfrom: (2.1.9 sid)
  • Revision ID: james.westby@ubuntu.com-20110708235550-yz5u79ubeo4dhyfx
Tags: 4.0.0-1
* New upstream release
* Update debian/watch file

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#------------------------------------------------------------------------------
 
2
# Copyright (c) 2008, Riverbank Computing Limited
 
3
# All rights reserved.
 
4
#
 
5
# This software is provided without warranty under the terms of the BSD
 
6
# license included in enthought/LICENSE.txt and may be redistributed only
 
7
# under the conditions described in the aforementioned license.  The license
 
8
# is also available online at http://www.enthought.com/licenses/BSD.txt
 
9
# Thanks for using Enthought open source!
 
10
#
 
11
# Author: Riverbank Computing Limited
 
12
# Description: <Enthought undo package component>
 
13
#------------------------------------------------------------------------------
 
14
 
 
15
 
 
16
# Enthought library imports.
 
17
from traits.api import Bool, Event, Instance, Int, Interface, Unicode
 
18
 
 
19
 
 
20
class IUndoManager(Interface):
 
21
    """ The undo manager interface.  An undo manager is responsible for one or
 
22
    more command stacks.  Typically an application would have a single undo
 
23
    manager.
 
24
    """
 
25
 
 
26
    #### 'IUndoManager' interface #############################################
 
27
 
 
28
    # This is the currently active command stack and may be None.  Typically it
 
29
    # is set when some sort of editor becomes active.
 
30
    active_stack = Instance('apptools.undo.api.ICommandStack')
 
31
 
 
32
    # This reflects the clean state of the currently active command stack.  It
 
33
    # is intended to support a "document modified" indicator in the GUI.  It is
 
34
    # maintained by the undo manager.
 
35
    active_stack_clean = Bool
 
36
 
 
37
    # This is the name of the command that can be redone.  It will be empty if
 
38
    # there is no command that can be redone.  It is maintained by the undo
 
39
    # manager.
 
40
    redo_name = Unicode
 
41
 
 
42
    # This is the sequence number of the next command to be performed.  It is
 
43
    # incremented immediately before a command is invoked (by its 'do()'
 
44
    # method).
 
45
    sequence_nr = Int
 
46
 
 
47
    # This event is fired when the index of a command stack changes.  Note that
 
48
    # it may not be the active stack.
 
49
    stack_updated = Event(Instance('apptools.undo.api.ICommandStack'))
 
50
 
 
51
    # This is the name of the command that can be undone.  It will be empty if
 
52
    # there is no command that can be undone.  It is maintained by the undo
 
53
    # manager.
 
54
    undo_name = Unicode
 
55
 
 
56
    ###########################################################################
 
57
    # 'IUndoManager' interface.
 
58
    ###########################################################################
 
59
 
 
60
    def redo(self):
 
61
        """ Redo the last undone command of the active command stack. """
 
62
 
 
63
    def undo(self):
 
64
        """ Undo the last command of the active command stack. """