本文整理汇总了Python中EPGConfig类的典型用法代码示例。如果您正苦于以下问题:Python EPGConfig类的具体用法?Python EPGConfig怎么用?Python EPGConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EPGConfig类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, session):
self.session = session
Screen.__init__(self, session)
self.setup_title = _("EPG Import Sources")
Screen.setTitle(self, self.setup_title)
self["key_red"] = Button(_("Cancel"))
self["key_green"] = Button(_("Ok"))
self["key_yellow"] = Button() # _("Import now"))
self["key_blue"] = Button()
self.onChangedEntry = []
cfg = EPGConfig.loadUserSettings()
filter = cfg["sources"]
sources = [
# (description, value, index, selected)
SelectionEntryComponent(x.description, x.description, 0, (filter is None) or (x.description in filter))
for x in EPGConfig.enumSources(CONFIG_PATH, filter=None)
]
self["list"] = SelectionList(sources)
self["setupActions"] = ActionMap(["SetupActions", "ColorActions", "MenuActions"],
{
"red": self.cancel,
"green": self.save,
"yellow": self.doimport,
"save": self.save,
"cancel": self.cancel,
"ok": self["list"].toggleSelection,
"menu": self.cancel,
}, -2)
示例2: runImport
def runImport(self):
cfg = EPGConfig.loadUserSettings()
sources = [ s for s in EPGConfig.enumSources(CONFIG_PATH, filter = cfg["sources"]) ]
if sources:
sources.reverse()
epgimport.sources = sources
epgimport.onDone = doneImport
epgimport.beginImport(longDescUntil = config.plugins.epgimport.longDescDays.value * 24 * 3600 + time.time())
示例3: runImport
def runImport(self):
if self.prev_onlybouquet != config.plugins.epgimport.import_onlybouquet.value or self.prev_multibouquet != config.usage.multibouquet.value:
self.prev_onlybouquet = config.plugins.epgimport.import_onlybouquet.value
self.prev_multibouquet = config.usage.multibouquet.value
EPGConfig.channelCache = {}
cfg = EPGConfig.loadUserSettings()
sources = [ s for s in EPGConfig.enumSources(CONFIG_PATH, filter = cfg["sources"]) ]
if sources:
sources.reverse()
epgimport.sources = sources
epgimport.onDone = doneImport
epgimport.beginImport(longDescUntil = config.plugins.epgimport.longDescDays.value * 24 * 3600 + time.time())
示例4: doimport
def doimport(self):
if epgimport.isImportRunning():
print>>log, "[EPGImport] Already running, won't start again"
self.session.open(MessageBox, _("EPGImport Plugin\nImport of epg data is still in progress. Please wait."), MessageBox.TYPE_ERROR, timeout = 10, close_on_any_key = True)
return
cfg = EPGConfig.loadUserSettings()
sources = [ s for s in EPGConfig.enumSources(CONFIG_PATH, filter = cfg["sources"]) ]
if not sources:
self.session.open(MessageBox, _("No active EPG sources found, nothing to do"), MessageBox.TYPE_INFO, timeout = 10, close_on_any_key = True)
return
# make it a stack, first on top.
sources.reverse()
epgimport.sources = sources
self.session.openWithCallback(self.do_import_callback, MessageBox, _("EPGImport Plugin\nImport of epg data will start\nThis may take a few minutes\nIs this ok?"), MessageBox.TYPE_YESNO, timeout = 15, default = True)
示例5: importFrom
def importFrom(epgimport, sourceXml):
# Hack to make this test run on Windows (where the reactor cannot handle files)
if sys.platform.startswith('win'):
import twisted.python.runtime
twisted.python.runtime.platform.supportsThreads = lambda: False
class FakeReactor:
def addReader(self, r):
self.r = r
def removeReader(self, r):
if self.r is r:
self.r = None
else:
raise Exception, "Removed reader without adding it"
def run(self):
while self.r is not None:
self.r.doRead()
def stop(self):
print "reactor stopped"
pass
EPGImport.reactor = FakeReactor()
sources = [ s for s in EPGConfig.enumSourcesFile(sourceXml, filter = None) ]
sources.reverse()
epgimport.sources = sources
epgimport.onDone = done
epgimport.beginImport(longDescUntil = time.time() + (5*24*3600))
EPGImport.reactor.run()
示例6: runImport
def runImport(self):
cfg = config.plugins.epgimport.sources.getValue().split("|")
sources = [ s for s in EPGConfig.enumSources(CONFIG_PATH, filter = cfg) ]
if sources:
sources.reverse()
epgimport.sources = sources
epgimport.onDone = doneImport
epgimport.beginImport(longDescUntil = config.plugins.epgimport.longDescDays.value * 24 * 3600 + time.time())
示例7: __init__
def __init__(self, session):
self.session = session
Screen.__init__(self, session)
self["key_red"] = Button(_("Cancel"))
self["key_green"] = Button(_("Save"))
self["key_blue"] = Button()
cfg = EPGConfig.loadUserSettings()
filter = cfg["sources"]
tree = []
cat = None
for x in EPGConfig.enumSources(CONFIG_PATH, filter=None, categories=True):
if hasattr(x, 'description'):
sel = (filter is None) or (x.description in filter)
entry = (x.description, x.description, sel)
if cat is None:
# If no category defined, use a default one.
cat = ExpandableSelectionList.category("[.]")
tree.append(cat)
cat[0][2].append(entry)
if sel:
ExpandableSelectionList.expand(cat, True)
else:
cat = ExpandableSelectionList.category(x)
tree.append(cat)
self["list"] = ExpandableSelectionList.ExpandableSelectionList(tree, enableWrapAround=True)
if tree:
self["key_yellow"] = Button(_("Import current source"))
else:
self["key_yellow"] = Button()
self["setupActions"] = ActionMap(["SetupActions", "ColorActions"],
{
"red": self.cancel,
"green": self.save,
"yellow": self.do_import,
"save": self.save,
"cancel": self.cancel,
"ok": self["list"].toggleSelection,
}, -2)
self.setTitle(_("EPG Import Sources"))
示例8: save
def save(self):
sources = [ item[0][1] for item in self["list"].list if item[0][3] ]
print>>log, "[EPGImport] Selected sources:", sources
EPGConfig.storeUserSettings(sources=sources)
self.close(True, sources)
示例9: save
def save(self):
# Make the entries unique through a set
sources = list(set([item[1] for item in self["list"].enumSelected()]))
print>>log, "[EPGImport] Selected sources:", sources
EPGConfig.storeUserSettings(sources=sources)
self.close(True, sources, None)