1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
|
Description: Updates for wxPython 3.0
These changes should maintain compatibility with wxPython 2.8.
Author: Olly Betts <olly@survex.com>
Forwarded: no
Last-Update: 2014-08-15
Index: python-pyface-4.4.0/pyface/ui/wx/directory_dialog.py
===================================================================
--- python-pyface-4.4.0.orig/pyface/ui/wx/directory_dialog.py
+++ python-pyface-4.4.0/pyface/ui/wx/directory_dialog.py
@@ -70,7 +70,7 @@ class DirectoryDialog(MDirectoryDialog,
def _create_control(self, parent):
# The default style.
- style = wx.OPEN
+ style = 0
# Create the wx style depending on which buttons are required etc.
if self.new_directory:
Index: python-pyface-4.4.0/pyface/ui/wx/file_dialog.py
===================================================================
--- python-pyface-4.4.0.orig/pyface/ui/wx/file_dialog.py
+++ python-pyface-4.4.0/pyface/ui/wx/file_dialog.py
@@ -105,11 +105,11 @@ class FileDialog(MFileDialog, Dialog):
default_filename = self.default_filename
if self.action == 'open':
- style = wx.OPEN
+ style = wx.FD_OPEN
elif self.action == 'open files':
- style = wx.OPEN | wx.MULTIPLE
+ style = wx.FD_OPEN | wx.FD_MULTIPLE
else:
- style = wx.SAVE | wx.OVERWRITE_PROMPT
+ style = wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT
# Create the actual dialog.
dialog = wx.FileDialog(parent, self.title, defaultDir=default_directory,
Index: python-pyface-4.4.0/pyface/ui/wx/init.py
===================================================================
--- python-pyface-4.4.0.orig/pyface/ui/wx/init.py
+++ python-pyface-4.4.0/pyface/ui/wx/init.py
@@ -15,17 +15,17 @@ import wx
# Check the version number is late enough.
-if wx.VERSION < (2, 6):
- raise RuntimeError, "Need wx version 2.6 or higher, but got %s" % str(wx.VERSION)
+if wx.VERSION < (2, 8):
+ raise RuntimeError, "Need wx version 2.8 or higher, but got %s" % str(wx.VERSION)
# It's possible that it has already been initialised.
_app = wx.GetApp()
if _app is None:
- _app = wx.PySimpleApp()
-
- # Before we can load any images we have to initialize wxPython's image
- # handlers.
- wx.InitAllImageHandlers()
+ # wx.PySimpleApp() is deprecated in wx3.0, but this is all it really does:
+ class PySimpleApp(wx.App):
+ def OnInit(self):
+ return True
+ _app = PySimpleApp()
#### EOF ######################################################################
Index: python-pyface-4.4.0/pyface/wx/dialog.py
===================================================================
--- python-pyface-4.4.0.orig/pyface/wx/dialog.py
+++ python-pyface-4.4.0/pyface/wx/dialog.py
@@ -36,7 +36,7 @@ class OpenFileDialog(wx.FileDialog):
def __init__(self, parent=None, **kw):
""" Constructor. """
- style = wx.OPEN | wx.HIDE_READONLY
+ style = wx.FD_OPEN
# Base-class constructor.
wx.FileDialog.__init__(self, parent, "Open", style=style, **kw)
@@ -49,7 +49,7 @@ class OpenDirDialog(wx.DirDialog):
def __init__(self, parent=None, **kw):
""" Constructor. """
- style = wx.OPEN | wx.HIDE_READONLY | wx.DD_NEW_DIR_BUTTON
+ style = wx.DD_NEW_DIR_BUTTON
# Base-class constructor.
wx.DirDialog.__init__(self, parent, "Open", style=style, **kw)
@@ -62,7 +62,7 @@ class SaveFileAsDialog(wx.FileDialog):
def __init__(self, parent=None, **kw):
""" Constructor. """
- style = wx.SAVE | wx.OVERWRITE_PROMPT
+ style = wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT
# Base-class constructor.
wx.FileDialog.__init__(self, parent, "Save As", style=style, **kw)
Index: python-pyface-4.4.0/pyface/util/guisupport.py
===================================================================
--- python-pyface-4.4.0.orig/pyface/util/guisupport.py
+++ python-pyface-4.4.0/pyface/util/guisupport.py
@@ -81,7 +81,12 @@ def get_app_wx(*args, **kwargs):
if app is None:
if not kwargs.has_key('redirect'):
kwargs['redirect'] = False
- app = wx.PySimpleApp(*args, **kwargs)
+ # wx.PySimpleApp() is deprecated in wx3.0, but this is all it really
+ # does:
+ class PySimpleApp(wx.App):
+ def OnInit(self):
+ return True
+ app = PySimpleApp(*args, **kwargs)
return app
def is_event_loop_running_wx(app=None):
|