3232from string import Template
3333
3434errorMessageTemplate = Template ("""$reason
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" ]
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" ]
3839
3940try :
4041 import wxversion
4142 from wxversion import VersionError
42- if sys .platform == 'darwin' :
43- supported_versions .append ("2.9" )
4443 wxversion .select (supported_versions )
4544 import wx
4645except ImportError as e :
47- if "no appropriate 64-bit architecture" in e . message .lower () and \
46+ if "no appropriate 64-bit architecture" in "{0}" . format ( e ) .lower () and \
4847 sys .platform == 'darwin' :
49- print "python should be executed in 32-bit mode with wxPython on OSX."
48+ print ( "python should be executed in 32-bit mode with wxPython on OSX." )
5049 else :
51- print errorMessageTemplate .substitute (reason = "wxPython not found." )
50+ print ( errorMessageTemplate .substitute (reason = "wxPython not found." ) )
5251 sys .exit (1 )
5352except VersionError :
54- print errorMessageTemplate .substitute (reason = "Wrong wxPython version." )
53+ print ( errorMessageTemplate .substitute (reason = "Wrong wxPython version." ) )
5554 sys .exit (1 )
5655
5756if "ansi" in wx .PlatformInfo :
58- print errorMessageTemplate .substitute (
59- reason = "wxPython with ansi encoding is not supported" )
57+ print ( errorMessageTemplate .substitute (reason = "wxPython with ansi encoding \
58+ is not supported") )
6059 sys .exit (1 )
6160
6261
6766def main (* args ):
6867 noupdatecheck , debug_console , inpath = _parse_args (args )
6968 if len (args ) > 3 or '--help' in args :
70- print __doc__
69+ print ( __doc__ )
7170 sys .exit ()
7271 try :
7372 _run (inpath , not noupdatecheck , debug_console )
@@ -82,7 +81,7 @@ def _parse_args(args):
8281 return False , False , None
8382 noupdatecheck = '--noupdatecheck' in args
8483 debug_console = '--debugconsole' in args
85- inpath = args [- 1 ] if args [- 1 ] not in ['--noupdatecheck' , '--debugconsole' ] \
84+ inpath = args [- 1 ] if args [- 1 ] not in ['--noupdatecheck' , '--debugconsole' ]\
8685 else None
8786 return noupdatecheck , debug_console , inpath
8887
@@ -107,19 +106,17 @@ def _show_old_wxpython_warning_if_needed(parent=None):
107106 if wx .VERSION >= (2 , 8 , 12 , 1 ):
108107 return
109108 title = 'Please upgrade your wxPython installation'
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 )
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 ))
117115 style = wx .ICON_EXCLAMATION
118116 if not parent :
119- _ = wx .PySimpleApp ()
120- parent = wx .Frame (None , size = (0 ,0 ))
117+ _ = wx .App ()
118+ parent = wx .Frame (None , size = (0 , 0 ))
121119 wx .MessageDialog (parent , message , title , style ).ShowModal ()
122120
123-
124121if __name__ == '__main__' :
125122 main (sys .argv [1 :])
0 commit comments