20 # |
20 # |
21 #You should have received a copy of the GNU General Public |
21 #You should have received a copy of the GNU General Public |
22 #License along with this library; if not, write to the Free Software |
22 #License along with this library; if not, write to the Free Software |
23 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
23 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
24 |
24 |
25 from wxPython.wx import * |
|
26 import wx |
25 import wx |
|
26 |
27 from time import localtime |
27 from time import localtime |
28 from datetime import datetime |
28 from datetime import datetime |
29 |
29 |
30 import os, re, platform, sys, time, traceback, getopt, commands |
30 import os, re, platform, sys, time, traceback, getopt, commands |
31 base_folder = os.path.split(sys.path[0])[0] |
31 base_folder = os.path.split(sys.path[0])[0] |
855 return '\n'.join(['%s%s: %s' % (indent, k, repr(v)[:10000]) for k, v in d.iteritems()]) |
855 return '\n'.join(['%s%s: %s' % (indent, k, repr(v)[:10000]) for k, v in d.iteritems()]) |
856 |
856 |
857 |
857 |
858 ignored_exceptions = [] # a problem with a line in a module is only reported once per session |
858 ignored_exceptions = [] # a problem with a line in a module is only reported once per session |
859 |
859 |
860 def wxAddExceptHook(path, app_version='[No version]'):#, ignored_exceptions=[]): |
860 def AddExceptHook(path, app_version='[No version]'):#, ignored_exceptions=[]): |
861 |
861 |
862 def handle_exception(e_type, e_value, e_traceback): |
862 def handle_exception(e_type, e_value, e_traceback): |
863 traceback.print_exception(e_type, e_value, e_traceback) # this is very helpful when there's an exception in the rest of this func |
863 traceback.print_exception(e_type, e_value, e_traceback) # this is very helpful when there's an exception in the rest of this func |
864 last_tb = get_last_traceback(e_traceback) |
864 last_tb = get_last_traceback(e_traceback) |
865 ex = (last_tb.tb_frame.f_code.co_filename, last_tb.tb_frame.f_lineno) |
865 ex = (last_tb.tb_frame.f_code.co_filename, last_tb.tb_frame.f_lineno) |
897 |
897 |
898 #sys.excepthook = lambda *args: wx.CallAfter(handle_exception, *args) |
898 #sys.excepthook = lambda *args: wx.CallAfter(handle_exception, *args) |
899 sys.excepthook = handle_exception |
899 sys.excepthook = handle_exception |
900 |
900 |
901 if __name__ == '__main__': |
901 if __name__ == '__main__': |
902 app = wxPySimpleApp() |
902 app = wx.PySimpleApp() |
903 wxInitAllImageHandlers() |
903 wx.InitAllImageHandlers() |
904 |
904 |
905 # Install a exception handle for bug reports |
905 # Install a exception handle for bug reports |
906 wxAddExceptHook(os.getcwd(),__version__) |
906 AddExceptHook(os.getcwd(),__version__) |
907 |
907 |
908 frame = Beremiz(None) |
908 frame = Beremiz(None) |
909 |
909 |
910 frame.Show() |
910 frame.Show() |
911 app.MainLoop() |
911 app.MainLoop() |