def save(self, filename=''): _lock.acquire() try: if not filename: filename = self.get_default_inifile() try: obj2ini.dump(self, filename, encoding='utf-8') except: try: obj2ini.dump(self, filename) except: error.traceback() finally: _lock.release()
def save(self, filename=''): _lock.acquire() try: if not filename: filename = self.get_defulat_inifile() try: obj2ini.dump(self, filename, encoding='utf-8') except: try: obj2ini.dump(self, filename) except: error.traceback() finally: _lock.release()
def OnFileSessionSave(win, event=None): dlg = wx.FileDialog(win, tr("Save To Session File"), win.pref.last_session_dir, "", 'UliPad Session File (*.ses)|*.ses', wx.SAVE|wx.OVERWRITE_PROMPT) filename = None if dlg.ShowModal() == wx.ID_OK: filename = dlg.GetPath() dlg.Destroy() if filename: try: get_recent_session_file(win, filename) sessions, last_index = gather_status() last_file = win.editctrl.getDoc(last_index).filename obj2ini.dump({'sessions':sessions, 'last_file':last_file}, filename) except: error.traceback() common.warn(tr('There was something wrong with saving the session file.'))