Mercurial > MadButterfly
annotate pyink/dom_event.py @ 1475:8c6078c17f2d
Install test data when show FSM_window
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Sun, 24 Apr 2011 18:17:36 +0800 |
parents | 5313bbfafa67 |
children |
rev | line source |
---|---|
1253
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
1 import pybInkscape |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
2 |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
3 class ObjectWatcher(pybInkscape.PYNodeObserver): |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
4 def __init__(self, obj, type, func, arg): |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
5 self.obj = obj |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
6 self.type = type |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
7 self.func = func |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
8 self.arg = arg |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
9 |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
10 def notifyChildAdded(self, node, child, prev): |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
11 if self.type == 'DOMNodeInserted': |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
12 self.func(node, child) |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
13 def notifyChildRemoved(self, node, child, prev): |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
14 if self.type == 'DOMNodeRemoved': |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
15 self.func(node, child) |
1359
5313bbfafa67
Fix issue of chain of reference for opacity and matrix
Thinker K.F. Li <thinker@codemud.net>
parents:
1253
diff
changeset
|
16 def notifyChildOrderChanged(self, node, child, old_prev, new_prev): |
1253
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
17 pass |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
18 def notifyContentChanged(self,node,old_content,new_content): |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
19 if self.type == 'DOMSubtreeModified': |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
20 self.func(node) |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
21 def notifyAttributeChanged(self,node, name, old_value, new_value): |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
22 if self.type == 'DOMAttrModified': |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
23 self.func(node, name, old_value, new_value) |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
24 |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
25 def addEventListener(obj, type, func, arg): |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
26 obs = ObjectWatcher(obj, type, func, arg) |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
27 obj.addSubtreeObserver(obs) |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
28 pass |
07e0cb1e051d
Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
29 |