def open_window_from_gauss(self, gauss): for model in self.modelset.get_models_with_gaussian(gauss): mw = None if model.name not in [mw.model.name for mw in self.models_windows]: mw = ModelWindow(model, self) self.models_windows.append(mw) else: for mwin in self.models_windows: if model.name == mwin.model.name: mwin.window.present() mw = mwin break if mw is not None: for i, state in enumerate(model.states): if state.has_gaussian(gauss): selection = mw.states_view.get_selection() if selection is not None: selection.select_path(i) mw.load_state(state) for j, data in enumerate(mw.gaussians_store): if data[2] == gauss.name: selection = mw.gaussians_view.get_selection() if selection is not None: selection.select_path(j)
def drawarea_button_press_event(self, eb, event): if self.modelset is not None: model = self.get_model_at(event.x, event.y) if model is None: self.models_selected = [] self.mice['drag'] = False self.selection_rectangle['x1'] = event.x self.selection_rectangle['y1'] = event.y self.selection_rectangle['x2'] = event.x self.selection_rectangle['y2'] = event.y else: if event.type == Gdk.EventType.BUTTON_PRESS and event.button == 3: self.open_menu(event, model) elif event.type == Gdk.EventType._2BUTTON_PRESS: if model.model.name not in [mw.model.name for mw in self.models_windows]: mw = ModelWindow(model, self) self.models_windows.append(mw) else: for mw in self.models_windows: if model.model.name == mw.model.name: mw.window.present() break if model not in self.models_selected: self.models_selected = [model] if model.x <= event.x <= model.x + self.MODEL_CHECK.get_width(): if model.y <= event.y <= model.y + self.MODEL_CHECK.get_height(): model.checked = not model.checked model.gaussians() for mw in self.models_windows: if model.model.name == mw.model.name: mw.fill_states_table() self.visual_win.refresh() self.mice['drag'] = True self.mice['mouse_down'] = True self.mice['x'] = event.x self.mice['y'] = event.y self.drawarea.queue_draw()