comparison pyink/comp_dock.py @ 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 fa4d0480d6cb
children 199ba528fd4a
comparison
equal deleted inserted replaced
1525:701a568f6949 1526:04b67119df8c
398 new_text, *args): 398 new_text, *args):
399 model = self._components_model 399 model = self._components_model
400 itr = model.get_iter(path) 400 itr = model.get_iter(path)
401 401
402 old_name = model.get_value(itr, 0) 402 old_name = model.get_value(itr, 0)
403 if old_name == 'main':
404 raise ValueError, 'can not change name of main component'
403 405
404 model.set_value(itr, 0, new_text) 406 model.set_value(itr, 0, new_text)
405 model.set_value(itr, 1, False) 407 model.set_value(itr, 1, False)
406 408
407 self._domview_ui.rename_component(old_name, new_text) 409 self._domview_ui.rename_component(old_name, new_text)
469 self._drop_undo() 471 self._drop_undo()
470 pass 472 pass
471 473
472 def on_cellrenderer_timelines_edited(self, renderer, path, 474 def on_cellrenderer_timelines_edited(self, renderer, path,
473 new_text, *args): 475 new_text, *args):
476 comp_name = self._domview_ui.get_current_component()
477 if comp_name == 'main':
478 raise ValueError, \
479 'can not change name of timeline of main component'
480
474 model = self._timelines_model 481 model = self._timelines_model
475 itr = model.get_iter(path) 482 itr = model.get_iter(path)
476 483
477 old_name = model.get_value(itr, 0) 484 old_name = model.get_value(itr, 0)
478 485