[kupfer: 29/51] show_qrcode: Port to wants_context



commit e1c98e752e94a3b7e3e0ec095a5a81c1cc42257f
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Mon Mar 28 16:51:46 2011 +0200

    show_qrcode: Port to wants_context

 kupfer/plugin/show_qrcode.py |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/kupfer/plugin/show_qrcode.py b/kupfer/plugin/show_qrcode.py
index b736c23..5efec05 100644
--- a/kupfer/plugin/show_qrcode.py
+++ b/kupfer/plugin/show_qrcode.py
@@ -24,7 +24,10 @@ class ShowQRCode (Action):
 		"""initialize action"""
 		Action.__init__(self, _("Show QRCode"))
 
-	def activate(self, leaf):
+	def wants_context(self):
+		return True
+
+	def activate(self, leaf, ctx):
 		"""Create the image from leaf text and display it on window"""
 
 		image_file = StringIO.StringIO()
@@ -44,7 +47,7 @@ class ShowQRCode (Action):
 		image.set_from_pixbuf(pixbuf)
 		image.show()
 		window.add(image)
-		window.show()
+		ctx.environment.present_window(window)
 
 	def item_types(self):
 		yield Leaf



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