3232from string import Template
3333
3434errorMessageTemplate = Template ("""$reason
35- You need to install wxPython 2.8.12.1 or 3.0.2 or newer with unicode support \
36- to run RIDE. wxPython can be downloaded from \
37- http://sourceforge.net/projects/wxpython/files/wxPython/""" )
38- supported_versions = ["2.8" , "3.0" ]
35+ You need to install wxPython 2.8.12.1 with unicode support to run RIDE.
36+ wxPython 2.8.12.1 can be downloaded from http://sourceforge.net/projects/wxpython/files/wxPython/2.8.12.1/""" )
37+ supported_versions = ["2.8" ]
3938
4039try :
4140 import wxversion
4241 from wxversion import VersionError
42+ if sys .platform == 'darwin' :
43+ supported_versions .append ("2.9" )
4344 wxversion .select (supported_versions )
4445 import wx
4546except ImportError as e :
46- if "no appropriate 64-bit architecture" in "{0}" . format ( e ) .lower () and \
47+ if "no appropriate 64-bit architecture" in e . message .lower () and \
4748 sys .platform == 'darwin' :
48- print ( "python should be executed in 32-bit mode with wxPython on OSX." )
49+ print "python should be executed in 32-bit mode with wxPython on OSX."
4950 else :
50- print ( errorMessageTemplate .substitute (reason = "wxPython not found." ) )
51+ print errorMessageTemplate .substitute (reason = "wxPython not found." )
5152 sys .exit (1 )
5253except VersionError :
53- print ( errorMessageTemplate .substitute (reason = "Wrong wxPython version." ) )
54+ print errorMessageTemplate .substitute (reason = "Wrong wxPython version." )
5455 sys .exit (1 )
5556
5657if "ansi" in wx .PlatformInfo :
57- print ( errorMessageTemplate .substitute (reason = "wxPython with ansi encoding \
58- is not supported") )
58+ print errorMessageTemplate .substitute (
59+ reason = "wxPython with ansi encoding is not supported" )
5960 sys .exit (1 )
6061
6162
6667def main (* args ):
6768 noupdatecheck , debug_console , inpath = _parse_args (args )
6869 if len (args ) > 3 or '--help' in args :
69- print ( __doc__ )
70+ print __doc__
7071 sys .exit ()
7172 try :
7273 _run (inpath , not noupdatecheck , debug_console )
@@ -81,7 +82,7 @@ def _parse_args(args):
8182 return False , False , None
8283 noupdatecheck = '--noupdatecheck' in args
8384 debug_console = '--debugconsole' in args
84- inpath = args [- 1 ] if args [- 1 ] not in ['--noupdatecheck' , '--debugconsole' ]\
85+ inpath = args [- 1 ] if args [- 1 ] not in ['--noupdatecheck' , '--debugconsole' ] \
8586 else None
8687 return noupdatecheck , debug_console , inpath
8788
@@ -106,17 +107,19 @@ def _show_old_wxpython_warning_if_needed(parent=None):
106107 if wx .VERSION >= (2 , 8 , 12 , 1 ):
107108 return
108109 title = 'Please upgrade your wxPython installation'
109- message = ("RIDE officially supports wxPython 2.8.12.1, 3.0.2 and newer \
110- releases in 3.0 series. Your current version is {0}.\n \n \
111- Older wxPython versions are known to miss some features used by RIDE.\n \
112- wxPython 2.8.12.1 packages can be found from\n \
113- http://sourceforge.net/projects/wxpython/files/wxPython/2.8.12.1/." .format (
114- wx .VERSION_STRING ))
110+ message = ('RIDE officially supports wxPython 2.8.12.1. '
111+ 'Your current version is %s.\n \n '
112+ 'Older wxPython versions are known to miss some features used by RIDE. '
113+ 'Notice also that wxPython 3.0 is not yet supported.\n \n '
114+ 'wxPython 2.8.12.1 packages can be found from\n '
115+ 'http://sourceforge.net/projects/wxpython/files/wxPython/2.8.12.1/.'
116+ % wx .VERSION_STRING )
115117 style = wx .ICON_EXCLAMATION
116118 if not parent :
117- _ = wx .App ()
118- parent = wx .Frame (None , size = (0 , 0 ))
119+ _ = wx .PySimpleApp ()
120+ parent = wx .Frame (None , size = (0 ,0 ))
119121 wx .MessageDialog (parent , message , title , style ).ShowModal ()
120122
123+
121124if __name__ == '__main__' :
122125 main (sys .argv [1 :])
0 commit comments