def __init__(self): Renderer.__init__(self) VariableText.__init__(self) if "bm750" in HardwareInfo().get_device_name(): self.ZeigeTemp = True else: self.ZeigeTemp = False
def __init__(self): Renderer.__init__(self) VariableText.__init__(self) self.foreColors = [] self.backColors = [] self.__get_value = False self.__text = False
def __init__(self, cuda_code, snaprange, acont_filenames, name_template, data_dir=DEFAULT_LOC, snap=None): ''' Creates an emissivity renderer. cuda_code is the string representation of the cuda kernel. Snaprange is the range of allowable snaps, represented as a tuple, e.g. (100, 199). acont_filenames is the location of the CHIANTI tables. name_template is the base name of the snap/aux files, e.g. qsmag_by00it%03 (where %03 is a placeholder for the snap number). ''' Renderer.__init__(self, cuda_code) self.data_dir = data_dir self.template = name_template self.snap_range = snaprange if snap is None: snap = self.snap_range[0] self.acont_filenames = acont_filenames self.rhoeetab = Rhoeetab(fdir=data_dir) self.nrhobin = self.rhoeetab.params['nrhobin'] self.dmin = m.log(self.rhoeetab.params['rhomin']) self.drange = m.log(self.rhoeetab.params['rhomax']) - self.dmin self.neibin = self.rhoeetab.params['neibin'] self.emin = m.log(self.rhoeetab.params['eimin']) self.erange = m.log(self.rhoeetab.params['eimax']) - self.emin self.tg_table = self.rhoeetab.get_table('tg') self.ne_table = self.rhoeetab.get_table('ne') self.set_snap(snap)
def __init__(self): Renderer.__init__(self) self.backgroundColor = parseColor("#ff000000") self.nocColor = parseColor("#00aaaaaa") self.emmColor = parseColor("#00aaaaaa") self.ecmColor = parseColor("#0056c856") self.font = gFont("Regular", 20)
def __init__(self): Renderer.__init__(self) self.PicLoad = ePicLoad() self.PicLoad.PictureData.get().append(self.updatePicon) self.piconsize = (0,0) self.pngname = "" self.lastPath = None if getBoxType() in bw_lcd or config.lcd.picon_pack.value: pngname = findLcdPicon("lcd_picon_default") else: pngname = findLcdPicon("picon_default") self.defaultpngname = None if not pngname: if getBoxType() in bw_lcd or config.lcd.picon_pack.value: tmp = resolveFilename(SCOPE_ACTIVE_SKIN, "lcd_picon_default.png") else: tmp = resolveFilename(SCOPE_ACTIVE_SKIN, "picon_default.png") if pathExists(tmp): pngname = tmp else: if getBoxType() in bw_lcd or config.lcd.picon_pack.value: pngname = resolveFilename(SCOPE_ACTIVE_SKIN, "lcd_picon_default.png") else: pngname = resolveFilename(SCOPE_ACTIVE_SKIN, "picon_default.png") if os.path.getsize(pngname): self.defaultpngname = pngname
def __init__(self): Renderer.__init__(self) self.PicLoad = ePicLoad() self.PicLoad.PictureData.get().append(self.updatePicon) self.piconsize = (0,0) self.pngname = "" self.lastPath = None if getBoxType() == 'vuultimo' or getBoxType() == 'quadbox2400' or getMachineProcModel().startswith("ini-90") or getMachineProcModel().startswith("ini-80"): pngname = findLcdPicon("lcd_picon_default") else: pngname = findLcdPicon("picon_default") self.defaultpngname = None if not pngname: if getBoxType() == 'vuultimo' or getBoxType() == 'quadbox2400' or getMachineProcModel().startswith("ini-90") or getMachineProcModel().startswith("ini-80"): tmp = resolveFilename(SCOPE_ACTIVE_SKIN, "lcd_picon_default.png") else: tmp = resolveFilename(SCOPE_ACTIVE_SKIN, "picon_default.png") if pathExists(tmp): pngname = tmp else: if getBoxType() == 'vuultimo' or getBoxType() == 'quadbox2400' or getMachineProcModel().startswith("ini-90") or getMachineProcModel().startswith("ini-80"): pngname = resolveFilename(SCOPE_ACTIVE_SKIN, "lcd_picon_default.png") else: pngname = resolveFilename(SCOPE_ACTIVE_SKIN, "picon_default.png") if os.path.getsize(pngname): self.defaultpngname = pngname
def __init__(self): Renderer.__init__(self) self.PicLoad = ePicLoad() self.PicLoad.PictureData.get().append(self.updatePicon) self.piconsize = (0,0) self.pngname = "" self.lastPath = None if getBoxType() in ('vuultimo', 'et10000', 'mutant2400', 'xpeedlx3', 'quadbox2400', 'sezammarvel', 'atemionemesis', 'mbultra', 'beyonwizt4', 'dm7080'): pngname = findLcdPicon("lcd_picon_default") else: pngname = findLcdPicon("picon_default") self.defaultpngname = None if not pngname: if getBoxType() in ('vuultimo', 'et10000', 'mutant2400', 'xpeedlx3', 'quadbox2400', 'sezammarvel', 'atemionemesis', 'mbultra', 'beyonwizt4', 'dm7080'): tmp = resolveFilename(SCOPE_ACTIVE_SKIN, "lcd_picon_default.png") else: tmp = resolveFilename(SCOPE_ACTIVE_SKIN, "picon_default.png") if pathExists(tmp): pngname = tmp else: if getBoxType() in ('vuultimo', 'et10000', 'mutant2400', 'xpeedlx3', 'quadbox2400', 'sezammarvel', 'atemionemesis', 'mbultra', 'beyonwizt4', 'dm7080'): pngname = resolveFilename(SCOPE_ACTIVE_SKIN, "lcd_picon_default.png") else: pngname = resolveFilename(SCOPE_ACTIVE_SKIN, "picon_default.png") if os.path.getsize(pngname): self.defaultpngname = pngname
def __init__(self): Renderer.__init__(self) self.__position = 0 self.__seek_position = 0 self.__length = 0 self.__seek_enable = 0 self.__cutlist = []
def __init__(self): self.lines = False Renderer.__init__(self) VariableText.__init__(self) self.epgcache = eEPGCache.getInstance() self.timer = eTimer() self.timer.callback.append(self.refresh)
def __init__(self): Renderer.__init__(self) VariableText.__init__(self) if '8000' in HardwareInfo().get_device_name() or '500' in HardwareInfo().get_device_name() or '800se' in HardwareInfo().get_device_name(): self.ZeigeTemp = True else: self.ZeigeTemp = False
def __init__(self): Poll.__init__(self) Renderer.__init__(self) self.path = 'emu' self.nameCache = {} self.pngname = '' self.picon_default = "picon_default.png"
def __init__(self): Renderer.__init__(self) VariableText.__init__(self) self.EmptyText = "" self.fillTimer = eTimer() self.fillTimer.timeout.get().append(self.__fillText) self.backText = ""
def __init__(self): Renderer.__init__(self) global fbtool fbtool=KravenFBHelper() self.Position=self.Size=None self.decoder=0 if SystemInfo.get("NumVideoDecoders",1)>1: self.decoder=1 self.fb_w=getDesktop(0).size().width() self.fb_h=getDesktop(0).size().height() self.fb_size=None self._del_pip=False self._can_extended_PiG=False self.first_PiG=False self.is_channelselection=False self.x2=103 self.y2=523 self.w2=544 self.h2=306 self.x2=format(int(float(self.x2)/self.fb_w*720.0),'x').zfill(8) self.y2=format(int(float(self.y2)/self.fb_h*576.0),'x').zfill(8) self.w2=format(int(float(self.w2)/self.fb_w*720.0),'x').zfill(8) self.h2=format(int(float(self.h2)/self.fb_h*576.0),'x').zfill(8) self.fb_size2=[self.w2,self.h2,self.x2,self.y2]
def __init__(self): Renderer.__init__(self) self.foregroundColor = parseColor('#ffffff') self.backgroundColor = parseColor('#171717') self.emmColor = parseColor('#f23d21') self.ecmColor = parseColor('#389416') self.font = gFont('Regular', 20)
def __init__(self): Renderer.__init__(self) self.backgroundColor = parseColor('#ff000000') self.emmColor = parseColor('#00aaaaaa') self.clGrey = parseColor('#00aaaaaa') self.ecmColor = parseColor('#0056c856') self.font = gFont('Regular', 20)
def __init__(self): Renderer.__init__(self) self.__content = None self.__wrap_around = False self.__selection_enabled = True self.__scrollbarMode = "showOnDemand" self.__backlogMode = False
def __init__(self): Renderer.__init__(self) global KravenFBTool KravenFBTool = KravenFBHelper() self.Position = self.Size = None self.timer = eTimer() self.timer.callback.append(self.showpip) self.pipCreated = False self.pipRemoved = False self.Initialized = False self.PigStyle = config.plugins.KravenFHD.PigStyle.value if SystemInfo.get("NumVideoDecoders", 1) > 1 and not self.PigStyle == "Preview": self.decoder = 1 else: self.decoder = 0 self.fb_w = getDesktop(0).size().width() self.fb_h = getDesktop(0).size().height() self.fb_size = None self.x2 = 103 self.y2 = 530 self.w2 = 544 self.h2 = 306 self.x2 = format(int(float(self.x2) / self.fb_w * 720.0), 'x').zfill(8) self.y2 = format(int(float(self.y2) / self.fb_h * 576.0), 'x').zfill(8) self.w2 = format(int(float(self.w2) / self.fb_w * 720.0), 'x').zfill(8) self.h2 = format(int(float(self.h2) / self.fb_h * 576.0), 'x').zfill(8) self.fb_size2 = [self.w2, self.h2, self.x2, self.y2]
def __init__(self): Renderer.__init__(self) VariableText.__init__(self) if getBoxType() == "vuduo": self.stringlength = 16 else: self.stringlength = 12
def __init__(self): Renderer.__init__(self) VariableText.__init__(self) if getBoxType() == 'vuduo' or getBoxType() == 'suntwin': self.stringlength = 16 else: self.stringlength = 12
def __init__(self): Renderer.__init__(self) VariableText.__init__(self) config.plugins.AtileHD.save() configfile.save() self.woeid = config.plugins.AtileHD.woeid.value self.timer = 1
def __init__(self): Renderer.__init__(self) VariableText.__init__(self) if getBoxType() == 'inihdp': self.stringlength = 25 else: self.stringlength = 12
def __init__(self): Renderer.__init__(self) VariableText.__init__(self) if getMachineBuild() == 'inihdp': self.stringlength = 25 else: self.stringlength = 16
def __init__(self): Renderer.__init__(self) VariableText.__init__(self) if getMachineProcModel().startswith("ini-90"): self.stringlength = 25 else: self.stringlength = 16
def __init__(self): Renderer.__init__(self) VariableText.__init__(self) self.ena = True try: self.ena = config.plugins.setupGlass16.par48.value except: pass if not self.ena: try: self.allSat = {} satellites = parse("/etc/tuxbox/satellites.xml").getroot() if satellites is not None: for x in satellites.findall("sat"): name = x.get("name") or None position = x.get("position") or None if name is not None and position is not None: position = "%s.%s" % (position[:-1], position[-1:]) if position.startswith("-"): position = "%sW" % position[1:] else: position = "%sE" % position if position.startswith("."): position = "0%s" % position self.allSat[position] = str(name.encode("utf-8")) except: pass
def __init__(self): Renderer.__init__(self) self.PicLoad = ePicLoad() self.PicLoad.PictureData.get().append(self.updatePicon) self.piconsize = (0, 0) self.pngname = '' return
def __init__(self): Renderer.__init__(self) self.PicLoad = ePicLoad() self.PicLoad.PictureData.get().append(self.updatePicon) self.piconsize = (0, 0) self.pngname = '' self.lastPath = None if getBoxType() in ('vuultimo', 'et10000', 'mutant2400', 'quadbox2400') or getMachineBuild() in 'inihdp': pngname = findLcdPicon('lcd_picon_default') else: pngname = findLcdPicon('picon_default') self.defaultpngname = None if not pngname: if getBoxType() in ('vuultimo', 'et10000', 'mutant2400', 'quadbox2400') or getMachineBuild() in 'inihdp': tmp = resolveFilename(SCOPE_ACTIVE_SKIN, 'lcd_picon_default.png') else: tmp = resolveFilename(SCOPE_ACTIVE_SKIN, 'picon_default.png') if pathExists(tmp): pngname = tmp elif getBoxType() in ('vuultimo', 'et10000', 'mutant2400', 'quadbox2400') or getMachineBuild() in 'inihdp': pngname = resolveFilename(SCOPE_ACTIVE_SKIN, 'lcd_picon_default.png') else: pngname = resolveFilename(SCOPE_ACTIVE_SKIN, 'picon_default.png') if os.path.getsize(pngname): self.defaultpngname = pngname return
def __init__(self): Renderer.__init__(self) VariableText.__init__(self) config.plugins.MetrixUpdater.save() configfile.save() self.configFile = "/etc/MetrixUpdater.config" self.timer = 1
def __init__(self): Renderer.__init__(self) self.backgroundColor = parseColor("#ff000000") self.nocColor = parseColor("#008f8f8f") self.emmColor = parseColor("#00bab329") self.ecmColor = parseColor("#00009a00") self.font = gFont("Regular", 20)
def __init__(self): Renderer.__init__(self) self.PicLoad = ePicLoad() self.PicLoad.PictureData.get().append(self.updatePicon) self.piconsize = (0,0) self.pngname = "" self.lastPath = None if HardwareInfo().get_device_name() == 'vuultimo': pngname = findLcdPicon("lcd_picon_default") else: pngname = findLcdPicon("picon_default") self.defaultpngname = None if not pngname: if HardwareInfo().get_device_name() == 'vuultimo': tmp = resolveFilename(SCOPE_ACTIVE_SKIN, "lcd_picon_default.png") else: tmp = resolveFilename(SCOPE_ACTIVE_SKIN, "picon_default.png") if pathExists(tmp): pngname = tmp else: if HardwareInfo().get_device_name() == 'vuultimo': pngname = resolveFilename(SCOPE_ACTIVE_SKIN, "lcd_picon_default.png") else: pngname = resolveFilename(SCOPE_ACTIVE_SKIN, "picon_default.png") if os.path.getsize(pngname): self.defaultpngname = pngname
def __init__(self): Renderer.__init__(self) self.backgroundColor = parseColor("transparent") self.nocColor = parseColor("#00aaaaaa") self.emmColor = parseColor("#00aaaaaa") self.ecmColor = parseColor("#0056c856") self.font = gFont("Pro_Display", 17)
def applySkin(self, desktop, screen): def retValue(val, limit, default, Min=False): try: if Min: x = min(limit, int(val)) else: x = max(limit, int(val)) except: x = default return x def setWrapFlag(attrib, value): if (attrib.lower() == "wrap" and value == "0") or \ (attrib.lower() == "nowrap" and value != "0"): self.txtflags &= ~RT_WRAP else: self.txtflags |= RT_WRAP self.halign = valign = eLabel.alignLeft if self.skinAttributes: attribs = [] for (attrib, value) in self.skinAttributes: if attrib == "font": self.txfont = parseFont(value, ((1, 1), (1, 1))) elif attrib == "foregroundColor": self.scroll_label.setForegroundColor(parseColor(value)) elif attrib in ("shadowColor", "borderColor"): # fake for openpli-enigma2 self.scroll_label.setShadowColor(parseColor(value)) elif attrib == "shadowOffset": x, y = value.split(',') self.soffset = (int(x), int(y)) self.scroll_label.setShadowOffset(ePoint(self.soffset)) elif attrib == "borderWidth": # fake for openpli-enigma2 self.soffset = (-int(value), -int(value)) elif attrib == "valign" and value in ("top", "center", "bottom"): valign = { "top": eLabel.alignTop, "center": eLabel.alignCenter, "bottom": eLabel.alignBottom }[value] self.txtflags |= { "top": RT_VALIGN_TOP, "center": RT_VALIGN_CENTER, "bottom": RT_VALIGN_BOTTOM }[value] elif attrib == "halign" and value in ("left", "center", "right", "block"): self.halign = { "left": eLabel.alignLeft, "center": eLabel.alignCenter, "right": eLabel.alignRight, "block": eLabel.alignBlock }[value] self.txtflags |= { "left": RT_HALIGN_LEFT, "center": RT_HALIGN_CENTER, "right": RT_HALIGN_RIGHT, "block": RT_HALIGN_BLOCK }[value] elif attrib == "noWrap": setWrapFlag(attrib, value) elif attrib == "options": options = value.split(',') for o in options: if o.find('=') != -1: opt, val = (x.strip() for x in o.split('=', 1)) else: opt, val = o.strip(), "" if opt == "": continue elif opt in ("wrap", "nowrap"): setWrapFlag(opt, val) elif opt == "movetype" and val in ("none", "running", "swimming"): self.type = { "none": NONE, "running": RUNNING, "swimming": SWIMMING }[val] elif opt == "direction" and val in ("left", "right", "top", "bottom"): self.direction = { "left": LEFT, "right": RIGHT, "top": TOP, "bottom": BOTTOM }[val] elif opt == "step" and val: self.mStep = retValue(val, 1, self.mStep) elif opt == "steptime" and val: self.mStepTimeout = retValue( val, 25, self.mStepTimeout) elif opt == "startdelay" and val: self.mStartDelay = retValue( val, 0, self.mStartDelay) elif opt == "pause" and val: self.mLoopTimeout = retValue( val, 0, self.mLoopTimeout) elif opt == "oneshot" and val: self.mOneShot = retValue(val, 0, self.mOneShot) elif opt == "repeat" and val: self.mRepeat = retValue(val, 0, self.mRepeat) elif opt == "always" and val: self.mAlways = retValue(val, 0, self.mAlways) elif opt == "startpoint" and val: self.mStartPoint = int(val) elif opt == "pagedelay" and val: self.mPageDelay = retValue(val, 0, self.mPageDelay) elif opt == "pagelength" and val: self.mPageLength = retValue( val, 0, self.mPageLength) else: attribs.append((attrib, value)) if attrib == "backgroundColor": self.scroll_label.setBackgroundColor(parseColor(value)) elif attrib == "transparent": self.scroll_label.setTransparent(int(value)) self.skinAttributes = attribs ret = Renderer.applySkin(self, desktop, screen) if self.mOneShot: self.mOneShot = max(self.mStepTimeout, self.mOneShot) if self.mLoopTimeout: self.mLoopTimeout = max(self.mStepTimeout, self.mLoopTimeout) if self.mPageDelay: self.mPageDelay = max(self.mStepTimeout, self.mPageDelay) self.scroll_label.setFont(self.txfont) if not (self.txtflags & RT_WRAP): self.scroll_label.setNoWrap(1) self.scroll_label.setVAlign(valign) self.scroll_label.setHAlign(self.halign) self.scroll_label.move(ePoint(0, 0)) self.scroll_label.resize(eSize(self.W, self.H)) # test for auto correction text height: if self.direction in (TOP, BOTTOM): from enigma import fontRenderClass flh = int(fontRenderClass.getInstance().getLineHeight(self.txfont) or self.txfont.pointSize / 6 + self.txfont.pointSize) self.scroll_label.setText("WQq") if flh > self.scroll_label.calculateSize().height(): self.lineHeight = flh self.scroll_label.setText("") return ret
def __init__(self): Renderer.__init__(self) self.picload = ePicLoad() self.picload.PictureData.get().append(self.paintIconPixmapCB) self.iconFileName = ''
def connect(self, source): Renderer.connect(self, source) self.changed((self.CHANGED_DEFAULT, ))
def __init__(self): Renderer.__init__(self) self.nameCache = { } self.picname = "" self.scalecover = "1"
def make_color(self): c = Colorer() self.color = c.coder(self.data) self.r = Renderer(self.bad, self.color)
def __init__(self): Renderer.__init__(self) self.path = '/media/usb/AnimatedWeatherPixmap' self.pixdelay = 100 self.control = 1 self.slideicon = None
def disconnectAll(self): self.picload.PictureData.get().remove(self.paintIconPixmapCB) self.picload = None Renderer.disconnectAll(self)
def __init__(self): Renderer.__init__(self) self.timer = eTimer() self.timer.callback.append(self.pollme)
def __init__(self): Renderer.__init__(self) self.pngname = ''
def __init__(self): Renderer.__init__(self) self.path = 'piconProv' self.nameCache = {} self.pngname = ''
def __init__(self): Renderer.__init__(self) VariableText.__init__(self) self.vol_timer = eTimer() self.vol_timer.callback.append(self.poll)
def connect(self, source): Renderer.connect(self, source)
def __init__(self): Renderer.__init__(self) self.path = "picon" self.nameCache = {} self.pngname = ""
def __init__(self): Renderer.__init__(self)
def __init__(self): Renderer.__init__(self) self.fColor = gRGB(255, 255, 255, 0) self.bColor = gRGB(0, 0, 0, 255) self.numval = -1
import pygame, sys import pygame.time import pygame.transform from pygame.rect import Rect from Renderer import Renderer import Input from Entity import Entity import GameController #import cProfile import random import Params import Utils clock = pygame.time.Clock() pygame.init() Input.init() GameController.init() if __name__ == "__main__": #cProfile.run('run()') while True: clock.tick(60) Input.process_events() Renderer.clear_screen() GameController.run() pygame.display.flip()
def __init__(self): Renderer.__init__(self) self.pngname = None self.defaultpngname = resolveFilename(SCOPE_ACTIVE_SKIN, "picon_default.png")
def applySkin(self, desktop, screen): def retValue(val, limit, default, Min=False): try: if Min: x = min(limit, int(val)) else: x = max(limit, int(val)) except: x = default return x def setWrapFlag(attrib, value): if attrib.lower() == 'wrap' and value == '0' or attrib.lower( ) == 'nowrap' and value != '0': self.txtflags &= ~RT_WRAP else: self.txtflags |= RT_WRAP self.halign = valign = eLabel.alignLeft if self.skinAttributes: attribs = [] for attrib, value in self.skinAttributes: if attrib == 'font': self.txfont = parseFont(value, ((1, 1), (1, 1))) elif attrib == 'foregroundColor': self.scroll_label.setForegroundColor(parseColor(value)) elif attrib in ('shadowColor', 'borderColor'): self.scroll_label.setShadowColor(parseColor(value)) elif attrib == 'shadowOffset': x, y = value.split(',') self.soffset = (int(x), int(y)) self.scroll_label.setShadowOffset(ePoint(self.soffset)) elif attrib == 'borderWidth': self.soffset = (-int(value), -int(value)) elif attrib == 'valign' and value in ('top', 'center', 'bottom'): valign = { 'top': eLabel.alignTop, 'center': eLabel.alignCenter, 'bottom': eLabel.alignBottom }[value] self.txtflags |= { 'top': RT_VALIGN_TOP, 'center': RT_VALIGN_CENTER, 'bottom': RT_VALIGN_BOTTOM }[value] elif attrib == 'halign' and value in ('left', 'center', 'right', 'block'): self.halign = { 'left': eLabel.alignLeft, 'center': eLabel.alignCenter, 'right': eLabel.alignRight, 'block': eLabel.alignBlock }[value] self.txtflags |= { 'left': RT_HALIGN_LEFT, 'center': RT_HALIGN_CENTER, 'right': RT_HALIGN_RIGHT, 'block': RT_HALIGN_BLOCK }[value] elif attrib == 'noWrap': setWrapFlag(attrib, value) elif attrib == 'options': options = value.split(',') for o in options: if o.find('=') != -1: opt, val = (x.strip() for x in o.split('=', 1)) else: opt, val = o.strip(), '' if opt == '': continue elif opt in ('wrap', 'nowrap'): setWrapFlag(opt, val) elif opt == 'movetype' and val in ('none', 'running', 'swimming'): self.type = { 'none': NONE, 'running': RUNNING, 'swimming': SWIMMING }[val] elif opt == 'direction' and val in ('left', 'right', 'top', 'bottom'): self.direction = { 'left': LEFT, 'right': RIGHT, 'top': TOP, 'bottom': BOTTOM }[val] elif opt == 'step' and val: self.mStep = retValue(val, 1, self.mStep) elif opt == 'steptime' and val: self.mStepTimeout = retValue( val, 25, self.mStepTimeout) elif opt == 'startdelay' and val: self.mStartDelay = retValue( val, 0, self.mStartDelay) elif opt == 'pause' and val: self.mLoopTimeout = retValue( val, 0, self.mLoopTimeout) elif opt == 'oneshot' and val: self.mOneShot = retValue(val, 0, self.mOneShot) elif opt == 'repeat' and val: self.mRepeat = retValue(val, 0, self.mRepeat) elif opt == 'always' and val: self.mAlways = retValue(val, 0, self.mAlways) elif opt == 'startpoint' and val: self.mStartPoint = int(val) elif opt == 'pagedelay' and val: self.mPageDelay = retValue(val, 0, self.mPageDelay) elif opt == 'pagelength' and val: self.mPageLength = retValue( val, 0, self.mPageLength) else: attribs.append((attrib, value)) if attrib == 'backgroundColor': self.scroll_label.setBackgroundColor(parseColor(value)) elif attrib == 'transparent': self.scroll_label.setTransparent(int(value)) self.skinAttributes = attribs ret = Renderer.applySkin(self, desktop, screen) if self.mOneShot: self.mOneShot = max(self.mStepTimeout, self.mOneShot) if self.mLoopTimeout: self.mLoopTimeout = max(self.mStepTimeout, self.mLoopTimeout) if self.mPageDelay: self.mPageDelay = max(self.mStepTimeout, self.mPageDelay) self.scroll_label.setFont(self.txfont) if not self.txtflags & RT_WRAP: self.scroll_label.setNoWrap(1) self.scroll_label.setVAlign(valign) self.scroll_label.setHAlign(self.halign) self.scroll_label.move(ePoint(0, 0)) self.scroll_label.resize(eSize(self.W, self.H)) if self.direction in (TOP, BOTTOM): from enigma import fontRenderClass flh = int(fontRenderClass.getInstance().getLineHeight(self.txfont) or self.txfont.pointSize / 6 + self.txfont.pointSize) self.scroll_label.setText('WQq') if flh > self.scroll_label.calculateSize().height(): self.lineHeight = flh self.scroll_label.setText('') return ret
def __init__(self): Renderer.__init__(self) VariableText.__init__(self) self.stringlength = 36
def __init__(self): Renderer.__init__(self) self.path = 'cript' self.nameCache = {} self.pngname = '' self.picon_default = "picon_default.png"
def __init__(self): Renderer.__init__(self) self.pstrNm = '' self.path = ""
def applySkin(self, desktop, screen): def retValue(val, limit, default, Min=False): try: if Min: x = min(limit, int(val)) else: x = max(limit, int(val)) except: x = default return x self.halign = valign = eLabel.alignLeft if self.skinAttributes: attribs = [] for (attrib, value) in self.skinAttributes: if attrib == "font": self.txfont = parseFont(value, ((1, 1), (1, 1))) elif attrib == "foregroundColor": self.fcolor = parseColor(value) elif attrib == "backgroundColor": self.bcolor = parseColor(value) elif attrib == "shadowColor": self.scolor = parseColor(value) elif attrib == "shadowOffset": x, y = value.split(',') self.soffset = (int(x), int(y)) elif attrib == "valign" and value in ("top", "center", "bottom"): valign = { "top": eLabel.alignTop, "center": eLabel.alignCenter, "bottom": eLabel.alignBottom }[value] self.txtflags |= { "top": RT_VALIGN_TOP, "center": RT_VALIGN_CENTER, "bottom": RT_VALIGN_BOTTOM }[value] elif attrib == "halign" and value in ("left", "center", "right", "block"): self.halign = { "left": eLabel.alignLeft, "center": eLabel.alignCenter, "right": eLabel.alignRight, "block": eLabel.alignBlock }[value] self.txtflags |= { "left": RT_HALIGN_LEFT, "center": RT_HALIGN_CENTER, "right": RT_HALIGN_RIGHT, "block": RT_HALIGN_BLOCK }[value] elif attrib == "noWrap": if value == "0": self.txtflags |= RT_WRAP else: self.txtflags &= ~RT_WRAP elif attrib == "options": options = value.split(',') for opt in options: val = '' pos = opt.find('=') if pos != -1: val = opt[pos + 1:].strip() opt = opt[:pos].strip() if opt == "wrap": if val == "0": self.txtflags &= ~RT_WRAP else: self.txtflags |= RT_WRAP elif opt == "nowrap": if val == "0": self.txtflags |= RT_WRAP else: self.txtflags &= ~RT_WRAP elif opt == "movetype" and val in ("none", "running", "swimming"): self.type = { "none": NONE, "running": RUNNING, "swimming": SWIMMING }[val] elif opt == "direction" and val in ("left", "right", "top", "bottom"): self.direction = { "left": LEFT, "right": RIGHT, "top": TOP, "bottom": BOTTOM }[val] elif opt == "step" and val: #retValue(val, limit, default, Min=False) self.mStep = retValue(val, 1, self.mStep) elif opt == "steptime" and val: self.mStepTimeout = retValue( val, 25, self.mStepTimeout) elif opt == "startdelay" and val: self.mStartDelay = retValue( val, 0, self.mStartDelay) elif opt == "pause" and val: self.mLoopTimeout = retValue( val, 0, self.mLoopTimeout) elif opt == "oneshot" and val: self.mOneShot = retValue(val, 0, self.mOneShot) elif opt == "repeat" and val: self.mRepeat = retValue(val, 0, self.mRepeat) elif opt == "always" and val: self.mAlways = retValue(val, 0, self.mAlways) elif opt == "startpoint" and val: self.mStartPoint = int(val) else: attribs.append((attrib, value)) self.skinAttributes = attribs ret = Renderer.applySkin(self, desktop, screen) #if self.type == RUNNING and self.direction in (LEFT,RIGHT): # self.halign = eLabel.alignLeft # self.txtflags = RT_HALIGN_LEFT | (self.txtflags & RT_WRAP) if self.mOneShot: self.mOneShot = max(self.mStepTimeout, self.mOneShot) if self.mLoopTimeout: self.mLoopTimeout = max(self.mStepTimeout, self.mLoopTimeout) self.test_label.setFont(self.txfont) #self.test_label.setForegroundColor(self.fcolor) #self.test_label.setBackgroundColor(self.bcolor) #if not self.scolor is None: # self.test_label.setShadowColor(self.scolor) # self.test_label.setShadowOffset(ePoint(self.soffset[0], self.soffset[1])) if not (self.txtflags & RT_WRAP): self.test_label.setNoWrap(1) self.test_label.setVAlign(valign) self.test_label.setHAlign(self.halign) self.test_label.move(ePoint(self.W, self.H)) self.test_label.resize(eSize(self.W, self.H)) #self.test_label.hide() #self.changed((self.CHANGED_DEFAULT,)) return ret
def __init__(self): Renderer.__init__(self) VariableValue.__init__(self)
def __init__(self): Renderer.__init__(self) VariableText.__init__(self) self.text = '---'
def __init__(self): Renderer.__init__(self) self.path = 'piconUni' self.scale = '0' self.nameCache = {} self.pngname = ''
def __init__(self): Renderer.__init__(self) self.path = 'animated_weather_icons' self.pixdelay = 100 self.pixdelay_overwrite = False self.slideicon = None
def __init__(self): Renderer.__init__(self) VariableText.__init__(self)
def __init__(self): Renderer.__init__(self) self.size = None self.nameAudioCache = {} self.pngname = "" self.path = ""
def __init__(self): Renderer.__init__(self) VariableText.__init__(self) self.epgcache = eEPGCache.getInstance()
def main(): options = parse_args(constants.TOOL_RUNNER) # Save us having to pass debugging everywhere. die = functools.partial(_die, options.verbosity >= 3) log.set_verbosity(options.verbosity) def done(s): ret = 0 if s: options.outfile.write(s) options.outfile.close() sys.exit(ret) if not options.platform or options.platform in ('?', 'help') \ or options.platform not in PLATFORMS: die('Valid --platform arguments are %s' % ', '.join(PLATFORMS)) if not options.file or len(options.file) > 1: die('A single input file must be provided for this operation') # Construct the compilation cache if requested. cache = None if options.cache in ('on', 'readonly', 'writeonly'): cache = Cache(options.cache_dir) f = options.file[0] try: s = f.read() # Try to find this output in the compilation cache if possible. This is # one of two places that we check in the cache. This check will 'hit' # if the source files representing the input spec are identical to some # previous execution. if options.cache in ('on', 'readonly'): key = [version(), os.path.abspath(f.name), s, cache_relevant_options(options), options.platform, options.item] value = cache.get(key) assert value is None or isinstance(value, FileSet), \ 'illegally cached a value for %s that is not a FileSet' % options.item if value is not None and value.valid(): # Cache hit. log.debug('Retrieved %(platform)s.%(item)s from cache' % \ options.__dict__) done(value.output) ast = parser.parse_to_ast(s, options.cpp, options.cpp_flag, options.ply_optimise) parser.assign_filenames(ast, f.name) except parser.CAmkESSyntaxError as e: e.set_column(s) die('%s:%s' % (f.name, str(e))) except Exception as inst: die('While parsing \'%s\': %s' % (f.name, inst)) try: for t in AST_TRANSFORMS[PRE_RESOLUTION]: ast = t(ast) except Exception as inst: die('While transforming AST: %s' % str(inst)) try: ast, imported = parser.resolve_imports(ast, \ os.path.dirname(os.path.abspath(f.name)), options.import_path, options.cpp, options.cpp_flag, options.ply_optimise) except Exception as inst: die('While resolving imports of \'%s\': %s' % (f.name, inst)) try: # if there are multiple assemblies, combine them now compose_assemblies(ast) except Exception as inst: die('While combining assemblies: %s' % str(inst)) # If we have a readable cache check if our current target is in the cache. # The previous check will 'miss' and this one will 'hit' when the input # spec is identical to some previous execution modulo a semantically # irrelevant element (e.g. an introduced comment). I.e. the previous check # matches when the input is exactly the same and this one matches when the # AST is unchanged. if options.cache in ('on', 'readonly'): key = [version(), ast, cache_relevant_options(options), options.platform, options.item] value = cache.get(key) if value is not None: assert options.item not in NEVER_AST_CACHE, \ '%s, that is marked \'never cache\' is in your cache' % options.item log.debug('Retrieved %(platform)s.%(item)s from cache' % \ options.__dict__) done(value) # If we have a writable cache, allow outputs to be saved to it. if options.cache in ('on', 'writeonly'): orig_ast = deepcopy(ast) fs = FileSet(imported) def save(item, value): # Save an input-keyed cache entry. This one is based on the # pre-parsed inputs to save having to derive the AST (parse the # input) in order to locate a cache entry in following passes. # This corresponds to the first cache check above. key = [version(), os.path.abspath(options.file[0].name), s, cache_relevant_options(options), options.platform, item] specialised = fs.specialise(value) if item == 'capdl': specialised.extend(options.elf) cache[key] = specialised if item not in NEVER_AST_CACHE: # Save an AST-keyed cache entry. This corresponds to the second # cache check above. cache[[version(), orig_ast, cache_relevant_options(options), options.platform, item]] = value else: def save(item, value): pass ast = parser.dedupe(ast) try: ast = parser.resolve_references(ast) except Exception as inst: die('While resolving references of \'%s\': %s' % (f.name, inst)) try: parser.collapse_references(ast) except Exception as inst: die('While collapsing references of \'%s\': %s' % (f.name, inst)) try: for t in AST_TRANSFORMS[POST_RESOLUTION]: ast = t(ast) except Exception as inst: die('While transforming AST: %s' % str(inst)) try: resolve_hierarchy(ast) except Exception as inst: die('While resolving hierarchy: %s' % str(inst)) # All references in the AST need to be resolved for us to continue. unresolved = reduce(lambda a, x: a.union(x), map(lambda x: x.unresolved(), ast), set()) if unresolved: die('Unresolved references in input specification:\n %s' % \ '\n '.join(map(lambda x: '%(filename)s:%(lineno)s:\'%(name)s\' of type %(type)s' % { 'filename':x.filename or '<unnamed file>', 'lineno':x.lineno, 'name':x._symbol, 'type':x._type.__name__, }, unresolved))) # Locate the assembly assembly = [x for x in ast if isinstance(x, AST.Assembly)] if len(assembly) > 1: die('Multiple assemblies found') elif len(assembly) == 1: assembly = assembly[0] else: die('No assembly found') obj_space = ObjectAllocator() obj_space.spec.arch = options.architecture cspaces = {} pds = {} conf = assembly.configuration shmem = defaultdict(dict) templates = Templates(options.platform) map(templates.add_root, options.templates) r = Renderer(templates.get_roots(), options) # The user may have provided their own connector definitions (with # associated) templates, in which case they won't be in the built-in lookup # dictionary. Let's add them now. Note, definitions here that conflict with # existing lookup entries will overwrite the existing entries. for c in (x for x in ast if isinstance(x, AST.Connector)): if c.from_template: templates.add(c.name, 'from.source', c.from_template) if c.to_template: templates.add(c.name, 'to.source', c.to_template) # We're now ready to instantiate the template the user requested, but there # are a few wrinkles in the process. Namely, # 1. Template instantiation needs to be done in a deterministic order. The # runner is invoked multiple times and template code needs to be # allocated identical cap slots in each run. # 2. Components and connections need to be instantiated before any other # templates, regardless of whether they are the ones we are after. Some # other templates, such as the Makefile depend on the obj_space and # cspaces. # 3. All actual code templates, up to the template that was requested, # need to be instantiated. This is related to (1) in that the cap slots # allocated are dependent on what allocations have been done prior to a # given allocation call. # Instantiate the per-component source and header files. for id, i in enumerate(assembly.composition.instances): # Don't generate any code for hardware components. if i.type.hardware: continue if i.address_space not in cspaces: p = Perspective(phase=RUNNER, instance=i.name, group=i.address_space) cnode = obj_space.alloc(seL4_CapTableObject, name=p['cnode'], label=i.address_space) cspaces[i.address_space] = CSpaceAllocator(cnode) pd = obj_space.alloc(seL4_PageDirectoryObject, name=p['pd'], label=i.address_space) pds[i.address_space] = pd for t in ('%s.source' % i.name, '%s.header' % i.name, '%s.linker' % i.name): try: template = templates.lookup(t, i) g = '' if template: g = r.render(i, assembly, template, obj_space, cspaces[i.address_space], \ shmem, options=options, id=id, my_pd=pds[i.address_space]) save(t, g) if options.item == t: if not template: log.warning('Warning: no template for %s' % options.item) done(g) except Exception as inst: die('While rendering %s: %s' % (i.name, inst)) # Instantiate the per-connection files. conn_dict = {} for id, c in enumerate(assembly.composition.connections): tmp_name = c.name key_from = (c.from_instance.name + '_' + c.from_interface.name) in conn_dict key_to = (c.to_instance.name + '_' + c.to_interface.name) in conn_dict if not key_from and not key_to: # We need a new connection name conn_name = 'conn' + str(id) c.name = conn_name conn_dict[c.from_instance.name + '_' + c.from_interface.name] = conn_name conn_dict[c.to_instance.name + '_' + c.to_interface.name] = conn_name elif not key_to: conn_name = conn_dict[c.from_instance.name + '_' + c.from_interface.name] c.name = conn_name conn_dict[c.to_instance.name + '_' + c.to_interface.name] = conn_name elif not key_from: conn_name = conn_dict[c.to_instance.name + '_' + c.to_interface.name] c.name = conn_name conn_dict[c.from_instance.name + '_' + c.from_interface.name] = conn_name else: continue for t in (('%s.from.source' % tmp_name, c.from_instance.address_space), ('%s.from.header' % tmp_name, c.from_instance.address_space), ('%s.to.source' % tmp_name, c.to_instance.address_space), ('%s.to.header' % tmp_name, c.to_instance.address_space)): try: template = templates.lookup(t[0], c) g = '' if template: g = r.render(c, assembly, template, obj_space, cspaces[t[1]], \ shmem, options=options, id=id, my_pd=pds[t[1]]) save(t[0], g) if options.item == t[0]: if not template: log.warning('Warning: no template for %s' % options.item) done(g) except Exception as inst: die('While rendering %s: %s' % (t[0], inst)) c.name = tmp_name # The following block handles instantiations of per-connection # templates that are neither a 'source' or a 'header', as handled # above. We assume that none of these need instantiation unless we are # actually currently looking for them (== options.item). That is, we # assume that following templates, like the CapDL spec, do not require # these templates to be rendered prior to themselves. # FIXME: This is a pretty ugly way of handling this. It would be nicer # for the runner to have a more general notion of per-'thing' templates # where the per-component templates, the per-connection template loop # above, and this loop could all be done in a single unified control # flow. for t in (('%s.from.' % c.name, c.from_instance.address_space), ('%s.to.' % c.name, c.to_instance.address_space)): if not options.item.startswith(t[0]): # This is not the item we're looking for. continue try: # If we've reached here then this is the exact item we're # after. template = templates.lookup(options.item, c) if template is None: raise Exception('no registered template for %s' % options.item) g = r.render(c, assembly, template, obj_space, cspaces[t[1]], \ shmem, options=options, id=id, my_pd=pds[t[1]]) save(options.item, g) done(g) except Exception as inst: die('While rendering %s: %s' % (options.item, inst)) # Perform any per component simple generation. This needs to happen last # as this template needs to run after all other capabilities have been # allocated for id, i in enumerate(assembly.composition.instances): # Don't generate any code for hardware components. if i.type.hardware: continue assert i.address_space in cspaces if conf and conf.settings and [x for x in conf.settings if \ x.instance == i.name and x.attribute == 'simple' and x.value]: for t in ('%s.simple' % i.name,): try: template = templates.lookup(t, i) g = '' if template: g = r.render(i, assembly, template, obj_space, cspaces[i.address_space], \ shmem, options=options, id=id, my_pd=pds[i.address_space]) save(t, g) if options.item == t: if not template: log.warning('Warning: no template for %s' % options.item) done(g) except Exception as inst: die('While rendering %s: %s' % (i.name, inst)) # Derive a set of usable ELF objects from the filenames we were passed. elfs = {} for e in options.elf: try: name = os.path.basename(e) if name in elfs: raise Exception('duplicate ELF files of name \'%s\' encountered' % name) elf = ELF(e, name, options.architecture) p = Perspective(phase=RUNNER, elf_name=name) group = p['group'] # Avoid inferring a TCB as we've already created our own. elf_spec = elf.get_spec(infer_tcb=False, infer_asid=False, pd=pds[group], use_large_frames=options.largeframe) obj_space.merge(elf_spec, label=group) elfs[name] = (e, elf) except Exception as inst: die('While opening \'%s\': %s' % (e, inst)) if options.item in ('capdl', 'label-mapping'): # It's only relevant to run these filters if the final target is CapDL. # Note, this will no longer be true if we add any other templates that # depend on a fully formed CapDL spec. Guarding this loop with an if # is just an optimisation and the conditional can be removed if # desired. for f in CAPDL_FILTERS: try: # Pass everything as named arguments to allow filters to # easily ignore what they don't want. f(ast=ast, obj_space=obj_space, cspaces=cspaces, elfs=elfs, options=options, shmem=shmem) except Exception as inst: die('While forming CapDL spec: %s' % str(inst)) # Instantiate any other, miscellaneous template. If we've reached this # point, we know the user did not request a code template. try: template = templates.lookup(options.item) if template: g = r.render(assembly, assembly, template, obj_space, None, \ shmem, imported=imported, options=options) save(options.item, g) done(g) except Exception as inst: die('While rendering %s: %s' % (options.item, inst)) die('No valid element matching --item %s' % options.item)