changeset 1526:04b67119df8c

Prevent users from changing name of main component and its timelines
author Thinker K.F. Li <thinker@codemud.net>
date Wed, 31 Aug 2011 15:41:12 +0800
parents 701a568f6949
children d42951ebfc6f
files pyink/comp_dock.py
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/pyink/comp_dock.py	Mon Aug 22 19:20:20 2011 +0800
+++ b/pyink/comp_dock.py	Wed Aug 31 15:41:12 2011 +0800
@@ -400,6 +400,8 @@
         itr = model.get_iter(path)
 
         old_name = model.get_value(itr, 0)
+        if old_name == 'main':
+            raise ValueError, 'can not change name of main component'
 
         model.set_value(itr, 0, new_text)
         model.set_value(itr, 1, False)
@@ -471,6 +473,11 @@
 
     def on_cellrenderer_timelines_edited(self, renderer, path,
                                          new_text, *args):
+        comp_name = self._domview_ui.get_current_component()
+        if comp_name == 'main':
+            raise ValueError, \
+                'can not change name of timeline of main component'
+        
         model = self._timelines_model
         itr = model.get_iter(path)