From: Christian Weiske Date: Mon, 14 Nov 2011 16:11:52 +0000 (+0100) Subject: basic settings work now X-Git-Tag: v0.3~48 X-Git-Url: https://git.cweiske.de/enigma2-curlytx.git/commitdiff_plain/51b645f28c1b9f5e955db225c28b864370755d70 basic settings work now --- diff --git a/src/CurlyTx.py b/src/CurlyTx.py index d4f2146..d85143b 100644 --- a/src/CurlyTx.py +++ b/src/CurlyTx.py @@ -32,7 +32,7 @@ class CurlyTx(Screen): self["text"] = ScrollLabel("foo") - self["key_red"] = StaticText(_("Close")) + self["key_red"] = StaticText(_("Settings")) self["key_green"] = StaticText(_("Reload")) self["key_yellow"] = StaticText(_("Prev")) self["key_blue"] = StaticText(_("Next")) @@ -44,7 +44,7 @@ class CurlyTx(Screen): "up": self.pageUp, "down": self.pageDown, - "red": self.close, + "red": self.showSettings, "green": self.reload }, -1) @@ -80,3 +80,11 @@ class CurlyTx(Screen): "Error fetching URL:\n " + error.getErrorMessage() + "\n\nURL: " + url ) + + def showSettings(self): + #self.session.openWithCallback(self.setConf ,Pic_Setup) + from CurlyTxSettings import CurlyTxSettings + self.session.openWithCallback(self.onSettingsChanged, CurlyTxSettings) + + def onSettingsChanged(self): + "fixme" diff --git a/src/CurlyTxSettings.py b/src/CurlyTxSettings.py new file mode 100644 index 0000000..04277e4 --- /dev/null +++ b/src/CurlyTxSettings.py @@ -0,0 +1,51 @@ +from Screens.Screen import Screen +from Components.ActionMap import ActionMap, NumberActionMap +from Components.Sources.StaticText import StaticText + +from . import config +from Components.config import config, getConfigListEntry +from Components.ConfigList import ConfigList, ConfigListScreen + +class CurlyTxSettings(Screen, ConfigListScreen): + + def __init__(self, session): + Screen.__init__(self, session) + self.skinName = [ "CurlyTxSettings", "Setup" ] + self.setup_title = _("Settings") + + self["actions"] = ActionMap(["SetupActions"], + { + "cancel": self.keyCancel, + "save": self.keySave, + "ok": self.keySave + #fixme: open page editor + }, -2) + + self["key_red"] = StaticText(_("Cancel")) + self["key_green"] = StaticText(_("OK")) + + self.onChangedEntry = [ ] + ConfigListScreen.__init__(self, self.getConfigList(), session = self.session, on_change = self.changedEntry) + + def getConfigList(self): + list = [] + list.append(getConfigListEntry(_("Show in main menu"), config.plugins.CurlyTx.menuMain)) + list.append(getConfigListEntry(_("Menu title"), config.plugins.CurlyTx.menuTitle)) + # fixme: automatically set that + list.append(getConfigListEntry(_("Number of pages"), config.plugins.CurlyTx.pageCount)) + # fixme: other way? + #list.append(getConfigListEntry(_("Pages"), config.plugins.CurlyTx.pages)) + return list + + def changedEntry(self): + # fixme: needed? + for x in self.onChangedEntry: + x() + + def keyLeft(self): + ConfigListScreen.keyLeft(self) + + def keyRight(self): + ConfigListScreen.keyRight(self) + +