From 72c8914153b24457e73909c80a74a2ac3e05743f Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Sun, 13 Nov 2011 22:57:07 +0100 Subject: [PATCH] color buttons + reload --- src/CurlyTx.py | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/src/CurlyTx.py b/src/CurlyTx.py index 3547804..d4f2146 100644 --- a/src/CurlyTx.py +++ b/src/CurlyTx.py @@ -3,6 +3,7 @@ from Screens.MessageBox import MessageBox from Components.Label import Label from Components.ScrollLabel import ScrollLabel from Components.ActionMap import NumberActionMap +from Components.Sources.StaticText import StaticText from twisted.web import client from . import config @@ -10,21 +11,41 @@ from Components.config import config class CurlyTx(Screen): skin = """ - - + + + + + + + + + + """ + currentUrl = None + def __init__(self, session, args = None): - self.skin = CurlyTx.skin + #self.skin = CurlyTx.skin Screen.__init__(self, session) + #self.skinName = [ "CurlyTx", "Setup" ] self["text"] = ScrollLabel("foo") - self["actions"] = NumberActionMap(["WizardActions", "InputActions"], { + self["key_red"] = StaticText(_("Close")) + self["key_green"] = StaticText(_("Reload")) + self["key_yellow"] = StaticText(_("Prev")) + self["key_blue"] = StaticText(_("Next")) + + + self["actions"] = NumberActionMap(["WizardActions", "ColorActions", "InputActions"], { "ok": self.close, "back": self.close, "up": self.pageUp, - "down": self.pageDown + "down": self.pageDown, + + "red": self.close, + "green": self.reload }, -1) self.loadUrl("http://monitoring.home.cweiske.de/wetter/plain.txt") @@ -42,8 +63,12 @@ class CurlyTx(Screen): raise Exception("test-crash") self.close() + def reload(self): + self.loadUrl(self.currentUrl) + def loadUrl(self, url): self["text"].setText("Loading ...\n" + url); + self.currentUrl = url client.getPage(url).addCallback(self.urlLoaded).addErrback(self.urlFailed, url) -- 2.30.2