[Thuban-commits] r2869 - in trunk/thuban: . Thuban/UI

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Feb 19 19:17:38 CET 2009


Author: dpinte
Date: 2009-02-19 19:17:37 +0100 (Thu, 19 Feb 2009)
New Revision: 2869

Modified:
   trunk/thuban/ChangeLog
   trunk/thuban/Thuban/UI/dock.py
Log:
2009-02-19 Didrik Pinte <dpinte at dipole-consulting.com>

    * Thuban/UI/dock.py : bugfix for docking/undocking events



Modified: trunk/thuban/ChangeLog
===================================================================
--- trunk/thuban/ChangeLog	2008-12-08 08:50:53 UTC (rev 2868)
+++ trunk/thuban/ChangeLog	2009-02-19 18:17:37 UTC (rev 2869)
@@ -1,3 +1,7 @@
+2009-02-19 Didrik Pinte <dpinte at dipole-consulting.com>
+
+    * Thuban/UI/dock.py : bugfix for docking/undocking events
+
 2008-12-03 Didrik Pinte <dpinte at dipole-consulting.com>
 
     * Extensions/wms/layer.py : added a very simple caching mechanism

Modified: trunk/thuban/Thuban/UI/dock.py
===================================================================
--- trunk/thuban/Thuban/UI/dock.py	2008-12-08 08:50:53 UTC (rev 2868)
+++ trunk/thuban/Thuban/UI/dock.py	2009-02-19 18:17:37 UTC (rev 2869)
@@ -28,8 +28,11 @@
 
 from messages import DOCKABLE_DOCKED, DOCKABLE_UNDOCKED, DOCKABLE_CLOSED
 
-ID_BUTTON_DOCK = 4001
-ID_BUTTON_CLOSE = 4002
+# Commented ID's because ID's are the same as the ID's of the legend buttons ...
+#ID_BUTTON_DOCK = 4001
+#ID_BUTTON_CLOSE = 4002
+ID_BUTTON_DOCK = wx.ID_ANY
+ID_BUTTON_CLOSE = wx.ID_ANY
 
 PANEL_ID = 3141
 
@@ -54,7 +57,7 @@
 
         self.parent = parent
 
-        #self.SetDockParent(None)
+        self.SetDockParent(parent)
         #parent.SetPanel(self)
 
     def Create(self):
@@ -92,7 +95,7 @@
 class DockableWindow(Publisher):
 
     def __getattr__(self, attr):
-        return getattr(self.__topWindow, attr)
+        return getattr(self.__topWindow, attr)    
 
     def __init__(self, parent, id, name, title, dockWindow, orient):
         """Create the dockable window.
@@ -117,6 +120,7 @@
         else:
             self.__topWindow = self.__floatWindow
 
+        
         self.__floatSize     = None
         self.__floatPosition = None
 
@@ -192,6 +196,11 @@
         self.SetDockSize(self.__dockWindow.GetSize())
 
         if wasVisible: self.Show(True)
+        
+        # rebind the events to the correct window
+        # FIXME : should we remove the previous bindings ?
+        self.__topWindow.Bind(wx.EVT_BUTTON, self._OnToggleDock, self.__dockButton)
+        self.__topWindow.Bind(wx.EVT_BUTTON, self._OnButtonClose, self.__closeX) 
 
         self.issue(DOCKABLE_DOCKED, self.__id, self)
 
@@ -226,6 +235,11 @@
             self.SetPosition(self.__floatPosition)
         if self.__floatSize is not None:
             self.SetSize(self.__floatSize)
+            
+        # rebind the events to the correct window
+        # FIXME : should we remove the previous bindings ?
+        self.__topWindow.Bind(wx.EVT_BUTTON, self._OnToggleDock, self.__dockButton)
+        self.__topWindow.Bind(wx.EVT_BUTTON, self._OnButtonClose, self.__closeX) 
 
         self.__dockPanel.SetSize(self.__topWindow.GetClientSize())
 
@@ -279,7 +293,7 @@
     #
 
     def _OnButtonClose(self, event):
-        #self.Close()
+        self.Close()
         self.Show(False)
 
     def _OnClose(self, force = False):
@@ -364,11 +378,11 @@
 
         bmp = resource.GetBitmapResource(CLOSE_BMP, wx.BITMAP_TYPE_XPM)
 
-        closeX = wx.BitmapButton(self.__dockPanel, ID_BUTTON_CLOSE, bmp,
+        self.__closeX = wx.BitmapButton(self.__dockPanel, ID_BUTTON_CLOSE, bmp,
                           size = wx.Size(bmp.GetWidth() + 4,
                                         bmp.GetHeight() + 4),
                           style = wx.BU_EXACTFIT | wx.ADJUST_MINSIZE)
-        closeX.SetToolTip(wx.ToolTip(_("Close")))
+        self.__closeX.SetToolTip(wx.ToolTip(_("Close")))
 
         #
         # fill in the sizer in an order appropriate to the orientation
@@ -377,9 +391,9 @@
             headerBox.Add(text, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTRE_VERTICAL, 0)
             headerBox.Add((1, 5), 1, wx.GROW)
             headerBox.Add(self.__dockButton, 0, wx.ALIGN_RIGHT, 0)
-            headerBox.Add(closeX, 0, wx.ALIGN_RIGHT | wx.LEFT, 4)
+            headerBox.Add(self.__closeX, 0, wx.ALIGN_RIGHT | wx.LEFT, 4)
         else:
-            headerBox.Add(closeX, 0, wx.ALIGN_RIGHT | wx.BOTTOM, 4)
+            headerBox.Add(self.__closeX, 0, wx.ALIGN_RIGHT | wx.BOTTOM, 4)
             headerBox.Add(self.__dockButton, 0, wx.ALIGN_RIGHT, 0)
             headerBox.Add(text, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTRE_VERTICAL, 0)
 
@@ -392,8 +406,8 @@
         sizer.SetSizeHints(self.__dockPanel)
         sizer.SetSizeHints(self.__floatWindow)
 
-        self.Bind(wx.EVT_BUTTON, self._OnToggleDock, self.__dockPanel, id=ID_BUTTON_DOCK)
-        self.Bind(wx.EVT_BUTTON, self._OnButtonClose, self.__dockPanel, id=ID_BUTTON_CLOSE)
+        self.__topWindow.Bind(wx.EVT_BUTTON, self._OnToggleDock, self.__dockButton)
+        self.__topWindow.Bind(wx.EVT_BUTTON, self._OnButtonClose, self.__closeX)
 
 
 class DockFrame(wx.Frame):



More information about the Thuban-commits mailing list