# HG changeset patch # User K. Arvanitis kosta@alumni.uvic.ca # Date 1420971975 28800 # Sun Jan 11 02:26:15 2015 -0800 # Node ID 1d2e64219e8e0f40240ae223fbffa87e5f3b53df # Parent 5c8cf7aa6ab3d12598a3eaabf69ffdc074c4bcd2 [PATCH] UI Change to Settings Edit Window
This simple change removes the uncessary padding of the treeview; as well as connecting the "changed" event to the treeview.
By listening to the gtk event we are able to handle selection changes of the treeview which supports all input types and not only the left mouse click.
Bug #2179
diff -r 5c8cf7aa6ab3 -r 1d2e64219e8e chirpui/settingsedit.py --- a/chirpui/settingsedit.py Sat Jan 10 15:44:20 2015 -0800 +++ b/chirpui/settingsedit.py Sun Jan 11 02:26:15 2015 -0800 @@ -28,12 +28,12 @@ def __init__(self, rthread): super(SettingsEditor, self).__init__(rthread) self._changed = False - self.root = gtk.HBox(False, 10) + self.root = gtk.HBox(False, 0) self._store = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_PYOBJECT) self._view = gtk.TreeView(self._store) self._view.set_size_request(150, -1) - self._view.connect("button-press-event", self._group_selected) + self._view.get_selection().connect("changed", self._view_changed_cb) self._view.show() self.root.pack_start(self._view, 0, 0, 0)
@@ -222,15 +222,9 @@ def _build_ui(self, group): gobject.idle_add(self._build_ui_real, group)
- def _group_selected(self, view, event): - if event.button != 1: - return + def _view_changed_cb(self, selection): + (lst, iter) = selection.get_selected() + group, = self._store.get(iter, 1)
- try: - path, col, x, y = view.get_path_at_pos(int(event.x), int(event.y)) - except TypeError: - return # Didn't click on an actual item - - group, = self._store.get(self._store.get_iter(path), 1) if group: self._build_ui_group(group)