Changeset 610
- Timestamp:
- 07/09/03 19:29:45 (5 years ago)
- Files:
-
- trunk/RBSkinning/RBSkinning/wxPythonSkin/dockcontainer.py (modified) (2 diffs)
- trunk/RBSkinning/RBSkinning/wxPythonSkin/dockhost.py (modified) (4 diffs)
- trunk/RBSkinning/RBSkinning/wxPythonSkin/notebook_dockhost.py (modified) (3 diffs)
- trunk/RBSkinning/RBSkinning/wxPythonSkin/sash_dockhost.py (modified) (1 diff)
- trunk/RBSkinning/RBSkinning/wxTools/wxDockingTools.py (modified) (6 diffs)
- trunk/RBSkinning/demo/wxPythonSkin/docking/docking_notebook.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/RBSkinning/RBSkinning/wxPythonSkin/dockcontainer.py
r501 r610 31 31 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 32 32 33 class wxDockContainerSizerAdaptor(wxDockingTools.wxDockContainer): 33 class wxSkinDockContainer(wxDockingTools.wxDockContainer): 34 def DockHostContext(self): 35 dh = self.DockHost() 36 if dh is not None: 37 return dh.DockContext() 38 34 39 def SetItemMinSize(self, *args, **kw): 35 40 pass … … 53 58 def SkinInitialize(self): 54 59 # Create the layout sizer 55 self.object = wx DockContainerSizerAdaptor()60 self.object = wxSkinDockContainer() 56 61 for name, value in self.settings.iteritems(): 57 62 if isinstance(name, str) and name not in ['ctxvar','ctxnode']: trunk/RBSkinning/RBSkinning/wxPythonSkin/dockhost.py
r609 r610 24 24 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 25 25 26 import weakref 26 27 from wxSkinObject import wx, wxSkinObject, wxSkinObjectNoData 27 28 from RBSkinning.wxTools import wxDockingTools … … 30 31 #~ Definitions 31 32 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 33 34 class wxSkinDockHost(wxDockingTools.wxDockHost): 35 dockcontext = None 36 37 def DockContext(self): 38 return self.dockcontext 32 39 33 40 class dockhost(wxSkinObject, wxSkinObjectNoData): … … 53 60 kwSettings = self.wxSettingDict(['prepend', 'hideempty', 'rootparent', 'rootlayout'], 54 61 prepend=True, hideempty=False, rootparent=winParent, rootlayout=winParent.GetSizer()) 55 self.object = wx DockingTools.wxDockHost(winParent, layout, **kwSettings)62 self.object = wxSkinDockHost(winParent, layout, **kwSettings) 56 63 57 64 single = self.wxEvalCond('single', False) … … 64 71 if 'dockcontext' in self.settings: 65 72 self.object.dockcontext = self.context.getnamedvar(self.settings['dockcontext']) 73 try: SetDockHost = self.object.dockcontext.SetDockHost 74 except AttributeError: pass 75 else: SetDockHost(weakref.proxy(self.object)) 66 76 else: 67 77 self.object.dockcontext = None trunk/RBSkinning/RBSkinning/wxPythonSkin/notebook_dockhost.py
r603 r610 24 24 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 25 25 26 from wxSkinObject import wx, wxSkinObject, wxSkinObjectNoData 26 from wxSkinObject import wx 27 from dockhost import dockhost as _dockhost 27 28 from RBSkinning.wxTools import wxDockingTools 28 29 … … 31 32 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 32 33 33 class notebook_dockhost(wxSkinObject, wxSkinObjectNoData): 34 class wxNotebookSkinDockHost(wxDockingTools.wxNotebookDockHost): 35 dockcontext = None 36 37 def DockContext(self): 38 return self.dockcontext 39 40 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 41 42 class notebook_dockhost(_dockhost): 34 43 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 35 44 #~ Constants / Variables / Etc. 36 45 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 37 46 38 default_settings = wxSkinObject.default_settings.copy()47 default_settings = _dockhost.default_settings.copy() 39 48 #default_settings['prepend'] = True 40 49 #default_settings['hideempty'] = False … … 49 58 kwSettings = self.wxSettingDict(['prepend', 'hideempty', 'selectpage'], 50 59 prepend=True, hideempty=False, selectpage=True) 51 self.object = wx DockingTools.wxNotebookDockHost(winParent, **kwSettings)60 self.object = wxNotebookSkinDockHost(winParent, **kwSettings) 52 61 53 def SkinFinalize(self):54 self.wxStandardOptions()55 trunk/RBSkinning/RBSkinning/wxPythonSkin/sash_dockhost.py
r603 r610 24 24 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 25 25 26 from wxSkinObject import wx 26 27 from dockhost import dockhost as _dockhost 27 28 trunk/RBSkinning/RBSkinning/wxTools/wxDockingTools.py
r608 r610 27 27 from wxPython import wx 28 28 from RBFoundation.SubObs.Event import ObjectEventProperty 29 from RBFoundation.SubObs.Publish import DataPublisherProperty 29 30 from __init__ import SetLayoutContainerSizeHints 30 31 … … 60 61 class wxDockContainer(object): 61 62 OnDockHostUpdate = ObjectEventSubjectWithResultProperty() #(dockcontainer, dockhost, updatetype, *updateargs, **updatekeys) 63 Title = DataPublisherProperty() #(dockcontainer, dockhost, updatetype, *updateargs, **updatekeys) 62 64 OnDocked = ObjectEventProperty() #(dockcontainer, dockhost, redocking) 63 65 OnUndocked = ObjectEventProperty() #(dockcontainer, dockhost, redocking) … … 282 284 def __init__(self, *args, **kw): 283 285 wx.wxPanel.__init__(self, *args, **kw) 286 self.dockcontainer = None 284 287 self.dockitem = None 285 288 self.sizer = wx.wxBoxSizer(wx.wxVERTICAL) … … 289 292 return self.dockitem is dockitem 290 293 291 def UndockItem(self, dockitem, *args, **kw): 294 def GetTitleFromEnvironment(self): 295 title = getattr(self.dockcontainer, 'pagename', None) 296 if title is not None: return title 297 title = self.dockitem.GetLabel() 298 if title: return title 299 title = self.dockitem.__class__.__name__ 300 return title 301 302 def UpdateTitle(self, title=None): 303 if title is None: 304 title = self.GetTitleFromEnvironment() 305 self.SetLabel(title) 306 notebook = self.GetParent() 307 for pageidx in xrange(notebook.GetPageCount()): 308 if notebook.GetPage(pageidx) is self: 309 notebook.SetPageText(pageidx, title) 310 311 def UndockItem(self, dockcontainer, dockitem, *args, **kw): 292 312 if self.dockitem is dockitem: 293 self.DockItem(None )294 295 def DockItem(self, dock item, *args, **kw):313 self.DockItem(None, None) 314 315 def DockItem(self, dockcontainer, dockitem, *args, **kw): 296 316 if self.dockitem is not None: 297 317 self.sizer.Remove(self.dockitem) 318 if self.dockcontainer is not None: 319 self.dockcontainer.Title.Remove(self.UpdateTitle) 320 self.dockcontainer = dockcontainer 298 321 self.dockitem = dockitem 299 322 if self.dockitem is not None: 300 323 self.sizer.Add(self.dockitem, *args, **kw) 324 if self.dockcontainer is not None: 325 self.dockcontainer.Title.Add(self.UpdateTitle) 326 self.UpdateTitle(self.dockcontainer.Title.Get()) 301 327 self.Layout() 302 328 … … 331 357 else: DIReparent(page) 332 358 333 page.DockItem(dockitem, *args, **kw) 334 335 text = None 336 if text is None: 337 try: text = container.pagename 338 except AttributeError: pass 339 if text is None: 340 try: text = dockitem.GetLabel() 341 except AttributeError: pass 342 if text is None: 343 text = text or dockitem.__class__.__name__ 359 page.DockItem(container, dockitem, *args, **kw) 360 text = page.GetLabel() 344 361 345 362 if self.prepend: … … 369 386 page = self.FindNotebookDockPage(dockitem) 370 387 if page is None: raise KeyError, "Dockitem not found" 371 page.UndockItem( dockitem)388 page.UndockItem(container, dockitem) 372 389 373 390 for idx in range(self.notebook.GetPageCount()): trunk/RBSkinning/demo/wxPythonSkin/docking/docking_notebook.py
r603 r610 50 50 <command_event type='EVT_BUTTON' call='ctx.behaviormodel.Dock3' /> 51 51 </button> 52 <input value='Dockable 3' sizercfg='0, wxALIGN_RIGHT|wxEXPAND' > 53 <command_event type='EVT_TEXT' call='ctx.behaviormodel.ChangeDock3Title' /> 54 </input> 52 55 </layout> 53 56 </layout> … … 114 117 eo.SetLabel('Show Dock 3') 115 118 119 def ChangeDock3Title(self, evt): 120 self.dockable3.Title.Set(evt.GetEventObject().GetValue()) 121 116 122 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 117 123 #~ Main
