From ea1e130bea2892a636e80fe0ef6df44324eaabd9 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Fri, 11 Nov 2011 17:17:21 +0100 Subject: [PATCH] plugin shows popup --- src/CurlyTx.py | 36 ++++++++++++++++++++++++++++++++++++ src/__init__.py | 0 src/plugin.py | 28 ++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 src/CurlyTx.py create mode 100644 src/__init__.py create mode 100644 src/plugin.py diff --git a/src/CurlyTx.py b/src/CurlyTx.py new file mode 100644 index 0000000..8043695 --- /dev/null +++ b/src/CurlyTx.py @@ -0,0 +1,36 @@ +from Screens.Screen import Screen +from Screens.MessageBox import MessageBox +from Components.Label import Label +from Components.Sources.StaticText import StaticText +from Components.ActionMap import NumberActionMap + +class CurlyTx(Screen): + skin = """ + + + """ + + def __init__(self, session, args = None): + self.skin = CurlyTx.skin + Screen.__init__(self, session) + + self["text"] = StaticText("foo") + #sample = file(test).read() + #import urllib + ##req = urllib2.Request(url) + # r = urllib2.urlopen(req) + # f.write(r.read()) + # webFile.close() + #self.session.openWithCallback(self.mycallback, MessageBox, _("Test-Messagebox?")) + + self["actions"] = NumberActionMap(["WizardActions", "InputActions"], { + "ok": self.close, + "back": self.close + }, -1) + + + def mycallback(self, answer): + print "answer:", answer + if answer: + raise Exception("test-crash") + self.close() diff --git a/src/__init__.py b/src/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/plugin.py b/src/plugin.py new file mode 100644 index 0000000..dd0f5cf --- /dev/null +++ b/src/plugin.py @@ -0,0 +1,28 @@ +from Plugins.Plugin import PluginDescriptor +import CurlyTx + +def main(session, **kwargs): + reload(CurlyTx) + try: + session.open(CurlyTx.CurlyTx) + except: + import traceback + traceback.print_exc() + +def menuHook(menuid): + if menuid == "mainmenu": + return [(_("CurlyTx"), main, "curlytx", 1)] + return [ ] + + +def Plugins(**kwargs): + return [ + PluginDescriptor(name = "CurlyTx", + description = "View remote text files", + where = [PluginDescriptor.WHERE_PLUGINMENU], + fnc = main), + PluginDescriptor(name = "CurlyTx", + description = "View remote text files", + where=PluginDescriptor.WHERE_MENU, + fnc = menuHook), + ] -- 2.30.2