示例#1
0
 def load(self, filename=''):
     if not filename:
         filename = self.get_default_inifile()
     if os.path.exists(filename):
         try:
             obj2ini.load(filename, obj=self, encoding='utf-8')
         except:
             try:
                 obj2ini.load(filename, obj=self)
             except:
                 error.traceback()
示例#2
0
 def load(self, filename=''):
     if not filename:
         filename = self.get_defulat_inifile()
     if os.path.exists(filename):
         try:
             obj2ini.load(filename, obj=self, encoding='utf-8')
         except:
             try:
                 obj2ini.load(filename, obj=self)
             except:
                 error.traceback()
示例#3
0
def OnFileSessionOpen(win, event=None, filename=None):
    if not filename:
        dlg = wx.FileDialog(win, tr("Choose A Session File"), win.pref.last_session_dir, "", 'UliPad Session File (*.ses)|*.ses', wx.OPEN|wx.HIDE_READONLY)
        filename = None
        if dlg.ShowModal() == wx.ID_OK:
            filename = dlg.GetPath()
        dlg.Destroy()
    if filename:
        try:
            get_recent_session_file(win, filename)
            d = obj2ini.load(filename)
            sessions, last_file = d['sessions'], d['last_file']
            win.pref.sessions.extend(sessions)
            for v in sessions:
                win.editctrl.new(v[0], delay=True)
            for document in win.editctrl.getDocuments():
                if document.documenttype == 'texteditor' and document.filename == last_file:
                    wx.CallAfter(win.editctrl.switch, document, delay=False)
        except:
            error.traceback()
            common.warn(tr('There was something wrong with loading the session file.'))