本文整理汇总了Python中skin.applyAllAttributes函数的典型用法代码示例。如果您正苦于以下问题:Python applyAllAttributes函数的具体用法?Python applyAllAttributes怎么用?Python applyAllAttributes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了applyAllAttributes函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: applySkin
def applySkin(self):
self.skin_title = ""
z = 0
baseres = (720, 576) # FIXME: a skin might have set another resolution, which should be the base res
idx = 0
skin_title_idx = -1
title = self.title
for (key, value) in self.skinAttributes:
if key == "zPosition":
z = int(value)
elif key == "title":
self.skin_title = value
skin_title_idx = idx
if title:
self.skinAttributes[skin_title_idx] = ("title", title)
else:
self["Title"].text = value
self.summaries.setTitle(value)
elif key == "baseResolution":
baseres = tuple([int(x) for x in value.split(',')])
idx += 1
self.scale = ((baseres[0], baseres[0]), (baseres[1], baseres[1]))
if not self.instance:
from enigma import eWindow
self.instance = eWindow(self.desktop, z)
if skin_title_idx == -1 and title:
self.skinAttributes.append(("title", title))
# we need to make sure that certain attributes come last
self.skinAttributes.sort(key=lambda a: {"position": 1}.get(a[0], 0))
applyAllAttributes(self.instance, self.desktop, self.skinAttributes, self.scale)
self.createGUIScreen(self.instance, self.desktop)
开发者ID:Atsilla,项目名称:enigma2-openpli-fulan,代码行数:35,代码来源:GUISkin.py
示例2: 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
开发者ID:easyspider,项目名称:archivczsk,代码行数:32,代码来源:common.py
示例3: createGUIScreen
def createGUIScreen(self, parent, desktop, updateonly = False):
for val in self.renderer:
if isinstance(val, GUIComponent):
if not updateonly:
val.GUIcreate(parent)
if not val.applySkin(desktop, self):
print "warning, skin is missing renderer", val, "in", self
for key in self:
val = self[key]
if isinstance(val, GUIComponent):
if not updateonly:
val.GUIcreate(parent)
depr = val.deprecationInfo
if val.applySkin(desktop, self):
if depr:
print "WARNING: OBSOLETE COMPONENT '%s' USED IN SKIN. USE '%s' INSTEAD!" % (key, depr[0])
print "OBSOLETE COMPONENT WILL BE REMOVED %s, PLEASE UPDATE!" % (depr[1])
elif not depr:
print "warning, skin is missing element", key, "in", self
for w in self.additionalWidgets:
if not updateonly:
w.instance = w.widget(parent)
# w.instance.thisown = 0
applyAllAttributes(w.instance, desktop, w.skinAttributes, self.scale)
for f in self.onLayoutFinish:
if type(f) is not type(self.close): # is this the best way to do this?
exec(f) in globals(), locals()
else:
f()
开发者ID:Atsilla,项目名称:enigma2-openpli-fulan,代码行数:32,代码来源:GUISkin.py
示例4: applySkin
def applySkin(self):
z = 0
baseres = (720, 576)
idx = 0
skin_title_idx = -1
title = self.title
for key, value in self.skinAttributes:
if key == 'zPosition':
z = int(value)
elif key == 'title':
skin_title_idx = idx
if title:
self.skinAttributes[skin_title_idx] = ('title', title)
else:
self['Title'].text = value
self.summaries.setTitle(value)
elif key == 'baseResolution':
baseres = tuple([ int(x) for x in value.split(',') ])
idx += 1
self.scale = ((baseres[0], baseres[0]), (baseres[1], baseres[1]))
if not self.instance:
from enigma import eWindow
self.instance = eWindow(self.desktop, z)
if skin_title_idx == -1 and title:
self.skinAttributes.append(('title', title))
self.skinAttributes.sort(key=lambda a: {'position': 1}.get(a[0], 0))
applyAllAttributes(self.instance, self.desktop, self.skinAttributes, self.scale)
self.createGUIScreen(self.instance, self.desktop)
开发者ID:sodo13,项目名称:EG-gui,代码行数:29,代码来源:GUISkin.py
示例5: applySkin
def applySkin(self, desktop, parent):
attribs = []
longtext_attribs = []
for attrib, value in self.skinAttributes:
if attrib.find('step') != -1:
self.step = int(value)
if attrib.find('steptime') != -1:
self.steptime = int(value)
if attrib.find('startdelay') != -1:
self.startdelay = int(value)
if attrib.find('font') != -1 or attrib.find('size') != -1 or attrib.find('zPosition') != -1 or attrib.find('transparent') != -1 or attrib.find('backgroundColor') != -1 or attrib.find('foregroundColor') != -1 or attrib.find('valign') != -1 or attrib.find('halign') != -1:
longtext_attribs.append((attrib, value))
if attrib != 'font' and attrib != 'valign' and attrib != 'halign' and attrib != 'foregroundColor' and attrib != 'step' and attrib != 'steptime' and attrib != 'startdelay' and attrib != 'css':
attribs.append((attrib, value))
if attrib.find('css') != -1:
from skin import cascadingStyleSheets
styles = value.split(',')
for style in styles:
for _attrib in cascadingStyleSheets[style].keys():
_value = cascadingStyleSheets[style][_attrib]
if _attrib.find('step') != -1:
self.step = int(_value)
if _attrib.find('steptime') != -1:
self.steptime = int(_value)
if _attrib.find('startdelay') != -1:
self.startdelay = int(_value)
if _attrib.find('font') != -1 or _attrib.find('size') != -1 or _attrib.find('zPosition') != -1 or _attrib.find('transparent') != -1 or _attrib.find('backgroundColor') != -1 or _attrib.find('foregroundColor') != -1 or _attrib.find('valign') != -1 or _attrib.find('halign') != -1:
longtext_attribs.append((_attrib, _value))
if _attrib != 'font' and _attrib != 'valign' and _attrib != 'halign' and _attrib != 'foregroundColor' and _attrib != 'step' and _attrib != 'steptime' and _attrib != 'startdelay':
attribs.append((_attrib, _value))
skin.applyAllAttributes(self.long_text, desktop, longtext_attribs, parent.scale)
self.long_text.move(ePoint(0, 0))
self.skinAttributes = attribs
return Renderer.applySkin(self, desktop, parent)
开发者ID:bruco72,项目名称:Metropolis2HD,代码行数:35,代码来源:ScrollLabel.py
示例6: applySkin
def applySkin(self, desktop, parent):
if not self.visible:
self.instance.hide()
if self.skinAttributes is None:
return False
skin.applyAllAttributes(self.instance, desktop, self.skinAttributes, parent.scale)
return True
开发者ID:sodo13,项目名称:EG-gui,代码行数:7,代码来源:GUIComponent.py
示例7: applySkin
def applySkin(self, desktop, parent):
scrollbarWidth = 20
scrollbarBorderWidth = 1
ret = False
if self.skinAttributes:
widget_attribs = []
scrollbar_attribs = []
for (attrib, value) in self.skinAttributes:
if "borderColor" in attrib or "borderWidth" in attrib:
scrollbar_attribs.append((attrib,value))
if "transparent" in attrib or "backgroundColor" in attrib:
widget_attribs.append((attrib,value))
if "scrollbarSliderForegroundColor" in attrib:
scrollbar_attribs.append((attrib,value))
self.skinAttributes.remove((attrib, value))
if "scrollbarSliderBorderColor" in attrib:
scrollbar_attribs.append((attrib,value))
self.skinAttributes.remove((attrib, value))
if "scrollbarSliderPicture" in attrib:
scrollbar_attribs.append((attrib,value))
self.skinAttributes.remove((attrib, value))
if "scrollbarBackgroundPicture" in attrib:
scrollbar_attribs.append((attrib,value))
self.skinAttributes.remove((attrib, value))
if "scrollbarWidth" in attrib:
scrollbarWidth = int(value)
self.skinAttributes.remove((attrib, value))
if "scrollbarSliderBorderWidth" in attrib:
scrollbarBorderWidth = int(value)
self.skinAttributes.remove((attrib, value))
if "split" in attrib:
self.split = int(value)
if self.split:
self.right_text = eLabel(self.instance)
self.skinAttributes.remove((attrib, value))
if "colposition" in attrib:
self.column = int(value)
if "dividechar" in attrib:
self.splitchar = value
if self.split:
skin.applyAllAttributes(self.long_text, desktop, self.skinAttributes + [("halign", "left")], parent.scale)
skin.applyAllAttributes(self.right_text, desktop, self.skinAttributes + [("transparent", "1"), ("halign", "left" if self.column else "right")], parent.scale)
else:
skin.applyAllAttributes(self.long_text, desktop, self.skinAttributes, parent.scale)
skin.applyAllAttributes(self.instance, desktop, widget_attribs, parent.scale)
skin.applyAllAttributes(self.scrollbar, desktop, scrollbar_attribs + widget_attribs, parent.scale)
ret = True
self.pageWidth = self.long_text.size().width()
lineheight = fontRenderClass.getInstance().getLineHeight(self.long_text.getFont()) or 30 # assume a random lineheight if nothing is visible
lines = int(self.long_text.size().height() / lineheight)
self.pageHeight = int(lines * lineheight)
self.instance.move(self.long_text.position())
self.instance.resize(eSize(self.pageWidth, self.pageHeight + int(lineheight/6)))
self.scrollbar.move(ePoint(self.pageWidth - scrollbarWidth, 0))
self.scrollbar.resize(eSize(scrollbarWidth, self.pageHeight + int(lineheight / 6)))
self.scrollbar.setOrientation(eSlider.orVertical)
self.scrollbar.setRange(0, 100)
self.scrollbar.setBorderWidth(scrollbarBorderWidth)
self.setText(self.message)
return ret
开发者ID:openNSS,项目名称:enigma2,代码行数:60,代码来源:ScrollLabel.py
示例8: applySkin
def applySkin(self, desktop):
skin.applyAllAttributes(self.long_text, desktop, self.skinAttributes)
s = self.long_text.size()
self.instance.move(self.long_text.position())
lineheight = fontRenderClass.getInstance().getLineHeight(self.long_text.getFont())
lines = int(s.height() / lineheight)
self.pageHeight = int(lines * lineheight)
self.instance.resize(eSize(s.width(), self.pageHeight + int(lineheight / 6)))
self.scrollbar.move(ePoint(s.width() - 20, 0))
self.scrollbar.resize(eSize(20, self.pageHeight + int(lineheight / 6)))
self.scrollbar.setOrientation(eSlider.orVertical)
self.scrollbar.setRange(0, 100)
self.scrollbar.setBorderWidth(1)
self.long_text.move(ePoint(0, 0))
self.long_text.resize(eSize(s.width() - 30, self.pageHeight * 16))
self.setText(self.message)
开发者ID:Linux-Box,项目名称:LBpanel,代码行数:16,代码来源:TraceLabel.py
示例9: applySkin
def applySkin(self, desktop, parent):
ret = False
if self.skinAttributes is not None:
widget_attribs = []
scrollbar_attribs = []
for attrib, value in self.skinAttributes:
if 'borderColor' in attrib or 'borderWidth' in attrib:
scrollbar_attribs.append((attrib, value))
if 'transparent' in attrib or 'backgroundColor' in attrib:
widget_attribs.append((attrib, value))
if 'split' in attrib:
self.split = int(value)
if self.split:
self.right_text = eLabel(self.instance)
if 'colposition' in attrib:
self.column = int(value)
if 'dividechar' in attrib:
self.splitchar = value
if self.split:
skin.applyAllAttributes(self.long_text, desktop, self.skinAttributes + [('halign', 'left')], parent.scale)
skin.applyAllAttributes(self.right_text, desktop, self.skinAttributes + [('transparent', '1'), ('halign', 'left' and self.column or 'right')], parent.scale)
else:
skin.applyAllAttributes(self.long_text, desktop, self.skinAttributes, parent.scale)
skin.applyAllAttributes(self.instance, desktop, widget_attribs, parent.scale)
skin.applyAllAttributes(self.scrollbar, desktop, scrollbar_attribs + widget_attribs, parent.scale)
ret = True
s = self.long_text.size()
self.instance.move(self.long_text.position())
lineheight = fontRenderClass.getInstance().getLineHeight(self.long_text.getFont())
if not lineheight:
lineheight = 30
lines = int(s.height() / lineheight)
self.pageHeight = int(lines * lineheight)
self.instance.resize(eSize(s.width(), self.pageHeight + int(lineheight / 6)))
self.scrollbar.move(ePoint(s.width() - 10, 0))
self.scrollbar.resize(eSize(10, self.pageHeight + int(lineheight / 6)))
self.scrollbar.setOrientation(eSlider.orVertical)
self.scrollbar.setRange(0, 100)
self.scrollbar.setBorderWidth(1)
self.long_text.move(ePoint(0, 0))
self.long_text.resize(eSize(s.width() - 30, self.pageHeight * 40))
if self.split:
self.right_text.move(ePoint(self.column, 0))
self.right_text.resize(eSize(s.width() - self.column - 30, self.pageHeight * 40))
self.setText(self.message)
return ret
开发者ID:kingvuplus,项目名称:boom,代码行数:47,代码来源:ScrollLabel.py
示例10: applySkin
def applySkin(self, desktop, parent):
ret = False
if self.skinAttributes is not None:
widget_attribs = [ ]
scrollbar_attribs = [ ]
for (attrib, value) in self.skinAttributes:
if "borderColor" in attrib or "borderWidth" in attrib:
scrollbar_attribs.append((attrib,value))
if "transparent" in attrib or "backgroundColor" in attrib:
widget_attribs.append((attrib,value))
if "split" in attrib:
self.split = int(value)
if self.split:
self.right_text = eLabel(self.instance)
if "colposition" in attrib:
self.column = int(value)
if "dividechar" in attrib:
self.splitchar = value
if self.split:
skin.applyAllAttributes(self.long_text, desktop, self.skinAttributes + [("halign", "left")], parent.scale)
skin.applyAllAttributes(self.right_text, desktop, self.skinAttributes + [("transparent", "1"), ("halign", "left" and self.column or "right")], parent.scale)
else:
skin.applyAllAttributes(self.long_text, desktop, self.skinAttributes, parent.scale)
skin.applyAllAttributes(self.instance, desktop, widget_attribs, parent.scale)
skin.applyAllAttributes(self.scrollbar, desktop, scrollbar_attribs+widget_attribs, parent.scale)
ret = True
s = self.long_text.size()
self.instance.move(self.long_text.position())
lineheight=fontRenderClass.getInstance().getLineHeight( self.long_text.getFont() )
if not lineheight:
lineheight = 30 # assume a random lineheight if nothing is visible
lines = (int)(s.height() / lineheight)
self.pageHeight = (int)(lines * lineheight)
self.instance.resize(eSize(s.width(), self.pageHeight+(int)(lineheight/6)))
self.scrollbar.move(ePoint(s.width()-20,0))
self.scrollbar.resize(eSize(20,self.pageHeight+(int)(lineheight/6)))
self.scrollbar.setOrientation(eSlider.orVertical);
self.scrollbar.setRange(0,100)
self.scrollbar.setBorderWidth(1)
self.long_text.move(ePoint(0,0))
self.long_text.resize(eSize(s.width()-30, self.pageHeight*16))
if self.split:
self.right_text.move(ePoint(self.column,0))
self.right_text.resize(eSize(s.width()-self.column-30, self.pageHeight*16))
self.setText(self.message)
return ret
开发者ID:Brainbuster,项目名称:stb-gui,代码行数:46,代码来源:ScrollLabel.py
示例11: applySkin
def applySkin(self):
z = 0
title = ""
baseres = (720, 576) # FIXME: a skin might have set another resolution, which should be the base res
for (key, value) in self.skinAttributes:
if key == "zPosition":
z = int(value)
elif key == "title":
title = value
elif key == "baseResolution":
baseres = tuple([int(x) for x in value.split(',')])
self.scale = ((baseres[0], baseres[0]), (baseres[1], baseres[1]))
if not self.instance:
from enigma import eWindow
self.instance = eWindow(self.desktop, z)
self.title = title
applyAllAttributes(self.instance, self.desktop, self.skinAttributes, self.scale)
self.createGUIScreen(self.instance, self.desktop)
开发者ID:TitanNit,项目名称:tdt,代码行数:19,代码来源:GUISkin.py
示例12: applySkin
def applySkin(self, desktop, parent):
if not self.visible:
self.instance.hide()
if self.skinAttributes is None:
return False
scale = ((1,1),(1,1))
toremove = []
for (attrib, value) in self.skinAttributes:
#print 'Tabs - processing %r, %r'%(attrib, value)
if attrib == 'size':
size = parseSize(value, scale, self.instance, desktop)
self.params['size'] = (size.width(), size.height())
elif attrib == 'position':
position = parsePosition(value, scale, self.instance, desktop)
self.params['position'] = (position.x(), position.y())
elif attrib in ('spaceWidth',
'spaceHeight'):
self.params[attrib] = int(value)
toremove.append((attrib, value))
elif attrib == 'tab_size':
size = parseSize(value, scale, self.instance, desktop)
self.tab_params['size'] = (size.width(), size.height())
toremove.append((attrib, value))
elif attrib in ('tab_valign',
'tab_halign',
'tab_fontActive',
'tab_fontInactive',
'tab_foregroundColorActive',
'tab_foregroundColorInactive',
'tab_backgroundColorActive',
'tab_backgroundColorInactive'):
self.tab_params[attrib[4:]] = value
toremove.append((attrib, value))
for item in toremove:
self.skinAttributes.remove(item)
skin.applyAllAttributes(self.instance, desktop, self.skinAttributes, parent.scale)
self.initList()
return True
开发者ID:mx3L,项目名称:archivczsk,代码行数:42,代码来源:common.py
示例13: applySkin
def applySkin(self, desktop, parent):
ret = False
if self.skinAttributes is not None:
skin.applyAllAttributes(self.long_text, desktop, self.skinAttributes, parent.scale)
widget_attribs = [ ]
scrollbar_attribs = [ ]
for (attrib, value) in self.skinAttributes:
if attrib.find("borderColor") != -1 or attrib.find("borderWidth") != -1:
scrollbar_attribs.append((attrib,value))
if attrib.find("transparent") != -1 or attrib.find("backgroundColor") != -1:
widget_attribs.append((attrib,value))
skin.applyAllAttributes(self.instance, desktop, widget_attribs, parent.scale)
skin.applyAllAttributes(self.scrollbar, desktop, scrollbar_attribs+widget_attribs, parent.scale)
ret = True
s = self.long_text.size()
self.instance.move(self.long_text.position())
lineheight=fontRenderClass.getInstance().getLineHeight( self.long_text.getFont() )
if not lineheight:
lineheight = 30 # assume a random lineheight if nothing is visible
lines = (int)(s.height() / lineheight)
self.pageHeight = (int)(lines * lineheight)
self.instance.resize(eSize(s.width(), self.pageHeight+(int)(lineheight/6)))
scrollbarwidth, scrollbarborderwidth = self.scrollbar.updateScrollLabelProperties(20, 1)
self.scrollbar.move(ePoint(s.width()-scrollbarwidth,0))
self.scrollbar.resize(eSize(scrollbarwidth,self.pageHeight+(int)(lineheight/6)))
self.scrollbar.setOrientation(eSlider.orVertical);
self.scrollbar.setRange(0,100)
self.scrollbar.setBorderWidth(scrollbarborderwidth)
self.long_text.move(ePoint(0,0))
self.long_text.resize(eSize(s.width()-scrollbarwidth-10, self.pageHeight*16))
self.setText(self.message)
return ret
开发者ID:st7TEAM,项目名称:dreambox,代码行数:34,代码来源:ScrollLabel.py
示例14: applySkin
def applySkin(self, desktop, parent):
ret = False
if self.skinAttributes is not None:
skin.applyAllAttributes(self.long_text, desktop, self.skinAttributes, parent.scale)
widget_attribs = [ ]
scrollbar_attribs = [ ]
for (attrib, value) in self.skinAttributes:
if "borderColor" in attrib or "borderWidth" in attrib:
scrollbar_attribs.append((attrib,value))
if "transparent" in attrib or "backgroundColor" in attrib:
widget_attribs.append((attrib,value))
skin.applyAllAttributes(self.instance, desktop, widget_attribs, parent.scale)
skin.applyAllAttributes(self.scrollbar, desktop, scrollbar_attribs+widget_attribs, parent.scale)
ret = True
s = self.long_text.size()
self.instance.move(self.long_text.position())
lineheight=fontRenderClass.getInstance().getLineHeight( self.long_text.getFont() )
if not lineheight:
lineheight = 30 # assume a random lineheight if nothing is visible
lines = int(s.height() / lineheight)
self.pageHeight = int(lines * lineheight)
self.instance.resize(eSize(s.width(), self.pageHeight+ int(lineheight/6)))
self.scrollbar.move(ePoint(s.width()-10,0))
self.scrollbar.resize(eSize(10,self.pageHeight+ int(lineheight/6)))
self.scrollbar.setOrientation(eSlider.orVertical)
self.scrollbar.setRange(0,100)
self.scrollbar.setBorderWidth(1)
self.long_text.move(ePoint(0,0))
self.long_text.resize(eSize(s.width()-30, self.pageHeight*40))
self.setText(self.message)
return ret
开发者ID:1198s,项目名称:enigma2,代码行数:31,代码来源:ScrollLabel.py
注:本文中的skin.applyAllAttributes函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论