/[thuban]/branches/WIP-pyshapelib-bramz/Thuban/UI/dock.py
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/Thuban/UI/dock.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 571 by jonathan, Fri Mar 28 17:06:38 2003 UTC revision 631 by jonathan, Wed Apr 9 10:10:38 2003 UTC
# Line 194  class DockableWindow(Publisher): Line 194  class DockableWindow(Publisher):
194          #          #
195          # restore window information          # restore window information
196          #          #
197          #if self.__floatPosition is not None: self.SetPosition(self.__floatPosition)          if self.__floatPosition is not None: self.SetPosition(self.__floatPosition)
198          #if self.__floatSize     is not None: self.SetSize(self.__floatSize)          if self.__floatSize     is not None: self.SetSize(self.__floatSize)
199    
200            self.__dockPanel.SetSize(self.__topWindow.GetClientSize())
201    
202          self.issue(DOCKABLE_UNDOCKED, self.__id, self)          self.issue(DOCKABLE_UNDOCKED, self.__id, self)
203    
# Line 241  class DockableWindow(Publisher): Line 243  class DockableWindow(Publisher):
243          self.__dockWindow.SetDefaultSize(wxSize(rw, rh))          self.__dockWindow.SetDefaultSize(wxSize(rw, rh))
244    
245    
246      def Close(self):      def Destroy(self):
247          self.__panel.Close(True)          self.__panel.Destroy()
248          self.__floatWindow.Destroy()          self.__floatWindow.Destroy()
249          self.__dockWindow.Destroy()          self.__dockWindow.Destroy()
250          self.__parent.OnDockClose(self)          self.__parent.OnDockDestroy(self)
251            
252      ##      ##
253      # Event handlers      # Event handlers
254      #      #
255    
256      def _OnButtonClose(self, event):      def _OnButtonClose(self, event):
257          self.Close()          #self.Close()
258            self.Show(False)
259    
260      def _OnClose(self, force = False):      def _OnClose(self, force = False):
261          self.Close()          self.Show(False)
262    
263      def _OnToggleDock(self, event):      def _OnToggleDock(self, event):
264          self.__CheckAllGood()          self.__CheckAllGood()
# Line 316  class DockableWindow(Publisher): Line 319  class DockableWindow(Publisher):
319          # our orientation          # our orientation
320          #          #
321          text = wxStaticText(self.__dockPanel, -1, self.GetTitle(),          text = wxStaticText(self.__dockPanel, -1, self.GetTitle(),
322                               style = wxSIMPLE_BORDER | wxALIGN_CENTRE)                               style = wxALIGN_CENTRE)
323    
324          #          #
325          # Perhaps using wxToggleButton would be better, but it's only          # Perhaps using wxToggleButton would be better, but it's only
# Line 364  class DockFrame(wxFrame): Line 367  class DockFrame(wxFrame):
367    
368          self.openWindows = {}          self.openWindows = {}
369    
370          EVT_SIZE(self, self._OnSashSize)          self.__update_lock = 0
371    
372          self.SetMainWindow(None)          self.SetMainWindow(None)
373    
374    
375            EVT_SIZE(self, self._OnSashSize)
376            EVT_CLOSE(self, self._OnClose)
377    
378      layout2oppSash = {      layout2oppSash = {
379              wxLAYOUT_NONE   : wxSASH_NONE,              wxLAYOUT_NONE   : wxSASH_NONE,
380              wxLAYOUT_TOP    : wxSASH_BOTTOM,              wxLAYOUT_TOP    : wxSASH_BOTTOM,
# Line 375  class DockFrame(wxFrame): Line 382  class DockFrame(wxFrame):
382              wxLAYOUT_RIGHT  : wxSASH_LEFT,              wxLAYOUT_RIGHT  : wxSASH_LEFT,
383              wxLAYOUT_BOTTOM : wxSASH_TOP }              wxLAYOUT_BOTTOM : wxSASH_TOP }
384    
385    
386        def _OnClose(self, event):
387    
388            self.__update_lock += 1
389    
390            #
391            # child windows are not notified when the parent is destroyed
392            # as of v2.4.0.3 so we need to interate over our children
393            # and tell them to go away.
394            #
395            for key in self.openWindows.keys():
396                win = self.openWindows[key]
397                win.Destroy()
398    
399            self.__update_lock -= 1
400    
401            # should really call _UpdateDocks() here but we don't need to
402            # since we're going away
403    
404      def CreateDock(self, name, id, title, align):      def CreateDock(self, name, id, title, align):
405    
406          if align in (wxLAYOUT_NONE, wxLAYOUT_LEFT, wxLAYOUT_RIGHT):          if align in (wxLAYOUT_NONE, wxLAYOUT_LEFT, wxLAYOUT_RIGHT):
# Line 399  class DockFrame(wxFrame): Line 425  class DockFrame(wxFrame):
425      def FindRegisteredDock(self, name):      def FindRegisteredDock(self, name):
426          return self.openWindows.get(name)          return self.openWindows.get(name)
427    
428      def OnDockClose(self, win):      def OnDockDestroy(self, win):
429          del self.openWindows[win.GetName()]          del self.openWindows[win.GetName()]
430          self._UpdateDocks()          self._UpdateDocks()
431    
# Line 409  class DockFrame(wxFrame): Line 435  class DockFrame(wxFrame):
435                    
436      def _UpdateDocks(self):      def _UpdateDocks(self):
437          #print "_UpdateDocks()"          #print "_UpdateDocks()"
438          wxLayoutAlgorithm().LayoutWindow(self, self.__mainWindow)          if self.__update_lock == 0:
439                wxLayoutAlgorithm().LayoutWindow(self, self.__mainWindow)
440    
441      def _OnSashDragged(self, event):      def _OnSashDragged(self, event):
442          if event.GetDragStatus() == wxSASH_STATUS_OUT_OF_RANGE:          if event.GetDragStatus() == wxSASH_STATUS_OUT_OF_RANGE:
# Line 422  class DockFrame(wxFrame): Line 449  class DockFrame(wxFrame):
449          #print dockPanel          #print dockPanel
450          panel = dockPanel.FindWindowById(PANEL_ID)          panel = dockPanel.FindWindowById(PANEL_ID)
451          #print panel          #print panel
452          assert(isinstance(panel, DockPanel))          assert isinstance(panel, DockPanel)
453          win = panel.GetDockParent()          win = panel.GetDockParent()
454          #print win          #print win
455          assert(isinstance(win, DockableWindow))          assert isinstance(win, DockableWindow)
456    
457          assert(win.IsDocked())          assert win.IsDocked()
458    
459          rect = event.GetDragRect()          rect = event.GetDragRect()
460    

Legend:
Removed from v.571  
changed lines
  Added in v.631

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26