35 from string
import Template
37 errorMessageTemplate = Template(
"""$reason
38 RIDE depends on wx (wxPython). Historically, the last supported version was 2.8.12.1 with unicode support.\
39 At the time of this release the current wxPython version is 4.0.7.post2.\
40 You can install with 'pip install wxPython' on most operating systems, or find the \
41 the download link from https://wxPython.org/""")
45 import wx.lib.inspection
48 print(errorMessageTemplate.substitute(reason=
"wxPython not found."))
52 sys.path.append(os.path.join(os.path.dirname(__file__),
'spec'))
53 sys.path.append(os.path.join(os.path.dirname(__file__),
'lib'))
58 noupdatecheck, debug_console, inpath =
_parse_args(args)
59 if len(args) > 3
or '--help' in args:
62 if '--version' in args:
66 print(
"Error getting RIDE version!")
68 print(version.VERSION)
71 _run(inpath,
not noupdatecheck, debug_console)
74 traceback.print_exception(*sys.exc_info())
75 sys.stderr.write(
'\n\nUse --help to get usage information.\n')
80 return False,
False,
None
81 noupdatecheck =
'--noupdatecheck' in args
82 debug_console =
'--debugconsole' in args
83 inpath = args[-1]
if args[-1]
not in [
'--noupdatecheck',
84 '--debugconsole']
else None
85 return noupdatecheck, debug_console, inpath
88 def _run(inpath=None, updatecheck=True, debug_console=False):
95 ride = RIDE(inpath, updatecheck)
96 if wx.VERSION <= (4, 0, 4,
'',
''):
99 wx.CallAfter(_show_old_wxpython_warning_if_needed, ride.frame)
101 wx.lib.inspection.InspectionTool().Show()
102 debugconsole.start(ride)
109 def close(self):
pass
111 def flush(self):
pass
113 def write(self, line):
pass
115 def writelines(self, sequence):
pass
117 if sys.executable.endswith(
'pythonw.exe'):
120 if sys.stderr
is None:
121 sys.stderr = NullStream()
122 if sys.stdout
is None:
123 sys.stdout = NullStream()
127 if wx.VERSION <=(4, 0, 4,
'',
''):
128 title =
"Please upgrade your wxPython installation"
129 message = (
"RIDE needs a newer wxPython version. Your current "
132 "At the time of this release the current wxPython version is 4.0.7.post2. See "
133 "https://wxPython.org/ for downloads and instructions."
135 style = wx.ICON_EXCLAMATION
141 parent = wx.Frame(
None, size=(0, 0))
142 sys.stderr.write(
"{0}\n{1}\n".format(title, message))
143 dlg = wx.MessageDialog(parent, message=message, caption=title, style=style)
145 dlg.SetBackgroundColour(Colour(200, 222, 40))
146 dlg.SetForegroundColour(Colour(7, 0, 70))
151 if __name__ ==
'__main__':
def write(msg, level='INFO', html=False)
Writes the message to the log file using the given level.
def _run(inpath=None, updatecheck=True, debug_console=False)
def _show_old_wxpython_warning_if_needed(parent=None)
def _replace_std_for_win()