Control: tags 758957 + patch

Dear maintainer,

Here's a patch for wxPython 3.0 support for pype - it's an improved
version of the patch I attached to the upstream ticket (I'll update
the patch there shortly).

With this patch, pype seems to work in a simple test, though I'm
not familiar with it so a more thorough test from a habitual pype
user would be good.

There is a suspicious looking warning on startup, but I get the
same message with the package currently in unstable when using
wxpython 2.8, so this appears to be orthogonal to the switch
to wxpython 3.0:

[ Tue Sep  9 21:58:00 2014 ] /usr/share/pype/plugins/spellcheck.py:35: 
UnicodeWarning: Unicode equal comparison failed to convert both arguments to 
Unicode - interpreting them as being unequal
  non_word.update(dict([(unichr(i), ' ') for i in xrange(256) if chr(i) not in 
goodch]))

Let me know if you'd like me to NMU these changes.

Cheers,
    Olly
diff -Nru pype-2.9.4/debian/changelog pype-2.9.4/debian/changelog
--- pype-2.9.4/debian/changelog	2013-05-04 15:30:28.000000000 -0300
+++ pype-2.9.4/debian/changelog	2014-09-09 21:50:08.000000000 -0300
@@ -1,3 +1,11 @@
+pype (2.9.4-1.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Update for wxPython 3.0 (Closes: #758957):
+    - New patch: wxpython3.0.patch
+
+ -- Olly Betts <o...@survex.com>  Wed, 10 Sep 2014 00:49:52 +0000
+
 pype (2.9.4-1) unstable; urgency=low
 
   * New upstream release
diff -Nru pype-2.9.4/debian/control pype-2.9.4/debian/control
--- pype-2.9.4/debian/control	2013-05-01 11:01:45.000000000 -0300
+++ pype-2.9.4/debian/control	2014-09-05 20:11:54.000000000 -0300
@@ -11,7 +11,7 @@
 
 Package: pype
 Architecture: all
-Depends: python-wxgtk2.8, python-wxversion, ${misc:Depends}, ${python:Depends}
+Depends: python-wxgtk3.0, python-wxversion, ${misc:Depends}, ${python:Depends}
 Description: Python programmers editor
  PyPE (Python Programmers Editor) is a lightweight but powerful
  editor.  Tools for the new and seasoned user alike are included
diff -Nru pype-2.9.4/debian/patches/series pype-2.9.4/debian/patches/series
--- pype-2.9.4/debian/patches/series	2012-08-26 15:45:02.000000000 -0300
+++ pype-2.9.4/debian/patches/series	2014-09-09 21:49:48.000000000 -0300
@@ -1,3 +1,4 @@
 #command-shell.patch
 #interpreter.py_warning.patch
 move_help_file.patch
+wxpython3.0.patch
diff -Nru pype-2.9.4/debian/patches/wxpython3.0.patch pype-2.9.4/debian/patches/wxpython3.0.patch
--- pype-2.9.4/debian/patches/wxpython3.0.patch	1969-12-31 21:00:00.000000000 -0300
+++ pype-2.9.4/debian/patches/wxpython3.0.patch	2014-09-09 21:50:14.000000000 -0300
@@ -0,0 +1,129 @@
+Description: Updates for wxPython 3.0
+ These changes should remain compatible with wxPython 2.8.
+Author: Olly Betts <o...@survex.com>
+Bug-Debian: https://bugs.debian.org/758957
+Forwarded: no
+Last-Update: 2014-09-05
+
+Index: pype-2.9.4/plugins/interpreter.py
+===================================================================
+--- pype-2.9.4.orig/plugins/interpreter.py
++++ pype-2.9.4/plugins/interpreter.py
+@@ -966,7 +966,6 @@ class MyShellFrame(wx.Frame):
+ 
+ def main():
+     app = wx.App(0)
+-    wx.InitAllImageHandlers()
+     frame = MyShellFrame()
+     frame.Show()
+     app.SetTopWindow(frame)
+Index: pype-2.9.4/pype.py
+===================================================================
+--- pype-2.9.4.orig/pype.py
++++ pype-2.9.4/pype.py
+@@ -1420,7 +1420,8 @@ class MainWindow(wx.Frame):
+                 self.menubar.Check(DOCUMENT_LIST_OPTION_TO_ID2[document_options2], 1)
+             self.menubar.Check(SHOW_RECENT, show_recent)
+             self.menubar.Check(SHOW_SEARCH, show_search)
+-            self.menubar.Check(MIDDLE_CL, MIDDLE_PASTE)
++            if sys.platform.startswith('win32'):
++                self.menubar.Check(MIDDLE_CL, MIDDLE_PASTE)
+ 
+             for i in TOOLS_ENABLE_L:
+                 if i[4] in window_management.enabled:
+@@ -2226,7 +2227,7 @@ class MainWindow(wx.Frame):
+     def OnSaveAs(self,e,upd=1):
+         wnum, win = self.getNumWin(e)
+ 
+-        dlg = wx.FileDialog(self, "Save file as...", current_path, "", "All files (*.*)|*.*", wx.SAVE|wx.OVERWRITE_PROMPT)
++        dlg = wx.FileDialog(self, "Save file as...", current_path, "", "All files (*.*)|*.*", wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT)
+         rslt = dlg.ShowModal()
+         if rslt == wx.ID_OK:
+             fn=dlg.GetFilename()
+@@ -2296,7 +2297,7 @@ class MainWindow(wx.Frame):
+ 
+     def OnOpen(self,e):
+         wd = self.config.get('lastpath', current_path)
+-        dlg = wx.FileDialog(self, "Choose a/some file(s)...", wd, "", wildcard, wx.OPEN|wx.MULTIPLE)
++        dlg = wx.FileDialog(self, "Choose a/some file(s)...", wd, "", wildcard, wx.FD_OPEN|wx.FD_MULTIPLE)
+         if dlg.ShowModal() == wx.ID_OK:
+             self.OnDrop(dlg.GetPaths())
+             self.config['lp'] = dlg.GetDirectory()
+@@ -2345,7 +2346,7 @@ class MainWindow(wx.Frame):
+         if "lastopen" in self.config:
+             self.OnDrop(self.config['lastopen'], 1)
+     def AddSearchPath(self, e):
+-        dlg = wx.DirDialog(self, "Choose a path", "", style=wx.DD_DEFAULT_STYLE|wx.DD_NEW_DIR_BUTTON)
++        dlg = wx.DirDialog(self, "Choose a path", "", style=wx.DD_DEFAULT_STYLE)
+         if dlg.ShowModal() == wx.ID_OK:
+             path = os.path.normcase(os.path.normpath(dlg.GetPath()))
+             if not (path in self.config['modulepaths']) and not (path in sys.path):
+@@ -3380,7 +3381,7 @@ class MainWindow(wx.Frame):
+         dlg = wx.FileDialog(
+             self, message="Choose a Python Interpreter", defaultDir=wd,
+             defaultFile="", wildcard="All files (*.*)|*.*",
+-            style=wx.OPEN|wx.HIDE_READONLY|wx.FILE_MUST_EXIST
++            style=wx.FD_OPEN|wx.FD_FILE_MUST_EXIST
+         )
+ 
+         x = interpreter.python_choices[:]
+Index: pype-2.9.4/plugins/documents.py
+===================================================================
+--- pype-2.9.4.orig/plugins/documents.py
++++ pype-2.9.4/plugins/documents.py
+@@ -109,11 +109,8 @@ class MyNB(BaseNotebook):
+     def __init__(self, root, id, parent):
+         BaseNotebook.__init__(self, parent, id, style=_style)
+         self.root = root
+-        if WHICHNB != 2:
+-            if __main__.USE_DOC_ICONS:
+-                self.AssignImageList(__main__.IMGLIST2)
+-        else:
+-            self.imagelist = __main__.IMGLIST3
++        if __main__.USE_DOC_ICONS:
++            self.AssignImageList(__main__.IMGLIST2)
+ 
+         #for some reason, the notebook needs the next line...the text control
+         #doesn't.
+@@ -156,11 +153,6 @@ class MyNB(BaseNotebook):
+         if self.GetPageCount():
+             self.GetPage(self.GetSelection()).GetWindow1().SetFocus()
+ 
+-    def GNBI(self, i):
+-        if WHICHNB == 2:
+-            return self.imagelist[i]
+-        return i
+-
+     def GetCurrentPage(self):
+         x = self.GetSelection()
+         if x >= 0:
+@@ -330,7 +322,7 @@ class MyNB(BaseNotebook):
+ 
+     def AddPage(self, page, text, switch=1):
+         which = __main__.GDI(text)
+-        BaseNotebook.AddPage(self, page, text, switch, self.GNBI(which))
++        BaseNotebook.AddPage(self, page, text, switch, which)
+         self.root.dragger._AddItem(text)
+         if switch or self.GetPageCount() == 1:
+             self.root.OnDocumentChange(page.GetWindow1())
+@@ -341,7 +333,7 @@ class MyNB(BaseNotebook):
+ 
+     def InsertPage(self, posn, page, text, switch=1):
+         which = __main__.GDI(text)
+-        BaseNotebook.InsertPage(self, posn, page, text, switch, self.GNBI(which))
++        BaseNotebook.InsertPage(self, posn, page, text, switch, which)
+         self.root.dragger._InsertItem(posn, text)
+         if self.GetSelection() == posn or switch:
+             self.root.OnDocumentChange(page.GetWindow1())
+@@ -403,10 +395,7 @@ class MyNB(BaseNotebook):
+         self._seen()
+ 
+     def SetPageImage(self, which, img):
+-        if WHICHNB == 2:
+-            self.SetPageBitmap(which, self.GNBI(img))
+-        else:
+-            BaseNotebook.SetPageImage(self, which, img)
++        BaseNotebook.SetPageImage(self, which, img)
+ 
+     def _seen(self):
+         if not self.cs:

Reply via email to