Kaynağa Gözat

wxGUI: fixing related to wxPython 2.8.11 (see https://trac.osgeo.org/grass/ticket/1085)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@42549 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 15 yıl önce
ebeveyn
işleme
1f26dbf0b9

+ 6 - 1
gui/wxpython/gui_modules/layertree.py

@@ -25,8 +25,10 @@ import string
 import wx
 try:
     import wx.lib.agw.customtreectrl as CT
+    hasAgw = True
 except ImportError:
     import wx.lib.customtreectrl as CT
+    hasAgw = False
 import wx.combo
 import wx.lib.newevent
 import wx.lib.buttons  as  buttons
@@ -94,7 +96,10 @@ class LayerTree(treemixin.DragAndDrop, CT.CustomTreeCtrl):
         self.rerender = False                # layer change requires a rerendering if auto render
         self.reorder = False                 # layer change requires a reordering
         
-        super(LayerTree, self).__init__(parent, id, style = ctstyle, **kwargs)
+        if hasAgw:
+            super(LayerTree, self).__init__(parent, id, agwStyle = ctstyle, **kwargs)
+        else:
+            super(LayerTree, self).__init__(parent, id, style = ctstyle, **kwargs)
         self.SetName("LayerTree")
         
         ### SetAutoLayout() causes that no vertical scrollbar is displayed

+ 6 - 1
gui/wxpython/gui_modules/menuform.py

@@ -71,8 +71,10 @@ import wx
 import wx.html
 try:
     import wx.lib.agw.flatnotebook as FN
+    hasAgw = True
 except ImportError:
     import wx.lib.flatnotebook as FN
+    hasAgw = False
 import wx.lib.colourselect as csel
 import wx.lib.filebrowsebutton as filebrowse
 from wx.lib.expando import ExpandoTextCtrl, EVT_ETC_LAYOUT_NEEDED
@@ -1032,7 +1034,10 @@ class cmdPanel(wx.Panel):
 
         # Build notebook
         nbStyle = globalvar.FNPageStyle
-        self.notebook = FN.FlatNotebook( self, id=wx.ID_ANY, style=nbStyle)
+        if hasAgw:
+            self.notebook = FN.FlatNotebook( self, id = wx.ID_ANY, agwStyle = nbStyle)
+        else:
+            self.notebook = FN.FlatNotebook( self, id = wx.ID_ANY, style = nbStyle)
         self.notebook.SetTabAreaColour(globalvar.FNPageColor)
         self.notebook.Bind(FN.EVT_FLATNOTEBOOK_PAGE_CHANGED, self.OnPageChange)
 

+ 13 - 7
gui/wxpython/wxgui.py

@@ -52,12 +52,12 @@ import wx.html
 import wx.stc
 try:
     import wx.lib.agw.customtreectrl as CT
+    import wx.lib.agw.flatnotebook   as FN
+    hasAgw = True
 except ImportError:
     import wx.lib.customtreectrl as CT
-try:
-    import wx.lib.agw.flatnotebook as FN
-except ImportError:
-    import wx.lib.flatnotebook as FN
+    import wx.lib.flatnotebook   as FN
+    hasAgw = False
 
 sys.path.append(os.path.join(globalvar.ETCDIR, "python"))
 from grass.script import core as grass
@@ -202,11 +202,17 @@ class GMFrame(wx.Frame):
             FN.FNB_NO_NAV_BUTTONS | \
             FN.FNB_NO_X_BUTTON
         
-        self.notebook = FN.FlatNotebook(parent=self, id=wx.ID_ANY, style=nbStyle)
-        
+        if hasAgw:
+            self.notebook = FN.FlatNotebook(parent=self, id=wx.ID_ANY, agwStyle = nbStyle)
+        else:
+            self.notebook = FN.FlatNotebook(parent=self, id=wx.ID_ANY, style = nbStyle)
+
         # create displays notebook widget and add it to main notebook page
         cbStyle = globalvar.FNPageStyle
-        self.gm_cb = FN.FlatNotebook(self, id=wx.ID_ANY, style=cbStyle)
+        if hasAgw:
+            self.gm_cb = FN.FlatNotebook(self, id=wx.ID_ANY, agwStyle = cbStyle)
+        else:
+            self.gm_cb = FN.FlatNotebook(self, id=wx.ID_ANY, style = cbStyle)
         self.gm_cb.SetTabAreaColour(globalvar.FNPageColor)
         self.notebook.AddPage(self.gm_cb, text=_("Map layers"))