[grass] 16/20: Add wxpy3.0-compat.patch for wxPython 3.0 support, adapt for 6.4.4.

Bas Couwenberg sebastic at xs4all.nl
Wed Sep 3 22:27:17 UTC 2014


This is an automated email from the git hooks/post-receive script.

sebastic-guest pushed a commit to branch master
in repository grass.

commit 47d752b068bd9af26f976f9625e280f1c79307c3
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Wed Sep 3 22:39:26 2014 +0200

    Add wxpy3.0-compat.patch for wxPython 3.0 support, adapt for 6.4.4.
---
 debian/changelog                    |   3 +
 debian/control                      |   7 +-
 debian/control.in                   |   7 +-
 debian/patches/series               |   1 +
 debian/patches/wxpy3.0-compat.patch | 304 ++++++++++++++++++++++++++++++++++++
 5 files changed, 314 insertions(+), 8 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index f84da54..72b9379 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -21,6 +21,9 @@ grass (6.4.4-1) UNRELEASED; urgency=medium
   * Move image files to /usr/share, symlink them from /usr/lib.
   * Add lintian overrides for image-file-in-usr-lib false positives.
   * Update copyright file using copyright-format 1.0.
+  * Add wxpy3.0-compat.patch for wxPython 3.0 support, adapt for 6.4.4.
+    Thanks to Olly Betts for the patch.
+    (closes: #757308)
 
  -- Bas Couwenberg <sebastic at xs4all.nl>  Sat, 23 Aug 2014 17:37:14 +0200
 
diff --git a/debian/control b/debian/control
index 20efa68..205cdf9 100644
--- a/debian/control
+++ b/debian/control
@@ -30,17 +30,16 @@ Build-Depends: autoconf2.13,
                proj-bin,
                libreadline-dev,
                libsqlite3-dev,
+               libwxgtk3.0-dev,
                libxmu-dev,
 # install optipng if compressing the PNG images in the programmers' manual
 #              optipng,
                python,
-               python-wxgtk2.8,
-               libwxgtk2.8-dev,
+               python-wxgtk3.0,
                python-dev,
                tcl-dev (>= 8.5),
                tk-dev (>= 8.5),
                unixodbc-dev
-Build-Conflicts: wx2.6-headers
 Standards-Version: 3.9.5
 Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-grass/grass.git
 Vcs-Git: git://anonscm.debian.org/pkg-grass/grass.git
@@ -112,7 +111,7 @@ Architecture: any
 Depends: ${shlibs:Depends},
          grass-core,
          ${python:Depends},
-         python-wxgtk2.8,
+         python-wxgtk3.0,
 # pyGL needed for wxNviz
          python-opengl,
          xterm | x-terminal-emulator,
diff --git a/debian/control.in b/debian/control.in
index d60bd97..b6d2c41 100644
--- a/debian/control.in
+++ b/debian/control.in
@@ -30,17 +30,16 @@ Build-Depends: autoconf2.13,
                proj-bin,
                libreadline-dev,
                libsqlite3-dev,
+               libwxgtk3.0-dev,
                libxmu-dev,
 # install optipng if compressing the PNG images in the programmers' manual
 #              optipng,
                python,
-               python-wxgtk2.8,
-               libwxgtk2.8-dev,
+               python-wxgtk3.0,
                python-dev,
                tcl-dev (>= 8.5),
                tk-dev (>= 8.5),
                unixodbc-dev
-Build-Conflicts: wx2.6-headers
 Standards-Version: 3.9.5
 Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-grass/grass.git
 Vcs-Git: git://anonscm.debian.org/pkg-grass/grass.git
@@ -112,7 +111,7 @@ Architecture: any
 Depends: ${shlibs:Depends},
          grass-core,
          ${python:Depends},
-         python-wxgtk2.8,
+         python-wxgtk3.0,
 # pyGL needed for wxNviz
          python-opengl,
          xterm | x-terminal-emulator,
diff --git a/debian/patches/series b/debian/patches/series
index 05819e4..fdce13e 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -5,3 +5,4 @@ xterm
 instdir
 check4dev
 help_about_names
+wxpy3.0-compat.patch
diff --git a/debian/patches/wxpy3.0-compat.patch b/debian/patches/wxpy3.0-compat.patch
new file mode 100644
index 0000000..34ed29d
--- /dev/null
+++ b/debian/patches/wxpy3.0-compat.patch
@@ -0,0 +1,304 @@
+Description: Fix to work with wxPython 3.0
+Author: Olly Betts <olly at survex.com>
+Last-Update: 2014-08-16
+
+--- a/gui/wxpython/wxplot/profile.py
++++ b/gui/wxpython/wxplot/profile.py
+@@ -332,7 +332,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()
+--- a/gui/wxpython/psmap/frame.py
++++ b/gui/wxpython/psmap/frame.py
+@@ -392,7 +392,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()]
+@@ -417,7 +417,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()
+@@ -2220,7 +2220,8 @@ def main():
+     gettext.install('grasswxpy', os.path.join(os.getenv("GISBASE"), 'locale'), unicode = True)
+     
+     app = wx.PySimpleApp()
+-    wx.InitAllImageHandlers()
++    if not globalvar.CheckWxVersion([2, 9]):
++        wx.InitAllImageHandlers()
+     frame = PsMapFrame()
+     frame.Show()
+     
+--- a/gui/wxpython/psmap/dialogs.py
++++ b/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:"))
+--- a/gui/wxpython/nviz/tools.py
++++ b/gui/wxpython/nviz/tools.py
+@@ -519,7 +519,7 @@ class NvizToolWindow(FN.FlatNotebook):
+         self.mainPanelData.SetupScrolling(scroll_x = False)
+ ##        style = fpb.CaptionBarStyle()
+ ##        style.SetCaptionStyle(fpb.CAPTIONBAR_FILLED_RECTANGLE)
+-##        style.SetFirstColour(wx.Color(250,250,250))
++##        style.SetFirstColour(wx.Colour(250,250,250))
+         try:# wxpython <= 2.8.10
+             self.foldpanelData = fpb.FoldPanelBar(parent = self.mainPanelData, id = wx.ID_ANY,
+                                                   style = fpb.FPB_DEFAULT_STYLE,
+--- a/gui/wxpython/modules/colorrules.py
++++ b/gui/wxpython/modules/colorrules.py
+@@ -395,7 +395,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 = '*',
+                                                      size = globalvar.DIALOG_GSELECT_SIZE,
+@@ -404,7 +404,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)
+         
+         default = wx.Button(parent = parent, id = wx.ID_ANY, label = _("Reload default table"))   
+--- a/gui/wxpython/modules/histogram.py
++++ b/gui/wxpython/modules/histogram.py
+@@ -416,7 +416,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()
+--- a/gui/wxpython/modules/mcalc_builder.py
++++ b/gui/wxpython/modules/mcalc_builder.py
+@@ -515,7 +515,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:
+@@ -536,7 +536,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:
+--- a/gui/wxpython/location_wizard/wizard.py
++++ b/gui/wxpython/location_wizard/wizard.py
+@@ -72,6 +72,8 @@ class TitledPage(BaseClass, wiz.WizardPa
+         # 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"""
+@@ -1168,7 +1170,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)
+@@ -1241,7 +1243,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()
+@@ -1419,7 +1421,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()
+--- a/gui/wxpython/mapdisp/frame.py
++++ b/gui/wxpython/mapdisp/frame.py
+@@ -576,7 +576,7 @@ class MapFrame(MapFrameBase):
+                             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()
+--- a/gui/wxpython/gui_core/ghelp.py
++++ b/gui/wxpython/gui_core/ghelp.py
+@@ -88,6 +88,7 @@ class SearchModuleWindow(wx.Panel):
+         """!Do layout"""
+         sizer = wx.StaticBoxSizer(self.box, wx.HORIZONTAL)
+         gridSizer = wx.GridBagSizer(hgap = 3, vgap = 3)
++        gridSizer.SetCols(2)
+         
+         gridSizer.Add(item = self.searchBy,
+                       flag = wx.ALIGN_CENTER_VERTICAL, pos = (0, 0))
+@@ -397,6 +398,7 @@ class AboutWindow(wx.Frame):
+         infoTxt.SetupScrolling()
+         infoSizer = wx.BoxSizer(wx.VERTICAL)
+         infoGridSizer = wx.GridBagSizer(vgap = 5, hgap = 5)
++        infoGridSizer.SetCols(2)
+         logo = os.path.join(globalvar.ETCDIR, "gui", "icons", "grass-64x64.png")
+         logoBitmap = wx.StaticBitmap(parent = infoTxt, id = wx.ID_ANY,
+                                      bitmap = wx.Bitmap(name = logo,
+--- a/gui/wxpython/gui_core/goutput.py
++++ b/gui/wxpython/gui_core/goutput.py
+@@ -662,7 +662,7 @@ class GMConsole(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.
+@@ -812,7 +812,7 @@ class GMConsole(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:
+--- a/gui/wxpython/gui_core/forms.py
++++ b/gui/wxpython/gui_core/forms.py
+@@ -1296,9 +1296,9 @@ class CmdPanel(wx.Panel):
+                 # file selector
+                 elif p.get('prompt','') !=  'color' and p.get('element', '') ==  'file':
+                     if p.get('age', 'new_file') == 'new_file':
+-                        fmode = wx.SAVE
++                        fmode = wx.FD_SAVE
+                     else:
+-                        fmode = wx.OPEN
++                        fmode = wx.FD_OPEN
+                     fbb = filebrowse.FileBrowseButton(parent = which_panel, id = wx.ID_ANY, fileMask = '*',
+                                                       size = globalvar.DIALOG_GSELECT_SIZE, labelText = '',
+                                                       dialogTitle = _('Choose %s') % \
+@@ -1549,7 +1549,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()
+--- a/gui/wxpython/gmodeler/frame.py
++++ b/gui/wxpython/gmodeler/frame.py
+@@ -551,7 +551,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()
+@@ -1657,7 +1657,8 @@ def main():
+     gettext.install('grasswxpy', os.path.join(os.getenv("GISBASE"), 'locale'), unicode = True)
+     
+     app = wx.PySimpleApp()
+-    wx.InitAllImageHandlers()
++    if not globalvar.CheckWxVersion([2, 9]):
++        wx.InitAllImageHandlers()
+     frame = ModelFrame(parent = None)
+     if len(sys.argv) > 1:
+         frame.LoadModelFile(sys.argv[1])
+--- a/gui/wxpython/gcp/mapdisplay.py
++++ b/gui/wxpython/gcp/mapdisplay.py
+@@ -456,7 +456,7 @@ class MapFrame(MapFrameBase):
+                             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()
+--- a/gui/wxpython/dbmgr/manager.py
++++ b/gui/wxpython/dbmgr/manager.py
+@@ -3101,9 +3101,10 @@ def main(argv = None):
+     if len(argv) != 2:
+         print >> sys.stderr, __doc__
+         sys.exit()
+-    
++
+     #some applications might require image handlers
+-    wx.InitAllImageHandlers()
++    if not globalvar.CheckWxVersion([2, 9]):
++        wx.InitAllImageHandlers()
+     
+     app = wx.PySimpleApp()
+     f = AttributeManager(parent = None, id = wx.ID_ANY,
+--- a/gui/wxpython/core/globalvar.py
++++ b/gui/wxpython/core/globalvar.py
+@@ -32,7 +32,7 @@ import grass.script as grass
+ 
+ def CheckWxVersion(version = [2, 8, 11, 0]):
+     """!Check wx version"""
+-    ver = wx.version().split(' ')[0]
++    ver = wx.__version__
+     if map(int, ver.split('.')) < version:
+         return False
+     
+@@ -53,7 +53,7 @@ def CheckForWx():
+         # wxversion.select(str(minVersion[0]) + '.' + str(minVersion[1]))
+         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('.')))

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/grass.git



More information about the Pkg-grass-devel mailing list