BeremizIDE.py
changeset 1780 c52d1460cea8
parent 1769 4665ba25a0ba
child 1781 b112bfdde5cc
equal deleted inserted replaced
1779:6cf16e5bfbf9 1780:c52d1460cea8
   170             self.lock.release()
   170             self.lock.release()
   171             self.output.Thaw()
   171             self.output.Thaw()
   172             self.LastRefreshTime = gettime()
   172             self.LastRefreshTime = gettime()
   173             try:
   173             try:
   174                 self.RefreshLock.release()
   174                 self.RefreshLock.release()
   175             except:
   175             except Exception:
   176                 pass
   176                 pass
   177             newtime = time.time()
   177             newtime = time.time()
   178             if newtime - self.rising_timer > 1:
   178             if newtime - self.rising_timer > 1:
   179                 self.risecall(self.output)
   179                 self.risecall(self.output)
   180             self.rising_timer = newtime
   180             self.rising_timer = newtime
   674 
   674 
   675     def RefreshRecentProjectsMenu(self):
   675     def RefreshRecentProjectsMenu(self):
   676         try:
   676         try:
   677             recent_projects = map(DecodeFileSystemPath,
   677             recent_projects = map(DecodeFileSystemPath,
   678                                   self.GetConfigEntry("RecentProjects", []))
   678                                   self.GetConfigEntry("RecentProjects", []))
   679         except:
   679         except Exception:
   680             recent_projects = []
   680             recent_projects = []
   681 
   681 
   682         while self.RecentProjectsMenu.GetMenuItemCount() > len(recent_projects):
   682         while self.RecentProjectsMenu.GetMenuItemCount() > len(recent_projects):
   683             item = self.RecentProjectsMenu.FindItemByPosition(0)
   683             item = self.RecentProjectsMenu.FindItemByPosition(0)
   684             self.RecentProjectsMenu.RemoveItem(item)
   684             self.RecentProjectsMenu.RemoveItem(item)
   824 
   824 
   825     def RefreshConfigRecentProjects(self, projectpath, err=False):
   825     def RefreshConfigRecentProjects(self, projectpath, err=False):
   826         try:
   826         try:
   827             recent_projects = map(DecodeFileSystemPath,
   827             recent_projects = map(DecodeFileSystemPath,
   828                                   self.GetConfigEntry("RecentProjects", []))
   828                                   self.GetConfigEntry("RecentProjects", []))
   829         except:
   829         except Exception:
   830             recent_projects = []
   830             recent_projects = []
   831         if projectpath in recent_projects:
   831         if projectpath in recent_projects:
   832             recent_projects.remove(projectpath)
   832             recent_projects.remove(projectpath)
   833         if not err:
   833         if not err:
   834             recent_projects.insert(0, projectpath)
   834             recent_projects.insert(0, projectpath)
   844         if self.CTR is not None and not self.CheckSaveBeforeClosing():
   844         if self.CTR is not None and not self.CheckSaveBeforeClosing():
   845             return
   845             return
   846 
   846 
   847         try:
   847         try:
   848             defaultpath = DecodeFileSystemPath(self.Config.Read("lastopenedfolder"))
   848             defaultpath = DecodeFileSystemPath(self.Config.Read("lastopenedfolder"))
   849         except:
   849         except Exception:
   850             defaultpath = os.path.expanduser("~")
   850             defaultpath = os.path.expanduser("~")
   851 
   851 
   852         dialog = wx.DirDialog(self, _("Choose an empty directory for new project"), defaultpath)
   852         dialog = wx.DirDialog(self, _("Choose an empty directory for new project"), defaultpath)
   853         if dialog.ShowModal() == wx.ID_OK:
   853         if dialog.ShowModal() == wx.ID_OK:
   854             projectpath = dialog.GetPath()
   854             projectpath = dialog.GetPath()
   880         if self.CTR is not None and not self.CheckSaveBeforeClosing():
   880         if self.CTR is not None and not self.CheckSaveBeforeClosing():
   881             return
   881             return
   882 
   882 
   883         try:
   883         try:
   884             defaultpath = DecodeFileSystemPath(self.Config.Read("lastopenedfolder"))
   884             defaultpath = DecodeFileSystemPath(self.Config.Read("lastopenedfolder"))
   885         except:
   885         except Exception:
   886             defaultpath = os.path.expanduser("~")
   886             defaultpath = os.path.expanduser("~")
   887 
   887 
   888         dialog = wx.DirDialog(self, _("Choose a project"), defaultpath,
   888         dialog = wx.DirDialog(self, _("Choose a project"), defaultpath,
   889                               style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
   889                               style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
   890         if dialog.ShowModal() == wx.ID_OK:
   890         if dialog.ShowModal() == wx.ID_OK:
  1173             exception_locals = last_tb.tb_frame.f_locals  # the locals at the level of the stack trace where the exception actually occurred
  1173             exception_locals = last_tb.tb_frame.f_locals  # the locals at the level of the stack trace where the exception actually occurred
  1174             info['locals'] = format_namespace(exception_locals)
  1174             info['locals'] = format_namespace(exception_locals)
  1175             if 'self' in exception_locals:
  1175             if 'self' in exception_locals:
  1176                 try:
  1176                 try:
  1177                     info['self'] = format_namespace(exception_locals['self'].__dict__)
  1177                     info['self'] = format_namespace(exception_locals['self'].__dict__)
  1178                 except:
  1178                 except Exception:
  1179                     pass
  1179                     pass
  1180         if not os.path.exists(path):
  1180         if not os.path.exists(path):
  1181             os.mkdir(path)
  1181             os.mkdir(path)
  1182         output = open(bug_report_path, 'w')
  1182         output = open(bug_report_path, 'w')
  1183         lst = info.keys()
  1183         lst = info.keys()
  1208         def run_with_except_hook(*args, **kw):
  1208         def run_with_except_hook(*args, **kw):
  1209             try:
  1209             try:
  1210                 run_old(*args, **kw)
  1210                 run_old(*args, **kw)
  1211             except (KeyboardInterrupt, SystemExit):
  1211             except (KeyboardInterrupt, SystemExit):
  1212                 raise
  1212                 raise
  1213             except:
  1213             except Exception:
  1214                 sys.excepthook(*sys.exc_info())
  1214                 sys.excepthook(*sys.exc_info())
  1215         self.run = run_with_except_hook
  1215         self.run = run_with_except_hook
  1216     threading.Thread.__init__ = init
  1216     threading.Thread.__init__ = init