04277e422aac0e40ec3bc2ce141171c06ff2b355
[enigma2-curlytx.git] / src / CurlyTxSettings.py
1 from Screens.Screen import Screen
2 from Components.ActionMap import ActionMap, NumberActionMap
3 from Components.Sources.StaticText import StaticText
4
5 from . import config
6 from Components.config import config, getConfigListEntry
7 from Components.ConfigList import ConfigList, ConfigListScreen
8
9 class CurlyTxSettings(Screen, ConfigListScreen):
10
11     def __init__(self, session):
12         Screen.__init__(self, session)
13         self.skinName = [ "CurlyTxSettings", "Setup" ]
14         self.setup_title = _("Settings")
15
16         self["actions"] = ActionMap(["SetupActions"],
17             {
18                 "cancel": self.keyCancel,
19                 "save": self.keySave,
20                 "ok": self.keySave
21                 #fixme: open page editor
22             }, -2)
23
24         self["key_red"] = StaticText(_("Cancel"))
25         self["key_green"] = StaticText(_("OK"))
26
27         self.onChangedEntry = [ ]
28         ConfigListScreen.__init__(self, self.getConfigList(), session = self.session, on_change = self.changedEntry)
29
30     def getConfigList(self):
31         list = []
32         list.append(getConfigListEntry(_("Show in main menu"), config.plugins.CurlyTx.menuMain))
33         list.append(getConfigListEntry(_("Menu title"), config.plugins.CurlyTx.menuTitle))
34         # fixme: automatically set that
35         list.append(getConfigListEntry(_("Number of pages"), config.plugins.CurlyTx.pageCount))
36         # fixme: other way?
37         #list.append(getConfigListEntry(_("Pages"), config.plugins.CurlyTx.pages))
38         return list
39
40     def changedEntry(self):
41         # fixme: needed?
42         for x in self.onChangedEntry:
43             x()
44
45     def keyLeft(self):
46         ConfigListScreen.keyLeft(self)
47
48     def keyRight(self):
49         ConfigListScreen.keyRight(self)
50
51