本文整理汇总了Python中Components.Label.Label类的典型用法代码示例。如果您正苦于以下问题:Python Label类的具体用法?Python Label怎么用?Python Label使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Label类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: applySkin
def applySkin(self, desktop, parent):
# testInstance = self.GUI_WIDGET(parent)
testInstance = self.testInstance
testInstance.hide()
testSkinAttributes = []
if self.skinAttributes:
for (attrib, value) in self.skinAttributes:
if attrib == 'size':
x, y = value.split(',')
x = '2000'
new_value = x + ',' + y
testSkinAttributes.append((attrib, new_value))
else:
testSkinAttributes.append((attrib, value))
skin.applyAllAttributes(testInstance, desktop, testSkinAttributes, parent.scale)
Label.applySkin(self, desktop, parent)
maxWidth = self.instance.size().width()
# some random text
text = 'DSADJASNKDNSJANDJKSANDJKSANDNASJKNDSJKANDJKSANDJKAS'
text += 'FDSFDSFDSFDSFDSFDSFDSFDSFDSFDSFDSFDSFDSFDSFSDFDSFDS'
text += 'FDSFDSFDSFDSFDSFDSFDSFDSFDSFDSFDSFDSFDSFDSFSDFDSFDS'
text += 'FDSFDSFDSFDSFDSFDSFDSFDSFDSFDSFDSFDSFDSFDSFSDFDSFDS'
testInstance.setText(text)
actWidth = testInstance.calculateSize().width()
pixsPerChar = float(actWidth) / float(len(text))
print actWidth, '/', len(text), '=', pixsPerChar
print maxWidth
if pixsPerChar > 0:
self.maxChars = int(maxWidth / pixsPerChar)
print self.maxChars
示例2: __init__
def __init__(self, text, cutLeft=True, replaceChar='.', replaceCharNum=4):
self.maxChars = 9999
self.cutLeft = cutLeft
self.replaceChar = replaceChar
self.replaceCharNum = replaceCharNum
self.testInstance = None
Label.__init__(self, text)
示例3: __init__
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.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)
示例4: __init__
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.ipkg = IpkgComponent()
self.ipkg.addCallback(self.ipkgCallback)
self.runningCmd = None
self.runNextCmd()
self['actions'] = ActionMap(['WizardActions'], {'ok': self.exit,
'back': self.exit}, -1)
return
示例5: __init__
def __init__(self,session):
Label.__init__(self,text=Channel)
self.timer=eTimer()
self.timer_conn = self.timer.timeout.connect(self.updateChanName)
self.timer.start(500)
self.oldname=self.text
self.pipe=MessagePipe()
示例6: __init__
def __init__(self, text=""):
self.offset = 0
self.displayLength = 100
Label.__init__(self, text)
self.moveTimer = eTimer()
self.moveTimer_conn = self.moveTimer.timeout.connect(self.doMove)
示例7: __init__
def __init__(self, text=""):
self.offset = 0
self.displayLength = 100
Label.__init__(self, text)
self.moveTimer = eTimer()
self.moveTimer.callback.append(self.doMove)
示例8: setText
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)
示例9: doMove
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()
示例10: __init__
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)
示例11: __init__
def __init__(self, session, args = 0):
self.session = session
Screen.__init__(self, session)
self["setupActions"] = ActionMap(["SetupActions", "ColorActions"],
{
"cancel": self.cancel,
"ok": self.keyOk,
}, -2)
self.setTitle(_("UserSkin %s") % UserSkinInfo)
self['skininfo'] = Label("")
if path.exists(SkinPath + 'skin.config'):
with open(SkinPath + 'skin.config', "r") as f:
for line in f:
if line.startswith('description='):
self['skininfo'].text = line.split('=')[1].replace('"','').replace("'","").strip()
break
f.close()
示例12: __init__
def __init__(self, session, picPath = None):
Screen.__init__(self, session)
print '[sfteambckScreen] __init__\n'
self.picPath = picPath
self.Scale = AVSwitch().getFramebufferScale()
self.PicLoad = ePicLoad()
self['sftPic'] = Pixmap()
self['information'] = Label('')
self['information'].text = _('\n\n\n\nInstructions\n------------------------------\n\n1) Mount HDD in your receiver\n2) En caso necesario monte como HDD pulsando boton azul\n3) Click OK to start the process')
self['actions'] = ActionMap(['OkCancelActions', 'ColorActions'], {'cancel': self.cancel,
'blue': self.mount,
'green': self.preHaceBackup,
'red': self.cancel}, -1)
self['key_red'] = Label(_('Cancel'))
self['key_green'] = Label(_('OK'))
self['key_blue'] = Label(_('Mount'))
self.PicLoad.PictureData.get().append(self.DecodePicture)
self.onLayoutFinish.append(self.ShowPicture)
示例13: __init__
def __init__(self, session):
Screen.__init__(self, session)
ConfigListScreen.__init__(self, [], session=session)
self._streamServerControl = streamServerControl
self._upstreamBitrate = 0
self._clientCount = streamServerControl.rtspClientCount
self._key_blue = StaticText("")
self["key_blue"] = self._key_blue
self["key_yellow"] = StaticText(_("Presets"))
self._info = Label("")
self["info"] = self._info
self["details_label"] = Label(_("Status Detail"))
self._details = Label(_("No details available..."))
self["details"] = self._details
self._detailsHint = Label("Press PVR in channel selection to change the service in background mode")
self["details_hint"] = self._detailsHint
if not self._setInfoText in self["config"].onSelectionChanged:
self["config"].onSelectionChanged.append(self._setInfoText)
self._closeAfterApply = False
self._presetChoiceBox = None
self["setupActions"] = ActionMap(["OkCancelActions", "ColorActions"],
{
"blue": self.apply,
"yellow": self._showPresets,
"cancel": self._applyAndClose,
"ok" : self._applyAndClose,
}, -2)
self.setTitle(_("Streaming Server"))
streamServerControl.onRtspClientCountChanged.append(self._onRtspClientCountChanged)
self._streamServerControl.config.streamserver.rtsp.enabled.addNotifier(self._onEnabled, initial_call=False)
self._streamServerControl.config.streamserver.hls.enabled.addNotifier(self._onEnabled, initial_call=False)
self._streamServerControl.config.streamserver.gopLength.addNotifier(self._onGopLengthChanged, initial_call=False)
self._streamServerControl.config.streamserver.bFrames.addNotifier(self._onBframesChanged, initial_call=False)
self._createSetup()
示例14: __init__
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)
示例15: applySkin
def applySkin(self, desktop, screen):
if self.skinAttributes is not None:
attribs = []
append = attribs.append
for attrib, value in self.skinAttributes:
if attrib == "displayLength":
self.displayLength = int(value)
else:
append((attrib, value))
self.skinAttributes = attribs
return Label.applySkin(self, desktop, screen)