comparison pyink/comp_dock.py @ 1335:194c7a831083

Consistent checking for components and timelines
author Thinker K.F. Li <thinker@codemud.net>
date Mon, 31 Jan 2011 23:21:20 +0800
parents 3cbc1ab15541
children 0b5ee9c90af7
comparison
equal deleted inserted replaced
1334:38403fdb0c6c 1335:194c7a831083
264 domview_ui.switch_timeline(timeline_name) 264 domview_ui.switch_timeline(timeline_name)
265 pass 265 pass
266 266
267 def on_add_comp_clicked(self, *args): 267 def on_add_comp_clicked(self, *args):
268 self._add_component() 268 self._add_component()
269 self._desktop.doc().done("None",
270 "Add a new component")
269 pass 271 pass
270 272
271 def on_remove_comp_clicked(self, *args): 273 def on_remove_comp_clicked(self, *args):
272 self._rm_component() 274 self._rm_component()
275 self._desktop.doc().done("None",
276 "Remove a component")
273 pass 277 pass
274 278
275 def on_treeview_components_button_press_event(self, widget, event, *args): 279 def on_treeview_components_button_press_event(self, widget, event, *args):
276 if event.type != gtk.gdk.BUTTON_PRESS: 280 if event.type != gtk.gdk.BUTTON_PRESS:
277 return 281 return
282 self._components_menu.popup(None, None, None, event.button, event.time) 286 self._components_menu.popup(None, None, None, event.button, event.time)
283 pass 287 pass
284 288
285 def on_treeview_components_row_activated(self, *args): 289 def on_treeview_components_row_activated(self, *args):
286 self._switch_component() 290 self._switch_component()
291 self._desktop.doc().done("None",
292 "Switch to another component")
287 pass 293 pass
288 294
289 ## \brief Handle of changing component name. 295 ## \brief Handle of changing component name.
290 # 296 #
291 def on_cellrenderer_comp_edited(self, renderer, path, 297 def on_cellrenderer_comp_edited(self, renderer, path,
297 303
298 model.set_value(itr, 0, new_text) 304 model.set_value(itr, 0, new_text)
299 model.set_value(itr, 1, False) 305 model.set_value(itr, 1, False)
300 306
301 self._domview_ui.rename_component(old_name, new_text) 307 self._domview_ui.rename_component(old_name, new_text)
308
309 self._desktop.doc().done("None",
310 "Change name of a component")
302 pass 311 pass
303 312
304 def on_rename_component_activate(self, *args): 313 def on_rename_component_activate(self, *args):
305 treeview = self._components_treeview 314 treeview = self._components_treeview
306 path, col = treeview.get_cursor() 315 path, col = treeview.get_cursor()
318 comp_name = self._current_component() 327 comp_name = self._current_component()
319 cur_layer_group_sp = desktop.currentLayer() 328 cur_layer_group_sp = desktop.currentLayer()
320 cur_layer_group = cur_layer_group_sp.repr 329 cur_layer_group = cur_layer_group_sp.repr
321 330
322 self._domview_ui.link_to_component(comp_name, cur_layer_group) 331 self._domview_ui.link_to_component(comp_name, cur_layer_group)
332
333 self._desktop.doc().done("None",
334 "Make a xlink of a component")
323 pass 335 pass
324 336
325 def on_switch_component_activate(self, *args): 337 def on_switch_component_activate(self, *args):
326 self._switch_component() 338 self._switch_component()
339 self._desktop.doc().done("None",
340 "Switch to another component")
327 pass 341 pass
328 342
329 def on_add_timeline_clicked(self, *args): 343 def on_add_timeline_clicked(self, *args):
330 self._add_timeline() 344 self._add_timeline()
345 self._desktop.doc().done("None",
346 "Add a timeline")
331 pass 347 pass
332 348
333 def on_remove_timeline_clicked(self, *args): 349 def on_remove_timeline_clicked(self, *args):
334 self._rm_timeline() 350 self._rm_timeline()
351 self._desktop.doc().done("None",
352 "Remove a timeline")
335 pass 353 pass
336 354
337 def on_treeview_timelines_button_press_event(self, widget, event, *args): 355 def on_treeview_timelines_button_press_event(self, widget, event, *args):
338 if event.type != gtk.gdk.BUTTON_PRESS: 356 if event.type != gtk.gdk.BUTTON_PRESS:
339 return 357 return
344 self._timelines_menu.popup(None, None, None, event.button, event.time) 362 self._timelines_menu.popup(None, None, None, event.button, event.time)
345 pass 363 pass
346 364
347 def on_treeview_timelines_row_activated(self, *args): 365 def on_treeview_timelines_row_activated(self, *args):
348 self._switch_timeline() 366 self._switch_timeline()
367 self._desktop.doc().done("None",
368 "Switch to another timeline")
349 pass 369 pass
350 370
351 def on_cellrenderer_timelines_edited(self, renderer, path, 371 def on_cellrenderer_timelines_edited(self, renderer, path,
352 new_text, *args): 372 new_text, *args):
353 model = self._timelines_model 373 model = self._timelines_model
357 377
358 model.set_value(itr, 0, new_text) 378 model.set_value(itr, 0, new_text)
359 model.set_value(itr, 1, False) 379 model.set_value(itr, 1, False)
360 380
361 self._domview_ui.rename_timeline(old_name, new_text) 381 self._domview_ui.rename_timeline(old_name, new_text)
382
383 self._desktop.doc().done("None",
384 "Change name of a timeline")
362 pass 385 pass
363 386
364 def on_rename_timeline_activate(self, *args): 387 def on_rename_timeline_activate(self, *args):
365 treeview = self._timelines_treeview 388 treeview = self._timelines_treeview
366 path, col = treeview.get_cursor() 389 path, col = treeview.get_cursor()
372 treeview.set_cursor(path, col, True) 395 treeview.set_cursor(path, col, True)
373 pass 396 pass
374 397
375 def on_switch_timeline_activate(self, *args): 398 def on_switch_timeline_activate(self, *args):
376 self._switch_timeline() 399 self._switch_timeline()
400 self._desktop.doc().done("None",
401 "Switch to another timeline")
377 pass 402 pass
378 pass 403 pass
379 404
380 ## \brief Component dock 405 ## \brief Component dock
381 # 406 #