changeset 1276:0442ae9c2ac2

Fix bug of max frame of domview. - old implementation does not consider condition about undo.
author Thinker K.F. Li <thinker@codemud.net>
date Wed, 12 Jan 2011 22:15:06 +0800
parents 776b024ae8f9
children 4686f3131f2a
files pyink/domview.py
diffstat 1 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/pyink/domview.py	Wed Jan 12 21:41:26 2011 +0800
+++ b/pyink/domview.py	Wed Jan 12 22:15:06 2011 +0800
@@ -159,7 +159,21 @@
 		pass
 	    pass
 	elif (name in ('start', 'end')) and node.name() == 'ns0:scene':
-	    self._maxframe = max(int(new_value), self._maxframe)
+            try:
+                new_value = int(new_value)
+                old_value = int(old_value)
+            except TypeError:
+                scenes_node = node.parent()
+                self._maxframe = self._find_maxframe(scenes_node)
+            else:
+                if old_value == self._maxframe and old_value > new_value:
+                    # _maxframe may be reduced.
+                    scenes_node = node.parent()
+                    self._maxframe = self._find_maxframe(scenes_node)
+                else:
+                    self._maxframe = max(int(new_value), self._maxframe)
+                    pass
+                pass
 	    pass
 	pass