Ejemplo n.º 1
0
    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)
Ejemplo n.º 2
0
	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
Ejemplo n.º 3
0
	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()
Ejemplo n.º 4
0
 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
Ejemplo n.º 5
0
    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)
Ejemplo n.º 6
0
    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
Ejemplo n.º 7
0
	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)
Ejemplo n.º 8
0
    def applySkin(self, desktop, parent):
        if not self.visible:
            self.instance.hide()

        if self.skinAttributes is None:
            return False

        if config.skin.primary_skin.value.split('/')[0] not in ('Darkness'):
            self.skinAttributes.sort()
        skin.applyAllAttributes(self.instance, desktop, self.skinAttributes,
                                parent.scale)
        return True
Ejemplo n.º 9
0
    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
        ret = Renderer.applySkin(self, desktop, parent)
        self.changed((self.CHANGED_DEFAULT, ))
        return ret
Ejemplo n.º 10
0
	def applySkin(self, desktop, parent):
		scrollbarWidth = 20
		scrollbarBorderWidth = 1
		ret = False
		if self.skinAttributes:
			widget_attribs = []
			scrollbar_attribs = []
			scrollbarAttrib = ["borderColor", "borderWidth", "scrollbarSliderForegroundColor", "scrollbarSliderBorderColor", "scrollbarSliderPicture", "scrollbarBackgroundPicture"]
			for (attrib, value) in self.skinAttributes:
				if attrib in scrollbarAttrib:
					scrollbar_attribs.append((attrib, value))
					self.skinAttributes.remove((attrib, value))
				elif "transparent" in attrib or "backgroundColor" in attrib:
					widget_attribs.append((attrib, value))
				elif "scrollbarWidth" in attrib:
 					scrollbarWidth = int(value)
 					self.skinAttributes.remove((attrib, value))
 				elif "scrollbarSliderBorderWidth" in attrib:
 					scrollbarBorderWidth = int(value)
 					self.skinAttributes.remove((attrib, value))
 				elif "split" in attrib:
					self.split = int(value)
					if self.split:
						self.right_text = eLabel(self.instance)
					self.skinAttributes.remove((attrib, value))	
				elif "colposition" in attrib:
					self.column = int(value)
				elif "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
Ejemplo n.º 11
0
	def applySkin(self, desktop, parent):
		if not self.visible:
			self.instance.hide()

		if self.skinAttributes is None:
			return False

		#//workaround for values from attributes the not be set
		#
		#The order of some attributes is crucial if they are applied. Also, an attribute may be responsible that another does not take effect and occurs at different skins.
		#It was noticed at 'scrollbarSliderBorderWidth' and 'scrollbarSliderForegroundColor'.
		#
		if config.skin.primary_skin.value.split('/')[0] not in ('DMConcinnity-HD'):
			self.skinAttributes.sort()
		skin.applyAllAttributes(self.instance, desktop, self.skinAttributes, parent.scale)
		return True
Ejemplo n.º 12
0
 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)
Ejemplo n.º 13
0
    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
Ejemplo n.º 14
0
	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
Ejemplo n.º 15
0
	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*100))
		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
Ejemplo n.º 16
0
	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)
Ejemplo n.º 17
0
    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
Ejemplo n.º 18
0
 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(
                     "[Screen] Warning: Skin is missing renderer '%s' in %s."
                     % (val, str(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(
                         "[Screen] WARNING: OBSOLETE COMPONENT '%s' USED IN SKIN. USE '%s' INSTEAD!"
                         % (key, depr[0]))
                     print(
                         "[Screen] OBSOLETE COMPONENT WILL BE REMOVED %s, PLEASE UPDATE!"
                         % depr[1])
             elif not depr:
                 print(
                     "[Screen] Warning: Skin is missing element '%s' in %s."
                     % (key, str(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 not isinstance(f, type(self.close)):
             if six.PY2:
                 exec f in globals(), locals()
             else:
                 exec(f, globals(), locals())
         else:
             f()
Ejemplo n.º 19
0
	def applySkin(self):
		# DEBUG: baseRes = (getDesktop(GUI_SKIN_ID).size().width(), getDesktop(GUI_SKIN_ID).size().height())
		baseRes = (720, 576)  # FIXME: A skin might have set another resolution, which should be the base res.
		zPosition = 0
		for (key, value) in self.skinAttributes:
			if key == "baseResolution":
				baseRes = tuple([int(x) for x in value.split(",")])
			elif key == "zPosition":
				zPosition = int(value)
		self.scale = ((baseRes[0], baseRes[0]), (baseRes[1], baseRes[1]))
		if not self.instance:
			self.instance = eWindow(self.desktop, zPosition)
		if "title" not in self.skinAttributes and self.screenTitle:
			self.skinAttributes.append(("title", self.screenTitle))
		else:
			for attribute in self.skinAttributes:
				if attribute[0] == "title":
					self.setTitle(_(attribute[1]))
		self.skinAttributes.sort(key=lambda a: {"position": 1}.get(a[0], 0))  # We need to make sure that certain attributes come last.
		applyAllAttributes(self.instance, self.desktop, self.skinAttributes, self.scale)
		self.createGUIScreen(self.instance, self.desktop)
Ejemplo n.º 20
0
	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
Ejemplo n.º 21
0
	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
Ejemplo n.º 22
0
	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
Ejemplo n.º 23
0
    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("[GUISkin] 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(
                            "[GUISkin] WARNING: OBSOLETE COMPONENT '%s' USED IN SKIN. USE '%s' INSTEAD!"
                            % (key, depr[0]))
                        print(
                            "[GUISkin] OBSOLETE COMPONENT WILL BE REMOVED %s, PLEASE UPDATE!"
                            % (depr[1]))
                elif not depr:
                    print("[GUISkin] 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()
Ejemplo n.º 24
0
    def applySkin(self):
        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":
                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(',')])
            elif key == "devtag":
                self["DeveloperTag"].text = value
            idx += 1
        self.scale = ((baseres[0], baseres[0]), (baseres[1], baseres[1]))
        if self["DeveloperTag"].text == "":
            self["DeveloperTag"].text = self.__class__.__name__

        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)
Ejemplo n.º 25
0
 def applySkin(self, desktop, parent):
     ret = False
     if self.skinAttributes is not None:
         self.spreadSingleAttribute(self.skinAttributes)
         applyAllAttributes(self.instance, desktop, self.widget_attribs,
                            parent.scale)
         applyAllAttributes(self.long_text, desktop, self.longtext_attribs,
                            parent.scale)
         applyAllAttributes(self.scrollbar, desktop,
                            self.scrollbar_attribs + self.widget_attribs,
                            parent.scale)
         ret = True
     self.instance.move(self._position)
     self.resize(self._size)
     self.long_text.move(ePoint(0, 0))
     self.scrollbar.move(
         ePoint(self._size.width() - self.sliderlengthtip * 2, 1))
     self.scrollbar.resize(
         eSize(self.sliderlengthtip * 2,
               self._size.height() - 2))
     self.scrollbar.setOrientation(eSlider.orVertical)
     self.scrollbar.setRange(0, 1000)
     self.scrollbar.hide()
     self.changed((self.CHANGED_DEFAULT, ))
     return ret
Ejemplo n.º 26
0
 def createGUIScreen(self, parent, desktop, updateonly=False):
     for item in self.renderer:
         if isinstance(item, GUIComponent):
             if not updateonly:
                 item.GUIcreate(parent)
             if not item.applySkin(desktop, self):
                 print(
                     "[Screen] Warning: Skin is missing renderer '%s' in %s."
                     % (item, str(self)))
     for (name, item) in self.items():
         if isinstance(item, GUIComponent):
             if not updateonly:
                 item.GUIcreate(parent)
             depr = item.deprecationInfo
             if item.applySkin(desktop, self):
                 if depr:
                     print(
                         "[Screen] WARNING: OBSOLETE COMPONENT '%s' USED IN SKIN. USE '%s' INSTEAD!"
                         % (name, depr[0]))
                     print(
                         "[Screen] OBSOLETE COMPONENT WILL BE REMOVED %s, PLEASE UPDATE!"
                         % depr[1])
             elif not depr:
                 print(
                     "[Screen] Warning: Skin is missing element '%s' in %s."
                     % (name, str(self)))
     for item in self.additionalWidgets:
         if not updateonly:
             item.instance = item.widget(parent)
         applyAllAttributes(item.instance, desktop, item.skinAttributes,
                            self.scale)
     for callback in self.onLayoutFinish:
         if not isinstance(callback, type(self.close)):
             # The following command triggers an error in Puthon 3 even if a PY2 test is used!!!
             exec callback in globals(), locals(
             )  # Use this version for Python 2.
             # exec(callback, globals(), locals())  # Use this version for Python 3.
         else:
             callback()
Ejemplo n.º 27
0
    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
Ejemplo n.º 28
0
 def applySkin(self):
     bounds = (getDesktop(GUI_SKIN_ID).size().width(),
               getDesktop(GUI_SKIN_ID).size().height())
     resolution = bounds
     zPosition = 0
     for (key, value) in self.skinAttributes:
         if key == "resolution":
             resolution = tuple([int(x.strip()) for x in value.split(",")])
         elif key == "zPosition":
             zPosition = int(value)
     if not self.instance:
         self.instance = eWindow(self.desktop, zPosition)
     if "title" not in self.skinAttributes and self.screenTitle:
         self.skinAttributes.append(("title", self.screenTitle))
     else:
         for attribute in self.skinAttributes:
             if attribute[0] == "title":
                 self.setTitle(_(attribute[1]))
     self.scale = ((bounds[0], resolution[0]), (bounds[1], resolution[1]))
     applyAllAttributes(self.instance, self.desktop, self.skinAttributes,
                        self.scale)
     self.createGUIScreen(self.instance, self.desktop)
Ejemplo n.º 29
0
    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)
            applyAllAttributes(w.instance, desktop, w.skinAttributes,
                               self.scale)

        for f in self.onLayoutFinish:
            if type(f) is not type(self.close):
                exec f in globals(), locals()
            else:
                f()

        if config.misc.fadeShowMenu.value and parent:
            parent.animationEnd.get().append(self.animationEnd)
Ejemplo n.º 30
0
    def applySkin(self, desktop, parent):
        if self.skinAttributes is None:
            return False
        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)

        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 True
Ejemplo n.º 31
0
    def applySkin(self, desktop, parent):
        scrollbarWidth = 10
        itemHeight = 30
        scrollbarBorderWidth = 1
        ret = False
        if self.skinAttributes:
            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)
                    self.skinAttributes.remove((attrib, value))
                if 'colposition' in attrib:
                    self.column = int(value)
                if 'dividechar' in attrib:
                    self.splitchar = 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' 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()
        self.lineheight = fontRenderClass.getInstance().getLineHeight(
            self.long_text.getFont()) or itemHeight
        lines = int(self.long_text.size().height() / self.lineheight)
        self.pageHeight = int(lines * self.lineheight)
        self.instance.move(self.long_text.position())
        self.instance.resize(
            eSize(self.pageWidth, self.pageHeight + int(self.lineheight / 6)))
        self.scrollbar.move(ePoint(self.pageWidth - scrollbarWidth, 0))
        self.scrollbar.resize(
            eSize(scrollbarWidth, self.pageHeight + int(self.lineheight / 6)))
        self.scrollbar.setOrientation(eSlider.orVertical)
        self.scrollbar.setRange(0, 100)
        self.scrollbar.setBorderWidth(scrollbarBorderWidth)
        self.setText(self.message)
        return ret
Ejemplo n.º 32
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
Ejemplo n.º 33
0
 def applySkin(self, desktop, parent):
     scrollLabelDefaults = (("scrollbarBorderWidth",
                             eListbox.DefaultScrollBarBorderWidth),
                            ("scrollbarMode", eListbox.showOnDemand),
                            ("scrollbarOffset",
                             eListbox.DefaultScrollBarOffset),
                            ("scrollbarScroll",
                             eListbox.DefaultScrollBarScroll),
                            ("scrollbarWidth",
                             eListbox.DefaultScrollBarWidth))
     for attribute, default in scrollLabelDefaults:
         if attribute not in scrollLabelStyle:
             scrollLabelStyle[attribute] = default
     splitMargin = 0
     splitPosition = 0
     splitSeparated = False
     sliderBorderWidth = scrollLabelStyle["scrollbarBorderWidth"]
     sliderMode = scrollLabelStyle["scrollbarMode"]
     sliderScroll = scrollLabelStyle["scrollbarScroll"]
     sliderOffset = scrollLabelStyle["scrollbarOffset"]
     sliderWidth = scrollLabelStyle["scrollbarWidth"]
     if self.skinAttributes:
         sliderProperties = ("scrollbarBorderColor", "scrollbarBorderWidth",
                             "scrollbarBackgroundColor",
                             "scrollbarForegroundColor",
                             "scrollbarBackgroundPixmap",
                             "scrollbarForegroundPixmap")
         widgetAttributes = []
         leftLabelAttributes = [("transparent", "1")]
         rightLabelAttributes = [("transparent", "1")]
         sliderAttributes = [("transparent", "1")]
         leftAlign = "left"
         rightAlign = "left"
         for attribute, value in self.skinAttributes:
             if attribute in sliderProperties:
                 sliderAttributes.append((attribute, value))
             else:
                 if attribute in ("backgroundColor", "transparent"):
                     widgetAttributes.append((attribute, value))
                     continue
                 if attribute in ("leftColumnAlignment", "leftColAlign"):
                     leftAlign = parseHorizontalAlignment(
                         value
                     )  # The parser is used to check if the value is valid, an exception is raised if it isn't!
                 elif attribute in ("rightColumnAlignment",
                                    "rightColAlign"):
                     rightAlign = parseHorizontalAlignment(
                         value
                     )  # The parser is used to check if the value is valid, an exception is raised if it isn't!
                     self.split = True
                 elif attribute == "split":
                     self.split = parseBoolean("split", value)
                 elif attribute in ("splitCharacter", "divideChar",
                                    "dividechar"):
                     self.splitCharacter = value
                     self.split = True
                 elif attribute == "splitMargin":
                     splitMargin = parseInteger(value)
                 elif attribute in ("splitPosition", "colPosition",
                                    "colposition"):
                     splitPosition = parseInteger(value)
                     self.split = True
                 elif attribute == "splitSeparated":
                     splitSeparated = parseBoolean("splitSeparated", value)
                     self.split = True
                 elif attribute == "splitTrim":
                     self.splitTrim = parseBoolean("splitTrim", value)
                 elif attribute == "scrollbarBorderWidth":
                     sliderBorderWidth = parseInteger(
                         value, eListbox.DefaultScrollBarBorderWidth)
                 elif attribute == "scrollbarMode":
                     sliderMode = parseScrollbarMode(value)
                 elif attribute == "scrollbarScroll":
                     sliderScroll = parseScrollbarScroll(value)
                 elif attribute == "scrollbarOffset":
                     sliderOffset = parseInteger(
                         value, eListbox.DefaultScrollBarOffset)
                 elif attribute == "scrollbarWidth":
                     sliderWidth = parseInteger(
                         value, eListbox.DefaultScrollBarWidth)
                 else:
                     leftLabelAttributes.append((attribute, value))
                     rightLabelAttributes.append((attribute, value))
         if self.split:
             for attribute, value in leftLabelAttributes[:]:
                 if attribute == "noWrap":  # Remove "noWrap" attribute so it can be set later.
                     leftLabelAttributes.remove((attribute, value))
                     break
             for attribute, value in rightLabelAttributes[:]:
                 if attribute == "noWrap":  # Remove "noWrap" attribute so it can be set later.
                     rightLabelAttributes.remove((attribute, value))
                     break
             if not splitSeparated:
                 leftAlign = "left"  # If columns are used and not separated then left column needs to be "left" aligned to avoid overlapping text.
             leftLabelAttributes.extend([
                 ("horizontalAlignment", leftAlign), ("noWrap", "1")
             ])  # Set "noWrap" to keep lines synchronized.
             rightLabelAttributes.extend([
                 ("horizontalAlignment", rightAlign), ("noWrap", "1")
             ])  # Set "noWrap" to keep lines synchronized.
         applyAllAttributes(self.instance, desktop, widgetAttributes,
                            parent.scale)
         applyAllAttributes(self.leftText, desktop, leftLabelAttributes,
                            parent.scale)
         applyAllAttributes(self.rightText, desktop, rightLabelAttributes,
                            parent.scale)
         applyAllAttributes(self.slider, desktop, sliderAttributes,
                            parent.scale)
         retVal = True
     else:
         retVal = False
     lineHeight = int(
         fontRenderClass.getInstance().getLineHeight(
             self.leftText.getFont())
         or 25)  # Assume a random line height if nothing is visible.
     self.pageWidth = self.leftText.size().width()
     self.pageHeight = (self.leftText.size().height() //
                        lineHeight) * lineHeight
     self.instance.move(self.leftText.position())
     self.instance.resize(eSize(self.pageWidth, self.pageHeight))
     self.sliderWidth = sliderOffset + sliderWidth
     if self.split and sliderMode != eListbox.showNever:  # Check that there is space for the scrollbar in the split.
         if abs(splitPosition) < self.sliderWidth:
             splitPosition = None
         elif abs(self.pageWidth - splitPosition) < self.sliderWidth:
             splitPosition = None
     splitPosition = self.pageWidth // 2 if splitPosition is None else splitPosition
     self.leftWidth = (splitPosition -
                       splitMargin) if splitSeparated else self.pageWidth
     self.rightColX = splitPosition + splitMargin
     self.rightWidth = self.pageWidth - splitPosition - splitMargin
     self.splitSeparated = splitSeparated
     self.leftText.move(ePoint(0, 0))
     self.rightText.move(ePoint(self.rightColX, 0))
     self.slider.move(
         ePoint(
             0 if sliderMode in (eListbox.showLeftOnDemand,
                                 eListbox.showLeftAlways) else
             (self.pageWidth - sliderWidth), 0))
     self.slider.resize(eSize(sliderWidth, self.pageHeight))
     self.slider.setOrientation(eSlider.orVertical)
     self.slider.setRange(0, 1000)
     self.slider.setBorderWidth(sliderBorderWidth)
     self.sliderMode = sliderMode
     self.sliderScroll = lineHeight if sliderScroll else self.pageHeight
     self.setText(self.msgText)
     return retVal
Ejemplo n.º 34
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
			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.long_text.position())
		self.lineheight = fontRenderClass.getInstance().getLineHeight( self.long_text.getFont() )
		if not self.lineheight:
			self.lineheight = itemHeight # assume a random lineheight if nothing is visible
		lines = int(s.height() / self.lineheight)
		self.pageHeight = int(lines * self.lineheight)
		self.instance.resize(eSize(s.width(), self.pageHeight+ int(self.lineheight/6)))
#TODO scrollbarmode
		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.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
Ejemplo n.º 35
0
 def applySkin(self, desktop, parent):
     scrollbarWidth = 20
     scrollbarBorderWidth = 1
     ret = False
     if self.skinAttributes is not None:
         scrollbar_attribs = []
         widget_attribs = []
         remove_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))
             if attrib.find("scrollbarSliderForegroundColor") != -1:
                 scrollbar_attribs.append((attrib, value))
                 remove_attribs.append((attrib, value))
             if attrib.find("scrollbarSliderBorderColor") != -1:
                 scrollbar_attribs.append((attrib, value))
                 remove_attribs.append((attrib, value))
             if attrib.find("scrollbarSliderPicture") != -1:
                 scrollbar_attribs.append((attrib, value))
                 remove_attribs.append((attrib, value))
             if attrib.find("scrollbarBackgroundPicture") != -1:
                 scrollbar_attribs.append((attrib, value))
                 remove_attribs.append((attrib, value))
             if attrib.find("scrollbarWidth") != -1:
                 scrollbarWidth = int(value)
                 remove_attribs.append((attrib, value))
             if attrib.find("scrollbarSliderBorderWidth") != -1:
                 scrollbarBorderWidth = int(value)
                 remove_attribs.append((attrib, value))
         for (attrib, value) in remove_attribs:
             self.skinAttributes.remove((attrib, value))
         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() - 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() - 30, self.pageHeight * 16))
     self.setText(self.message)
     return ret