[kupfer: 10/12] +obj.special: PleaseConfigureLeaf, InvalidCredentialsLeaf



commit 12f0b38ae3bd417ad3b12fa058ea2bad2ca847d9
Author: Karol BÄ?dkowski <karol bedkowsk+gh gmail com>
Date:   Wed Feb 3 21:33:05 2010 +0100

    +obj.special: PleaseConfigureLeaf, InvalidCredentialsLeaf
    
    This leaves can be returned by plugin when proper configuration is missing.
    User can quickly open by them settings window with selected plugin.

 kupfer/obj/special.py |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/kupfer/obj/special.py b/kupfer/obj/special.py
new file mode 100644
index 0000000..04d13c7
--- /dev/null
+++ b/kupfer/obj/special.py
@@ -0,0 +1,30 @@
+__version__ = '2010-01-21'
+
+
+from kupfer.obj.objects import RunnableLeaf
+from kupfer import kupferui
+
+
+class PleaseConfigureLeaf(RunnableLeaf):
+	""" Show information and allow to open preferences for given plugin """
+	message = _("Please Configure Plugin")
+	description = _("Plugin %s is not configured")
+
+	def __init__(self, plugin_id, plugin_name):
+		RunnableLeaf.__init__(self, plugin_id, self.message)
+		self.plugin_name = plugin_name
+
+	def run(self):
+		kupferui.show_plugin_info(self.object)
+
+	def get_icon_name(self):
+		return 'gtk-preferences'
+
+	def get_description(self):
+		return self.description % self.plugin_name
+
+
+class InvalidCredentialsLeaf(PleaseConfigureLeaf):
+	description = _("Invalid user credentials for %s")
+
+



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