Просмотр исходного кода

wxGUI: ensure compatibility with wxPython 2.9

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@54916 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová 12 лет назад
Родитель
Сommit
fc0ae66265

+ 3 - 1
gui/wxpython/animation/g.gui.animation.py

@@ -51,6 +51,7 @@ if __name__ == '__main__':
     sys.path.append(os.path.join(os.environ['GISBASE'], "etc", "gui", "wxpython"))
 
 from core.settings import UserSettings
+from core.globalvar import CheckWxVersion
 from core.giface import StandaloneGrassInterface
 from animation.frame import AnimationFrame, MAX_COUNT
 
@@ -76,7 +77,8 @@ def main():
         strds = None
 
     app = wx.PySimpleApp()
-    wx.InitAllImageHandlers()
+    if not CheckWxVersion([2, 9]):
+        wx.InitAllImageHandlers()
 
     frame = AnimationFrame(parent = None)
     frame.CentreOnScreen()

+ 2 - 1
gui/wxpython/gis_set.py

@@ -956,7 +956,8 @@ class StartUp(wx.App):
     """!Start-up application"""
 
     def OnInit(self):
-        wx.InitAllImageHandlers()
+        if not globalvar.CheckWxVersion([2, 9]):
+            wx.InitAllImageHandlers()
         StartUp = GRASSStartup()
         StartUp.CenterOnScreen()
         self.SetTopWindow(StartUp)

+ 2 - 1
gui/wxpython/gmodeler/frame.py

@@ -1062,7 +1062,8 @@ class ModelEvtHandler(ogl.ShapeEvtHandler):
         shape = self.GetShape()
         canvas = shape.GetCanvas()
         dc = wx.ClientDC(canvas)
-        canvas.PrepareDC(dc)
+        # probably does nothing, removed from wxPython 2.9
+        # canvas.PrepareDC(dc)
         
         if hasattr(self.frame, 'defineRelation'):
             drel = self.frame.defineRelation

+ 3 - 1
gui/wxpython/gmodeler/g.gui.gmodeler.py

@@ -45,6 +45,7 @@ import grass.script as grass
 sys.path.append(os.path.join(os.environ['GISBASE'], "etc", "gui", "wxpython"))
 
 from core.giface import StandaloneGrassInterface
+from core.globalvar import CheckWxVersion
 from gmodeler.frame import ModelFrame
 
 def main():
@@ -52,7 +53,8 @@ def main():
     gettext.install('grasswxpy', os.path.join(os.getenv("GISBASE"), 'locale'), unicode = True)
     
     app = wx.PySimpleApp()
-    wx.InitAllImageHandlers()
+    if not CheckWxVersion([2, 9]):
+        wx.InitAllImageHandlers()
     frame = ModelFrame(parent = None, giface = StandaloneGrassInterface())
     if options['file']:
         frame.LoadModelFile(options['file'])

+ 2 - 1
gui/wxpython/gui_core/ghelp.py

@@ -605,7 +605,8 @@ class HelpWindow(HtmlWindow):
         in the Panel.
         """
         self.parent = parent
-        wx.InitAllImageHandlers()
+        if not globalvar.CheckWxVersion([2, 9]):
+            wx.InitAllImageHandlers()
         HtmlWindow.__init__(self, parent = parent, **kwargs)
         
         self.loaded = False

+ 3 - 1
gui/wxpython/iclass/g.gui.iclass.py

@@ -58,6 +58,7 @@ if __name__ == '__main__':
     sys.path.append(os.path.join(os.environ['GISBASE'], "etc", "gui", "wxpython"))
 
 from core.settings  import UserSettings
+from core.globalvar import CheckWxVersion
 from core.giface    import StandaloneGrassInterface
 from iclass.frame   import IClassMapFrame
 
@@ -85,7 +86,8 @@ def main():
     
     # launch application
     app = wx.PySimpleApp()
-    wx.InitAllImageHandlers()
+    if not CheckWxVersion([2, 9]):
+        wx.InitAllImageHandlers()
     
     # show main frame
     giface = StandaloneGrassInterface()

+ 2 - 1
gui/wxpython/mapdisp/main.py

@@ -298,7 +298,8 @@ class DMonFrame(MapFrame):
 
 class MapApp(wx.App):
     def OnInit(self):
-        wx.InitAllImageHandlers()
+        if not globalvar.CheckWxVersion([2, 9]):
+            wx.InitAllImageHandlers()
         if __name__ == "__main__":
             self.cmdTimeStamp = os.path.getmtime(monFile['cmd'])
             self.Map = DMonMap(cmdfile = monFile['cmd'], mapfile = monFile['map'],

+ 4 - 2
gui/wxpython/mapdisp/mapwindow.py

@@ -363,7 +363,8 @@ class BufferedWindow(MapWindow, wx.Window):
         dc.Clear()
         
         # use PrepareDC to set position correctly
-        self.PrepareDC(dc)
+        # probably does nothing, removed from wxPython 2.9
+        # self.PrepareDC(dc)
         
         # create a clipping rect from our position and size
         # and update region
@@ -523,7 +524,8 @@ class BufferedWindow(MapWindow, wx.Window):
             
         dc = wx.BufferedDC(None, ibuffer)
         dc.Clear()
-        self.PrepareDC(dc)
+        # probably does nothing, removed from wxPython 2.9
+        # self.PrepareDC(dc)
         self.pdc.DrawToDC(dc)
         if self.pdcVector:
             self.pdcVector.DrawToDC(dc)

+ 3 - 1
gui/wxpython/mapswipe/g.gui.mapswipe.py

@@ -57,6 +57,7 @@ if __name__ == '__main__':
     sys.path.append(os.path.join(os.environ['GISBASE'], "etc", "gui", "wxpython"))
 
 from core.settings import UserSettings
+from core.globalvar import CheckWxVersion
 from core.giface import StandaloneGrassInterface
 from mapswipe.frame import SwipeMapFrame
 
@@ -83,7 +84,8 @@ def main():
                 grass.fatal(_("Raster map <%s> not found") % mapName)
 
     app = wx.PySimpleApp()
-    wx.InitAllImageHandlers()
+    if not CheckWxVersion([2, 9]):
+        wx.InitAllImageHandlers()
 
     frame = SwipeMapFrame(parent = None, giface = StandaloneGrassInterface())
     

+ 2 - 1
gui/wxpython/modules/colorrules.py

@@ -1810,7 +1810,8 @@ class BufferedWindow(wx.Window):
         dc = wx.BufferedPaintDC(self, self._Buffer)
         
         # use PrepareDC to set position correctly
-        self.PrepareDC(dc)
+        # probably does nothing, removed from wxPython 2.9
+        # self.PrepareDC(dc)
         
         # we need to clear the dc BEFORE calling PrepareDC
         bg = wx.Brush(self.GetBackgroundColour())

+ 4 - 2
gui/wxpython/modules/histogram.py

@@ -124,7 +124,8 @@ class BufferedWindow(wx.Window):
         dc = wx.BufferedPaintDC(self, self._buffer)
         
         # use PrepareDC to set position correctly
-        self.PrepareDC(dc)
+        # probably does nothing, removed from wxPython 2.9
+        # self.PrepareDC(dc)
         # we need to clear the dc BEFORE calling PrepareDC
         bg = wx.Brush(self.GetBackgroundColour())
         dc.SetBackground(bg)
@@ -184,7 +185,8 @@ class BufferedWindow(wx.Window):
         self.Draw(self.pdc, img, drawid = 99)
         dc = wx.BufferedPaintDC(self, ibuffer)
         dc.Clear()
-        self.PrepareDC(dc)
+        # probably does nothing, removed from wxPython 2.9
+        # self.PrepareDC(dc)
         self.pdc.DrawToDC(dc)
         ibuffer.SaveFile(FileName, FileType)
         

+ 2 - 1
gui/wxpython/nviz/tools.py

@@ -5056,7 +5056,8 @@ class PositionWindow(wx.Window):
         dc.SetBackground(wx.Brush("White"))
         dc.Clear()
         
-        self.PrepareDC(dc)
+        # probably does nothing, removed from wxPython 2.9
+        # self.PrepareDC(dc)
         self.pdc.DrawToDC(dc)
         
     def UpdatePos(self, xcoord, ycoord):

+ 2 - 1
gui/wxpython/psmap/frame.py

@@ -1241,7 +1241,8 @@ class PsMapBufferedWindow(wx.Window):
             return
         dc = wx.BufferedPaintDC(self, self._buffer)
         # use PrepareDC to set position correctly
-        self.PrepareDC(dc)
+        # probably does nothing, removed from wxPython 2.9
+        # self.PrepareDC(dc)
         
         dc.SetBackground(wx.LIGHT_GREY_BRUSH)
         dc.Clear()

+ 2 - 1
gui/wxpython/psmap/g.gui.psmap.py

@@ -49,7 +49,8 @@ def main():
     gettext.install('grasswxpy', os.path.join(os.getenv("GISBASE"), 'locale'), unicode = True)
     
     app = wx.PySimpleApp()
-    wx.InitAllImageHandlers()
+    if not CheckWxVersion([2, 9]):
+        wx.InitAllImageHandlers()
     frame = PsMapFrame(parent = None)
     frame.Show()
 

+ 3 - 1
gui/wxpython/rlisetup/g.gui.rlisetup.py

@@ -36,6 +36,7 @@ import grass.script as grass
 sys.path.append(os.path.join(os.environ['GISBASE'], "etc", "gui", "wxpython"))
 
 from core.giface import StandaloneGrassInterface
+from core.globalvar import CheckWxVersion
 from rlisetup.frame import RLiSetupFrame
 
 
@@ -43,7 +44,8 @@ def main():
     gettext.install('grasswxpy', os.path.join(os.getenv("GISBASE"), 'locale'),
                     unicode = True)
     app = wx.PySimpleApp()
-    wx.InitAllImageHandlers()
+    if not CheckWxVersion([2, 9]):
+        wx.InitAllImageHandlers()
     frame = RLiSetupFrame(parent = None, giface = StandaloneGrassInterface())
     frame.Show()
 

+ 3 - 1
gui/wxpython/vdigit/g.gui.vdigit.py

@@ -41,6 +41,7 @@ import wx
 if __name__ == '__main__':
     sys.path.append(os.path.join(os.environ['GISBASE'], "etc", "gui", "wxpython"))
 
+from core.globalvar import CheckWxVersion
 from mapdisp.frame import MapFrame
 from core.giface   import StandaloneGrassInterface
 from core.settings import UserSettings
@@ -79,7 +80,8 @@ def main():
         os.environ['GRASS_RENDER_IMMEDIATE'] = 'cairo'
     
     app = wx.PySimpleApp()
-    wx.InitAllImageHandlers()
+    if not CheckWxVersion([2, 9]):
+        wx.InitAllImageHandlers()
     frame = VDigitMapFrame(options['map'])
     frame.Show()
 

+ 2 - 1
gui/wxpython/wxgui.py

@@ -51,7 +51,8 @@ class GMApp(wx.App):
         
         @return True
         """
-        wx.InitAllImageHandlers()
+        if not globalvar.CheckWxVersion([2, 9]):
+            wx.InitAllImageHandlers()
         
         # create splash screen
         introImagePath = os.path.join(globalvar.ETCIMGDIR, "silesia_splash.png")