Exemple #1
0
    def spreadSingleAttribute(self, skinAttributes):
        for attrib, value in skinAttributes:
            if attrib == 'step':
                self.step = int(value)
            elif attrib == 'steptime':
                self.steptime = int(value)
            elif attrib == 'position':
                self._position = parsePosition(value, ((1, 1), (1, 1)))
                self.widget_attribs.append((attrib, value))
            elif attrib == 'size':
                self._size = parseSize(value, ((1, 1), (1, 1)))
                self.longtext_attribs.append((attrib, value))
            elif attrib == 'startdelay':
                if value.startswith('config.'):
                    value = int(configfile.getResolvedKey(value)) * 1000
                self.startdelay = int(value)
            elif attrib == 'animation':
                self.animationScreen = True
            elif attrib == 'astartdelay':
                if value.startswith('config.'):
                    value = int(configfile.getResolvedKey(value)) * 1000
                self.astartdelay = int(value)
            elif attrib == 'aposition':
                self.aposition = parsePosition(value, ((1, 1), (1, 1)))
            elif attrib == 'asize':
                self.asize = parseSize(value, ((1, 1), (1, 1)))
            elif attrib == 'autoScroll':
                self.autoScroll = value == '1'
            elif attrib == 'align':
                if 'bottom' in value.split(','):
                    self.valignbottom = True
                self.longtext_attribs.append((attrib, value))
            elif attrib == 'valign':
                if 'bottom' in value.split(','):
                    self.valignbottom = True
                self.longtext_attribs.append((attrib, value))
            elif attrib == 'scrollbarMode':
                self.scrollbarmode = value.lower()
            elif attrib == 'sliderLengthTip':
                self.sliderlengthtip = int(value)
                self.scrollbar_attribs.append((attrib, value))
            elif attrib in ('borderColor', 'borderWidth', 'sliderBackground',
                            'sliderForeground', 'sliderPointer'):
                self.scrollbar_attribs.append((attrib, value))
            elif attrib in ('font', 'transparent', 'foregroundColor',
                            'backgroundColor', 'halign'):
                self.longtext_attribs.append((attrib, value))
            elif attrib == 'css':
                from skin import cascadingStyleSheets
                styles = value.split(',')
                for style in styles:
                    for _attrib in cascadingStyleSheets[style].keys():
                        _value = cascadingStyleSheets[style][_attrib]
                        self.spreadSingleAttribute([(_attrib, _value)])

            else:
                self.widget_attribs.append((attrib, value))
 def parseAttribute(self, attrib, value):
     if attrib == "font0":
         self.font0 = parseFont(value, self.scale)
     elif attrib == "font1":
         self.font1 = parseFont(value, self.scale)
     elif attrib == "listHeight":
         self.listHeight = int(value)
     elif attrib == "line1Pos":
         self.line1Pos = parsePosition(value, self.scale)
     elif attrib == "line2Pos":
         self.line2Pos = parsePosition(value, self.scale)
     elif attrib == "line3Pos":
         self.line3Pos = parsePosition(value, self.scale)
     elif attrib == "line4Pos":
         self.line4Pos = parsePosition(value, self.scale)
     elif attrib == "line5Pos":
         self.line5Pos = parsePosition(value, self.scale)
     elif attrib == "line6Pos":
         self.line6Pos = parsePosition(value, self.scale)
     elif attrib == "line7Pos":
         self.line7Pos = parsePosition(value, self.scale)
     elif attrib == "lineSplit":
         self.lineSplit = int(value)
     elif attrib == "progressPos":
         self.progressPos = parsePosition(value, self.scale)
     elif attrib == "progressHeight":
         self.progressHeight = int(value)
 def parseAttribute(self, attrib, value):
     if attrib == "font0":
         self.font0 = parseFont(value, self.scale)
     elif attrib == "font1":
         self.font1 = parseFont(value, self.scale)
     elif attrib == "listHeight":
         self.listHeight = int(value)
     elif attrib == "line1Pos":
         self.line1Pos = parsePosition(value, self.scale)
     elif attrib == "line2Pos":
         self.line2Pos = parsePosition(value, self.scale)
     elif attrib == "picPos":
         self.picPos = parsePosition(value, self.scale)
     elif attrib == "picSize":
         self.picSize = parseSize(value, self.scale)
Exemple #4
0
	def applySkin(self, desktop, parent):
		self.sequence = None
		fix_fb_aspect = None
		canvas_size = None
		size = None
		pos = None
		size_idx = None
		pos_idx = None
		attribs = []

		idx = 0
		for (attrib, value) in self.skinAttributes:
			if attrib == "correct_aspect":
				fix_fb_aspect = value
				continue
			elif attrib == "canvas_size":
				s = parseSize(value, ((1,1),(1,1)), desktop=desktop, guiObject=self.instance)
				canvas_size = s.width(), s.height()
				continue
			elif attrib == "size":
				s = parseSize(value, ((1,1),(1,1)), desktop=desktop, guiObject=self.instance)
				size = s.width(), s.height()
				size_idx = idx
			elif attrib == "position":
				p = parsePosition(value, ((1,1),(1,1)), desktop=desktop, guiObject=self.instance)
				pos = p.x(), p.y()
				pos_idx = idx
			attribs.append((attrib, value))
			idx += 1

		if fix_fb_aspect and size and pos is not None:
			aspect = AVSwitch().getFramebufferScale()
			if fix_fb_aspect == 'height':
				fixed_height = (size[1] * aspect[0]) / aspect[1]
				y_corr = fixed_height - size[1]
				attribs[pos_idx] = ("position", str(pos[0])+','+str(pos[1] - y_corr))
				attribs[size_idx] = ("size", str(size[0])+','+str(fixed_height))
			elif fix_fb_aspect == 'width':
				fixed_width = (size[0] * aspect[1]) / aspect[0]
				x_corr = size[0] - fixed_width
				attribs[pos_idx] = ("position", str(pos[0] + x_corr)+','+str(pos[1]))
				attribs[size_idx] = ("size", str(fixed_width)+','+str(size[1]))

		self.skinAttributes = attribs

		ret = Renderer.applySkin(self, desktop, parent)

		if canvas_size is not None:
			size = canvas_size

		if size:
			self.instance.setSize(eSize(size[0], size[1]))

		self.pull_updates()

		return ret
 def parseAttribute(self, attrib, value):
     if attrib == "font0":
         self.font0 = parseFont(value, self.scale)
     elif attrib == "font1":
         self.font1 = parseFont(value, self.scale)
     elif attrib == "font2":
         self.font2 = parseFont(value, self.scale)
     elif attrib == "listHeight":
         self.listHeight = int(value)
     elif attrib == "line1Pos":
         self.line1Pos = parsePosition(value, self.scale)
     elif attrib == "line2Pos":
         self.line2Pos = parsePosition(value, self.scale)
     elif attrib == "line3Pos":
         self.line3Pos = parsePosition(value, self.scale)
     elif attrib == "line1Split":
         self.line1Split = int(value)
     elif attrib == "line2Split":
         self.line2Split = int(value)
     elif attrib == "line3Split":
         self.line3Split = int(value)
 def parseAttribute(self, attrib, value):
     TMDbSkinParam.parseAttribute(self, attrib, value)
     if attrib == "line3Pos":
         self.line3Pos = parsePosition(value, self.scale)
Exemple #7
0
    def applySkin(self, desktop, parent):
        scrollbarWidth = 10
        itemHeight = 30
        scrollbarBorderWidth = 1
        ret = False
        if self.skinAttributes is not None:
            widget_attribs = []
            scrollbar_attribs = []
            remove_attribs = []
            for attrib, value in self.skinAttributes:
                if 'itemHeight' in attrib:
                    itemHeight = int(value)
                    remove_attribs.append((attrib, value))
                if 'scrollbarMode' in attrib:
                    self.scrollbarmode = value
                    remove_attribs.append((attrib, value))
                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))
                    remove_attribs.append((attrib, value))
                if 'scrollbarSliderBorderColor' in attrib:
                    scrollbar_attribs.append((attrib, value))
                    remove_attribs.append((attrib, value))
                if 'scrollbarSliderPicture' in attrib:
                    scrollbar_attribs.append((attrib, value))
                    remove_attribs.append((attrib, value))
                if 'scrollbarBackgroundPicture' in attrib:
                    scrollbar_attribs.append((attrib, value))
                    remove_attribs.append((attrib, value))
                if 'scrollbarWidth' in attrib:
                    scrollbarWidth = int(value)
                    remove_attribs.append((attrib, value))
                if 'scrollbarSliderBorderWidth' in attrib:
                    scrollbarBorderWidth = int(value)
                    remove_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 attrib == 'step':
                    self.step = int(value)
                if attrib == 'steptime':
                    self.steptime = int(value)
                if attrib == 'position':
                    self._position = skin.parsePosition(
                        value, ((1, 1), (1, 1)))
                    self.widget_attribs.append((attrib, value))
                if attrib == 'size':
                    self._size = skin.parseSize(value, ((1, 1), (1, 1)))
                    self.longtext_attribs.append((attrib, value))
                if 'startdelay' in attrib:
                    if value.startswith('config.'):
                        value = int(configfile.getResolvedKey(value)) * 1000
                    self.startdelay = int(value)
                if 'animation' in attrib:
                    self.animation = True
                if 'astartdelay' in attrib:
                    if value.startswith('config.'):
                        value = int(configfile.getResolvedKey(value)) * 1000
                    self.astartdelay = int(value)
                if 'aposition' in attrib:
                    self.aposition = skin.parsePosition(
                        value, ((1, 1), (1, 1)))
                if 'asize' in attrib:
                    self.asize = skin.parseSize(value, ((1, 1), (1, 1)))
                if 'autoScroll' in attrib:
                    if value == '1' in attrib:
                        self.autoScroll = True
                    else:
                        self.autoScroll = False
                if attrib in ('borderColor', 'borderWidth', 'sliderLengthTip',
                              'sliderBackground', 'sliderForeground',
                              'sliderPointer'):
                    self.scrollbar_attribs.append((attrib, value))
                if attrib in ('font', 'transparent', 'foregroundColor',
                              'backgroundColor', 'valign', 'halign'):
                    self.longtext_attribs.append((attrib, value))

            for attrib, value in remove_attribs:
                self.skinAttributes.remove((attrib, 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._position)
        self.resize(self._size)
        self.lineheight = fontRenderClass.getInstance().getLineHeight(
            self.long_text.getFont())
        if not self.lineheight:
            self.lineheight = itemHeight
        lines = int(s.height() / self.lineheight)
        self.pageHeight = int(lines * self.lineheight)
        self.instance.resize(
            eSize(s.width(), self.pageHeight + int(self.lineheight / 6)))
        self.scrollbar.move(ePoint(s.width() - scrollbarWidth, 0))
        self.scrollbar.resize(
            eSize(scrollbarWidth, self.pageHeight + int(self.lineheight / 6)))
        self.scrollbar.setOrientation(eSlider.orVertical)
        self.scrollbar.setMode(eSlider.modeScrollbar)
        self.scrollbar.setRange(0, 100)
        self.scrollbar.setBorderWidth(scrollbarBorderWidth)
        self.long_text.move(ePoint(0, 0))
        self.long_text.resize(eSize(s.width() - 30, self.pageHeight))
        if self.split:
            self.right_text.move(ePoint(self.column, 0))
            self.right_text.resize(
                eSize(s.width() - self.column - 30, self.pageHeight))
        self.setText(self.message)
        return ret