bh: thuban/Thuban/UI legend.py, 1.37, 1.38 dock.py, 1.15, 1.16 classifier.py, 1.71, 1.72
cvs@intevation.de
cvs at intevation.de
Tue Feb 8 21:25:24 CET 2005
Author: bh
Update of /thubanrepository/thuban/Thuban/UI
In directory doto:/tmp/cvs-serv9432/Thuban/UI
Modified Files:
legend.py dock.py classifier.py
Log Message:
Compatibility with wxPython 2.5. The changes should make it work
better with 2.5 while still keeping compatibility with 2.4. There
are still problems with 2.5, though.
* Thuban/UI/dock.py (DockableWindow.__CreateBorder): Pass the size
of a spacer as a single item.
* Thuban/UI/classifier.py (ClassGroupPropertiesCtrl): Derive only
from wxControl
* Thuban/UI/legend.py (LegendTree): When running with wxPython <
2.5, add an implementation of the GetFirstChild method that does
not require the second parameter.
(LegendTree.find_layer, LegendTree._OnMsgMapLayersAdded)
(LegendTree._OnMsgMapLayersRemoved, LegendTree.DeleteAllItems)
(LegendTree.DeleteChildren, LegendTree.__ShowHideLayer): Do not
pass the second parameter to GetFirstChild
Index: legend.py
===================================================================
RCS file: /thubanrepository/thuban/Thuban/UI/legend.py,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- legend.py 18 Apr 2004 20:37:45 -0000 1.37
+++ legend.py 8 Feb 2005 20:25:22 -0000 1.38
@@ -1,4 +1,4 @@
-# Copyright (c) 2001, 2002, 2003 by Intevation GmbH
+# Copyright (c) 2001, 2002, 2003, 2005 by Intevation GmbH
# Authors:
# Jonathan Coles <jonathan at intevation.de>
# Frank Koormann <frank.koormann at intevation.de>
@@ -15,6 +15,7 @@
import resource
from wxPython.wx import *
+import wxPython
from Thuban.Model.layer import BaseLayer
from Thuban.Model.map import Map
@@ -284,7 +285,7 @@
def find_layer(self, layer):
"""Return the tree item for the layer"""
root = self.GetRootItem()
- id, cookie = self.GetFirstChild(root, 0)
+ id, cookie = self.GetFirstChild(root)
while id.IsOk():
if self.GetPyData(id) is layer:
return id
@@ -487,7 +488,7 @@
# Build a dict with all layers known by the the tree as keys
layers = {}
root = self.GetRootItem()
- id, cookie = self.GetFirstChild(root, 0)
+ id, cookie = self.GetFirstChild(root)
while id.IsOk():
layers[self.GetPyData(id)] = 1
id, cookie = self.GetNextChild(root, cookie)
@@ -506,7 +507,7 @@
layers = map.Layers()
root = self.GetRootItem()
- id, cookie = self.GetFirstChild(root, 0)
+ id, cookie = self.GetFirstChild(root)
while id.IsOk():
if self.GetPyData(id) not in layers:
self.__RemoveLayer(id)
@@ -598,7 +599,7 @@
pid = self.GetRootItem()
- id, cookie = self.GetFirstChild(pid, 123)
+ id, cookie = self.GetFirstChild(pid)
while id.IsOk():
self.__RemoveLayer(id)
id, cookie = self.GetNextChild(pid, cookie)
@@ -636,7 +637,7 @@
self.Delete(id)
def DeleteChildren(self, pid):
- id, cookie = self.GetFirstChild(pid, 123)
+ id, cookie = self.GetFirstChild(pid)
while id.IsOk():
self.availImgListIndices.append(self.GetItemImage(id))
id, cookie = self.GetNextChild(pid, cookie)
@@ -692,12 +693,25 @@
self.__SetVisibilityStyle(visible, parent)
- id, cookie = self.GetFirstChild(parent, 123)
+ id, cookie = self.GetFirstChild(parent)
while id.IsOk():
self.__SetVisibilityStyle(visible, id)
id, cookie = self.GetNextChild(parent, cookie)
-
+
+ # In wxPython 2.4 the GetFirstChild method has to be called with a
+ # second argument and in 2.5 it must not. Reading the code of
+ # wxPython 2.4 it seems that the second parameter was intended to be
+ # optional there but due to a bug in the C++ code it doesn't work
+ # and omitting the second argument leads to a segfault. To cope
+ # with this and to make the code usable with both 2.5 and 2.4 we
+ # overwrite the inherited method when running with 2.4 to provide a
+ # default value for the second argument.
+ if map(int, wxPython.__version__.split(".")[:2]) < [2, 5]:
+ def GetFirstChild(self, item):
+ return wxTreeCtrl.GetFirstChild(self, item, 0)
+
+
class ScaleBarBitmap(wxBoxSizer):
def __init__(self, parent, map, mainWindow):
Index: dock.py
===================================================================
RCS file: /thubanrepository/thuban/Thuban/UI/dock.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- dock.py 30 Jul 2003 15:43:28 -0000 1.15
+++ dock.py 8 Feb 2005 20:25:22 -0000 1.16
@@ -375,7 +375,7 @@
#
if self.__orientation == wxLAYOUT_VERTICAL:
headerBox.Add(text, 0, wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL, 0)
- headerBox.Add(1, 5, 1, wxGROW)
+ headerBox.Add((1, 5), 1, wxGROW)
headerBox.Add(self.__dockButton, 0, wxALIGN_RIGHT, 0)
headerBox.Add(closeX, 0, wxALIGN_RIGHT | wxLEFT, 4)
else:
Index: classifier.py
===================================================================
RCS file: /thubanrepository/thuban/Thuban/UI/classifier.py,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -d -r1.71 -r1.72
--- classifier.py 7 Feb 2005 13:46:53 -0000 1.71
+++ classifier.py 8 Feb 2005 20:25:22 -0000 1.72
@@ -1407,7 +1407,7 @@
dc.DestroyClippingRegion()
-class ClassGroupPropertiesCtrl(wxWindow, wxControl):
+class ClassGroupPropertiesCtrl(wxControl):
"""A custom window and control that draw a preview of group properties
and can open a dialog to modify the properties if the user double-clicks
it.
@@ -1415,8 +1415,7 @@
def __init__(self, parent, id, props, shapeType,
size = wxDefaultSize, style = 0):
-
- wxWindow.__init__(self, parent, id, size = size, style = style)
+ wxControl.__init__(self, parent, id, size = size, style = style)
self.parent = parent
More information about the Thuban-devel
mailing list
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)