test
Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
FWCore
GuiBrowsers
python
Vispa
Share
UndoEvent.py
Go to the documentation of this file.
1
2
class
UndoEvent
(
object
):
3
LABEL =
""
4
5
def
__init__
(self):
6
pass
7
8
def
undo
(self):
9
""" Undos this event.
10
"""
11
raise
NotImplementedError
12
13
def
redo
(self):
14
""" Repeats this event.
15
"""
16
raise
NotImplementedError
17
18
def
combine
(self, otherUndoEvent):
19
""" Combines this event with another event of the same kind.
20
21
If the combination was successfull True or otherwise False will be returned.
22
"""
23
return
False
24
25
def
description
(self):
26
""" Returns a string with more detailed explanation of what this event does
27
28
E.g. what exactly was dragged, moved or which values changed.
29
"""
30
return
""
31
32
def
setLastSavedState
(self, flag):
33
""" Sets the last saved state flag.
34
35
If the flag is True, this UndoEvent represents the first action
36
after saving the file for the last time.
37
"""
38
self.
_lastSavedStateFlag
= flag
39
40
def
isLastSavedState
(self):
41
""" Returns the last saved state flag, see setLastSavedState().
42
"""
43
if
hasattr(self,
"_lastSavedStateFlag"
):
44
return
self.
_lastSavedStateFlag
45
return
False
46
47
def
dump
(self, prefix="undo"):
48
print
prefix,
": "
, self.
LABEL
, self.
isLastSavedState
()
49
50
51
class
MultiUndoEvent
(
UndoEvent
):
52
""" This UndoEvent holds a list of UndoEvents whose redo() and undo() are invoked at the same time
53
when the corresponding function of this event is invoked.
54
"""
55
56
LABEL =
"Multiple actions"
57
58
def
__init__
(self, listOfUndoEvents, label=None):
59
UndoEvent.__init__(self)
60
self.
_undoEvents
= listOfUndoEvents
61
if
label:
62
self.
LABEL
= label
63
if
len(self.
_undoEvents
) == 1:
64
self.
LABEL
= self.
_undoEvents
[0].LABEL
65
66
labels = []
67
for
event
in
self.
_undoEvents
:
68
if
not
event.LABEL
in
labels:
69
labels.append(event.LABEL)
70
if
len(labels) > 0:
71
self.
LABEL
+=
" (%s)"
%
", "
.
join
(labels)
72
73
def
undo
(self):
74
for
event
in
self.
_undoEvents
:
75
event.undo()
76
77
def
redo
(self):
78
# undo event list comes sorted so that it will work for undo
79
# if events depend on each other its important to reverse order for redo()
80
for
event
in
reversed(self.
_undoEvents
):
81
event.redo()
82
83
def
dump
(self, prefix="undo"):
84
UndoEvent.dump(self, prefix)
85
for
event
in
self.
_undoEvents
:
86
event.dump(
" "
+ prefix)
87
Vispa.Share.UndoEvent.UndoEvent
Definition:
UndoEvent.py:2
Vispa.Share.UndoEvent.MultiUndoEvent._undoEvents
_undoEvents
Definition:
UndoEvent.py:60
Vispa.Share.UndoEvent.UndoEvent.dump
def dump
Definition:
UndoEvent.py:47
Vispa.Share.UndoEvent.MultiUndoEvent.redo
def redo
Definition:
UndoEvent.py:77
Vispa.Share.UndoEvent.UndoEvent.redo
def redo
Definition:
UndoEvent.py:13
Vispa.Share.UndoEvent.UndoEvent.__init__
def __init__
Definition:
UndoEvent.py:5
Vispa.Share.UndoEvent.UndoEvent.setLastSavedState
def setLastSavedState
Definition:
UndoEvent.py:32
Vispa.Share.UndoEvent.MultiUndoEvent
Definition:
UndoEvent.py:51
join
static std::string join(char **cmd)
Definition:
RemoteFile.cc:18
Vispa.Share.UndoEvent.MultiUndoEvent.__init__
def __init__
Definition:
UndoEvent.py:58
Vispa.Share.UndoEvent.UndoEvent.description
def description
Definition:
UndoEvent.py:25
Vispa.Share.UndoEvent.UndoEvent.undo
def undo
Definition:
UndoEvent.py:8
dbtoconf.object
list object
Definition:
dbtoconf.py:77
Vispa.Share.UndoEvent.UndoEvent.combine
def combine
Definition:
UndoEvent.py:18
Vispa.Share.UndoEvent.UndoEvent._lastSavedStateFlag
_lastSavedStateFlag
Definition:
UndoEvent.py:38
Vispa.Share.UndoEvent.UndoEvent.LABEL
string LABEL
Definition:
UndoEvent.py:3
Vispa.Share.UndoEvent.MultiUndoEvent.dump
def dump
Definition:
UndoEvent.py:83
Vispa.Share.UndoEvent.MultiUndoEvent.undo
def undo
Definition:
UndoEvent.py:73
Vispa.Share.UndoEvent.UndoEvent.isLastSavedState
def isLastSavedState
Definition:
UndoEvent.py:40
Generated for CMSSW Reference Manual by
1.8.5