aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2011-11-15 19:37:51 +0100
committerChristian Weiske <cweiske@cweiske.de>2011-11-15 19:37:51 +0100
commit0155a052ca0944b213a4d1ec2a81a7252f8d5b5d (patch)
treeadca9fceb6c68a579f4996f67fb278591d96e1dc /src
parent3478c5839f69b2e8accca7e8def3e480a1699425 (diff)
downloadenigma2-curlytx-0155a052ca0944b213a4d1ec2a81a7252f8d5b5d.tar.gz
enigma2-curlytx-0155a052ca0944b213a4d1ec2a81a7252f8d5b5d.zip
we can create new pages
Diffstat (limited to 'src')
-rw-r--r--src/CurlyTxSettings.py35
-rw-r--r--src/config.py24
2 files changed, 48 insertions, 11 deletions
diff --git a/src/CurlyTxSettings.py b/src/CurlyTxSettings.py
index 3a58ecb..0863b8c 100644
--- a/src/CurlyTxSettings.py
+++ b/src/CurlyTxSettings.py
@@ -3,6 +3,7 @@ from Components.ActionMap import ActionMap, NumberActionMap
from Components.Sources.StaticText import StaticText
from . import config
+from config import createPage
from Components.config import config, getConfigListEntry
from Components.ConfigList import ConfigList, ConfigListScreen
@@ -71,19 +72,47 @@ class CurlyTxSettings(ConfigListScreen, Screen):
id = self["config"].getCurrentIndex()
del config.plugins.CurlyTx.pages[id]
- config.plugins.CurlyTx.pageCount.value -= 1
self["config"].setList(self.getConfigList())
def newPage(self):
- # FIXME
+ from CurlyTxSettings import CurlyTxSettings
+ self.session.openWithCallback(self.newPageCreated, CurlyTxPageEdit, createPage(), True)
+
+ def newPageCreated(self, page, new):
+ if new:
+ config.plugins.CurlyTx.pages.append(page)
+
+ self["config"].setList(self.getConfigList())
pass
class CurlyTxPageEdit(Screen, ConfigListScreen):
- def __init__(self, session):
+ def __init__(self, session, page, new = False):
Screen.__init__(self, session)
+ self.skinName = [ "CurlyTxPageEdit", "Setup" ]
self["key_red"] = StaticText(_("Cancel"))
self["key_green"] = StaticText(_("OK"))
+
+ self["setupActions"] = ActionMap(["SetupActions"],
+ {
+ "save": self.save,
+ "cancel": self.keyCancel
+ }, -1)
+
+ self.page = page
+ self.new = new
+ list = [
+ getConfigListEntry(_("Page URL"), page.uri),
+ getConfigListEntry(_("Title"), page.title),
+ ]
+ ConfigListScreen.__init__(self, list, session = self.session)
+
+ def save(self):
+ self.close(self.page, self.new)
+ #FIXME: pass page to parent
+
+ def keyCancel(self):
+ self.close()
diff --git a/src/config.py b/src/config.py
index 7c527b8..9a98357 100644
--- a/src/config.py
+++ b/src/config.py
@@ -5,12 +5,20 @@ config.plugins.CurlyTx = ConfigSubsection()
config.plugins.CurlyTx.menuMain = ConfigYesNo(default = True)
config.plugins.CurlyTx.menuTitle = ConfigText(default = "CurlyTx")
config.plugins.CurlyTx.pages = ConfigSubList()
-i = 0
-while i < len(config.plugins.CurlyTx.pages):
- s = ConfigSubsection()
- s.uri = ConfigText(default="http://", fixed_size=False)
- config.plugins.CurlyTx.pages.append(s)
- i += 1
- del s
-del i
+#i = 0
+#while i < len(config.plugins.CurlyTx.pages):
+# config.plugins.CurlyTx.pages.append(createPage)
+# i += 1
+# del s
+#del i
#config.plugins.CurlyTx.defaultPage = ConfigNumber(default=0)
+
+
+def createPage():
+ s = ConfigSubsection()
+ s.uri = ConfigText(default="http://", fixed_size=False)
+ s.title = ConfigText(
+ default = "Page #" + str(len(config.plugins.CurlyTx.pages) + 1),
+ fixed_size = False
+ )
+ return s