[kupfer] kupferui: Add functions to show preferences window



commit ec1b1a3e76272aff2f43afd6c2e3ef7ff6f603db
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Tue Dec 8 14:00:36 2009 +0100

    kupferui: Add functions to show preferences window

 kupfer/kupferui.py              |   10 ++++++++++
 kupfer/plugin/core.py           |    4 +---
 kupfer/plugin/kupfer_plugins.py |    5 ++---
 3 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/kupfer/kupferui.py b/kupfer/kupferui.py
index 7f4b2e5..cc391d7 100644
--- a/kupfer/kupferui.py
+++ b/kupfer/kupferui.py
@@ -46,3 +46,13 @@ def show_about_dialog(*ignored, **kwds):
 def _response_callback(dialog, response_id):
 	dialog.hide()
 
+
+def show_preferences():
+	from kupfer import preferences
+	win = preferences.GetPreferencesWindowController()
+	win.show()
+
+def show_plugin_info(plugin_id):
+	from kupfer import preferences
+	prefs = preferences.GetPreferencesWindowController()
+	prefs.show_focus_plugin(plugin_id)
diff --git a/kupfer/plugin/core.py b/kupfer/plugin/core.py
index 2330011..44ce1f7 100644
--- a/kupfer/plugin/core.py
+++ b/kupfer/plugin/core.py
@@ -221,9 +221,7 @@ class Preferences (RunnableLeaf):
 		if not name: name = _("Kupfer Preferences")
 		super(Preferences, self).__init__(name=name)
 	def run(self):
-		from kupfer import preferences
-		win = preferences.GetPreferencesWindowController()
-		win.show()
+		kupferui.show_preferences()
 	def get_description(self):
 		return _("Show preferences window for Kupfer")
 	def get_icon_name(self):
diff --git a/kupfer/plugin/kupfer_plugins.py b/kupfer/plugin/kupfer_plugins.py
index 2627558..6b00b80 100644
--- a/kupfer/plugin/kupfer_plugins.py
+++ b/kupfer/plugin/kupfer_plugins.py
@@ -2,6 +2,7 @@ import os
 
 from kupfer.objects import Action, Source, Leaf, FileLeaf, TextLeaf
 from kupfer import icons, plugin_support
+from kupfer import kupferui
 
 # Since this is a core plugin we break some rules
 # This module is normally out of bounds for plugins
@@ -21,10 +22,8 @@ class ShowInfo (Action):
 	def __init__(self):
 		Action.__init__(self, _("Show Information"))
 	def activate(self, leaf):
-		from kupfer import preferences
-		prefs = preferences.GetPreferencesWindowController()
 		plugin_id = leaf.object["name"]
-		prefs.show_focus_plugin(plugin_id)
+		kupferui.show_plugin_info(plugin_id)
 
 	def get_description(self):
 		pass



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]