comparison pyink/domview_ui.py @ 1305:573a51b1eb37

domview_ui_comp as a mix-in to oven comp_dock and domview_ui
author Thinker K.F. Li <thinker@codemud.net>
date Wed, 19 Jan 2011 18:28:16 +0800
parents 94e6594dea59
children 8c0a4684c1f7
comparison
equal deleted inserted replaced
1304:94e6594dea59 1305:573a51b1eb37
374 self._active_frame_callback = cb 374 self._active_frame_callback = cb
375 pass 375 pass
376 pass 376 pass
377 377
378 378
379 ## \biref Components and timelines management for domview.
380 #
381 # This is mix-in for domview_ui to provide components and timelines
382 # management functions.
383 #
384 class domview_ui_comp(object):
385 def __init__(self):
386 from comp_dock import comp_dock
387
388 self._comp_dock = comp_dock(self)
389 pass
390
391 ## \brief Setup desktop that the document will be serviced.
392 #
393 # This method must be called before handle_doc_root.
394 #
395 def set_desktop(self, desktop):
396 self._desktop = desktop
397 self._comp_dock.install_dock(desktop) # from component_manager
398 pass
399
400 pass
401
402
379 ## \brief Bridge of DOM-tree to syncrhonize data-model and UI. 403 ## \brief Bridge of DOM-tree to syncrhonize data-model and UI.
380 # 404 #
381 # This class is a wrapper 405 # This class is a wrapper
382 class domview_ui(object): 406 class domview_ui(object):
383 _tween_type_names = ('normal', 'scale') 407 _tween_type_names = ('normal', 'scale')
384 408
385 def __init__(self): 409 def __init__(self):
386 from comp_dock import comp_dock
387
388 super(domview_ui, self).__init__() 410 super(domview_ui, self).__init__()
389 411
390 self._fl_stack = frameline_stack() 412 self._fl_stack = frameline_stack()
391 self._dom = domview() 413 self._dom = domview()
392 self._comp_dock = comp_dock(self)
393 self._desktop = None 414 self._desktop = None
394 self._doc = None 415 self._doc = None
395 self._root = None 416 self._root = None
396 self._lock = False 417 self._lock = False
397 pass 418 pass
428 self._fl_stack.set_layer_label(layer_idx, label) 449 self._fl_stack.set_layer_label(layer_idx, label)
429 450
430 self._update_frameline_content(layer_idx) 451 self._update_frameline_content(layer_idx)
431 pass 452 pass
432 pass 453 pass
433
434 ## \brief Setup desktop that the document will be serviced.
435 #
436 # This method must be called before handle_doc_root.
437 #
438 def set_desktop(self, desktop):
439 self._desktop = desktop
440 self._comp_dock.install_dock(desktop) # from component_manager
441 pass
442 454
443 ## \brief This method is called to handle a new document. 455 ## \brief This method is called to handle a new document.
444 # 456 #
445 def handle_doc_root(self, doc, root): 457 def handle_doc_root(self, doc, root):
446 self._dom.handle_doc_root(doc, root) 458 self._dom.handle_doc_root(doc, root)
829 self._fl_stack.set_layer_label(layer_idx, label) 841 self._fl_stack.set_layer_label(layer_idx, label)
830 pass 842 pass
831 pass 843 pass
832 844
833 845
846 ## \brief Oven domview_ui and all mix-ins
847 #
848 class domview_ui_oven(domview_ui, domview_ui_comp):
849 def __init__(self):
850 super(domview_ui_oven, self).__init__()
851 pass
852 pass
853
834 ## \brief A mix-in to enable workers for a domview_ui. 854 ## \brief A mix-in to enable workers for a domview_ui.
835 # 855 #
836 class domview_ui_with_workers(domview_ui, domview_internal): 856 class domview_ui_with_workers(domview_ui_oven, domview_internal):
837 def __init__(self): 857 def __init__(self):
838 super(domview_ui_with_workers, self).__init__() 858 super(domview_ui_with_workers, self).__init__()
839 859
840 self._consistency_checker = consistency.consistency_checker(self) 860 self._consistency_checker = consistency.consistency_checker(self)
841 self._unlink_clone_checker = unlink_clone.unlink_clone_checker(self) 861 self._unlink_clone_checker = unlink_clone.unlink_clone_checker(self)