[kupfer] preferences: Implement show_plugin_info
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [kupfer] preferences: Implement show_plugin_info
- Date: Wed, 28 Oct 2009 21:32:14 +0000 (UTC)
commit 1335fb34c297f6012b29420e188fdc9cc42db051
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Wed Oct 28 21:42:58 2009 +0100
preferences: Implement show_plugin_info
Add functionality to open preferences window focusing the information
for a specific plugin.
data/preferences.ui | 2 +-
kupfer/preferences.py | 24 ++++++++++++++++++++++++
2 files changed, 25 insertions(+), 1 deletions(-)
---
diff --git a/data/preferences.ui b/data/preferences.ui
index d688c4a..a53d382 100644
--- a/data/preferences.ui
+++ b/data/preferences.ui
@@ -19,7 +19,7 @@
<property name="orientation">vertical</property>
<property name="spacing">10</property>
<child>
- <object class="GtkNotebook" id="notebook1">
+ <object class="GtkNotebook" id="preferences_notebook">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
diff --git a/kupfer/preferences.py b/kupfer/preferences.py
index 604083c..65a9c10 100644
--- a/kupfer/preferences.py
+++ b/kupfer/preferences.py
@@ -37,6 +37,7 @@ class PreferencesWindowController (pretty.OutputMixin):
self.pluglist_parent = builder.get_object("plugin_list_parent")
self.dirlist_parent = builder.get_object("directory_list_parent")
self.plugin_about_parent = builder.get_object("plugin_about_parent")
+ self.preferences_notebook = builder.get_object("preferences_notebook")
self.entrykeybinding = builder.get_object("entrykeybinding")
self.buttonkeybinding = builder.get_object("buttonkeybinding")
@@ -249,6 +250,18 @@ class PreferencesWindowController (pretty.OutputMixin):
plugin_id = self.store.get_value(it, id_col)
return plugin_id
+ def _table_path_for_id(self, id_):
+ """
+ Find the tree path of plugin @id_
+ """
+ id_col = self.columns.index("plugin_id")
+ for row in self.store:
+ plugin_id = row[id_col]
+ if plugin_id == id_:
+ return row.path
+ raise ValueError("No such plugin %s" % id_)
+
+
def _plugin_info_for_id(self, plugin_id):
for info in self.plugin_info:
if info["name"] == plugin_id:
@@ -489,6 +502,17 @@ class PreferencesWindowController (pretty.OutputMixin):
def show(self):
self.window.present()
+ def show_focus_plugin(self, plugin_id):
+ """
+ Open and show information about plugin @plugin_id
+ """
+ table_path = self._table_path_for_id(plugin_id)
+ self.table.set_cursor(table_path)
+ self.table.scroll_to_cell(table_path)
+ # FIXME: Revisit if we add new pages to the GtkNotebook
+ self.preferences_notebook.next_page()
+ self.window.present()
+
def hide(self):
self.window.hide()
def _close_window(self, *ignored):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]