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 to run RIDE.
36- wxPython can be downloaded from http://sourceforge.net/projects/wxpython/files/wxPython/""" )
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/""" )
3738supported_versions = ["2.8" , "3.0" ]
3839
3940try :
4243 wxversion .select (supported_versions )
4344 import wx
4445except ImportError as e :
45- if "no appropriate 64-bit architecture" in e . message .lower () and \
46+ if "no appropriate 64-bit architecture" in "{0}" . format ( e ) .lower () and \
4647 sys .platform == 'darwin' :
47- 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." )
4849 else :
49- print errorMessageTemplate .substitute (reason = "wxPython not found." )
50+ print ( errorMessageTemplate .substitute (reason = "wxPython not found." ) )
5051 sys .exit (1 )
5152except VersionError :
52- print errorMessageTemplate .substitute (reason = "Wrong wxPython version." )
53+ print ( errorMessageTemplate .substitute (reason = "Wrong wxPython version." ) )
5354 sys .exit (1 )
5455
5556if "ansi" in wx .PlatformInfo :
56- print errorMessageTemplate .substitute (
57- reason = "wxPython with ansi encoding is not supported" )
57+ print ( errorMessageTemplate .substitute (reason = "wxPython with ansi encoding \
58+ is not supported") )
5859 sys .exit (1 )
5960
6061
6566def main (* args ):
6667 noupdatecheck , debug_console , inpath = _parse_args (args )
6768 if len (args ) > 3 or '--help' in args :
68- print __doc__
69+ print ( __doc__ )
6970 sys .exit ()
7071 try :
7172 _run (inpath , not noupdatecheck , debug_console )
@@ -80,7 +81,7 @@ def _parse_args(args):
8081 return False , False , None
8182 noupdatecheck = '--noupdatecheck' in args
8283 debug_console = '--debugconsole' in args
83- inpath = args [- 1 ] if args [- 1 ] not in ['--noupdatecheck' , '--debugconsole' ] \
84+ inpath = args [- 1 ] if args [- 1 ] not in ['--noupdatecheck' , '--debugconsole' ]\
8485 else None
8586 return noupdatecheck , debug_console , inpath
8687
@@ -105,19 +106,17 @@ def _show_old_wxpython_warning_if_needed(parent=None):
105106 if wx .VERSION >= (2 , 8 , 12 , 1 ):
106107 return
107108 title = 'Please upgrade your wxPython installation'
108- message = ('RIDE officially supports wxPython 2.8.12.1, 3.0.2 and newer releases in 3.0 series. '
109- 'Your current version is %s.\n \n '
110- 'Older wxPython versions are known to miss some features used by RIDE. '
111- 'Notice also that wxPython 3.0 is not yet supported.\n \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/.'
114- % 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 ))
115115 style = wx .ICON_EXCLAMATION
116116 if not parent :
117- _ = wx .PyApp ()
118- parent = wx .Frame (None , size = (0 ,0 ))
117+ _ = wx .App ()
118+ parent = wx .Frame (None , size = (0 , 0 ))
119119 wx .MessageDialog (parent , message , title , style ).ShowModal ()
120120
121-
122121if __name__ == '__main__' :
123122 main (sys .argv [1 :])
0 commit comments