plugin shows popup
authorChristian Weiske <cweiske@cweiske.de>
Fri, 11 Nov 2011 16:17:21 +0000 (17:17 +0100)
committerChristian Weiske <cweiske@cweiske.de>
Fri, 11 Nov 2011 16:17:21 +0000 (17:17 +0100)
src/CurlyTx.py [new file with mode: 0644]
src/__init__.py [new file with mode: 0644]
src/plugin.py [new file with mode: 0644]

diff --git a/src/CurlyTx.py b/src/CurlyTx.py
new file mode 100644 (file)
index 0000000..8043695
--- /dev/null
@@ -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 = """
+        <screen position="100,100" size="550,400" title="Test" >
+           <widget name="text" position="0,0" size="550,25" font="Regular;20" />
+        </screen>"""
+
+    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 (file)
index 0000000..e69de29
diff --git a/src/plugin.py b/src/plugin.py
new file mode 100644 (file)
index 0000000..dd0f5cf
--- /dev/null
@@ -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),
+        ]