comparison pyink/comp_dock.py @ 1332:a0d3a4f8e99d

Siwtch components and timelines with context menu
author Thinker K.F. Li <thinker@codemud.net>
date Mon, 31 Jan 2011 16:42:15 +0800
parents 5da64f67d00d
children 3cbc1ab15541
comparison
equal deleted inserted replaced
1331:5da64f67d00d 1332:a0d3a4f8e99d
210 comp_name = model.get_value(itr, 0) 210 comp_name = model.get_value(itr, 0)
211 print comp_name 211 print comp_name
212 212
213 self._domview_ui.rm_component(comp_name) 213 self._domview_ui.rm_component(comp_name)
214 pass 214 pass
215
216 def _switch_component(self):
217 domview_ui = self._domview_ui
218
219 comp_name = self._current_component()
220 domview_ui.switch_component(comp_name)
221
222 group = domview_ui.get_layer_group(0)
223 desktop = self._desktop # from comp_dock_base
224 desktop.setCurrentLayer(group.spitem)
225 pass
215 226
216 def _add_timeline(self): 227 def _add_timeline(self):
217 def _make_timeline_name(): 228 def _make_timeline_name():
218 tl_name = 'New Timeline' 229 tl_name = 'New Timeline'
219 idx = 0 230 idx = 0
243 tl_name = model.get_value(itr, col) 254 tl_name = model.get_value(itr, col)
244 print tl_name 255 print tl_name
245 256
246 self._domview_ui.rm_timeline(tl_name) 257 self._domview_ui.rm_timeline(tl_name)
247 pass 258 pass
259
260 def _switch_timeline(self):
261 domview_ui = self._domview_ui
262
263 timeline_name = self._current_timeline()
264 domview_ui.switch_timeline(timeline_name)
265 pass
248 266
249 def on_add_comp_clicked(self, *args): 267 def on_add_comp_clicked(self, *args):
250 self._add_component() 268 self._add_component()
251 pass 269 pass
252 270
263 281
264 self._components_menu.popup(None, None, None, event.button, event.time) 282 self._components_menu.popup(None, None, None, event.button, event.time)
265 pass 283 pass
266 284
267 def on_treeview_components_row_activated(self, *args): 285 def on_treeview_components_row_activated(self, *args):
268 domview_ui = self._domview_ui 286 self._switch_component()
269
270 comp_name = self._current_component()
271 domview_ui.switch_component(comp_name)
272
273 group = domview_ui.get_layer_group(0)
274 desktop = self._desktop # from comp_dock_base
275 desktop.setCurrentLayer(group.spitem)
276 pass 287 pass
277 288
278 ## \brief Handle of changing component name. 289 ## \brief Handle of changing component name.
279 # 290 #
280 def on_cellrenderer_comp_edited(self, renderer, path, 291 def on_cellrenderer_comp_edited(self, renderer, path,
303 314
304 def on_link_component_activate(self, *args): 315 def on_link_component_activate(self, *args):
305 pass 316 pass
306 317
307 def on_switch_component_activate(self, *args): 318 def on_switch_component_activate(self, *args):
319 self._switch_component()
308 pass 320 pass
309 321
310 def on_add_timeline_clicked(self, *args): 322 def on_add_timeline_clicked(self, *args):
311 self._add_timeline() 323 self._add_timeline()
312 pass 324 pass
324 336
325 self._timelines_menu.popup(None, None, None, event.button, event.time) 337 self._timelines_menu.popup(None, None, None, event.button, event.time)
326 pass 338 pass
327 339
328 def on_treeview_timelines_row_activated(self, *args): 340 def on_treeview_timelines_row_activated(self, *args):
329 domview_ui = self._domview_ui 341 self._switch_timeline()
330
331 timeline_name = self._current_timeline()
332 domview_ui.switch_timeline(timeline_name)
333 pass 342 pass
334 343
335 def on_cellrenderer_timelines_edited(self, renderer, path, 344 def on_cellrenderer_timelines_edited(self, renderer, path,
336 new_text, *args): 345 new_text, *args):
337 model = self._timelines_model 346 model = self._timelines_model
354 model.set_value(itr, 1, True) 363 model.set_value(itr, 1, True)
355 364
356 treeview.set_cursor(path, col, True) 365 treeview.set_cursor(path, col, True)
357 pass 366 pass
358 367
359 def on_link_timeline_activate(self, *args):
360 pass
361
362 def on_switch_timeline_activate(self, *args): 368 def on_switch_timeline_activate(self, *args):
369 self._switch_timeline()
363 pass 370 pass
364 pass 371 pass
365 372
366 ## \brief Component dock 373 ## \brief Component dock
367 # 374 #