Mercurial > MadButterfly
view pyink/pyink.py @ 1342:972d749b9656
Move component_manager to a separated object.
- component_manager is a mixin for domview.
- domview inherit component_manager to mixing-in component_manager.
- There is no boundary between component_manager and domview, hard
to be managed and reused.
- component_manager is a separated object that hold a reference to
corresponding domview.
- domview delegate attribute accessing to component_manager object to
expose attributes and methods of component_manager. (__getattr__())
- component_manager is still a mix-in of domview.
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Tue, 08 Feb 2011 13:05:07 +0800 |
parents | 599b606c4669 |
children |
line wrap: on
line source
import os try: if os.environ['PYINK_DBG_ENABLE'] == 'yes': import pdb pdb.set_trace() pass pass except: pass import pybInkscape import pygtk import gtk from MBScene import * all_desktop_mbscenes = {} def _init_mbscene(inkscape, ptr): global all_desktop_mbscenes desktop = pybInkscape.GPointer_2_PYSPDesktop(ptr) top = desktop.getToplevel() mbscene = MBScene(desktop,top) mbscene.show() all_desktop_mbscenes[desktop] = mbscene pass ## \brief Handler for events of activating a desktop. # def act_desktop(inkscape, ptr): # Get Python wrapper of SPDesktop passed by ptr. desktop = pybInkscape.GPointer_2_PYSPDesktop(ptr) top = desktop.getToplevel() if not top: # has not top window. return if desktop in all_desktop_mbscenes: return # already initialized _init_mbscene(inkscape, ptr) pass def pyink_start(): import extensions pybInkscape.inkscape.connect('activate_desktop', act_desktop) extensions.initial() pass def pyink_context_menu(view, item, menu_factory): if view in all_desktop_mbscenes: mbscene = all_desktop_mbscenes[view] mbscene.context_menu(item, menu_factory) pass pass