def OnGlobPatternText(self, event): pattern = self.glob_pattern.GetValue() if pattern: self.target.glob_pattern = pattern self.target.internal_update() for child in self.target.children: child.propagate_down(UpdateEvent(None))
def listbox_select(self, event): particle_space = self.target.parent.request_data( ParticleSpaceSpec, **self.target.kwargs_cache) if particle_space is not None: idx = event.GetInt() sid = self.listbox.GetString(idx) if self.listbox.IsChecked(idx): if sid in self.target.ignore_list: self.target.ignore_list.remove(sid) else: if sid not in self.target.ignore_list: self.target.ignore_list.append(sid) self.target.internal_update() for child in self.target.children: child.propagate_down(UpdateEvent(None))
def max_num_entry_updated(self, event): raw_value = self.max_num_entry.GetValue().strip() if all(x in '0123456789' for x in raw_value): # convert to float and limit to 2 decimals value = int(raw_value) if value > 0: self.max_num_entry.ChangeValue(str(value)) self.target.max_num_particles = value self.target.internal_update() for child in self.target.children: child.propagate_down(UpdateEvent(None)) else: self.max_num_entry.ChangeValue( str(self.target.max_num_particles)) else: self.max_num_entry.ChangeValue(str(self.target.max_num_particles))
def view_scale_entry_updated(self, event): raw_value = self.view_scale_entry.GetValue().strip() value = 0.0 try: value = float(raw_value) except ValueError: value = 0.0 if value > 0: self.view_scale_entry.ChangeValue(str(value)) self.target.view_scale = value # self.target.internal_update() self.target.status_changed() for child in self.target.children: child.propagate_down(UpdateEvent(None)) else: self.view_scale_entry.ChangeValue(str(self.target.view_scale))
def doubleclick(self, event): dlg = wx.ColourDialog(self) dlg.GetColourData().SetChooseFull(True) if dlg.ShowModal() == wx.ID_OK: data = dlg.GetColourData() newcolor = tuple( [float(x) / 255 for x in data.GetColour().Get()]) # idx = event.GetInt() # sid = self.listbox.GetString(idx) for idx in self.listbox.GetSelections(): sid = self.listbox.GetString(idx) self.target.sid_color_map[sid] = newcolor self.target.status_changed() for child in self.target.children: child.propagate_down(UpdateEvent(None)) dlg.Destroy()
def OnImportButton(self, evt): """Called on Import... button """ dlg = wx.FileDialog( self, message="Open camera parameters ...", defaultDir=os.getcwd(), defaultFile="camera_params.json", wildcard="Json (*.json)|*.json|") ret = dlg.ShowModal() if ret==wx.ID_OK: path = dlg.GetPath() try: infile = open(path, 'r') data = json.loads(infile.read()) infile.close() camera = self.target.renderer.GetActiveCamera() camera.SetPosition(data['position']) camera.SetFocalPoint(data['focal_point']) camera.SetViewUp(data['view_up']) camera.SetParallelScale(data['parallel_scale']) self.params_from_camera() except Exception, e: debug('Import failed due to %s' %(str(e))) self.target.propagate_down(UpdateEvent(None))
def refresh_button_pressed(self, event): self.target.sid_color_map = None self.target.update_list() self.target.status_changed() for child in self.target.children: child.propagate_down(UpdateEvent(None))
def OnDatasourceChanged(self, event): """Hook on datasource change. """ debug('datasource.uri=%s' % self.datasource.uri) pevent = UpdateEvent(None) self.pipeline.propagate(pevent)
def OnCursorSpin(self, event): if self.target: self.target.index_cursor = self.cursor_spin.GetValue() self.target.propagate_down(UpdateEvent(None))