本文整理汇总了Python中Components.Label.Label.setText方法的典型用法代码示例。如果您正苦于以下问题:Python Label.setText方法的具体用法?Python Label.setText怎么用?Python Label.setText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Components.Label.Label
的用法示例。
在下文中一共展示了Label.setText方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setText
# 需要导入模块: from Components.Label import Label [as 别名]
# 或者: from Components.Label.Label import setText [as 别名]
def setText(self, text):
print len(text), self.maxChars
if len(text) > self.maxChars:
cutChars = len(text) - self.maxChars
if self.cutLeft:
text = text[cutChars:]
text = "%s %s" % (self.replaceChar * self.replaceCharNum, text[self.replaceCharNum + 1:])
else:
text = text[:self.cutChars]
text = "%s %s" % (text[:-self.replaceCharNum + 1], self.replaceChar * self.replaceCharNum)
Label.setText(self, text)
示例2: doMove
# 需要导入模块: from Components.Label import Label [as 别名]
# 或者: from Components.Label.Label import setText [as 别名]
def doMove(self):
offset = self.offset + 1
text = self.longText[offset:self.displayLength+offset]
self.offset = offset
if not text:
# it appears we're done displaying the full text, so stop now or waste cpu time forever :D
self.stopMoving()
try:
Label.setText(self, text.encode('utf-8', 'ignore'))
except Exception:
self.stopMoving()
示例3: PositionerSetup
# 需要导入模块: from Components.Label import Label [as 别名]
# 或者: from Components.Label.Label import setText [as 别名]
#.........这里部分代码省略.........
def createSetup(self):
self.list.append((_("Tune"), self.positioner_tune, "tune"))
self.list.append((_("Positioner movement"), self.positioner_move, "move"))
self.list.append((_("Positioner fine movement"), self.positioner_finemove, "finemove"))
self.list.append((_("Set limits"), self.positioner_limits, "limits"))
self.list.append((_("Positioner storage"), self.positioner_storage, "storage"))
self.list.append((_("Goto 0"), self.positioner_goto0, "goto0"))
self["list"].l.setList(self.list)
def go(self):
pass
def getCurrentConfigPath(self):
return self["list"].getCurrent()[2]
def up(self):
if not self.isMoving:
self["list"].instance.moveSelection(self["list"].instance.moveUp)
self.updateColors(self.getCurrentConfigPath())
def down(self):
if not self.isMoving:
self["list"].instance.moveSelection(self["list"].instance.moveDown)
self.updateColors(self.getCurrentConfigPath())
def left(self):
self["list"].handleKey(KEY_LEFT)
def right(self):
self["list"].handleKey(KEY_RIGHT)
def updateColors(self, entry):
if entry == "tune":
self.red.setText(_("Tune"))
self.green.setText("")
self.yellow.setText("")
self.blue.setText("")
elif entry == "move":
if self.isMoving:
self.red.setText(_("Stop"))
self.green.setText(_("Stop"))
self.yellow.setText(_("Stop"))
self.blue.setText(_("Stop"))
else:
self.red.setText(_("Move west"))
self.green.setText(_("Search west"))
self.yellow.setText(_("Search east"))
self.blue.setText(_("Move east"))
elif entry == "finemove":
self.red.setText("")
self.green.setText(_("Step west"))
self.yellow.setText(_("Step east"))
self.blue.setText("")
elif entry == "limits":
self.red.setText(_("Limits off"))
self.green.setText(_("Limit west"))
self.yellow.setText(_("Limit east"))
self.blue.setText(_("Limits on"))
elif entry == "storage":
self.red.setText("")
self.green.setText(_("Store position"))
self.yellow.setText(_("Goto position"))
self.blue.setText("")
elif entry == "goto0":
self.red.setText(_("Goto 0"))
self.green.setText("")
示例4: BrowserLauncher
# 需要导入模块: from Components.Label import Label [as 别名]
# 或者: from Components.Label.Label import setText [as 别名]
#.........这里部分代码省略.........
def makeConfig(self):
self.loadConfig()
self.createConfig()
def createConfig(self):
self.name_list = []
self.mouse_list = None
self.keyboard_list = None
self.devices = [(x, iInputDevices.getDeviceName(x).replace("dreambox advanced remote control (native)", "Remote Control").replace("dreambox front panel", "Front Panel") + "(" + x + ")") for x in iInputDevices.getDeviceList()]
if self.conf_mouse == "":
self.conf_mouse = "event1"
self.mouse = ConfigSelection(default = self.conf_mouse, choices = self.devices)
self.list.append(getConfigListEntry(_('Mouse'), _(self.mouse)))
if self.conf_keyboard == "":
self.conf_keyboard = "event1"
self.keyboard = ConfigSelection(default = self.conf_keyboard, choices = self.devices)
self.list.append(getConfigListEntry(_('Keyboard'), _(self.keyboard)))
if self.conf_alpha == "":
self.conf_alpha = "255"
self.alpha = ConfigSlider(default = int(self.conf_alpha), increment = 10, limits = (0, 255))
self.list.append(getConfigListEntry(_("Alpha Value"), self.alpha))
if self.conf_keymap == "":
self.conf_keymap = self.getLanguage()
self.lang_list = [("en", "English"), ("de", "German")]
self.langs = ConfigSelection(default = self.conf_keymap, choices = self.lang_list)
self.list.append(getConfigListEntry(_("Language"), self.langs))
self["config"].list = self.list
self["config"].l.setList(self.list)
def getLanguage(self, lang=language.getLanguage()):
if self.current_lang_idx == 1:
return "de"
return "en"
def startBrowser(self):
self.timer_start.stop()
self.lock = True
excute_cmd("killall -15 %s"%(self.browser_name))
excute_cmd("echo 0 > /proc/sys/vm/swappiness")
kbd_cmd = " "
mouse_cmd = " "
extra_cmd = " "
browser_cmd = "%s/%s -qws" % (self.browser_root, self.browser_name)
mouse_param = self.mouse.value
keyboard_param = self.keyboard.value
keymap_param = ""
if self.langs.value == "de":
keymap_param = ":keymap=/usr/share/keymaps/player/de.qmap"
cmd = "%s%s%s%s" % (extra_cmd, kbd_cmd, mouse_cmd, browser_cmd)
print "prepared command : [%s]" % cmd
self.launcher = eConsoleAppContainer()
self.launcher.appClosed.append(self.callbackLauncherAppClosed)
self.launcher.dataAvail.append(self.callbackLauncherDataAvail)
fbClass.getInstance().lock()
#eRCInput.getInstance().lock()
global alpha_value
alpha_value = self.alpha.value
change_galpha(set_const=True, set_value=True)
self.launcher.execute(cmd)
print "started browser..."
def keyGo(self):
self.saveConfig()
self.info.setText("Starting Webbrowser. Please wait...")
if self.lock == False:
if self.langs.value == "de":
language.activateLanguageIndex(1)
else:
language.activateLanguageIndex(0)
self.timer_start = eTimer()
self.timer_start.callback.append(self.startBrowser)
self.timer_start.start(10)
def callbackLauncherDataAvail(self, ret_data):
print ret_data
if ret_data.startswith("--done--"):
self.lock = False
self.doExit()
def callbackLauncherAppClosed(self, retval = 1):
self.lock = False
示例5: setText
# 需要导入模块: from Components.Label import Label [as 别名]
# 或者: from Components.Label.Label import setText [as 别名]
def setText(self, text):
text = (self.displayLength * ' ') + text
self.longText = text
self.offset = 0
Label.setText(self, text[:self.displayLength].encode('utf-8', 'ignore'))
示例6: Browser
# 需要导入模块: from Components.Label import Label [as 别名]
# 或者: from Components.Label.Label import setText [as 别名]
#.........这里部分代码省略.........
"blue" : self.__actionBlue,
})
self["numberactions"] = NumberActionMap(["NumberActions"],
{
"1": self.keyNumberGlobal,
"2": self.keyNumberGlobal,
"3": self.keyNumberGlobal,
"4": self.keyNumberGlobal,
"5": self.keyNumberGlobal,
"6": self.keyNumberGlobal,
"7": self.keyNumberGlobal,
"8": self.keyNumberGlobal,
"9": self.keyNumberGlobal,
"0": self.keyNumberGlobal
})
def execEnd(self):
Screen.execEnd(self)
for fnc in self.onExecEnd:
fnc()
def setBackgroundTransparent(self, enabled):
self.webnavigation.setBackgroundTransparent(enabled)
def __setKeyBoardModeAscii(self):
eRCInput.getInstance().setKeyboardMode(eRCInput.kmAscii)
def __unsetKeyBoardModeAscii(self):
eRCInput.getInstance().setKeyboardMode(self.__keyboardMode)
def __setStatus(self, text):
print "[Browser].__setStatus"
self.statuslabel.setText(text)
self.statuslabel.show()
self.__statusTimer.startLongTimer(3)
def __hideStatus(self):
self["statuslabel"].hide()
self.__statusTimer.stop()
def __setMouseMode(self, enabled):
self.__mouseMode = enabled
if enabled:
self.__setCursor()
self["cursor"].show()
self["red"].setText("Mouse On")
self.__clearCanvas()
else:
self["cursor"].hide()
self["red"].setText("Mouse Off")
def __actionExit(self):
if self.__isHbbtv:
self.__actionExitCB(True)
return
self.session.openWithCallback(self.__actionExitCB, MessageBox, _("Do you really want to exit the browser?"), type = MessageBox.TYPE_YESNO)
def __actionExitCB(self, confirmed):
if confirmed:
self.__urlSuggestionTimer.stop()
self.__inputTimer.stop()
if not self.__isHbbtv:
config.plugins.WebBrowser.lastvisited.value = self.webnavigation.url
config.plugins.WebBrowser.lastvisited.save()
self.__persistCookies()
示例7: MenuStart
# 需要导入模块: from Components.Label import Label [as 别名]
# 或者: from Components.Label.Label import setText [as 别名]
class MenuStart(Screen):
def __init__(self, session):
self.session = session
path = '/usr/lib/enigma2/python/Plugins/Extensions/iSkin/Skin/Main.xml'
with open(path, 'r') as f:
self.skin = f.read()
f.close()
mdom = xml.etree.cElementTree.parse(path)
for x in mdom.getroot():
if x.tag == 'widget' and x.get('name') == 'cover':
Size = x.get('size').split(',')
self.SizeY = int(Size[0])
self.SizeX = int(Size[1])
Screen.__init__(self, session)
self['Key_Red'] = Label(_('Exit'))
self['Key_Green'] = Label('')
self['Key_Yellow'] = Label('')
self['ButtonYellow'] = Pixmap()
self['ButtonYellow'].hide()
if os.path.exists('/usr/lib/enigma2/python/Components/Converter/TestConnection.pyo'):
self['Key_Yellow'].setText(_('Config Connection'))
self['ButtonYellow'].show()
self.Region = Label('')
self['Key_Region'] = self.Region
self.Key_Blu = Label('')
self['Key_Blu'] = self.Key_Blu
self['SkinSelect'] = iMenuList([])
self.isMoving = False
self['cover'] = Pixmap()
self.Loop = eTimer()
self.Loop.stop()
self.Loop.callback.append(self.Cover)
self['setupActions'] = ActionMap(['SkinActionSetup'], {'blue': self.keyBlue,
'green': self.keyGreen,
'yellow': self.keyYellow,
'ok': self.keyOK,
'up': self.up,
'down': self.down,
'red': self.close,
'cancel': self.close}, -1)
self.onLayoutFinish.append(self.layoutFinished)
self.onShown.append(self.SetButtonWeather)
def SetButtonWeather(self):
if os.path.exists('/usr/lib/enigma2/python/Plugins/Extensions/iSkin/Weather/Weather.pyo'):
self.Key_Blu.setText('Config Weather')
if os.path.exists('/usr/lib/enigma2/python/Plugins/Extensions/iSkin/Weather/Config/Region_id'):
jRegion_id = open('/usr/lib/enigma2/python/Plugins/Extensions/iSkin/Weather/Config/Region_id').read()
self.Region.setText(jRegion_id)
def keyYellow(self):
if os.path.exists('/usr/lib/enigma2/python/Plugins/Extensions/iSkin/Connection/Connection.pyo'):
try:
self.session.open(ConfigConnection)
except:
pass
def keyBlue(self):
try:
self.session.open(WeatherSearch)
except:
pass
def keyGreen(self):
try:
self.session.open(MeteoMain)
except:
pass
def Cover(self):
try:
self.Loop.stop()
except:
pass
try:
png = loadPic(str(self.getCurrentConfigPath()), self.SizeY, self.SizeX, 0, 0, 0, 1)
self['cover'].instance.setPixmap(png)
self['cover'].show()
except:
pass
def getCurrentConfigPath(self):
return self['SkinSelect'].getCurrent()[0][1]
def up(self):
if not self.isMoving:
self['SkinSelect'].instance.moveSelection(self['SkinSelect'].instance.moveUp)
self.Loop.start(100, True)
def down(self):
if not self.isMoving:
self['SkinSelect'].instance.moveSelection(self['SkinSelect'].instance.moveDown)
self.Loop.start(100, True)
def layoutFinished(self):
mdom = xml.etree.cElementTree.parse(os.path.dirname(sys.modules[__name__].__file__) + '/Config/SkinSetup.xml')
self.SkinSelect = []
#.........这里部分代码省略.........
示例8: Ipkg
# 需要导入模块: from Components.Label import Label [as 别名]
# 或者: from Components.Label.Label import setText [as 别名]
class Ipkg(Screen):
def __init__(self, session, cmdList = []):
Screen.__init__(self, session)
self.cmdList = cmdList
self.sliderPackages = {}
self.slider = Slider(0, len(cmdList))
self["slider"] = self.slider
self.activityslider = Slider(0, 100)
self["activityslider"] = self.activityslider
self.status = Label(_("Preparing... Please wait"))
self["status"] = self.status
self.package = Label()
self["package"] = self.package
self.packages = 0
self.error = 0
self.processed_packages = []
self.activity = 0
self.activityTimer = eTimer()
self.activityTimer_conn = self.activityTimer.timeout.connect(self.doActivityTimer)
#self.activityTimer.start(100, False)
self.ipkg = IpkgComponent()
self.ipkg.addCallback(self.ipkgCallback)
self.runningCmd = None
self.runNextCmd()
self["actions"] = ActionMap(["WizardActions"],
{
"ok": self.exit,
"back": self.exit
}, -1)
def runNextCmd(self):
if self.runningCmd is None:
self.runningCmd = 0
else:
self.runningCmd += 1
print len(self.cmdList), self.runningCmd
if len(self.cmdList) - 1 < self.runningCmd:
self.activityslider.setValue(0)
self.slider.setValue(len(self.cmdList))
self.package.setText("")
self.status.setText(_("Done - Installed, upgraded or removed %d packages with %d errors") % (self.packages, self.error))
return False
else:
cmd = self.cmdList[self.runningCmd]
self.slider.setValue(self.runningCmd)
self.ipkg.startCmd(cmd[0], args = cmd[1])
self.startActivityTimer()
def doActivityTimer(self):
if not self.ipkg.isRunning():
self.stopActivityTimer()
else:
self.activity += 1
if self.activity == 100:
self.activity = 0
self.activityslider.setValue(self.activity)
def startActivityTimer(self):
self.activityTimer.start(100, False)
def stopActivityTimer(self):
self.activityTimer.stop()
def ipkgCallback(self, event, param):
if event == IpkgComponent.EVENT_DOWNLOAD:
self.status.setText(_("Downloading"))
elif event == IpkgComponent.EVENT_UPGRADE:
if self.sliderPackages.has_key(param):
self.slider.setValue(self.sliderPackages[param])
self.package.setText(param)
self.status.setText(_("Upgrading"))
if not param in self.processed_packages:
self.processed_packages.append(param)
self.packages += 1
elif event == IpkgComponent.EVENT_INSTALL:
self.package.setText(param)
self.status.setText(_("Installing"))
if not param in self.processed_packages:
self.processed_packages.append(param)
self.packages += 1
elif event == IpkgComponent.EVENT_REMOVE:
self.package.setText(param)
self.status.setText(_("Removing"))
if not param in self.processed_packages:
self.processed_packages.append(param)
self.packages += 1
elif event == IpkgComponent.EVENT_CONFIGURING:
self.package.setText(param)
self.status.setText(_("Configuring"))
elif event == IpkgComponent.EVENT_ERROR:
self.error += 1
#.........这里部分代码省略.........
示例9: Ipkg
# 需要导入模块: from Components.Label import Label [as 别名]
# 或者: from Components.Label.Label import setText [as 别名]
class Ipkg(Screen):
def __init__(self, session, cmdList=None):
if not cmdList: cmdList = []
Screen.__init__(self, session)
self.cmdList = cmdList
self.sliderPackages = {}
self.slider = Slider(0, len(cmdList))
self["slider"] = self.slider
self.activityslider = Slider(0, 100)
self["activityslider"] = self.activityslider
self.status = Label(_("Preparing... Please wait"))
self["status"] = self.status
self.package = Label()
self["package"] = self.package
self.packages = 0
self.error = 0
self.processed_packages = []
self.activity = 0
self.activityTimer = eTimer()
self.activityTimer.callback.append(self.doActivityTimer)
#self.activityTimer.start(100, False)
self.ipkg = IpkgComponent()
self.ipkg.addCallback(self.ipkgCallback)
self.runningCmd = None
self.runNextCmd()
self["actions"] = ActionMap(["WizardActions"],
{
"ok": self.exit,
"back": self.exit
}, -1)
def runNextCmd(self):
if self.runningCmd is None:
self.runningCmd = 0
else:
self.runningCmd += 1
print len(self.cmdList), self.runningCmd
if len(self.cmdList) - 1 < self.runningCmd:
self.activityslider.setValue(0)
self.slider.setValue(len(self.cmdList))
self.package.setText("")
self.status.setText(ngettext("Done - Installed, upgraded or removed %d package (%s)", "Done - Installed, upgraded or removed %d packages (%s)", self.packages) % (self.packages, ngettext("with %d error", "with %d errors", self.error) % self.error))
return False
else:
cmd = self.cmdList[self.runningCmd]
self.slider.setValue(self.runningCmd)
self.ipkg.startCmd(cmd[0], args = cmd[1])
self.startActivityTimer()
def doActivityTimer(self):
if not self.ipkg.isRunning():
self.stopActivityTimer()
else:
self.activity += 1
if self.activity == 100:
self.activity = 0
self.activityslider.setValue(self.activity)
def startActivityTimer(self):
self.activityTimer.start(100, False)
def stopActivityTimer(self):
self.activityTimer.stop()
def ipkgCallback(self, event, param):
if event == IpkgComponent.EVENT_DOWNLOAD:
self.status.setText(_("Downloading"))
elif event == IpkgComponent.EVENT_UPGRADE:
if self.sliderPackages.has_key(param):
self.slider.setValue(self.sliderPackages[param])
self.package.setText(param)
self.status.setText(_("Upgrading"))
if not param in self.processed_packages:
self.processed_packages.append(param)
self.packages += 1
elif event == IpkgComponent.EVENT_INSTALL:
self.package.setText(param)
self.status.setText(_("Installing"))
if not param in self.processed_packages:
self.processed_packages.append(param)
self.packages += 1
elif event == IpkgComponent.EVENT_REMOVE:
self.package.setText(param)
self.status.setText(_("Removing"))
if not param in self.processed_packages:
self.processed_packages.append(param)
self.packages += 1
elif event == IpkgComponent.EVENT_CONFIGURING:
self.package.setText(param)
self.status.setText(_("Configuring"))
elif event == IpkgComponent.EVENT_ERROR:
#.........这里部分代码省略.........
示例10: StreamServerConfig
# 需要导入模块: from Components.Label import Label [as 别名]
# 或者: from Components.Label.Label import setText [as 别名]
#.........这里部分代码省略.........
entries.extend([
getConfigListEntry(_("HLS")),
getConfigListEntry(_("HLS Server"), self._streamServerControl.config.streamserver.hls.enabled)
])
if self._streamServerControl.config.streamserver.hls.enabled.value:
entries.extend([
getConfigListEntry(_("User"), self._streamServerControl.config.streamserver.hls.user),
getConfigListEntry(_("Password"), self._streamServerControl.config.streamserver.hls.password)
])
if config.usage.setup_level.index > 0:
entries.append(getConfigListEntry(_("Path"), self._streamServerControl.config.streamserver.hls.path))
if self._streamServerControl.isAnyEnabled():
entries.extend([
getConfigListEntry(_("Bitrates")),
getConfigListEntry(_("Audio Bitrate"),self. _streamServerControl.config.streamserver.audioBitrate),
getConfigListEntry(_("Video Bitrate"), self._streamServerControl.config.streamserver.videoBitrate),
getConfigListEntry(_("Basic Encoder Settings")),
getConfigListEntry(_("Data Source"), self._streamServerControl.config.streamserver.source),
getConfigListEntry(_("Resolution"), self._streamServerControl.config.streamserver.resolution),
getConfigListEntry(_("Framerate"), self._streamServerControl.config.streamserver.framerate),
getConfigListEntry(_("Expert Encoder Settings")),
getConfigListEntry(_("GOP Length (ms, P-Frames auto calculated)"), self._streamServerControl.config.streamserver.gopLength)
])
if self._streamServerControl.config.streamserver.gopLength.value == eStreamServer.GOP_LENGTH_AUTO:
entries.append( getConfigListEntry(_("Number of P-Frames"), self._streamServerControl.config.streamserver.pFrames) )
entries.append( getConfigListEntry(_("Number of B-Frames"), self._streamServerControl.config.streamserver.bFrames) )
if self._streamServerControl.config.streamserver.bFrames.value:
entries.append( getConfigListEntry(_("Open GOP"), self._streamServerControl.config.streamserver.openGop) )
if StreamServerControl.FEATURE_SCENE_DETECTION and not self._streamServerControl.config.streamserver.bFrames.value and not self._streamServerControl.config.streamserver.gopLength.value:
entries.append( getConfigListEntry(_("New GOP On Scene Change"), self._streamServerControl.config.streamserver.gopOnSceneChange) )
if StreamServerControl.FEATURE_SLICES:
entries.append( getConfigListEntry(_("Number of slices"), self._streamServerControl.config.streamserver.slices) )
entries.extend([
getConfigListEntry(_("Level"), self._streamServerControl.config.streamserver.level),
getConfigListEntry(_("Profile"), self._streamServerControl.config.streamserver.profile),
])
self["config"].list = entries
def _setInfoText(self):
detailtext =_("Local client(s):\n %s") %(self._clientCount)
self._details.setText(detailtext)
localstreams = []
if self._streamServerControl.config.streamserver.rtsp.enabled.value or self._streamServerControl.config.streamserver.hls.enabled.value:
ifaces = iNetworkInfo.getConfiguredInterfaces()
for iface in ifaces.itervalues():
ip = iface.getIpv4()
if not ip:
ip = iface.getIpv6()
if ip:
if self._streamServerControl.config.streamserver.rtsp.enabled.value:
localstreams.append("rtsp://%s:%s/%s" %(ip.getAddress(), self._streamServerControl.config.streamserver.rtsp.port.value, self._streamServerControl.config.streamserver.rtsp.path.value))
if self._streamServerControl.config.streamserver.hls.enabled.value:
localstreams.append("http://%s:%s/%s.m3u8" %(ip.getAddress(), self._streamServerControl.config.streamserver.hls.port.value, self._streamServerControl.config.streamserver.hls.path.value))
break
infotext = ""
if not localstreams:
infotext = _("no active streams...")
else:
infotext = "\n".join(localstreams)
self._info.setText(infotext)
def _showPresets(self):
presets = []
for preset in self.PRESETS:
presets.append((preset.name, preset))
current = self.PRESETS[0]
title = _("Video Bitrate:\t%s\nAudio Bitrate:\t%s\nResolution:\t%s") %(current.videoBitrate, current.audioBitrate, current.resolution)
self._presetChoiceBox = self.session.openWithCallback(self._onPresetSelected, ChoiceBox, title=title, titlebartext=_("Encoder Presets"), list=presets)
self._presetChoiceBox["list"].onSelectionChanged.append(self._onSelectedPresetChanged)
self._presetChoiceBox.onLayoutFinish.append(self._onSelectedPresetChanged)
def _onSelectedPresetChanged(self, *args):
if not self._presetChoiceBox:
return
current = self._presetChoiceBox["list"].getCurrent()
if not current:
return
current = current[0][1]
text = _("Video Bitrate:\t%s\nAudio Bitrate:\t%s\nResolution:\t%s") %(current.videoBitrate, current.audioBitrate, current.resolution)
self._presetChoiceBox["text"].setText(text)
def _onPresetSelected(self, choice):
self._presetChoiceBox = None
if choice:
preset = choice[1]
self._streamServerControl.config.streamserver.videoBitrate.value = preset.videoBitrate
self._streamServerControl.config.streamserver.audioBitrate.value = preset.audioBitrate
if preset.resolution != self._streamServerControl.config.streamserver.resolution.value:
self._streamServerControl.config.streamserver.resolution.value = preset.resolution
self._createSetup()
示例11: BrowserMenu
# 需要导入模块: from Components.Label import Label [as 别名]
# 或者: from Components.Label.Label import setText [as 别名]
#.........这里部分代码省略.........
self.__ckList = self.__db.getCookies()
def __action(self, action):
print "[BrowserMenu].__action :: action='%s'" %action
fnc = self.__actionFuncs[self.__curMenu].get(action, None)
if fnc != None:
fnc()
def __text(self):
if self.__curMenu == self.MENU_SETTINGS:
self.__cfgKeyText()
elif self.__curMenu == self.MENU_BOOKMARKS:
pass
def __keyNumberGlobal(self, number):
if self.__curMenu == self.MENU_SETTINGS:
self.__cfgKeyNumberGlobal(number)
elif self.__curMenu == self.MENU_BOOKMARKS:
self.__bmKeyNumberGlobal(number)
elif self.__curMenu == self.MENU_HISTORY:
self.__hisKeyNumberGlobal(number)
def __onMenuChanged(self):
self.__bmFilterTimer.stop()
self.__hisFilterTimer.stop()
self.__dlRefreshTimer.stop()
self.__curMenu = self.menu.getCurrent()[1]
if self.__curMenu == self.MENU_BOOKMARKS:
self.__showMenuList(True)
self.__setButtons(_("Delete"), _("Add"), _("Edit"), _("Set as Startpage"))
self.detailList.style = "default"
self.__bmBuildList()
self.detailInput.setText(self.__bmNeedle)
elif self.__curMenu == self.MENU_HISTORY:
self.__showMenuList(True)
self.__setButtons(_("Clear"), "", "", _("Set as Startpage"))
self.detailList.style = "history"
self.__hisBuildList()
self.detailInput.setText(self.__hisNeedle)
elif self.__curMenu == self.MENU_SETTINGS:
self.__showConfigList()
self.__setButtons(_("Cancel"), _("Save"), "", "")
elif self.__curMenu == self.MENU_DOWNLOADS:
self.__showMenuList()
self.__setButtons(_("Abort"), "", "", "")
self.detailList.style = "downloads"
self.__dlBuildList()
elif self.__curMenu == self.MENU_CERTS:
self.__showMenuList()
self.__setButtons(_("Delete"), _("Details"), "", "")
self.detailList.style = "certificates"
self.__crtBuildList()
elif self.__curMenu == self.MENU_COOKIES:
self.__showMenuList()
self.__setButtons(_("Delete"), "", "", _("Delete All"))
self.detailList.style = "cookies"
self.__ckBuildList()
def __setButtons(self, red, green, yellow, blue):
self.red.setText(red)
self.__setButtonPixmapVisible(self["button_red"], red)
self.green.setText(green)
self.__setButtonPixmapVisible(self["button_green"], green)
self.yellow.setText(yellow)
self.__setButtonPixmapVisible(self["button_yellow"], yellow)
示例12: SerienRecorderUpdateScreen
# 需要导入模块: from Components.Label import Label [as 别名]
# 或者: from Components.Label.Label import setText [as 别名]
class SerienRecorderUpdateScreen(Screen):
DESKTOP_WIDTH = getDesktop(0).size().width()
DESKTOP_HEIGHT = getDesktop(0).size().height()
skin = """
<screen name="SerienRecorderUpdate" position="%d,%d" size="720,320" title="%s" backgroundColor="#26181d20" flags="wfNoBorder">
<widget name="srlog" position="5,5" size="710,310" font="Regular;18" valign="center" halign="center" foregroundColor="white" transparent="1" zPosition="5"/>
<widget name="activityslider" position="5,280" size="710,25" borderWidth="1" transparent="1" zPosition="4"/>
<widget name="status" position="30,280" size="660,25" font="Regular;20" valign="center" halign="center" foregroundColor="#00808080" transparent="1" zPosition="6"/>
</screen>""" % ((DESKTOP_WIDTH - 720) / 2, (DESKTOP_HEIGHT - 320) / 2, _("SerienRecorder Update"))
def __init__(self, session, updateurl, version):
from Components.Slider import Slider
self.session = session
Screen.__init__(self, session)
self.target = updateurl
self.version = version
self.file_name = "/tmp/%s" % self.target.split('/')[-1]
self.fileSize = 5 * 1024
self.downloadDone = False
self.container = eConsoleAppContainer()
self.appClosed_conn = None
self.stdoutAvail_conn = None
self['srlog'] = Label()
self.status = Label(_("Preparing... Please wait"))
self['status'] = self.status
self.activityslider = Slider(0, 100)
self['activityslider'] = self.activityslider
self.activity = 0
self.activityTimer = eTimer()
if isDreamboxOS:
self.activityTimerConnection = self.activityTimer.timeout.connect(self.doActivityTimer)
else:
self.activityTimer.callback.append(self.doActivityTimer)
self.onLayoutFinish.append(self.__onLayoutFinished)
def doActivityTimer(self):
if self.downloadDone:
self.activity += 1
if self.activity == 101:
self.activity = 1
else:
if os.path.exists(self.file_name):
kBbytesDownloaded = int(os.path.getsize(self.file_name) / 1024)
else:
kBbytesDownloaded = 0
self.activity = int(kBbytesDownloaded * 100 / self.fileSize)
self.status.setText("%s / %s kB (%s%%)" % (kBbytesDownloaded, self.fileSize, self.activity))
self.activityslider.setValue(self.activity)
def startActivityTimer(self):
self.activityTimer.start(100, False)
def stopActivityTimer(self):
self.activityTimer.stop()
if self.activityTimer:
self.activityTimer.stop()
self.activityTimer = None
if isDreamboxOS:
self.activityTimerConnection = None
def __onLayoutFinished(self):
sl = self['srlog']
sl.instance.setZPosition(5)
getPage(str(self.target.replace("/download/", "/tag/").rsplit('/', 1)[0]), timeout=WebTimeout, agent=getUserAgent(), headers={'Content-Type':'application/x-www-form-urlencoded'}).addCallback(self.getFileSize).addErrback(self.downloadError)
self['srlog'].setText(_("Download wurde gestartet, bitte warten..."))
self.activityslider.setValue(0)
self.startActivityTimer()
if fileExists(self.file_name):
os.remove(self.file_name)
downloadPage(self.target, self.file_name).addCallback(self.downloadFinished).addErrback(self.downloadError)
def getFileSize(self, data):
if isDreamboxOS:
raw = re.findall('<a href="/einfall/serienrecorder/releases/download/v.*?/enigma2-plugin-extensions-serienrecorder_.*?_all.deb".*?aria-label="(.*?)">enigma2-plugin-extensions-serienrecorder_.*?_all.deb</span>',data,re.S)
else:
raw = re.findall('<a href="/einfall/serienrecorder/releases/download/v.*?/enigma2-plugin-extensions-serienrecorder_.*?_all.ipk".*?aria-label="(.*?)">enigma2-plugin-extensions-serienrecorder_.*?_all.ipk</span>',data,re.S)
if len(raw):
self.fileSize = int(float(raw[0].replace("MB", "").strip()) * 1024.0)
else:
self.fileSize = 5 * 1024
def downloadFinished(self, data):
self.downloadDone = True
self.activity = 0
self.status.setText("")
if fileExists(self.file_name):
self['srlog'].setText("Starte Update, bitte warten...")
if isDreamboxOS:
#.........这里部分代码省略.........
示例13: setText
# 需要导入模块: from Components.Label import Label [as 别名]
# 或者: from Components.Label.Label import setText [as 别名]
def setText(self, text):
text = (self.displayLength * " ") + text
self.longText = text
self.offset = 0
Label.setText(self, text[: self.displayLength].encode("utf-8", "ignore"))
示例14: BrowserLauncher
# 需要导入模块: from Components.Label import Label [as 别名]
# 或者: from Components.Label.Label import setText [as 别名]
#.........这里部分代码省略.........
if self.usb_mouse is not None:
tmp.insert(0, ("musb", "USB Mouse"))
if self.rc_mouse is not None:
tmp.insert(0, ("mrc", "Remote Control"))
self.mouse_list = tmp
tmp = copy.deepcopy(event_list)
if self.usb_keyboard is not None:
tmp.insert(0, ("kusb", "USB Keyboard"))
if self.rc_keyboard is not None:
tmp.insert(0, ("krc", "Remote Control"))
self.keyboard_list = tmp
print "E:", event_list
print "M:", self.mouse_list
print "K:", self.keyboard_list
def startBrowser(self):
self.timer_start.stop()
self.lock = True
excute_cmd("killall -15 %s"%(self.browser_name))
excute_cmd("echo 0 > /proc/sys/vm/swappiness")
kbd_cmd = " "
mouse_cmd = " "
extra_cmd = " "
browser_cmd = "%s/%s -qws" % (self.browser_root, self.browser_name)
mouse_param = self.mouse.value
if self.mouse.value == "mrc":
mouse_param = self.rc_mouse
elif self.mouse.value == "musb":
mouse_param = self.usb_mouse
keyboard_param = self.keyboard.value
if self.keyboard.value == "krc":
keyboard_param = self.rc_keyboard
elif self.keyboard.value == "kusb":
keyboard_param = self.usb_keyboard
if self.getHandlerName(mouse_param)[1:].startswith("dreambox"):
enable_rc_mouse(True) #rc-mouse on
if str(mouse_param).startswith("event"):
mouse_cmd = "export QWS_MOUSE_PROTO=LinuxInput:/dev/input/%s; " % (str(mouse_param))
keymap_param = ""
if self.langs.value == "de":
keymap_param = ":keymap=/usr/share/keymaps/player/de.qmap"
kbd_cmd = "export QWS_KEYBOARD=LinuxInput:/dev/input/%s%s; " % (str(keyboard_param), keymap_param)
cmd = "%s%s%s%s" % (extra_cmd, kbd_cmd, mouse_cmd, browser_cmd)
print "prepared command : [%s]" % cmd
self.launcher = eConsoleAppContainer()
self.launcher.appClosed.append(self.callbackLauncherAppClosed)
self.launcher.dataAvail.append(self.callbackLauncherDataAvail)
fbClass.getInstance().lock()
#eRCInput.getInstance().lock()
global alpha_value
alpha_value = self.alpha.value
change_galpha(set_const=True, set_value=True)
self.launcher.execute(cmd)
print "started browser..."
def keyGo(self):
self.saveConfig()
self.info.setText("Starting Webbrowser. Please wait...")
if self.lock == False:
if self.langs.value == "de":
language.activateLanguageIndex(1)
else:
language.activateLanguageIndex(0)
self.timer_start = eTimer()
self.timer_start.callback.append(self.startBrowser)
self.timer_start.start(10)
def getHandlerName(self, v):
if v == "mrc":
v = self.rc_mouse
elif v == "musb":
v = self.usb_mouse
elif v == "krc":
v = self.rc_keyboard
elif v == "kusb":
v = self.usb_keyboard
for l in self.name_list:
if l[0] == v:
return l[1]
return None
def callbackLauncherDataAvail(self, ret_data):
print ret_data
if ret_data.startswith("--done--"):
self.lock = False
self.doExit()
def callbackLauncherAppClosed(self, retval = 1):
self.lock = False