annotate pyink/dom_event.py @ 1270:ef1f16beef21

Remove a line of unused code - Keep it clean. - Please add it back if it is really useful. But, I don't think so.
author Thinker K.F. Li <thinker@codemud.net>
date Wed, 12 Jan 2011 21:04:45 +0800
parents 07e0cb1e051d
children 5313bbfafa67
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)
07e0cb1e051d Add class consistency_checker for domview_ui.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
16 def notifyChildOrderChanged(self,node,child,prev):
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