BeremizIDE.py
changeset 1736 7e61baa047f0
parent 1734 750eeb7230a1
child 1737 a39c2918c015
equal deleted inserted replaced
1735:c02818d7e29f 1736:7e61baa047f0
    35 import util.paths as paths
    35 import util.paths as paths
    36 from types import ListType
    36 from types import ListType
    37 
    37 
    38 beremiz_dir = paths.AbsDir(__file__)
    38 beremiz_dir = paths.AbsDir(__file__)
    39 
    39 
       
    40 
    40 def Bpath(*args):
    41 def Bpath(*args):
    41     return os.path.join(beremiz_dir,*args)
    42     return os.path.join(beremiz_dir,*args)
    42 
    43 
    43 
    44 
    44 
    45 
    86 
    87 
    87 from threading import Lock,Timer,currentThread
    88 from threading import Lock,Timer,currentThread
    88 MainThread = currentThread().ident
    89 MainThread = currentThread().ident
    89 REFRESH_PERIOD = 0.1
    90 REFRESH_PERIOD = 0.1
    90 from time import time as gettime
    91 from time import time as gettime
       
    92 
       
    93 
    91 class LogPseudoFile:
    94 class LogPseudoFile:
    92     """ Base class for file like objects to facilitate StdOut for the Shell."""
    95     """ Base class for file like objects to facilitate StdOut for the Shell."""
    93     def __init__(self, output, risecall):
    96     def __init__(self, output, risecall):
    94         self.red_white = 1
    97         self.red_white = 1
    95         self.red_yellow = 2
    98         self.red_yellow = 2
   210                      SCALING,\
   213                      SCALING,\
   211                      PAGETITLES,\
   214                      PAGETITLES,\
   212                      IDEFrame, AppendMenu,\
   215                      IDEFrame, AppendMenu,\
   213                      EncodeFileSystemPath, DecodeFileSystemPath
   216                      EncodeFileSystemPath, DecodeFileSystemPath
   214 from util.BitmapLibrary import GetBitmap
   217 from util.BitmapLibrary import GetBitmap
       
   218 
   215 
   219 
   216 class Beremiz(IDEFrame):
   220 class Beremiz(IDEFrame):
   217 
   221 
   218     def _init_utils(self):
   222     def _init_utils(self):
   219         self.ConfNodeMenu = wx.Menu(title='')
   223         self.ConfNodeMenu = wx.Menu(title='')
  1084 import threading
  1088 import threading
  1085 import traceback
  1089 import traceback
  1086 
  1090 
  1087 Max_Traceback_List_Size = 20
  1091 Max_Traceback_List_Size = 20
  1088 
  1092 
       
  1093 
  1089 def Display_Exception_Dialog(e_type, e_value, e_tb, bug_report_path):
  1094 def Display_Exception_Dialog(e_type, e_value, e_tb, bug_report_path):
  1090     trcbck_lst = []
  1095     trcbck_lst = []
  1091     for i,line in enumerate(traceback.extract_tb(e_tb)):
  1096     for i,line in enumerate(traceback.extract_tb(e_tb)):
  1092         trcbck = " " + str(i+1) + ". "
  1097         trcbck = " " + str(i+1) + ". "
  1093         if line[0].find(os.getcwd()) == -1:
  1098         if line[0].find(os.getcwd()) == -1:
  1122     finally:
  1127     finally:
  1123         dlg.Destroy()
  1128         dlg.Destroy()
  1124 
  1129 
  1125     return res
  1130     return res
  1126 
  1131 
       
  1132 
  1127 def get_last_traceback(tb):
  1133 def get_last_traceback(tb):
  1128     while tb.tb_next:
  1134     while tb.tb_next:
  1129         tb = tb.tb_next
  1135         tb = tb.tb_next
  1130     return tb
  1136     return tb
  1131 
  1137 
  1133 def format_namespace(d, indent='    '):
  1139 def format_namespace(d, indent='    '):
  1134     return '\n'.join(['%s%s: %s' % (indent, k, repr(v)[:10000]) for k, v in d.iteritems()])
  1140     return '\n'.join(['%s%s: %s' % (indent, k, repr(v)[:10000]) for k, v in d.iteritems()])
  1135 
  1141 
  1136 
  1142 
  1137 ignored_exceptions = [] # a problem with a line in a module is only reported once per session
  1143 ignored_exceptions = [] # a problem with a line in a module is only reported once per session
       
  1144 
  1138 
  1145 
  1139 def AddExceptHook(path, app_version='[No version]'):#, ignored_exceptions=[]):
  1146 def AddExceptHook(path, app_version='[No version]'):#, ignored_exceptions=[]):
  1140 
  1147 
  1141     def save_bug_report(e_type, e_value, e_traceback, bug_report_path,date):
  1148     def save_bug_report(e_type, e_value, e_traceback, bug_report_path,date):
  1142         info = {
  1149         info = {