the current page configuration.
+Disable settings
+================
+The page feed file may contain a tag that disables the settings button.
+By using it, you can prevent people from modifying the CurlyTx settings.
+
+First, register the namespace::
+
+ <feed xmlns="http://www.w3.org/2005/Atom" xmlns:c="http://ns.cweiske.de/curlytx">
+
+Then, add the setting after the author or self link::
+
+ <c:enableSettings>0</c:enableSettings>
+
+Here is the example feed with disabled settings::
+
+ <?xml version="1.0" encoding="utf-8"?>
+ <feed xmlns="http://www.w3.org/2005/Atom" xmlns:c="http://ns.cweiske.de/curlytx">
+ <title>URL list for CurlyTx</title>
+ <author>
+ <name>Christian Weiske</name>
+ </author>
+ <link rel="self" href="http://home.cweiske.de/pagefeed.atom"/>
+ <c:enableSettings>0</c:enableSettings>
+ <entry>
+ <id>ip</id>
+ <title>My IP</title>
+ <link rel="alternate" type="text/html" href="http://ip.cweiske.de/" />
+ </entry>
+ <entry>
+ <id>temp</id>
+ <title>House temperatures</title>
+ <link rel="alternate" type="text/html" href="http://home/temperatures.txt" />
+ </entry>
+ </feed>
+
+
=================
Modifying CurlyTx
=================
class AtomFeed:
""" Simple XML parser that extracts pages from a atom feed """
ns = "{http://www.w3.org/2005/Atom}"
+ nsc = "{http://ns.cweiske.de/curlytx}"
errorCallback = None
def __init__(self, url, callback, errorCallback):
if titleE != None and titleE.text != "" and url != None:
pages.append({"title": titleE.text, "url": url})
- callback(pages)
+ settings = dict()
+ for entry in list(xml):
+ if (entry.tag.startswith(self.nsc)):
+ settings[entry.tag[len(self.nsc):]] = entry.text
+
+ callback(pages, settings)
def bestLink(self, list):
""" Fetch the best matching link from an atom feed entry """
from enigma import gFont
from . import config
-from config import createPage, loadDefaultPageOptions, feedPagesToConfig, savePageConfig
+from config import createPage, loadDefaultPageOptions, feedPagesToConfig, feedSettingsToConfig, savePageConfig
from Components.config import config
import os
self["key_yellow"].setText(_("Prev"))
self["key_blue"].setText(_("Next"))
+ if config.plugins.CurlyTx.enableSettings.getValue():
+ self["key_red"].setText(_("Settings"))
+ else:
+ self["key_red"].setText("")
+
def pageUp(self):
self["text"].pageUp()
self.showingHeaders = True
def showSettings(self):
+ if not config.plugins.CurlyTx.enableSettings.getValue():
+ return
+
from CurlyTxSettings import CurlyTxSettings
self.session.openWithCallback(self.onSettingsChanged, CurlyTxSettings)
type = MessageBox.TYPE_ERROR
)
- def saveStaticConfig(self, pages):
+ def saveStaticConfig(self, pages, settings):
feedPagesToConfig(pages)
+ feedSettingsToConfig(settings)
savePageConfig()
+ self.loadButtons()
from Screens.MessageBox import MessageBox
from . import config
-from config import createPage, loadDefaultPageOptions, feedPagesToConfig, savePageConfig
+from config import createPage, loadDefaultPageOptions, feedPagesToConfig, feedSettingsToConfig, savePageConfig
from Components.config import config, getConfigListEntry, ConfigSelection
from Components.ConfigList import ConfigList, ConfigListScreen
self["config"].setList(self.getConfigList())
- def feedPagesReceived(self, pages):
+ def feedPagesReceived(self, pages, settings):
feedPagesToConfig(pages)
+ feedSettingsToConfig(settings)
self["config"].setList(self.getConfigList())
def feedPagesFail(self, errorMessage):
# License: GPLv3 or later
-from Components.config import config, ConfigYesNo, ConfigSelection, ConfigNumber, ConfigText, ConfigSubsection, ConfigSubList, ConfigInteger
+from Components.config import config, ConfigEnableDisable, ConfigYesNo, ConfigSelection, ConfigNumber, ConfigText, ConfigSubsection, ConfigSubList, ConfigInteger
def createPage():
""" Create and return a configuration page object """
page.title.setValue(pageData["title"])
page.uri.setValue(pageData["url"])
+def feedSettingsToConfig(settings):
+ changed = False
+ if 'enableSettings' in settings and config.plugins.CurlyTx.enableSettings.getValue() != settings['enableSettings']:
+ config.plugins.CurlyTx.enableSettings.setValue(int(settings['enableSettings']))
+ changed = True
+
+ if changed:
+ config.plugins.CurlyTx.save()
+
def savePageConfig():
for i in range(0, len(config.plugins.CurlyTx.pages)):
config.plugins.CurlyTx.pages[i].save()
config.plugins.CurlyTx = ConfigSubsection()
config.plugins.CurlyTx.menuMain = ConfigYesNo(default = True)
config.plugins.CurlyTx.menuExtensions = ConfigYesNo(default = False)
+config.plugins.CurlyTx.enableSettings = ConfigEnableDisable(default = True)
config.plugins.CurlyTx.menuTitle = ConfigText(default = "CurlyTx", fixed_size = False)
config.plugins.CurlyTx.feedUrl = ConfigText(default = "", fixed_size = False)
config.plugins.CurlyTx.pages = ConfigSubList()