load an url
authorChristian Weiske <cweiske@cweiske.de>
Fri, 11 Nov 2011 16:44:11 +0000 (17:44 +0100)
committerChristian Weiske <cweiske@cweiske.de>
Fri, 11 Nov 2011 16:44:11 +0000 (17:44 +0100)
src/.gitignore [new file with mode: 0644]
src/CurlyTx.py

diff --git a/src/.gitignore b/src/.gitignore
new file mode 100644 (file)
index 0000000..0d20b64
--- /dev/null
@@ -0,0 +1 @@
+*.pyc
index 8043695..b22fd3a 100644 (file)
@@ -1,32 +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.ScrollLabel import ScrollLabel
 from Components.ActionMap import NumberActionMap
+import urllib
 
 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" />
+           <widget name="text" position="0,0" size="550,400" 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["text"] = ScrollLabel("foo")
         #self.session.openWithCallback(self.mycallback, MessageBox, _("Test-Messagebox?"))
 
         self["actions"] = NumberActionMap(["WizardActions", "InputActions"], {
                 "ok": self.close,
-                "back": self.close
-                }, -1)
+                "back": self.close,
+                "up": self.pageUp,
+                "down":        self.pageDown
+            }, -1)
+        self.loadUrl()
+
+    def pageUp(self):
+        self["text"].pageUp()
+
+    def pageDown(self):
+        self["text"].pageDown()
 
 
     def mycallback(self, answer):
@@ -34,3 +38,13 @@ class CurlyTx(Screen):
         if answer:
             raise Exception("test-crash")
         self.close()
+
+    def loadUrl(self):
+        #sample = file(test).read()
+        #import urllib
+        ##req = urllib2.Request(url)
+        r = urllib.urlopen("http://www.bogo/tagebuch/tagebuch.css")
+        self["text"].setText(r.read())
+        r.close()
+        # f.write(r.read())
+        # webFile.close()