def init_controls(self): self.controls = wx.Panel(self) csizer = wx.BoxSizer(wx.VERTICAL) dtypes = self.data.keys() dtypes.sort() fst = True add = paply(csizer.Add, border=5, flag=wx.ALL) add_cb = paply(csizer.Add, border=5, flag=wx.LEFT | wx.RIGHT) btn = wx.Button(self.controls, -1, label="Close file") add(btn) self.Bind(wx.EVT_BUTTON, self.parent.on_cancel, btn) label = wx.StaticText(self.controls, label="Bands:") add(label) for dtype in dtypes: if dtype[0] != "_": cbox = wx.CheckBox(self.controls, label=dtype) if fst: fst = False self.first_dtype = dtype cbox.SetValue(True) add_cb(cbox) self.Bind(wx.EVT_CHECKBOX, paply(self.on_band, dtype), cbox) btn = wx.Button(self.controls, -1, label="Re-scale") add(btn) self.Bind(wx.EVT_BUTTON, self.rescale, btn) auto = wx.CheckBox(self.controls, label="Autoscale") add_cb(auto) self.Bind(wx.EVT_CHECKBOX, self.on_autoscale, auto) live_label = wx.StaticText(self.controls, label="Live mode:") choices = ["Update", "Follow", "Scale x"] live_mode = wx.Choice(self.controls, -1, choices=choices) self.controls.live_mode = live_mode add(live_label) add(live_mode) self.controls.SetSizer(csizer)
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)