本文整理汇总了Python中Components.config.ConfigYesNo.addNotifier方法的典型用法代码示例。如果您正苦于以下问题:Python ConfigYesNo.addNotifier方法的具体用法?Python ConfigYesNo.addNotifier怎么用?Python ConfigYesNo.addNotifier使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Components.config.ConfigYesNo
的用法示例。
在下文中一共展示了ConfigYesNo.addNotifier方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: QuickSubtitlesConfigMenu
# 需要导入模块: from Components.config import ConfigYesNo [as 别名]
# 或者: from Components.config.ConfigYesNo import addNotifier [as 别名]
class QuickSubtitlesConfigMenu(ConfigListScreen, Screen):
FLAG_CENTER_DVB_SUBS = 2048
def __init__(self, session, infobar):
Screen.__init__(self, session)
self.infobar = infobar or self.session.infobar
self.wait = eTimer()
self.wait.timeout.get().append(self.resyncSubtitles)
self.service = self.session.nav.getCurrentlyPlayingServiceReference()
servicepath = self.service and self.service.getPath()
if servicepath and servicepath.startswith("/") and self.service.toString().startswith("1:"):
info = eServiceCenter.getInstance().info(self.service)
self.service_string = info and info.getInfoString(self.service, iServiceInformation.sServiceref)
else:
self.service_string = self.service.toString()
self.center_dvb_subs = ConfigYesNo(default = (eDVBDB.getInstance().getFlag(eServiceReference(self.service_string)) & self.FLAG_CENTER_DVB_SUBS) and True)
self.center_dvb_subs.addNotifier(self.setCenterDvbSubs)
self["videofps"] = Label("")
sub = self.infobar.selected_subtitle
if sub[0] == 0: # dvb
menu = [
getConfigMenuItem("config.subtitles.dvb_subtitles_yellow"),
getConfigMenuItem("config.subtitles.dvb_subtitles_backtrans"),
getConfigMenuItem("config.subtitles.dvb_subtitles_original_position"),
(_("Center DVB subtitles"), self.center_dvb_subs),
getConfigMenuItem("config.subtitles.subtitle_position"),
getConfigMenuItem("config.subtitles.subtitle_bad_timing_delay"),
getConfigMenuItem("config.subtitles.subtitle_noPTSrecordingdelay"),
]
elif sub[0] == 1: # teletext
menu = [
getConfigMenuItem("config.subtitles.ttx_subtitle_colors"),
getConfigMenuItem("config.subtitles.ttx_subtitle_original_position"),
getConfigMenuItem("config.subtitles.subtitle_fontsize"),
getConfigMenuItem("config.subtitles.subtitle_position"),
getConfigMenuItem("config.subtitles.subtitle_rewrap"),
getConfigMenuItem("config.subtitles.subtitle_borderwidth"),
getConfigMenuItem("config.subtitles.showbackground"),
getConfigMenuItem("config.subtitles.subtitle_alignment"),
getConfigMenuItem("config.subtitles.subtitle_bad_timing_delay"),
getConfigMenuItem("config.subtitles.subtitle_noPTSrecordingdelay"),
]
else: # pango
menu = [
getConfigMenuItem("config.subtitles.pango_subtitles_delay"),
getConfigMenuItem("config.subtitles.pango_subtitle_colors"),
getConfigMenuItem("config.subtitles.pango_subtitle_fontswitch"),
getConfigMenuItem("config.subtitles.colourise_dialogs"),
getConfigMenuItem("config.subtitles.subtitle_fontsize"),
getConfigMenuItem("config.subtitles.subtitle_position"),
getConfigMenuItem("config.subtitles.subtitle_alignment"),
getConfigMenuItem("config.subtitles.subtitle_rewrap"),
getConfigMenuItem("config.subtitles.subtitle_borderwidth"),
getConfigMenuItem("config.subtitles.showbackground"),
getConfigMenuItem("config.subtitles.pango_subtitles_fps"),
]
self["videofps"].setText(_("Video: %s fps") % (self.getFps().rstrip(".000")))
ConfigListScreen.__init__(self, menu, self.session, on_change = self.changedEntry)
self["actions"] = NumberActionMap(["SetupActions"],
{
"cancel": self.cancel,
"ok": self.ok,
},-2)
self.onLayoutFinish.append(self.layoutFinished)
def setCenterDvbSubs(self, configElement):
if configElement.value:
eDVBDB.getInstance().addFlag(eServiceReference(self.service_string), self.FLAG_CENTER_DVB_SUBS)
config.subtitles.dvb_subtitles_centered.value = True
else:
eDVBDB.getInstance().removeFlag(eServiceReference(self.service_string), self.FLAG_CENTER_DVB_SUBS)
config.subtitles.dvb_subtitles_centered.value = False
def layoutFinished(self):
if not self["videofps"].text:
self.instance.resize(eSize(self.instance.size().width(), self["config"].l.getItemSize().height()*len(self["config"].getList()) + 10))
def changedEntry(self):
if self["config"].getCurrent() in [getConfigMenuItem("config.subtitles.pango_subtitles_delay"),getConfigMenuItem("config.subtitles.pango_subtitles_fps")]:
self.wait.start(500, True)
def resyncSubtitles(self):
self.infobar.setSeekState(self.infobar.SEEK_STATE_PAUSE)
self.infobar.setSeekState(self.infobar.SEEK_STATE_PLAY)
def getFps(self):
service = self.session.nav.getCurrentService()
info = service and service.info()
if not info:
return ""
fps = info.getInfo(iServiceInformation.sFrameRate)
if fps > 0:
return "%6.3f" % (fps/1000.)
return ""
#.........这里部分代码省略.........