def plot(self, data): xrc.get("load_progress", self).Hide() chart = xrc.get("chart_panel", self) if data["_times"] != []: title = data["_times"][int(len(data["_times"]) / 2)].strftime("%d %b %Y") else: title = os.path.basename(self.filepath) self.plot = PlotPanel(chart, data, title, self) sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.Add(self.plot, 1, wx.EXPAND) chart.SetSizer(sizer) self.Fit()
def configure(self, parent, filepath): self.filepath = filepath self.parent = parent # Init panel controls def bind_btn(btnid, fn): self.Bind(wx.EVT_BUTTON, fn, id=xrc.get(btnid)) bind_btn("btn_load_cancel", self.on_cancel) # Start loading thread self.thread_load = LoadThread(self, self.on_load_result, False) fn = paply(self.thread_load.default_progress_fn, wxgauge=xrc.get("progress_gauge", self)) self.thread_load.configure(filepath, fn) self.thread_load.start() self.Bind(wx.EVT_WINDOW_DESTROY, self.on_destroy)
def bind_btn(btnid, fn): self.Bind(wx.EVT_BUTTON, fn, id=xrc.get(btnid))