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
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()
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