def load_project(self, path): project_view = self.frame.project_view self.project = project.Project.load(path) menu.manager.publish(menu.PROJECT_OPEN) project_view.set_project(self.project) settings.session_set('project_filename', path) evt = AppEvent(EVT_APP_PROJECT_OPENED, self, data=self.project) wx.PostEvent(self, evt)
def unload_project(self): if self.project: self.project = None menu.manager.publish(menu.PROJECT_CLOSE) self.frame.project_view.set_project(None) settings.session_set('project_filename', '') self.detach() evt = AppEvent(EVT_APP_PROJECT_CLOSED, self) wx.PostEvent(self, evt)
def save_session(self): if self.project: settings.session_set('project_filename', self.project.filename) settings.session_set('open_files', self.frame.editor_view.open_files) settings.session_set('project_view_state', self.frame.project_view.save_state()) if self.frame.editor_maximized: settings.session_set('perspective', self.frame.saved_perspective) else: settings.session_set('perspective', self.frame.manager.SavePerspective()) settings.save_session()
def on_persist(self, evt): maximized = self.IsMaximized() x,y = self.GetPosition() width,height = self.GetSize() print (maximized, x, y, width, height) import settings if not self.IsIconized(): try: settings.session_set(str(self.__class__), (maximized, x, y, width, height)) settings.save_session() except Exception, e: print "Couldn't persist window: %s" % e finally:
def on_persist(self, evt): maximized = self.IsMaximized() x, y = self.GetPosition() width, height = self.GetSize() print(maximized, x, y, width, height) import settings if not self.IsIconized(): try: settings.session_set(str(self.__class__), (maximized, x, y, width, height)) settings.save_session() except Exception, e: print "Couldn't persist window: %s" % e finally: