Exemplo n.º 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))
Exemplo n.º 2
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
Exemplo n.º 3
0
    def applySkin(self, desktop, parent):
        attribs = []
        value_attributes = []
        size_attributes = []
        font_attributes = []
        color_attributes = []

        if self.skinAttributes:
            for (attrib, value) in self.skinAttributes:
                if attrib in value_attributes:
                    setattr(self, attrib, int(value))
                elif attrib in size_attributes:
                    setattr(self, attrib, parseSize(value, ((1, 1), (1, 1))))
                elif attrib in font_attributes:
                    setattr(self, attrib, parseFont(value, ((1, 1), (1, 1))))
                elif attrib in color_attributes:
                    setattr(self, attrib, parseColor(value).argb())
                else:
                    attribs.append((attrib, value))
        self.skinAttributes = attribs

        self.list_styles, template_attributes = parseTemplate(
            MovieList.default_template)
        self.setListStyle(config.plugins.moviecockpit.list_style.value)

        logger.debug("self.skinAttributes: %s", str(self.skinAttributes))
        GUIComponent.applySkin(self, desktop, parent)

        template_attributes["width"] = self.l.getItemSize().width() - 15
        self.applyTemplate(additional_locals=template_attributes)
Exemplo n.º 4
0
Arquivo: Cursor.py Projeto: vuteam/emc
    def applySkin(self, desktop, screen):
        if self.skinAttributes is not None:
            attribs = []
            for attrib, value in self.skinAttributes:
                if attrib == 'size':
                    self.skinSize = parseSize(value, ((1, 1), (1, 1)))
                attribs.append((attrib, value))

            self.skinAttributes = attribs
        return GUIComponent.applySkin(self, desktop, screen)
Exemplo n.º 5
0
	def applySkin(self, desktop, screen):
		if self.skinAttributes is not None:
			attribs = [ ]
			for (attrib, value) in self.skinAttributes:
				if attrib == "EntryForegroundColor":
					self.foreColor = parseColor(value).argb()
				elif attrib == "EntryForegroundColorSelected":
					self.foreColorSelected = parseColor(value).argb()
				elif attrib == "EntryBackgroundColor":
					self.backColor = parseColor(value).argb()
				elif attrib == "EntryBackgroundColorSelected":
					self.backColorSelected = parseColor(value).argb()
				elif attrib == "EntryBorderColor":
					self.borderColor = parseColor(value).argb()
				elif attrib == "EntryFont":
					font = parseFont(value, ((1,1),(1,1)) )
					self.entryFontName = font.family
					self.entryFontSize = font.pointSize
				elif attrib == "ServiceForegroundColor" or attrib == "ServiceNameForegroundColor":
					self.foreColorService = parseColor(value).argb()
				elif attrib == "ServiceForegroundColorSelected":
					self.foreColorServiceSelected = parseColor(value).argb()
				elif attrib == "ServiceBackgroundColor" or attrib == "ServiceNameBackgroundColor":
					self.backColorService = parseColor(value).argb()
				elif attrib == "ServiceBackgroundColorSelected":
					self.backColorServiceSelected = parseColor(value).argb()
				elif attrib == "ServiceBorderColor":
					self.borderColorService = parseColor(value).argb()
				elif attrib == "ServiceFont":
					self.serviceFont = parseFont(value, ((1,1),(1,1)) )
				elif attrib == "EntryBackgroundColorNow":
					self.backColorNow = parseColor(value).argb()
				elif attrib == "EntryForegroundColorNow":
					self.foreColorNow = parseColor(value).argb()
				elif attrib == "PiconSize":
					self.piconSize = parseSize(value, ((1,1),(1,1)))
				elif attrib == "ServiceBorderWidth":
					self.serviceBorderWidth = int(value)
				elif attrib == "ServiceNamePadding":
					self.serviceNamePadding = int(value)
				elif attrib == "EventBorderWidth":
					self.eventBorderWidth = int(value)
				elif attrib == "EventNamePadding":
					self.eventNamePadding = int(value)
				else:
					attribs.append((attrib,value))
			self.skinAttributes = attribs
		rc = GUIComponent.applySkin(self, desktop, screen)
		# now we know our size and can savely set items per page
		self.listHeight = self.instance.size().height()
		self.listWidth = self.instance.size().width()
		self.setItemsPerPage()
		return rc
Exemplo n.º 6
0
 def applySkin(self, desktop, screen):
     if self.skinAttributes is not None:
         attribs = []
         for (attrib, value) in self.skinAttributes:
             if attrib == "EntryForegroundColor":
                 self.foreColor = parseColor(value).argb()
             elif attrib == "EntryForegroundColorSelected":
                 self.foreColorSelected = parseColor(value).argb()
             elif attrib == "EntryBackgroundColor":
                 self.backColor = parseColor(value).argb()
             elif attrib == "EntryBackgroundColorSelected":
                 self.backColorSelected = parseColor(value).argb()
             elif attrib == "EntryBorderColor":
                 self.borderColor = parseColor(value).argb()
             elif attrib == "EntryFont":
                 font = parseFont(value, ((1, 1), (1, 1)))
                 self.entryFontName = font.family
                 self.entryFontSize = font.pointSize
             elif attrib == "ServiceForegroundColor" or attrib == "ServiceNameForegroundColor":
                 self.foreColorService = parseColor(value).argb()
             elif attrib == "ServiceForegroundColorSelected":
                 self.foreColorServiceSelected = parseColor(value).argb()
             elif attrib == "ServiceBackgroundColor" or attrib == "ServiceNameBackgroundColor":
                 self.backColorService = parseColor(value).argb()
             elif attrib == "ServiceBackgroundColorSelected":
                 self.backColorServiceSelected = parseColor(value).argb()
             elif attrib == "ServiceBorderColor":
                 self.borderColorService = parseColor(value).argb()
             elif attrib == "ServiceFont":
                 self.serviceFont = parseFont(value, ((1, 1), (1, 1)))
             elif attrib == "EntryBackgroundColorNow":
                 self.backColorNow = parseColor(value).argb()
             elif attrib == "EntryForegroundColorNow":
                 self.foreColorNow = parseColor(value).argb()
             elif attrib == "PiconSize":
                 self.piconSize = parseSize(value, ((1, 1), (1, 1)))
             elif attrib == "ServiceBorderWidth":
                 self.serviceBorderWidth = int(value)
             elif attrib == "ServiceNamePadding":
                 self.serviceNamePadding = int(value)
             elif attrib == "EventBorderWidth":
                 self.eventBorderWidth = int(value)
             elif attrib == "EventNamePadding":
                 self.eventNamePadding = int(value)
             else:
                 attribs.append((attrib, value))
         self.skinAttributes = attribs
     rc = GUIComponent.applySkin(self, desktop, screen)
     # now we know our size and can savely set items per page
     self.listHeight = self.instance.size().height()
     self.listWidth = self.instance.size().width()
     self.setItemsPerPage()
     return rc
Exemplo n.º 7
0
 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)
Exemplo n.º 8
0
    def applySkin(self, desktop, parent):
        attribs = []
        value_attributes = [
            "MVCStartHPos", "MVCSpacer", "MVCMovieHPos", "MVCMovieVPos",
            "MVCMovieWidth"
            "MVCIconVPos", "MVCIconHPos", "MVCRecIconVPos", "MVCRecIconHPos",
            "MVCBarHPos", "MVCBarVPos", "MVCDateHPos", "MVCDateVPos",
            "MVCDateWidth", "MVCSelNumTxtVPos", "MVCProgressHPos",
            "MVCProgressVPos", "MVCPiconHPos", "MVCPiconVPos"
        ]
        size_attributes = [
            "MVCBarSize", "MVCIconSize", "MVCRecIconSize", "MVCPiconSize"
        ]
        font_attributes = ["MVCFont", "MVCSelectFont", "MVCDateFont"]
        color_attributes = [
            "TitleColor", "DateColor", "DefaultColor", "BackColor",
            "BackColorSel", "FrontColorSel", "RecordingColor"
        ]

        if self.skinAttributes:
            for (attrib, value) in self.skinAttributes:
                if attrib in value_attributes:
                    setattr(self, attrib, int(value))
                elif attrib in size_attributes:
                    setattr(self, attrib, parseSize(value, ((1, 1), (1, 1))))
                elif attrib in font_attributes:
                    setattr(self, attrib, parseFont(value, ((1, 1), (1, 1))))
                elif attrib in color_attributes:
                    setattr(self, attrib, parseColor(value).argb())
                else:
                    attribs.append((attrib, value))
        self.skinAttributes = attribs

        self.l.setFont(1, self.MVCFont)
        self.l.setFont(3, self.MVCSelectFont)
        self.l.setFont(4, self.MVCDateFont)

        #print("MVC: MovieCenterGUI: applySkin: attribs: " + str(attribs))
        return GUIComponent.applySkin(self, desktop, parent)
Exemplo n.º 9
0
    def initSkin(self):
        self.MVCFont = parseFont("Regular;30", ((1, 1), (1, 1)))
        self.MVCSelectFont = parseFont("Regular;30", ((1, 1), (1, 1)))
        self.MVCDateFont = parseFont("Regular;28", ((1, 1), (1, 1)))

        self.MVCStartHPos = 10
        self.MVCSpacer = 10

        self.MVCMovieHPos = None
        self.MVCMovieVPos = None
        self.MVCMovieWidth = None

        self.MVCDateHPos = None
        self.MVCDateVPos = None
        self.MVCDateWidth = 230

        self.MVCProgressHPos = None
        self.MVCProgressVPos = None

        self.MVCBarHPos = None
        self.MVCBarVPos = None
        self.MVCBarSize = parseSize("90, 14", ((1, 1), (1, 1)))

        self.MVCIconVPos = None
        self.MVCIconHPos = None
        self.MVCIconSize = parseSize("45, 35", ((1, 1), (1, 1)))

        self.MVCRecIconVPos = None
        self.MVCRecIconHPos = None
        self.MVCRecIconSize = parseSize("230, 40", ((1, 1), (1, 1)))

        # MVCSelNumTxtHPos is equal to MVCIconHPos
        # MVCSelNumTxtWidth is equal to MVCIconSize.width()
        self.MVCSelNumTxtVPos = None

        self.MVCPiconHPos = None
        self.MVCPiconVPos = None
        self.MVCPiconSize = parseSize("55, 35", ((1, 1), (1, 1)))

        self.DefaultColor = parseColor("#bababa").argb()
        self.TitleColor = parseColor("#bababa").argb()
        self.DateColor = parseColor("#bababa").argb()
        self.BackColor = None
        self.BackColorSel = None
        self.FrontColorSel = parseColor(
            config.MVC.color_highlight.value).argb()
        self.RecordingColor = parseColor(
            config.MVC.color_recording.value).argb()

        skin_path = getSkinPath("img/")
        self.pic_back = LoadPixmap(cached=True, path=skin_path + "back.svg")
        self.pic_directory = LoadPixmap(cached=True,
                                        path=skin_path + "dir.svg")
        self.pic_movie_default = LoadPixmap(cached=True,
                                            path=skin_path +
                                            "movie_default.svg")
        self.pic_movie_watching = LoadPixmap(cached=True,
                                             path=skin_path +
                                             "movie_watching.svg")
        self.pic_movie_finished = LoadPixmap(cached=True,
                                             path=skin_path +
                                             "movie_finished.svg")
        self.pic_movie_rec = LoadPixmap(cached=True,
                                        path=skin_path + "movie_rec.svg")
        self.pic_movie_cut = LoadPixmap(cached=True,
                                        path=skin_path + "movie_cut.svg")
        self.pic_e2bookmark = LoadPixmap(cached=True,
                                         path=skin_path + "e2bookmark.svg")
        self.pic_trashcan = LoadPixmap(cached=True,
                                       path=skin_path + "trashcan.svg")
        self.pic_trashcan_full = LoadPixmap(cached=True,
                                            path=skin_path +
                                            "trashcan_full.svg")
        self.pic_link = LoadPixmap(cached=True, path=skin_path + "link.svg")
        self.pic_col_dir = LoadPixmap(cached=True,
                                      path=skin_path + "coldir.svg")
        self.pic_progress_bar = LoadPixmap(cached=True,
                                           path=skin_path + "progcl.svg")
        self.pic_rec_progress_bar = LoadPixmap(cached=True,
                                               path=skin_path +
                                               "rec_progcl.svg")
        self.pic_recording = LoadPixmap(cached=True,
                                        path=skin_path + "recording.svg")
Exemplo n.º 10
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