def load_session(self, filename): self.loading=True if (filename != ""): db=shelve.open(filename,"r") if db: for k in db.keys(): print k, db[k] #added_plot_ids=[] sources=db["sources"] newsources=[] for s in sources: news=Source() for sitem in s.__dict__.keys(): setattr(news, sitem, s.__dict__[sitem]) newsources.append(news) self.source_list._load(newsources, True) plots=db["plots"] plots.sort() pl=[] self.close_all_plots() self.plt_combo.clear() for p in plots: print "Loading:", p.title newp=Plot(id=p.id, title=p.title, parent=self) for item in p.__dict__.keys(): setattr(newp, item, p.__dict__[item]) for i, l in enumerate(newp.lines): newl=Line() for litem in l.__dict__.keys(): setattr(newl, litem, l.__dict__[litem]) newl.plot=newp newl.source=self.get_source_with_id(l.source) newl.source.attach(newl) #newl.source.update_x_data(self.source_list[:]) #newl.source.update_y_data(self.source_list[:]) newp.lines[i]=newl newp.parent=self newp.create_window() # if p.shown: # p.window.window.move(p.window_pos[0], p.window_pos[1]) # p.window.window.resize(p.window_size[0], p.window_size[1]) self.plt_combo.append_item(self.ellipsize(p.title, 20), data=newp) self.plt_combo.select_item_by_position(0) self.update_plt_title(newp) self.plt_proxy.set_model(newp) self.lines_list.clear() self.lines_list.add_list(newp.lines) #self.lines_list.select(self.lines_list[0]) self.plot_pane.set_sensitive(True) self.line_notebook.set_sensitive(True) # keys=db.keys() # keys.remove("active_plo # self.plot_list.set_active(db["active_plot"]) self.src_id=db["source_id"] self.plt_id=db["plot_id"] #self.source_list.update() # for p in plots: # if p.shown: # p.window.show() #self.plt_combo.update() #self.update_plt_title(p) db.close() #self.plt_combo.select_item_by_position(0) p=self.plt_combo.get_selected_data() for s in self.source_list: s.toggle=(s in p.get_lines_sources()) self.source_list.refresh() self.loading=False