瀏覽代碼

Fix to work with wxPython 3.0
Author: Olly Betts <olly@survex.com>
(taken from http://anonscm.debian.org/cgit/pkg-grass/grass.git/)


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@64610 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa 10 年之前
父節點
當前提交
c2ee8da8fa

+ 4 - 4
gui/wxpython/animation/dialogs.py

@@ -854,7 +854,7 @@ class ExportDialog(wx.Dialog):
                                                   labelText=_("Image file:"),
                                                   dialogTitle=_('Choose image file'),
                                                   buttonText=_('Browse'),
-                                                  startDirectory=os.getcwd(), fileMode=wx.OPEN,
+                                                  startDirectory=os.getcwd(), fileMode=wx.FD_OPEN,
                                                   changeCallback=self.OnSetImage)
         self.imageBox.Add(self.browse, proportion=1, flag=wx.EXPAND)
         self.hidevbox.Add(self.imageBox, proportion=0, flag=wx.EXPAND | wx.BOTTOM, border=5)
@@ -948,7 +948,7 @@ class ExportDialog(wx.Dialog):
                                                      labelText=_("GIF file:"),
                                                      dialogTitle=_("Choose file to save animation"),
                                                      buttonText=_("Browse"),
-                                                     startDirectory=os.getcwd(), fileMode=wx.SAVE)
+                                                     startDirectory=os.getcwd(), fileMode=wx.FD_SAVE)
         gifGridSizer = wx.GridBagSizer(hgap=5, vgap=5)
         gifGridSizer.AddGrowableCol(0)
         gifGridSizer.Add(self.gifBrowse, pos=(0, 0), flag = wx.EXPAND)
@@ -965,7 +965,7 @@ class ExportDialog(wx.Dialog):
                                                      labelText=_("SWF file:"),
                                                      dialogTitle=_("Choose file to save animation"),
                                                      buttonText=_("Browse"),
-                                                     startDirectory=os.getcwd(), fileMode=wx.SAVE)
+                                                     startDirectory=os.getcwd(), fileMode=wx.FD_SAVE)
         swfGridSizer = wx.GridBagSizer(hgap=5, vgap=5)
         swfGridSizer.AddGrowableCol(0)
         swfGridSizer.Add(self.swfBrowse, pos=(0, 0), flag = wx.EXPAND)
@@ -988,7 +988,7 @@ class ExportDialog(wx.Dialog):
                                                      labelText=_("AVI file:"),
                                                      dialogTitle=_("Choose file to save animation"),
                                                      buttonText=_("Browse"),
-                                                     startDirectory=os.getcwd(), fileMode=wx.SAVE)
+                                                     startDirectory=os.getcwd(), fileMode=wx.FD_SAVE)
         encodingLabel = wx.StaticText(parent=aviPanel, id=wx.ID_ANY, label=_("Video codec:"))
         self.encodingText = wx.TextCtrl(parent=aviPanel, id=wx.ID_ANY, value='mpeg4')
         optionsLabel = wx.StaticText(parent=aviPanel, label=_("Additional options:"))

+ 2 - 2
gui/wxpython/core/globalvar.py

@@ -43,7 +43,7 @@ from grass.script.core import get_commands
 
 def CheckWxVersion(version):
     """Check wx version"""
-    ver = wx.version().split(' ')[0]
+    ver = wx.__version__
     if map(int, ver.split('.')) < version:
         return False
 
@@ -67,7 +67,7 @@ def CheckForWx(forceVersion = os.getenv('GRASS_WXVERSION', None)):
             wxversion.select(forceVersion)
         wxversion.ensureMinimal(str(minVersion[0]) + '.' + str(minVersion[1]))
         import wx
-        version = wx.version().split(' ')[0]
+        version = wx.__version__
 
         if map(int, version.split('.')) < minVersion:
             raise ValueError('Your wxPython version is %s.%s.%s.%s' % tuple(version.split('.')))

+ 1 - 1
gui/wxpython/gcp/mapdisplay.py

@@ -383,7 +383,7 @@ class MapFrame(SingleMapFrame):
                             message = _("Choose a file name to save the image "
                                         "(no need to add extension)"),
                             wildcard = filetype,
-                            style=wx.SAVE | wx.FD_OVERWRITE_PROMPT)
+                            style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
         
         if dlg.ShowModal() == wx.ID_OK:
             path = dlg.GetPath()

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

@@ -578,7 +578,7 @@ class ModelFrame(wx.Frame):
                             defaultDir = "",
                             defaultFile = "",
                             wildcard = filetype,
-                            style=wx.SAVE | wx.FD_OVERWRITE_PROMPT)
+                            style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
         
         if dlg.ShowModal() == wx.ID_OK:
             path = dlg.GetPath()

+ 3 - 3
gui/wxpython/gui_core/forms.py

@@ -1503,9 +1503,9 @@ class CmdPanel(wx.Panel):
                 # file selector
                 elif p.get('prompt','') !=  'color' and p.get('prompt', '') == 'file':
                     if p.get('age', 'new') == 'new':
-                        fmode = wx.SAVE
+                        fmode = wx.FD_SAVE
                     else:
-                        fmode = wx.OPEN
+                        fmode = wx.FD_OPEN
                     # check wildcard
                     try:
                         fExt = os.path.splitext(p.get('key_desc', ['*.*'])[0])[1]
@@ -1924,7 +1924,7 @@ class CmdPanel(wx.Panel):
         dlg = wx.FileDialog(parent = self,
                             message = _("Save input as..."),
                             defaultDir = os.getcwd(),
-                            style = wx.SAVE | wx.FD_OVERWRITE_PROMPT)
+                            style = wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
 
         if dlg.ShowModal() == wx.ID_OK:
             path = dlg.GetPath()

+ 2 - 2
gui/wxpython/gui_core/goutput.py

@@ -375,7 +375,7 @@ class GConsoleWindow(wx.SplitterWindow):
                             defaultFile = "grass_cmd_output.txt",
                             wildcard = _("%(txt)s (*.txt)|*.txt|%(files)s (*)|*") % 
                             {'txt': _("Text files"), 'files': _("Files")},
-                            style = wx.SAVE | wx.FD_OVERWRITE_PROMPT)
+                            style = wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
         
         # Show the dialog and retrieve the user response. If it is the OK response,
         # process the data.
@@ -462,7 +462,7 @@ class GConsoleWindow(wx.SplitterWindow):
                                 defaultFile = "grass_cmd_log.txt",
                                 wildcard = _("%(txt)s (*.txt)|*.txt|%(files)s (*)|*") % 
                                             {'txt': _("Text files"), 'files': _("Files")},
-                                style = wx.SAVE)
+                                style = wx.FD_SAVE)
             if dlg.ShowModal() == wx.ID_OK:
                 self.cmdFileProtocol = dlg.GetPath()
             else:

+ 5 - 3
gui/wxpython/location_wizard/wizard.py

@@ -74,6 +74,8 @@ class TitledPage(BaseClass, wiz.WizardPageSimple):
         # main sizers
         self.pagesizer = wx.BoxSizer(wx.VERTICAL)
         self.sizer = wx.GridBagSizer(vgap = 0, hgap = 0)
+        self.sizer.SetCols(5)
+        self.sizer.SetRows(6)
         
     def DoLayout(self):
         """Do page layout"""
@@ -1220,7 +1222,7 @@ class GeoreferencedFilePage(TitledPage):
         """Choose file"""
         dlg = wx.FileDialog(self,
                             _("Select georeferenced file"),
-                            os.getcwd(), "", "*.*", wx.OPEN)
+                            os.getcwd(), "", "*.*", wx.FD_OPEN)
         if dlg.ShowModal() == wx.ID_OK:
             path = dlg.GetPath()
             self.tfile.SetValue(path)
@@ -1293,7 +1295,7 @@ class WKTPage(TitledPage):
                             message = _("Select Well Known Text (WKT) .prj file"),
                             defaultDir = os.getcwd(),
                             wildcard = "PRJ files (*.prj)|*.prj|Files (*.*)|*.*",
-                            style = wx.OPEN)
+                            style = wx.FD_OPEN)
 
         if dlg.ShowModal() == wx.ID_OK:
             path = dlg.GetPath()
@@ -1470,7 +1472,7 @@ class EPSGPage(TitledPage):
             path = os.getcwd()
         
         dlg = wx.FileDialog(parent = self, message = _("Choose EPSG codes file"),
-                            defaultDir = path, defaultFile = "", wildcard = "*", style = wx.OPEN)
+                            defaultDir = path, defaultFile = "", wildcard = "*", style = wx.FD_OPEN)
         
         if dlg.ShowModal() == wx.ID_OK:
             path = dlg.GetPath()

+ 1 - 1
gui/wxpython/mapdisp/frame.py

@@ -617,7 +617,7 @@ class MapFrame(SingleMapFrame):
                             message = _("Choose a file name to save the image "
                                         "(no need to add extension)"),
                             wildcard = filetype,
-                            style = wx.SAVE | wx.FD_OVERWRITE_PROMPT)
+                            style = wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
         
         if dlg.ShowModal() == wx.ID_OK:
             path = dlg.GetPath()

+ 1 - 1
gui/wxpython/mapswipe/frame.py

@@ -524,7 +524,7 @@ class SwipeMapFrame(DoubleMapFrame):
                             message = _("Choose a file name to save the image "
                                         "(no need to add extension)"),
                             wildcard = filetype,
-                            style = wx.SAVE | wx.FD_OVERWRITE_PROMPT)
+                            style = wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
         
         if dlg.ShowModal() == wx.ID_OK:
             path = dlg.GetPath()

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

@@ -409,7 +409,7 @@ class ColorTable(wx.Frame):
                                                      buttonText = _('Load'),
                                                      toolTip = _("Type filename or click to choose "
                                                                  "file and load color table"),
-                                                     startDirectory = os.getcwd(), fileMode = wx.OPEN,
+                                                     startDirectory = os.getcwd(), fileMode = wx.FD_OPEN,
                                                      changeCallback = self.OnLoadRulesFile)
         self.saveRules = filebrowse.FileBrowseButton(parent = parent, id = wx.ID_ANY, fileMask = '*',
                                                      labelText = '',
@@ -417,7 +417,7 @@ class ColorTable(wx.Frame):
                                                      toolTip = _("Type filename or click to choose "
                                                                  "file and save color table"),
                                                      buttonText = _('Save'),
-                                                     startDirectory = os.getcwd(), fileMode = wx.SAVE,
+                                                     startDirectory = os.getcwd(), fileMode = wx.FD_SAVE,
                                                      changeCallback = self.OnSaveRulesFile)
 
         colorTable = ColorTablesComboBox(parent = parent, size=globalvar.DIALOG_COMBOBOX_SIZE,

+ 1 - 1
gui/wxpython/modules/histogram.py

@@ -423,7 +423,7 @@ class HistogramFrame(wx.Frame):
                             message = _("Choose a file name to save the image "
                                         "(no need to add extension)"),
                             wildcard = filetype,
-                            style=wx.SAVE | wx.FD_OVERWRITE_PROMPT)
+                            style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
         
         if dlg.ShowModal() == wx.ID_OK:
             path = dlg.GetPath()

+ 2 - 2
gui/wxpython/modules/mcalc_builder.py

@@ -615,7 +615,7 @@ class MapCalcFrame(wx.Frame):
         dlg = wx.FileDialog(parent = self,
                             message = _("Choose a file name to save the expression"),
                             wildcard = _("Expression file (*)|*"),
-                            style = wx.SAVE | wx.FD_OVERWRITE_PROMPT)
+                            style = wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
         if dlg.ShowModal() == wx.ID_OK:
             path = dlg.GetPath()
             if not path:
@@ -636,7 +636,7 @@ class MapCalcFrame(wx.Frame):
         dlg = wx.FileDialog(parent = self,
                             message = _("Choose a file name to load the expression"),
                             wildcard = _("Expression file (*)|*"),
-                            style = wx.OPEN)
+                            style = wx.FD_OPEN)
         if dlg.ShowModal() == wx.ID_OK:
             path = dlg.GetPath()
             if not path:

+ 2 - 2
gui/wxpython/psmap/dialogs.py

@@ -1970,7 +1970,7 @@ class VPropertiesDialog(PsmapDialog):
         self.epsFileCtrl = filebrowse.FileBrowseButton(panel, id = wx.ID_ANY, labelText = '',
                                 buttonText =  _("Browse"), toolTip = _("Type filename or click browse to choose file"), 
                                 dialogTitle = _("Choose a file"), startDirectory = '', initialValue = '',
-                                fileMask = "Encapsulated PostScript (*.eps)|*.eps|All files (*.*)|*.*", fileMode = wx.OPEN)
+                                fileMask = "Encapsulated PostScript (*.eps)|*.eps|All files (*.*)|*.*", fileMode = wx.FD_OPEN)
         if not self.vPropertiesDict['eps']:
             self.epsFileCtrl.SetValue('')
         else: #eps chosen
@@ -2159,7 +2159,7 @@ class VPropertiesDialog(PsmapDialog):
         self.patFileCtrl = filebrowse.FileBrowseButton(panel, id = wx.ID_ANY, labelText = _("Choose pattern file:"),
                                 buttonText =  _("Browse"), toolTip = _("Type filename or click browse to choose file"), 
                                 dialogTitle = _("Choose a file"), startDirectory = self.patternPath, initialValue = '',
-                                fileMask = "Encapsulated PostScript (*.eps)|*.eps|All files (*.*)|*.*", fileMode = wx.OPEN)
+                                fileMask = "Encapsulated PostScript (*.eps)|*.eps|All files (*.*)|*.*", fileMode = wx.FD_OPEN)
         self.patWidthText = wx.StaticText(panel, id = wx.ID_ANY, label = _("pattern line width (pts):"))
         self.patWidthSpin = wx.SpinCtrl(panel, id = wx.ID_ANY, min = 1, max = 25, initial = 1)
         self.patScaleText = wx.StaticText(panel, id = wx.ID_ANY, label = _("pattern scale factor:"))

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

@@ -398,7 +398,7 @@ class PsMapFrame(wx.Frame):
         filename = ''
         dlg = wx.FileDialog(self, message = _("Save file as"), defaultDir = "", 
                             defaultFile = mapName, wildcard = wildcard,
-                            style = wx.CHANGE_DIR | wx.SAVE | wx.OVERWRITE_PROMPT)
+                            style = wx.FD_CHANGE_DIR | wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
         if dlg.ShowModal() == wx.ID_OK:
             filename = dlg.GetPath()
             suffix = suffix[dlg.GetFilterIndex()]
@@ -423,7 +423,7 @@ class PsMapFrame(wx.Frame):
         filename = ''
         dlg = wx.FileDialog(self, message = "Find instructions file", defaultDir = "", 
                             defaultFile = '', wildcard = "All files (*.*)|*.*",
-                            style = wx.CHANGE_DIR|wx.OPEN)
+                            style = wx.FD_CHANGE_DIR|wx.FD_OPEN)
         if dlg.ShowModal() == wx.ID_OK:
             filename = dlg.GetPath()
         dlg.Destroy()

+ 1 - 1
gui/wxpython/wxplot/profile.py

@@ -341,7 +341,7 @@ class ProfileFrame(BasePlotFrame):
         dlg = wx.FileDialog(parent = self,
                             message = _("Choose prefix for file(s) where to save profile values..."),
                             defaultDir = os.getcwd(), 
-                            wildcard = _("Comma separated value (*.csv)|*.csv"), style = wx.SAVE)
+                            wildcard = _("Comma separated value (*.csv)|*.csv"), style = wx.FD_SAVE)
         pfile = []
         if dlg.ShowModal() == wx.ID_OK:
             path = dlg.GetPath()