def on_selection_changed(self, selection: Gtk.TreeSelection) -> None: model, tree_iter = selection.get_selected() if tree_iter: tree_iter = model.convert_iter_to_child_iter(tree_iter) row = self.get(tree_iter, "device") dev = row["device"] self.emit("device-selected", dev, tree_iter)
def on_selection_changed(self, selection: Gtk.TreeSelection) -> None: model, tree_iter = selection.get_selected() assert tree_iter is not None name = self.list.get(tree_iter, "name")["name"] cls: Type[AppletPlugin] = self.applet.Plugins.get_classes()[name] self.plugin_name.props.label = "<b>" + name + "</b>" self.icon.props.icon_name = cls.__icon__ self.author_txt.props.label = cls.__author__ self.description.props.label = cls.__description__ if cls.__depends__: self.depends_hdr.props.visible = True self.depends_txt.props.visible = True self.depends_txt.props.label = ", ".join(cls.__depends__) else: self.depends_hdr.props.visible = False self.depends_txt.props.visible = False if cls.__conflicts__: self.conflicts_hdr.props.visible = True self.conflicts_txt.props.visible = True self.conflicts_txt.props.label = ", ".join(cls.__conflicts__) else: self.conflicts_hdr.props.visible = False self.conflicts_txt.props.visible = False if cls.is_configurable() and name in self.applet.Plugins.get_loaded(): self.b_prefs.props.sensitive = True else: self.b_prefs.props.sensitive = False self.update_config_widget(cls)
def on_tree_selection_notes_changed(self, selection: Gtk.TreeSelection) -> None: model, treeiter = selection.get_selected() if not treeiter: return self.controller.note_selected(model[treeiter][0])
def on_tree_selection_changed(selection: Gtk.TreeSelection) -> None: model, iter_ = selection.get_selected() if iter_: parent = model.iter_parent(iter_) if parent: selection.select_iter(parent)
def on_selection_changed(self, tree_selection: Gtk.TreeSelection): self.log.debug(u'Selection changed') (tree_model, iter) = tree_selection.get_selected( ) # type: NotebookTreeStore, Gtk.TreeIter if iter is not None: note_id = tree_model.get_note_id_from_iter(iter) else: note_id = None self._publish(OpenNoteCommand(note_id))
def _do_selection_changed(self, selection: Gtk.TreeSelection, *_): _, selected = selection.get_selected() # Ensure that we have a valid selection if selected is None: return selected_category = self.tree_model_filter.get_value(selected, 0) self.search_box.set_text(selected_category)
def _do_changed(self, selection: Gtk.TreeSelection, *_): _, selected = selection.get_selected() # Ensure that we have a valid selection if selected is None: return v = self.category_store.get_value(selected, 1) self._update_details_pane(v)
def on_tree_devices_selection_changed( self, selection: Gtk.TreeSelection) -> None: '''tree_devices_selection "changed" signal.''' model, treeiter = selection.get_selected() if not treeiter: return self.controller.device_selected(model[treeiter][0])
def feed_selected(self, selection: Gtk.TreeSelection) -> None: model, it = selection.get_selected() if it: feed_name = model[it][0] # Remove old info for child in self.info_scroll: child.destroy() # Display new information self.info_scroll.add(self.create_feed_info(feed_name, it)) self.info_scroll.show_all()
def on_tree_selection_changed(self, selection: Gtk.TreeSelection, *args): model, treeiter = selection.get_selected() if model is not None and treeiter is not None: idx = model[treeiter][0] self.drawer.set_selected(self._markers[int(idx)]) map_name = model[treeiter][1] if map_name != '': #TODO: Use the list from the game when available ll_by_name = self._config.script_data.level_list__by_name if self._level_id != ll_by_name[map_name].id: self._level_id = ll_by_name[map_name].id self._change_map_bg(ll_by_name[map_name].id, self.builder.get_object('draw'), self.drawer)
def on_tree_props_selection_changed( self, selection: Gtk.TreeSelection) -> None: '''tree_props_selection "changed" signal.''' model, treeiter = selection.get_selected() if not treeiter: return self.controller.prop_selected( model[treeiter][0], model[treeiter][1], model[treeiter][2], )
def on_profile_selected(self, tree_selection: Gtk.TreeSelection) -> None: list_store, tree_iter = tree_selection.get_selected() if self._driver_list: device_type = self._get_current_device_type() if device_type == X52DeviceType.X52_PRO: profile_class = X52ProProfile elif device_type == X52DeviceType.X52: profile_class = X52Profile else: raise ValueError(f"Unsupported device type {device_type.name}") profile = None if tree_iter is None else profile_class.get_or_none( id=list_store.get_value(tree_iter, 0)) if profile is not None: self._profile_selected = profile self._update_mfd_profile_name(profile.name, True) self.main_view.refresh_profile_data(self._profile_selected)
def on_select(self, treeviewselection: Gtk.TreeSelection): model, it = treeviewselection.get_selected() if it is None: return # mark the change. self.mark_change() path = [] # not a TreePath, just a list of node names in the config hierarchy. parent = it while parent is not None: path.append(parent) parent = model.iter_parent(parent) self._selectionpath = [model[i][0] for i in reversed(path)] self._selectioniter = it # get the config value for the currently selected node. val = self.instrument.config for name in self._selectionpath: val = val[name] self._updating_edit_field = True try: self.builder.get_object("path_label").set_text("::".join(["ROOT"] + self._selectionpath[:-1])) self.builder.get_object("name_label").set_text(model[it][0]) self.builder.get_object("type_label").set_text(val.__class__.__name__) if isinstance(val, str): self.builder.get_object("entry_stack").set_visible_child_name("str") self.builder.get_object("str_entry").set_text(val) elif isinstance(val, int): self.builder.get_object("entry_stack").set_visible_child_name("int") self.builder.get_object("int_entry_adjustment").set_value(val) elif isinstance(val, float): self.builder.get_object("entry_stack").set_visible_child_name("float") self.builder.get_object("float_entry_adjustment").set_value(val) elif isinstance(val, bool): self.builder.get_object("entry_stack").set_visible_child_name("bool") self.builder.get_object("bool_entry").set_active(val) elif isinstance(val, dict): self.builder.get_object("entry_stack").set_visible_child_name("dict") else: self.builder.get_object("entry_stack").set_visible_child_name("notimplemented") self.builder.get_object("other_display").set_text(str(val)) finally: self._updating_edit_field = False
def on_step_selected(self, tree_selection: Gtk.TreeSelection) -> None: LOG.debug("selected") list_store, tree_iter = tree_selection.get_selected() step = None if tree_iter is None else SpeedStep.get_or_none( id=list_store.get_value(tree_iter, 0)) self.refresh_controls(step)
def on_selection_changed(self, selection: Gtk.TreeSelection) -> None: _model, tree_iter = selection.get_selected() if tree_iter: row = self.get(tree_iter, "device") dev = row["device"] self.emit("device-selected", dev, tree_iter)
def on_open_tree_selection_changed(self, selection: Gtk.TreeSelection): """Open a file selected in a tree""" model, treeiter = selection.get_selected() if treeiter is not None and model is not None: self._open_file(model[treeiter][0]) self.builder.get_object('open_menu').hide()
def on_category_tree_selection_changed(self, selection: TreeSelection): """Open a file selected in a tree""" model, treeiter = selection.get_selected() if treeiter is not None and model is not None: self._active_category = model[treeiter][1] self._filter.refilter()