def FileEntryComponent(name, absolute = None, isDir = False): if getDesktop(0).size().width() == 1920: res = [(absolute, isDir), (eListboxPythonMultiContent.TYPE_TEXT, 35, 1, 900, 40, 0, RT_HALIGN_LEFT, name)] if isDir: png = LoadPixmap(cached=True, path=resolveFilename(SCOPE_ACTIVE_SKIN, "extensions/directory.png")) else: extension = name.split('.') extension = extension[-1].lower() if EXTENSIONS.has_key(extension): png = LoadPixmap(resolveFilename(SCOPE_ACTIVE_SKIN, "extensions/" + EXTENSIONS[extension] + ".png")) else: png = None if png is not None: res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 10, 7, 20, 20, png)) return res if getDesktop(0).size().width() == 1280: res = [(absolute, isDir), (eListboxPythonMultiContent.TYPE_TEXT, 35, 1, 470, 20, 0, RT_HALIGN_LEFT, name)] if isDir: png = LoadPixmap(cached=True, path=resolveFilename(SCOPE_ACTIVE_SKIN, "extensions/directory.png")) else: extension = name.split('.') extension = extension[-1].lower() if EXTENSIONS.has_key(extension): png = LoadPixmap(resolveFilename(SCOPE_ACTIVE_SKIN, "extensions/" + EXTENSIONS[extension] + ".png")) else: png = None if png is not None: res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 10, 2, 20, 20, png)) return res
def LoadSkin(SkinName): from enigma import getDesktop model='' if os_path.exists("/proc/stb/info/vumodel"): with open("/proc/stb/info/vumodel", "r") as f: model=f.read().strip() f.close() if SkinName.endswith('.xml'): SkinName=SkinName[:-4] skinDef=None if getDesktop(0).size().width() == 1920 and os_path.exists("%s/skins/%s%sFHD.xml" % (PluginPath,SkinName,model)): with open("%s/skins/%s%sFHD.xml" % (PluginPath,SkinName,model),'r') as skinfile: skinDef=skinfile.read() skinfile.close() elif getDesktop(0).size().width() == 1920 and os_path.exists("%s/skins/%sFHD.xml" % (PluginPath,SkinName)): with open("%s/skins/%sFHD.xml" % (PluginPath,SkinName),'r') as skinfile: skinDef=skinfile.read() skinfile.close() elif os_path.exists("%s/skins/%s%s.xml" % (PluginPath,SkinName,model)): with open("%s/skins/%s%s.xml" % (PluginPath,SkinName,model),'r') as skinfile: skinDef=skinfile.read() skinfile.close() elif os_path.exists("%s/skins/%s.xml" % (PluginPath,SkinName)): with open("%s/skins/%s.xml" % (PluginPath,SkinName),'r') as skinfile: skinDef=skinfile.read() skinfile.close() else: printDEBUG("[LoadSkin] %s does not exists" % SkinName ) return skinDef
def __init__(self, session, backend, file): self.backend = backend backend.window=self #self.skinName = "MoviePlayer" self.bgcolor = "#00000000" space = 0 #formerly 40 we will see ;-) size_w = getDesktop(0).size().width() size_h = getDesktop(0).size().height() self.skin = "<screen position=\"0,0\" size=\"" + str(size_w) + "," + str(size_h) + "\" flags=\"wfNoBorder\" > \ <eLabel position=\"0,0\" zPosition=\"0\" size=\""+ str(size_w) + "," + str(size_h) + "\" backgroundColor=\""+ self.bgcolor +"\" /> \ <widget name=\"pic\" position=\"" + str(space+20) + "," + str(space) + "\" size=\"" + str(size_w-(space*2)) + "," + str(size_h-(space*2)) + "\" zPosition=\"1\" alphatest=\"on\" /> \ </screen>" Screen.__init__(self, session) self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "DirectionActions", "MovieSelectionActions"], { "cancel": self.Exit, }, -1) self["pic"] = Pixmap() self.file = file self.picload = ePicLoad() self.picload.PictureData.get().append(self.finish_decode) self.onLayoutFinish.append(self.setPicloadConf)
def LayoutFinished(self): self.currentHeight= getDesktop(0).size().height() self.currentWidth = getDesktop(0).size().width() # first we initiate the TV preview screen self["SkinPicture"].hide() fileName = self.ScreenFile.replace('allScreens/','allPreviews/preview_')[:-4] if path.exists(fileName + '.png'): fileName = fileName + '.png' elif path.exists(fileName + '.jpg'): fileName = fileName + '.jpg' else: fileName = self.getPicFileNameWithPath('tvpreview.png') if path.exists(fileName): self["ScreenPixMapPictureInScale"].instance.setScale(1) self["ScreenPixMapPictureInScale"].instance.setPixmap(LoadPixmap(path=fileName)) self["ScreenPixMapPictureInScale"].show() else: print "no preview file" self.WidgetPreviewX = self["ScreenPixMapPictureInScale"].instance.position().x() self.WidgetPreviewY = self["ScreenPixMapPictureInScale"].instance.position().y() self.WidgetPreviewScale = ( float(self["ScreenPixMapPictureInScale"].instance.size().width()) / float(getDesktop(0).size().width()) ) self["widgetDetailsTXT"].setText('') self["PreviewFont"].setText('') self["PixMapPreview"].hide() self.createWidgetsList()
def __init__(self, session,title,filename, slideshowcallback = None,args=0): self.slideshowcallback=slideshowcallback self.screentitle = title self.filename = filename size_w = getDesktop(0).size().width() size_h = getDesktop(0).size().height() self.skin = """ <screen position="0,0" size="%i,%i" title="%s" flags=\"wfNoBorder\"> <widget name="pixmap" position="0,0" size="%i,%i" backgroundColor=\"black\"/> </screen>""" % (size_w,size_h,filename,size_w,size_h) Screen.__init__(self, session) self.picload = ePicLoad() self.picload.PictureData.get().append(self.setPictureCB) sc = AVSwitch().getFramebufferScale() self.picload.setPara((size_w, size_h, sc[0], sc[1], False, 1, '#ff000000')) self["pixmap"] = Pixmap() self.paused = False self["actions"] = ActionMap(["WizardActions", "DirectionActions","ChannelSelectBaseActions","ShortcutActions"], { "ok": self.do, "back": self.exit, "green": self.AutoReloaderSwitch, "yellow": self.pause, "red": self.prev, "blue": self.next, }, -1) self.onLayoutFinish.append(self.do)
def ChoiceEntryComponent(key="", text=None): if getDesktop(0).size().width() == 1920: if not text: text = ["--"] res = [ text ] if text[0] == "--": res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 00, 1000, 25, 0, RT_HALIGN_LEFT, "-"*200)) else: res.append((eListboxPythonMultiContent.TYPE_TEXT, 65, 2, 1000, 40, 0, RT_HALIGN_LEFT, text[0])) pngfile = resolveFilename(SCOPE_ACTIVE_SKIN, "buttons/key_" + key + ".png") if fileExists(pngfile): png = LoadPixmap(pngfile) res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 10, 2, 35, 35, png)) return res if getDesktop(0).size().width() == 1280: if not text: text = ["--"] res = [ text ] if text[0] == "--": res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 00, 800, 25, 0, RT_HALIGN_LEFT, "-"*200)) else: res.append((eListboxPythonMultiContent.TYPE_TEXT, 45, 00, 800, 25, 0, RT_HALIGN_LEFT, text[0])) pngfile = resolveFilename(SCOPE_ACTIVE_SKIN, "buttons/key_" + key + ".png") if fileExists(pngfile): png = LoadPixmap(pngfile) res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 5, 0, 35, 30, png)) return res
def movePixmap(self): self.startmovingtimer.stop() newX = randrange(getDesktop(0).size().width() - self.coverartsize[0] - 1) newY = randrange(getDesktop(0).size().height() - self.coverartsize[1] - 1) self["cover"].moveTo(newX, newY, time=config.plugins.LastFM.sreensaver.coverartspeed.value) self["cover"].startMoving() self.startmovingtimer.start(config.plugins.LastFM.sreensaver.coverartinterval.value * 1000)
def imdb_show(self, title, pp, elapsed, genre, search_title): res = [ (title, pp, elapsed, genre, search_title) ] s1=_("Exist") + "|" + _("N/A") if not re.match('.*?(' + s1 + ')', elapsed): elapsed = "%s ms" % elapsed if getDesktop(0).size().width() == 1920: f=1.5 gF=6 elif getDesktop(0).size().width() == 3840: f=3 gF=7 else: f=1 gF=4 h = image() if self.count_movies * h > self.listHeight: w = self.listWidth - 15 # place for scrollbar else: w = self.listWidth res.append(MultiContentEntryText(pos=(0, 0), size=(w, h), font=gF, text=search_title, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER)) res.append(MultiContentEntryText(pos=(w-100*f, 0), size=(100*f, h), font=gF, text=elapsed, flags=RT_HALIGN_RIGHT|RT_VALIGN_CENTER)) return res
def testpic_filter(self): self.next = self.testpic_gamma self.show() c = self["Canvas"] xres, yres = getDesktop(0).size().width(), getDesktop(0).size().height() c.fill(0, 0, xres, yres, RGB(64, 64, 64)) width = xres - xres/5 offset = xres/10 yb = yres * 2 / 3 height = yres / 20 o = yres / 60 border = xres / 60 g1 = 255 g2 = 128 c.fill(offset - border, yb - border, border * 2 + width, border * 2 + (height * 3 + o * 2), RGB(g1, g1, g1)) for x in xrange(0, width, 2): c.fill(offset + x, yb, 1, height, RGB(g2,g2,g2)) for x in xrange(0, width, 4): c.fill(offset + x, yb + (o + height), 2, height, RGB(g2,g2,g2)) for x in xrange(0, width, 8): c.fill(offset + x, yb + (o + height) * 2, 4, height, RGB(g2,g2,g2)) c.flush()
def testpic_brightness(self): self.next = self.testpic_contrast c = self["Canvas"] xres, yres = getDesktop(0).size().width(), getDesktop(0).size().height() bbw, bbh = xres / 192, yres / 192 c.fill(0, 0, xres, yres, RGB(0,0,0)) for i in range(15): col = i * 116 / 14 height = yres / 3 eh = height / 8 offset = yres/6 + eh * i x = xres * 2 / 3 width = yres / 6 c.fill(x, offset, width, eh, RGB(col, col, col)) if col == 0 or col == 16 or col == 116: c.fill(x, offset, width, 2, RGB(255, 255, 255)) if i < 2: c.writeText(x + width, offset, width, eh, RGB(255, 255, 255), RGB(0,0,0), gFont("Regular", 20), "%d." % (i+1)) c.writeText(xres / 10, yres / 6 - 40, xres * 3 / 5, 40, RGB(128,255,255), RGB(0,0,0), gFont("Regular", 40), _("Brightness")) c.writeText(xres / 10, yres / 6, xres * 4 / 7, yres * 4 / 6, RGB(255,255,255), RGB(0,0,0), gFont("Regular", 20), _("If your TV has a brightness or contrast enhancement, disable it. If there is something called \"dynamic\", " "set it to standard. Adjust the backlight level to a value suiting your taste. " "Turn down contrast on your TV as much as possible.\nThen turn the brightness setting as " "low as possible, but make sure that the two lowermost shades of gray stay distinguishable.\n" "Do not care about the bright shades now. They will be set up in the next step.\n" "If you are happy with the result, press OK."), RT_WRAP) c.flush()
def testpic_gamma(self): self.next = self.testpic_overscan self.show() c = self["Canvas"] xres, yres = getDesktop(0).size().width(), getDesktop(0).size().height() c.fill(0, 0, xres, yres, RGB(0, 0, 0)) width = xres - xres/5 offset_x = xres/10 height = yres - yres/5 offset_y = yres/10 for y in xrange(0, height, 4): c.fill(offset_x, offset_y + y, width/2, 2, RGB(255,255,255)) l = 0 fnt = gFont("Regular", height / 14) import math for i in xrange(1, 15): y = i * height / 14 h = y - l gamma = 0.6 + i * 0.2 col = int(math.pow(.5, 1.0/gamma) * 256.0) c.fill(offset_x + width/2, offset_y + l, width/2, h, RGB(col,col,col)) c.writeText(offset_x + width/2, offset_y + l, width/2, h, RGB(0,0,0), RGB(col,col,col), fnt, "%1.2f" % gamma, RT_WRAP|RT_HALIGN_RIGHT) l = y c.flush()
def autoResize(self): desktop_w = enigma.getDesktop(0).size().width() desktop_h = enigma.getDesktop(0).size().height() count = len(self.list) if count > 15: count = 15 if not self["text"].text: # move list textsize = (520, 0) listsize = (520, 25 * count) self["list"].instance.move(enigma.ePoint(0, 0)) self["list"].instance.resize(enigma.eSize(*listsize)) else: textsize = self["text"].getSize() if textsize[0] < textsize[1]: textsize = (textsize[1], textsize[0] + 10) if textsize[0] > 520: textsize = (textsize[0], textsize[1] + 25) else: textsize = (520, textsize[1] + 25) listsize = (textsize[0], 25 * count) # resize label self["text"].instance.resize(enigma.eSize(*textsize)) self["text"].instance.move(enigma.ePoint(10, 10)) # move list self["list"].instance.move(enigma.ePoint(0, textsize[1])) self["list"].instance.resize(enigma.eSize(*listsize)) wsizex = textsize[0] wsizey = textsize[1] + listsize[1] wsize = (wsizex, wsizey) self.instance.resize(enigma.eSize(*wsize)) # center window self.instance.move(enigma.ePoint((desktop_w - wsizex) / 2, (desktop_h - wsizey) / 2))
def _cb_stop_browser(self): self._close_timer.stop() try: if self._cb_set_title in vbcfg.g_main.vbhandler.onSetTitleCB: vbcfg.g_main.vbhandler.onSetTitleCB.remove(self._cb_set_title) except Exception: pass try: if self._cb_close_window in vbcfg.g_main.vbhandler.onCloseCB: vbcfg.g_main.vbhandler.onCloseCB.remove(self._cb_close_window) except Exception: pass self.toggle_top() from enigma import gMainDC gMainDC.getInstance().setResolution(self.WIDTH, self.HEIGHT) vbcfg.setPosition(vbcfg.g_position) fbClass.getInstance().unlock() eRCInput.getInstance().unlock() getDesktop(0).paint() self.is_browser_opened = False vbcfg.LOG("Stop Browser") self.setTitle(_("BrowserMain")) if self.m_url is not None: self.keyCancel() if vbcfg.g_service: self.session.nav.playService(vbcfg.g_service) else: self.keyRight() self.keyLeft()
def moveWindow(self): try: if self.x_pos is None or self.y_pos is None: self.x_pos = self.instance.position().x() self.y_pos = self.instance.position().y() if self.instance.size().width() + 20 >= getDesktop(0).size().width() and self.instance.size().height() + 20 >= getDesktop(0).size().height(): return self.x_pos += self.x_dir self.y_pos += self.y_dir if self.x_dir > 0 and self.x_pos + self.instance.size().width() >= getDesktop(0).size().width(): self.x_dir = -self.x_dir elif self.x_dir < 0 and self.x_pos <= 0: self.x_dir = -self.x_dir if self.y_dir > 0 and self.y_pos + self.instance.size().height() >= getDesktop(0).size().height(): self.y_dir = -self.y_dir elif self.y_dir < 0 and self.y_pos <= 0: self.y_dir = -self.y_dir self.instance.move(ePoint(self.x_pos, self.y_pos)) except Exception: pass try: self.WindowMoveTimer.start(150, True) except Exception: pass
def __init__(self, session, parent): size_w = getDesktop(0).size().width() size_h = getDesktop(0).size().height() self.skin = """<screen position="0,0" size="%i,%i" flags="wfNoBorder" title="LastFMSaveScreen" > <widget name="cover" position="50,50" size="%i,%i" /> </screen>""" % (size_w, size_h, self.coverartsize[0], self.coverartsize[1]) Screen.__init__(self, session) HelpableScreen.__init__(self) self.imageconverter = ImageConverter(self.coverartsize[0], self.coverartsize[1], self.setCoverArt) self.session = session self.streamplayer = parent.streamplayer self.parent = parent self["cover"] = MovingPixmap() self["actions"] = HelpableActionMap(self, ["WizardActions", "ShortcutActions"], { "ok": (self.action_exit, _("Exit screensaver")), "back": (self.action_exit, _("Exit screensaver")), "red": (self.parent.action_startstop, _("Start/stop streaming")), "green": (self.parent.skipTrack, _("Skip current track")), "yellow": (self.parent.love, _("Mark track as loved")), "blue": (self.parent.banTrack, _("Ban track, never play")) }, prio=-1, description=config.plugins.LastFM.name.value + " " + _("Screensaver")) self.onLayoutFinish.append(self.update) self.updatetimer = eTimer() self.updatetimer.timeout.get().append(self.update) self.updatetimer.start(1000) if config.plugins.LastFM.sreensaver.coverartanimation.value: self.startmovingtimer = eTimer() self.startmovingtimer.timeout.get().append(self.movePixmap) self.startmovingtimer.start(config.plugins.LastFM.sreensaver.coverartinterval.value * 1000)
def image(item=True, itemfont=False, pixmap=False): if item: if getDesktop(0).size().width() == 1920: if imgVti: return 42 else: return 40 elif getDesktop(0).size().width() == 3840: if imgVti: return 70 else: return 70 else: if imgVti: return 37 else: return 28 if itemfont: if imgVti: return 37 else: return 28 if pixmap: if imgVti: return "/usr/lib/enigma2/python/Plugins/Extensions/EnhancedMovieCenter/img/cursor_vti.png" else: return "/usr/lib/enigma2/python/Plugins/Extensions/EnhancedMovieCenter/img/cursor.png"
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) 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 ServiceInfoListEntry(a, b, valueType=TYPE_TEXT, param=4): if not isinstance(b, str): if valueType == TYPE_VALUE_HEX: b = ("0x%0" + str(param) + "x") % to_unsigned(b) elif valueType == TYPE_VALUE_DEC: b = str(b) elif valueType == TYPE_VALUE_HEX_DEC: b = ("0x%0" + str(param) + "x (%dd)") % (to_unsigned(b), b) elif valueType == TYPE_VALUE_ORBIT_DEC: direction = 'E' if b > 1800: b = 3600 - b direction = 'W' b = "%d.%d%s" % (b // 10, b % 10, direction) else: b = str(b) if getDesktop(0).size().width() == 1920: return [ #PyObject *type, *px, *py, *pwidth, *pheight, *pfnt, *pstring, *pflags; (eListboxPythonMultiContent.TYPE_TEXT, 0, 0, 450, 40, 0, RT_HALIGN_LEFT, ""), (eListboxPythonMultiContent.TYPE_TEXT, 0, 0, 450, 40, 0, RT_HALIGN_LEFT, a), (eListboxPythonMultiContent.TYPE_TEXT, 270, 0, 630, 40, 0, RT_HALIGN_LEFT, b) ] if getDesktop(0).size().width() == 1280: return [ #PyObject *type, *px, *py, *pwidth, *pheight, *pfnt, *pstring, *pflags; (eListboxPythonMultiContent.TYPE_TEXT, 0, 0, 200, 24, 0, RT_HALIGN_LEFT, ""), (eListboxPythonMultiContent.TYPE_TEXT, 0, 0, 200, 24, 0, RT_HALIGN_LEFT, a), (eListboxPythonMultiContent.TYPE_TEXT, 230, 0, 450, 24, 0, RT_HALIGN_LEFT, b) ]
def autoResize(self): desktop_w = enigma.getDesktop(0).size().width() desktop_h = enigma.getDesktop(0).size().height() count = len(self.list) itemheight = self['list'].getItemHeight() if count > 15: count = 15 if not self['text'].text: textsize = (520, 0) listsize = (520, itemheight * count) self['list'].instance.move(enigma.ePoint(0, 0)) self['list'].instance.resize(enigma.eSize(*listsize)) else: textsize = self['text'].getSize() if textsize[0] < textsize[1]: textsize = (textsize[1], textsize[0] + 10) if textsize[0] > 520: textsize = (textsize[0], textsize[1] + itemheight) else: textsize = (520, textsize[1] + itemheight) listsize = (textsize[0], itemheight * count) self['text'].instance.resize(enigma.eSize(*textsize)) self['text'].instance.move(enigma.ePoint(10, 10)) self['list'].instance.move(enigma.ePoint(0, textsize[1])) self['list'].instance.resize(enigma.eSize(*listsize)) wsizex = textsize[0] wsizey = textsize[1] + listsize[1] wsize = (wsizex, wsizey) self.instance.resize(enigma.eSize(*wsize)) self.instance.move(enigma.ePoint((desktop_w - wsizex) / 2, (desktop_h - wsizey) / 2))
def __init__(self, session, path=None, args=None): Screen.__init__(self, session) self.session = session self.menu = args self.e = None xml_file = '/etc/openpanel.xml' if path: xml_file = path try: self.Desktop_width = getDesktop(0).size().width() self.Desktop_height = getDesktop(0).size().height() except: self.Desktop_width = 720 self.Desktop_height = 576 # print "[OpenPanel] Desktop size: ", self.Desktop_width, self.Desktop_height self.zapHistory = [None] self.pluginlist = plugins.getPlugins([PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_EVENTINFO]) try: parser = minidom.parse(xml_file) self.currentNode = parser.documentElement self.getList(self.makeEntrys(self.currentNode)[0], self.makeEntrys(self.currentNode)[1]) self["list"] = OpenPanelList(list = self.list, selection = 0) self["summary_list"] = StaticText() self.updateSummary() except Exception, e: self.e = e self["list"] = OpenPanelList(None)
def setPreviewPosition(self): size_w = getDesktop(0).size().width() size_h = getDesktop(0).size().height() dsk_w = int(float(size_w)) / float(720) dsk_h = int(float(size_h)) / float(576) dst_left = int(config.osd.dst_left.getValue()) dst_width = int(config.osd.dst_width.getValue()) dst_top = int(config.osd.dst_top.getValue()) dst_height = int(config.osd.dst_height.getValue()) while dst_width + (dst_left / float(dsk_w)) >= 720.5 or dst_width + dst_left > 720: dst_width = int(dst_width) - 1 while dst_height + (dst_top / float(dsk_h)) >= 576.5 or dst_height + dst_top > 576: dst_height = int(dst_height) - 1 config.osd.dst_left.setValue(dst_left) config.osd.dst_width.setValue(dst_width) config.osd.dst_top.setValue(dst_top) config.osd.dst_height.setValue(dst_height) setPosition( config.osd.dst_left.getValue(), config.osd.dst_width.getValue(), config.osd.dst_top.getValue(), config.osd.dst_height.getValue(), ) setAlpha(config.osd.alpha.getValue())
def setPreviewPosition(self): size_w = getDesktop(0).size().width() size_h = getDesktop(0).size().height() dsk_w = int(float(size_w)) / float(720) dsk_h = int(float(size_h)) / float(576) dst_left = int(config.osd.dst_left.value) dst_width = int(config.osd.dst_width.value) dst_top = int(config.osd.dst_top.value) dst_height = int(config.osd.dst_height.value) while dst_width + dst_left / float(dsk_w) >= 720.5 or dst_width + dst_left > 720: dst_width = int(dst_width) - 1 while dst_height + dst_top / float(dsk_h) >= 576.5 or dst_height + dst_top > 576: dst_height = int(dst_height) - 1 config.osd.dst_left.setValue(dst_left) config.osd.dst_width.setValue(dst_width) config.osd.dst_top.setValue(dst_top) config.osd.dst_height.setValue(dst_height) print "Setting OSD position: %s %s %s %s" % ( config.osd.dst_left.value, config.osd.dst_width.value, config.osd.dst_top.value, config.osd.dst_height.value, )
def __selectionChanged(self): cur = self["config"].getCurrent() cur = cur and len(cur) > 2 and cur[2] if cur == "PRESET": self.getPreset() if cur == "ENABLED" or cur == "ENABLED_FHD" or cur == "PRESET": self["config"].setList(self.getMenuItemList()) self.Console = Console() self.service_name = "enigma2-plugin-skins-metrix-atv-fhd-icons" self.x = getDesktop(0).size().width() self.y = getDesktop(0).size().height() if ( cur == "ENABLED_FHD" and config.plugins.MyMetrixLiteOther.FHDenabled.value and self.x < 1920 and self.y < 1080 ): self.session.openWithCallback( self.resolutionTest, MessageBox, _( "If you chose 'yes', then starts the resolution test.\n\nCan't you see the next message,\nthe old resolution will automatically after 10 seconds restored." ), default=False, ) elif cur == "ENABLED_FHD" and not config.plugins.MyMetrixLiteOther.FHDenabled.value: self.UninstallCheck() elif cur == "ENABLED_FHD" and config.plugins.MyMetrixLiteOther.FHDenabled.value: self.InstallCheck()
def __init__(self,session,parent): size_w = getDesktop(0).size().width() size_h = getDesktop(0).size().height() self.skin = """<screen position="0,0" size="%i,%i" flags="wfNoBorder" title="LastFMSaveScreen" > <widget name="cover" position="50,50" size="%i,%i" /> </screen>"""%(size_w,size_h,self.coverartsize[0],self.coverartsize[1]) Screen.__init__(self,session) self.imageconverter = ImageConverter(self.coverartsize[0],self.coverartsize[1],self.setCoverArt) self.session = session self.streamplayer = parent.streamplayer self.parent = parent self["cover"] = MovingPixmap() self["actions"] = ActionMap(["InfobarChannelSelection","WizardActions", "DirectionActions","MenuActions","ShortcutActions","GlobalActions","HelpActions"], { "ok": self.action_exit, "back": self.action_exit, "red": self.parent.action_startstop, "green": self.parent.skipTrack, "yellow": self.parent.love, "blue": self.parent.banTrack , }, -1) self.onLayoutFinish.append(self.update) self.updatetimer = eTimer() self.updatetimer.timeout.get().append(self.update) self.updatetimer.start(1000) if config.plugins.LastFM.sreensaver.coverartanimation.value: self.startmovingtimer = eTimer() self.startmovingtimer.timeout.get().append(self.movePixmap) self.startmovingtimer.start(config.plugins.LastFM.sreensaver.coverartinterval.value*1000)
def loadEnigmalightSkin(): """ loads the corresponding skin.xml file @param: none @return none """ width = getDesktop(0).size().width() height = getDesktop(0).size().height() skin = "/usr/lib/enigma2/python/Plugins/Extensions/EnigmaLight/skins/default/skin-hd.xml" #load fullhd skin when fullhd framebuffer is used. if width > 1280 and height > 720: skin = "/usr/lib/enigma2/python/Plugins/Extensions/EnigmaLight/skins/default/skin-fullhd.xml" if skin: loadSkin(skin) EnigmaLight_log("",None,"__common__::loadEnigmalightSkin() > Load Skin: " + skin) if skin: try: loadSkin(skin) except: from traceback import format_exc EnigmaLight_log("",None,"__common__::loadEnigmalightSkin > ERROR: " +format_exc() ) try: open(getCrashFilePath(),"w").write(format_exc()) except: pass
def MultiFileSelectEntryComponent(name, absolute = None, isDir = False, selected = False): if getDesktop(0).size().width() == 1920: res = [(absolute, isDir, selected, name), (eListboxPythonMultiContent.TYPE_TEXT, 55, 1, 470, 40, 0, RT_HALIGN_LEFT, name)] else: res = [(absolute, isDir, selected, name), (eListboxPythonMultiContent.TYPE_TEXT, 55, 1, 470, 20, 0, RT_HALIGN_LEFT, name)] if isDir: png = LoadPixmap(cached=True, path=resolveFilename(SCOPE_ACTIVE_SKIN, "extensions/directory.png")) else: extension = name.split('.') extension = extension[-1].lower() if EXTENSIONS.has_key(extension): png = LoadPixmap(resolveFilename(SCOPE_ACTIVE_SKIN, "extensions/" + EXTENSIONS[extension] + ".png")) else: png = None if png is not None: res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 30, 2, 20, 20, png)) if not name.startswith('<'): if selected: icon = LoadPixmap(cached=True, path=resolveFilename(SCOPE_ACTIVE_SKIN, "icons/lock_on.png")) else: icon = LoadPixmap(cached=True, path=resolveFilename(SCOPE_ACTIVE_SKIN, "icons/lock_off.png")) if getDesktop(0).size().width() == 1920: res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 2, 5, 25, 25, icon)) else: res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 2, 0, 25, 25, icon)) return res
def Exit(self): del self.picload if config.usage.pic_resolution.value and (self.size_w, self.size_h) != eval(config.usage.pic_resolution.value): gMainDC.getInstance().setResolution(self.size_w, self.size_h) getDesktop(0).resize(eSize(self.size_w, self.size_h)) self.close(self.lastindex + self.dirlistcount)
def SaveDesktopInfo(): global _g_dw, _g_dh try: _g_dw = getDesktop(0).size().width() _g_dh = getDesktop(0).size().height() except: _g_dw,_g_dh = 1280,720 print "[XBMC] Desktop size [%dx%d]" % (_g_dw,_g_dh) open("/tmp/dw.info", "w").write(str(_g_dw) + "x" + str(_g_dh))
def showData(self): if self.firstrun: data = self.webif_data self.firstrun = False else: data = self.readXML(typ = self.what) if not isinstance(data,str): out = [] if self.what != "l": heading = ( self.HEAD[self.NAME], self.HEAD[self.PROT], self.HEAD[self.CAID_SRVID], self.HEAD[self.SRVNAME], self.HEAD[self.ECMTIME], self.HEAD[self.IP_PORT], "") outlist = [heading] for i in data: outlist.append( i ) self.fieldsize = self.calcSizes(outlist) out = [ self.buildListEntry(heading, heading=True)] for i in data: out.append(self.buildListEntry(i)) else: for i in data: if i != "": out.append( self.buildLogListEntry( (i,) )) #out.reverse() if getDesktop(0).size().width() == 1920: ysize = (len(out) + 4 ) * 80 else: ysize = (len(out) + 4 ) * 25 if self.what == "c": self.changeScreensize( ysize ) self.setTitle("Client Info ( Oscam-Version: %s )" % self.getVersion()) elif self.what == "s": self.changeScreensize( ysize ) self.setTitle("Server Info( Oscam-Version: %s )" % self.getVersion()) elif self.what == "l": if getDesktop(0).size().width() == 1920: self.changeScreensize( 980 ) else: self.changeScreensize( 500 ) self.setTitle("Oscam Log ( Oscam-Version: %s )" % self.getVersion()) self["output"].l.setList(out) self["output"].selectionEnabled(False) else: self.errmsg = (data,) if config.oscaminfo.autoupdate.value: self.loop.stop() out = [] self.fieldsize = self.calcSizes( [(data,)] ) for i in self.errmsg: out.append( self.buildListEntry( (i,) )) if getDesktop(0).size().width() == 1920: ysize = (len(out) + 4 ) * 60 else: ysize = (len(out) + 4 ) * 25 self.changeScreensize( ysize ) self.setTitle(_("Error") + data) self["output"].l.setList(out) self["output"].selectionEnabled(False)
def postWidgetCreate(self, instance): desk = getDesktop(0) instance.setDecoder(0) instance.setFBSize(desk.size())
self.services.append(s) def delService(self, ref): if isinstance(ref, str): if ref in self.services: self.services.remove(ref) def delAll(self): self.services = [] self.save() filtersServicesList = FiltersList() FHD = False if getDesktop(0).size().width() == 1920: FHD = True class filtersServicesSetup(Screen): if FHD: skin = """ <screen name="filtersServicesSetup" position="center,170" size="1280,820" title="Ignore services list"> <ePixmap pixmap="Default-FHD/skin_default/buttons/red.svg" position="10,5" size="315,70" /> <ePixmap pixmap="Default-FHD/skin_default/buttons/green.svg" position="325,5" size="315,70" /> <ePixmap pixmap="Default-FHD/skin_default/buttons/yellow.svg" position="640,5" size="315,70" /> <ePixmap pixmap="Default-FHD/skin_default/buttons/blue.svg" position="955,5" size="315,70" /> <widget backgroundColor="#9f1313" font="Regular;24" halign="center" name="key_red" position="10,5" foregroundColor="white" shadowColor="black" shadowOffset="-2,-2" size="315,70" transparent="1" valign="center" zPosition="1" /> <widget backgroundColor="#1f771f" font="Regular;24" halign="center" name="key_green" position="325,5" foregroundColor="white" shadowColor="black" shadowOffset="-2,-2" size="315,70" transparent="1" valign="center" zPosition="1" /> <widget backgroundColor="#a08500" font="Regular;24" halign="center" name="key_yellow" position="640,5" foregroundColor="white" shadowColor="black" shadowOffset="-2,-2" size="315,70" transparent="1" valign="center" zPosition="1" /> <widget backgroundColor="#18188b" font="Regular;24" halign="center" name="key_blue" position="955,5" foregroundColor="white" shadowColor="black" shadowOffset="-2,-2" size="315,70" transparent="1" valign="center" zPosition="1" />
class SoftcamSetup(Screen, ConfigListScreen): if getDesktop(0).size().width() == 1280: skin = """ <screen name="SoftcamSetup" position="center,center" size="560,550" > <widget name="config" position="5,10" size="550,180" /> <widget name="info" position="5,200" size="550,340" font="Fixed;18" /> <ePixmap name="red" position="0,510" zPosition="1" size="140,40" pixmap="buttons/red.png" transparent="1" alphatest="on" /> <ePixmap name="green" position="140,510" zPosition="1" size="140,40" pixmap="buttons/green.png" transparent="1" alphatest="on" /> <widget objectTypes="key_red,StaticText" source="key_red" render="Label" position="0,510" zPosition="2" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" shadowColor="black" shadowOffset="-1,-1" /> <widget objectTypes="key_green,StaticText" source="key_green" render="Label" position="140,510" zPosition="2" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" shadowColor="black" shadowOffset="-1,-1" /> <widget objectTypes="key_blue,StaticText" source="key_blue" render="Label" position="420,510" zPosition="2" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" shadowColor="black" shadowOffset="-1,-1"/> <widget objectTypes="key_blue,StaticText" source="key_blue" render="Pixmap" pixmap="buttons/blue.png" position="420,510" zPosition="1" size="140,40" transparent="1" alphatest="on"> <convert type="ConditionalShowHide"/> </widget> </screen>""" else: skin = """ <screen name="SoftcamSetup" position="485,center" size="951,860" > <widget name="config" position="5,10" size="941,180" font="Fixed;28" itemHeight="32" /> <widget name="info" position="5,200" size="941,500" font="Fixed;32" /> <ePixmap name="red" position="0,819" zPosition="1" size="140,40" pixmap="buttons/red.png" transparent="1" alphatest="on" /> <ePixmap name="green" position="140,819" zPosition="1" size="141,40" pixmap="buttons/green.png" transparent="1" alphatest="on" /> <widget objectTypes="key_red,StaticText" source="key_red" render="Label" position="0,819" zPosition="2" size="140,40" valign="center" halign="center" font="Regular;28" transparent="1" shadowColor="black" shadowOffset="-1,-1" /> <widget objectTypes="key_green,StaticText" source="key_green" render="Label" position="140,819" zPosition="2" size="140,40" valign="center" halign="center" font="Regular;28" transparent="1" shadowColor="black" shadowOffset="-1,-1" /> <widget objectTypes="key_blue,StaticText" source="key_blue" render="Label" position="809,819" zPosition="2" size="140,40" valign="center" halign="center" font="Regular;28" transparent="1" shadowColor="black" shadowOffset="-1,-1"/> <widget objectTypes="key_blue,StaticText" source="key_blue" render="Pixmap" pixmap="buttons/blue.png" position="809,819" zPosition="1" size="140,40" transparent="1" alphatest="on"> <convert type="ConditionalShowHide"/> </widget> </screen>""" def __init__(self, session): Screen.__init__(self, session) self.setup_title = _("Softcam setup") self.setTitle(self.setup_title) self["actions"] = ActionMap( ["OkCancelActions", "ColorActions", "CiSelectionActions"], { "cancel": self.cancel, "green": self.save, "red": self.cancel, "blue": self.ppanelShortcut, }, -1) self.list = [] ConfigListScreen.__init__(self, self.list, session=session, on_change=self.changedEntry) self.softcam = CamControl('softcam') self.cardserver = CamControl('cardserver') self.ecminfo = GetEcmInfo() (newEcmFound, ecmInfo) = self.ecminfo.getEcm() self["info"] = ScrollLabel("".join(ecmInfo)) self.EcmInfoPollTimer = eTimer() self.EcmInfoPollTimer.callback.append(self.setEcmInfo) self.EcmInfoPollTimer.start(1000) softcams = self.softcam.getList() cardservers = self.cardserver.getList() self.softcams = ConfigSelection(choices=softcams) self.softcams.value = self.softcam.current() self.softcams_text = _("Select Softcam") self.list.append(getConfigListEntry(self.softcams_text, self.softcams)) if cardservers: self.cardservers = ConfigSelection(choices=cardservers) self.cardservers.value = self.cardserver.current() self.list.append( getConfigListEntry(_("Select Card Server"), self.cardservers)) self.list.append( getConfigListEntry(_("Restart softcam"), ConfigAction(self.restart, "s"))) if cardservers: self.list.append( getConfigListEntry(_("Restart cardserver"), ConfigAction(self.restart, "c"))) self.list.append( getConfigListEntry(_("Restart both"), ConfigAction(self.restart, "sc"))) self["key_red"] = StaticText(_("Cancel")) self["key_green"] = StaticText(_("OK")) self["key_blue"] = StaticText() self.onShown.append(self.blueButton) def changedEntry(self): if self["config"].getCurrent()[0] == self.softcams_text: self.blueButton() def blueButton(self): if self.softcams.value and self.softcams.value.lower() != "none": self["key_blue"].setText(_("Info")) else: self["key_blue"].setText("") def setEcmInfo(self): (newEcmFound, ecmInfo) = self.ecminfo.getEcm() if newEcmFound: self["info"].setText("".join(ecmInfo)) def ppanelShortcut(self): ppanelFileName = '/etc/ppanels/' + self.softcams.value + '.xml' if "oscam" in self.softcams.value.lower() and os.path.isfile( '/usr/lib/enigma2/python/Plugins/Extensions/OscamStatus/plugin.pyo' ): from Plugins.Extensions.OscamStatus.plugin import OscamStatus self.session.open(OscamStatus) elif "cccam" in self.softcams.value.lower() and os.path.isfile( '/usr/lib/enigma2/python/Plugins/Extensions/CCcamInfo/plugin.pyo' ): from Plugins.Extensions.CCcamInfo.plugin import CCcamInfoMain self.session.open(CCcamInfoMain) elif os.path.isfile(ppanelFileName) and os.path.isfile( '/usr/lib/enigma2/python/Plugins/Extensions/PPanel/plugin.pyo' ): from Plugins.Extensions.PPanel.ppanel import PPanel self.session.open(PPanel, name=self.softcams.value + ' PPanel', node=None, filename=ppanelFileName, deletenode=None) else: return 0 def restart(self, what): self.what = what if "s" in what: if "c" in what: msg = _("Please wait, restarting softcam and cardserver.") else: msg = _("Please wait, restarting softcam.") elif "c" in what: msg = _("Please wait, restarting cardserver.") self.mbox = self.session.open(MessageBox, msg, MessageBox.TYPE_INFO) self.activityTimer = eTimer() self.activityTimer.timeout.get().append(self.doStop) self.activityTimer.start(100, False) def doStop(self): self.activityTimer.stop() if "c" in self.what: self.cardserver.command('stop') if "s" in self.what: self.softcam.command('stop') self.oldref = self.session.nav.getCurrentlyPlayingServiceOrGroup() self.session.nav.stopService() self.activityTimer = eTimer() self.activityTimer.timeout.get().append(self.doStart) self.activityTimer.start(1000, False) def doStart(self): self.activityTimer.stop() del self.activityTimer if "c" in self.what: self.cardserver.select(self.cardservers.value) self.cardserver.command('start') if "s" in self.what: self.softcam.select(self.softcams.value) self.softcam.command('start') if self.mbox: self.mbox.close() self.close() self.session.nav.playService(self.oldref, adjust=False) def restartCardServer(self): if hasattr(self, 'cardservers'): self.restart("c") def restartSoftcam(self): self.restart("s") def save(self): what = '' if hasattr(self, 'cardservers') and (self.cardservers.value != self.cardserver.current()): what = 'sc' elif self.softcams.value != self.softcam.current(): what = 's' if what: self.restart(what) else: self.close() def cancel(self): self.close()
class StartImage(Screen): screenwidth = getDesktop(0).size().width() if screenwidth and screenwidth == 1920: skin = """<screen position="center, center" size="1241, 850" title="NeoBoot"> \n\t\t\t<ePixmap position="491, 673" zPosition="-2" size="365, 160" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/matrixhd.png" /> <widget source="list" render="Listbox" position="20, 171" size="1194, 290" scrollbarMode="showOnDemand">\n\t\t\t\t<convert type="TemplatedMultiContent"> \n \t\t{"template": [ \n \t\t\tMultiContentEntryText(pos = (90, 1), size = (920, 66), flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER, text = 0), \n \t\t\tMultiContentEntryPixmapAlphaTest(pos = (8, 4), size = (66, 66), png = 1), \n \t\t\t], \n \t\t\t"fonts": [gFont("Regular", 40)],\n \t\t\t"itemHeight": 66\n \t\t} \n \t\t</convert>\n\t\t</widget> \n <widget name="label1" position="21, 29" zPosition="1" size="1184, 116" font="Regular;35" halign="center" valign="center" backgroundColor="black" transparent="1" foregroundColor="red" /> \n\t\t <widget name="label2" position="22, 480" zPosition="-2" size="1205, 168" font="Regular;35" halign="center" valign="center" backgroundColor="black" transparent="1" foregroundColor="red" /> \n\t\t </screen>""" else: skin = """<screen position="center, center" size="835, 500" title="NeoBoot"> \n\t\t\t <ePixmap position="0,0" zPosition="-1" size="835,500" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/frame835x500.png" /> <widget source="list" render="Listbox" position="16, 150" size="800, 40" selectionPixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/listselection800x35.png" scrollbarMode="showOnDemand"> \n\t\t\t\t<convert type="TemplatedMultiContent"> \n \t\t{"template": [ \n \t\t\tMultiContentEntryText(pos = (180, 0), size = (520, 36), flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER, text = 0), \n \t\t\tMultiContentEntryPixmapAlphaTest(pos = (4, 2), size = (36, 36), png = 1), \n \t\t\t],\n \t\t\t"fonts": [gFont("Regular", 22)], \n \t\t\t"itemHeight": 35\n \t\t}\n \t\t</convert> \n\t\t</widget>\n<widget name="label1" font="Regular; 26" position="15, 70" size="803, 58" halign="center" valign="center" backgroundColor="black" transparent="1" foregroundColor="#00cc99" /> <widget name="label2" position="40, 232" zPosition="2" size="806, 294" font="Regular;25" halign="center" valign="center" backgroundColor="black" transparent="1" foregroundColor="#00cc99" /> \n\t\t </screen>""" __module__ = __name__ def __init__(self, session): Screen.__init__(self, session) self.list = [] self['list'] = List(self.list) self.select() self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'ok': self.KeyOk, 'back': self.close}) self['label1'] = Label(_('Start the chosen system now ?')) self['label2'] = Label(_('Select OK to run the image.')) def select(self): self.list = [] mypath = '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot' if not fileExists(mypath + 'icons'): mypixmap = '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/ok.png' png = LoadPixmap(mypixmap) res = (_('OK Start image...'), png, 0) self.list.append(res) self['list'].list = self.list def KeyOk(self): if getImageNeoBoot() != 'Flash': if not fileExists('%sImageBoot/%s/.control_ok' % ( getNeoLocation(), getImageNeoBoot())): cmd = _("echo -e '[NeoBoot] Uwaga!!! po poprawnym starcie wybranego oprogramowania w neoboot,\nnalezy uruchomic NEOBOOTA by potwierdzic prawidlowy start image.\n\nNacisnij OK lub exit na pilocie by kontynuowac...\n\n\n'") self.session.openWithCallback(self.StartImageInNeoBoot, Console, _('NeoBoot: Start image...'), [cmd]) else: os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % ( getNeoLocation(), getImageNeoBoot())) self.StartImageInNeoBoot() else: os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % ( getNeoLocation(), getImageNeoBoot())) self.StartImageInNeoBoot() def StartImageInNeoBoot(self): if getImageNeoBoot() != 'Flash': if fileExists('%sImageBoot/%s/.control_ok' % ( getNeoLocation(), getImageNeoBoot())): system('touch /tmp/.control_ok ') else: system('touch %sImageBoot/%s/.control_boot_new_image ' % ( getNeoLocation(), getImageNeoBoot() )) system('chmod 755 /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/kernel.sh; /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/neo_location') self.sel = self['list'].getCurrent() if self.sel: self.sel = self.sel[2] if self.sel == 0: if fileExists('/media/mmc/etc/init.d/neobootmount.sh'): os.system('rm -f /media/mmc/etc/init.d/neobootmount.sh;') #################_____ARM____########################## #ARM procesor: DM900; AX HD60 4K if getCPUtype() == 'ARMv7' and getCPUSoC() or getBoxHostName() == ['osmio4k', 'ax60', 'sf8008', 'bcm7251', 'sf4008', 'et1x000', 'dm920', 'bcm7251s', 'h7', 'hi3798mv200' 'zgemmah9s', 'bcm7252s', 'gbquad4k', 'ustym4kpro', '3798mv200' 'dm900'] : if getImageNeoBoot() == 'Flash': if fileExists('/.multinfo'): os.system('cd /media/mmc; ln -sfn /sbin/init.sysvinit /media/mmc/sbin/init; reboot -f ') elif not fileExists('/.multinfo'): cmd = "echo -e '\n\n%s '" % _('NEOBOOT - Restart image flash....\nPlease wait, in a moment the decoder will be restarted...\n') cmd1='sleep 5; ln -sfn /sbin/init.sysvinit /sbin/init; reboot -f ' self.session.open(Console, _('NeoBoot ....'), [cmd, cmd1]) elif getImageNeoBoot() != 'Flash': cmd = "echo -e '\n\n%s '" % _('NEOBOOT - Restart image flash....\nPlease wait, in a moment the decoder will be restarted...\n') cmd1='sleep 5; ln -sfn /sbin/neoinitarm /sbin/init; reboot -f ' self.session.open(Console, _('NeoBoot ....'), [cmd, cmd1]) else: os.system('echo "Flash " >> ' + getNeoLocation() + 'ImageBoot/.neonextboot') self.messagebox = self.session.open(MessageBox, _('Wygląda na to że multiboot nie wspiera tego modelu STB !!! '), MessageBox.TYPE_INFO, 8) self.close() else: os.system('echo "Flash " >> ' + getNeoLocation() + 'ImageBoot/.neonextboot') self.messagebox = self.session.open(MessageBox, _('Wygląda na to że multiboot nie wspiera tego modelu STB !!! '), MessageBox.TYPE_INFO, 8) self.close() def myclose2(self, message): self.session.open(MessageBox, message, MessageBox.TYPE_INFO) self.close()
def __init__(self, session, piclist, lastindex, path): self["key_red"] = Button("") self["key_green"] = Button("Slide Show") self["key_yellow"] = Button("File View") self["key_blue"] = Button(_("Settings")) self.textcolor = config.plugins.mc_pp.textcolor.value self.color = config.plugins.mc_pp.bgcolor.value textsize = 20 self.spaceX = 20 self.spaceY = 28 self.picX = config.plugins.mc_pp.ThumbWidth.value self.picY = config.plugins.mc_pp.ThumbHeight.value size_w = getDesktop(0).size().width() size_h = getDesktop(0).size().height() if size_w == 1280: self.spaceTop = 130 self.spaceLeft = 50 self.ButtonPosY = 95 else: self.spaceTop = 120 self.spaceLeft = 25 self.ButtonPosY = 72 self.thumbsX = size_w / (self.spaceX + self.picX) # thumbnails in X self.thumbsY = size_h / (self.spaceY + self.picY) # thumbnails in Y self.thumbsC = self.thumbsX * self.thumbsY # all thumbnails self.positionlist = [] skincontent = "" posX = -1 for x in range(self.thumbsC): posY = x / self.thumbsX posX += 1 if posX >= self.thumbsX: posX = 0 absX = self.spaceLeft + self.spaceX + (posX * (self.spaceX + self.picX)) absY = self.spaceTop + self.spaceY + (posY * (self.spaceY + self.picY)) self.positionlist.append((absX, absY)) skincontent += "<widget name=\"label" + str( x ) + "\" position=\"" + str(absX + 5) + "," + str( absY + self.picY - textsize ) + "\" size=\"" + str(self.picX - 10) + "," + str( textsize ) + "\" font=\"Regular;14\" zPosition=\"2\" transparent=\"1\" noWrap=\"1\" foregroundColor=\"" + self.textcolor + "\" />" skincontent += "<widget name=\"thumb" + str( x) + "\" position=\"" + str(absX + 5) + "," + str( absY + 5 ) + "\" size=\"" + str(self.picX - 10) + "," + str( self.picY - (textsize * 2) ) + "\" zPosition=\"2\" transparent=\"1\" alphatest=\"on\" />" # Screen, buttons, backgroundlabel and MovingPixmap self.skin = "<screen position=\"0,0\" size=\"" + str( size_w ) + "," + str(size_h) + "\" flags=\"wfNoBorder\" > \ <ePixmap name=\"mb_bg\" position=\"0,0\" zPosition=\"1\" size=\"" + str( size_w ) + "," + str( size_h ) + "\" pixmap=\"" + mcpath + "skins/defaultHD/images/background.png\" /> \ <ePixmap pixmap=\"" + mcpath + "icons/key-red.png\" position=\"60," + str( self.ButtonPosY ) + "\" zPosition=\"2\" size=\"140,40\" transparent=\"1\" alphatest=\"on\" /> \ <ePixmap pixmap=\"" + mcpath + "icons/key-green.png\" position=\"210," + str( self.ButtonPosY ) + "\" zPosition=\"2\" size=\"140,40\" transparent=\"1\" alphatest=\"on\" /> \ <ePixmap pixmap=\"" + mcpath + "icons/key-yellow.png\" position=\"360," + str( self.ButtonPosY ) + "\" zPosition=\"2\" size=\"140,40\" transparent=\"1\" alphatest=\"on\" /> \ <ePixmap pixmap=\"" + mcpath + "icons/key-blue.png\" position=\"510," + str( self.ButtonPosY ) + "\" zPosition=\"2\" size=\"140,40\" transparent=\"1\" alphatest=\"on\" /> \ <widget name=\"key_red\" position=\"60," + str( self.ButtonPosY ) + "\" zPosition=\"3\" size=\"140,40\" font=\"Regular;20\" valign=\"center\" halign=\"center\" backgroundColor=\"#9f1313\" transparent=\"1\" /> \ <widget name=\"key_green\" position=\"210," + str( self.ButtonPosY ) + "\" zPosition=\"3\" size=\"140,40\" font=\"Regular;20\" valign=\"center\" halign=\"center\" backgroundColor=\"#1f771f\" transparent=\"1\" /> \ <widget name=\"key_yellow\" position=\"360," + str( self.ButtonPosY ) + "\" zPosition=\"3\" size=\"140,40\" font=\"Regular;20\" valign=\"center\" halign=\"center\" backgroundColor=\"#a08500\" transparent=\"1\" /> \ <widget name=\"key_blue\" position=\"510," + str( self.ButtonPosY ) + "\" zPosition=\"3\" size=\"140,40\" font=\"Regular;20\" valign=\"center\" halign=\"center\" backgroundColor=\"#18188b\" transparent=\"1\" /> \ <eLabel position=\"0,0\" zPosition=\"0\" size=\"" + str(size_w) + "," + str( size_h ) + "\" backgroundColor=\"" + self.color + "\" /> \ <widget name=\"frame\" position=\"35,30\" size=\"" + str( self.picX + 1 ) + "," + str( self.picY + 10 ) + "\" pixmap=\"pic_frame.png\" zPosition=\"3\" alphatest=\"on\" />" + skincontent + "</screen>" Screen.__init__(self, session) self["actions"] = HelpableActionMap( self, "MC_PictureViewerActions", { "ok": (self.KeyOk, "Show Picture"), "cancel": (self.Exit, "Exit Picture Viewer"), "left": (self.key_left, "List Top"), "right": (self.key_right, "List Bottom"), "up": (self.key_up, "List up"), "down": (self.key_down, "List down"), "info": (self.StartExif, "Show File Info"), "green": (self.startslideshow, "Start Slideshow"), "yellow": (self.close, "File View"), "blue": (self.Settings, "Settings"), }, -2) self["frame"] = MovingPixmap() for x in range(self.thumbsC): self["label" + str(x)] = Label() self["thumb" + str(x)] = Pixmap() self.Thumbnaillist = [] self.filelist = [] self.currPage = -1 self.dirlistcount = 0 self.path = path index = 0 framePos = 0 Page = 0 for x in piclist: if x[0][1] == False: self.filelist.append( (index, framePos, Page, x[0][0], path + x[0][0])) index += 1 framePos += 1 if framePos > (self.thumbsC - 1): framePos = 0 Page += 1 else: self.dirlistcount += 1 self.maxentry = len(self.filelist) - 1 self.index = lastindex - self.dirlistcount if self.index < 0: self.index = 0 self.picload = ePicLoad() self.picload.PictureData.get().append(self.showPic) self.onLayoutFinish.append(self.setPicloadConf) self.ThumbTimer = eTimer() self.ThumbTimer.callback.append(self.showPic)
class fourODMainMenu(Screen): wsize = getDesktop(0).size().width() - 200 hsize = getDesktop(0).size().height() - 300 skin = """ <screen position="100,150" size=\"""" + str(wsize) + "," + str(hsize) + """\" title="4OD - Main Menu" > <widget name="fourODMainMenu" position="10,10" size=\"""" + str(wsize - 20) + "," + str(hsize - 20) + """\" scrollbarMode="showOnDemand" /> </screen>""" def __init__(self, session, action, value): self.imagedir = "/tmp/onDemandImg/" self.session = session self.action = action self.value = value self.url = "http://m.channel4.com/4od/tags" osdList = [] osdList.append((_("Search"), "search")) if self.action is "start": # Read the URL for the selected category on the Main Menu. try: (data, isUK) = wgetUrl(self.url) if data: soup = BeautifulSoup(data) categoriesSection = soup.find('section', id="categories") entries = categoriesSection.find('nav').findAll('a') pattern = u'/4od/tags/(.+)' for entry in entries: """ <section id="categories" class="clearfix"> <aside class="catNav clearfix"> <nav> <h2>Most popular</h2> <ul> <li class="active"> <span class="chevron"></span> <a href="/4od/tags/comedy">Comedy (100)</a> </li> </ul> <h2>More categories</h2> <ul> <li> <span class="chevron"></span> <a href="/4od/tags/animals">Animals (4)</a> </li> """ id = entry['href'] match = re.search(pattern, id, re.DOTALL | re.IGNORECASE) categoryName = match.group(1) label = unicode(entry.text).replace('\r\n', '') label = re.sub(' +', ' ', label) osdList.append((_(str(label)), str(categoryName))) except (Exception) as exception: print(__plugin__, __version__, 'StreamsMenu: Error parsing feed: ', exception) osdList.append((_("Back"), "exit")) Screen.__init__(self, session) self["fourODMainMenu"] = MenuList(osdList) self["myActionMap"] = ActionMap(["SetupActions"], { "ok": self.go, "cancel": self.cancel }, -1) #============================================================================== def go(self): title = self["fourODMainMenu"].l.getCurrentSelection()[0] category = self["fourODMainMenu"].l.getCurrentSelection()[1] if category is "exit": self.removeFiles(self.imagedir) self.close(None) elif category is "search": self.session.open(StreamsThumb, category, title, category) else: self.session.open(StreamsThumb, self.action, title, category) #============================================================================== def cancel(self): self.removeFiles(self.imagedir) self.close(None) #============================================================================== def removeFiles(self, targetdir): for root, dirs, files in os_walk(targetdir): for name in files: os_remove(os_path.join(root, name))
#!/usr/bin/python # -*- coding: utf-8 -*- # for localized messages from . import _ from Plugins.Plugin import PluginDescriptor from enigma import getDesktop, addFont from Components.config import config, ConfigSubsection, ConfigSelection, ConfigDirectory, ConfigYesNo, ConfigNumber, ConfigSelectionNumber import os import shutil VERSION = "2.65-20201116" screenwidth = getDesktop(0).size() dir_dst = "/etc/enigma2/xstreamity/" dir_tmp = "/tmp/xstreamity/" dir_plugins = "/usr/lib/enigma2/python/Plugins/Extensions/XStreamity/" if screenwidth.width() > 1280: skin_directory = "%sskin/fhd/" % (dir_plugins) else: skin_directory = "%sskin/hd/" % (dir_plugins) folders = os.listdir(skin_directory) if "common" in folders: folders.remove("common") for folder in folders: skinlist = folder
def getFramebufferScale(self): aspect = self.getOutputAspect() fb_size = getDesktop(0).size() return aspect[0] * fb_size.height(), aspect[1] * fb_size.width()
def __init__(self, session): Screen.__init__(self, session) self.setTitle(_("About")) hddsplit = skin.parameters.get("AboutHddSplit", 0) AboutText = _("Hardware: ") + about.getHardwareTypeString() + "\n" cpu = about.getCPUInfoString() AboutText += _("CPU: ") + cpu + "\n" AboutText += _("Image: ") + about.getImageTypeString() + "\n" AboutText += _("Build date: ") + about.getBuildDateString() + "\n" AboutText += _("Last update: ") + about.getUpdateDateString() + "\n" AboutText += _("Developer Name:\tRedouane ") + "\n" # [WanWizard] Removed until we find a reliable way to determine the installation date # AboutText += _("Installed: ") + about.getFlashDateString() + "\n" EnigmaVersion = about.getEnigmaVersionString() EnigmaVersion = EnigmaVersion.rsplit("-", EnigmaVersion.count("-") - 2) if len(EnigmaVersion) == 3: EnigmaVersion = EnigmaVersion[0] + " (" + EnigmaVersion[ 2] + "-" + EnigmaVersion[1] + ")" else: EnigmaVersion = EnigmaVersion[0] + " (" + EnigmaVersion[1] + ")" EnigmaVersion = _("Enigma version: ") + EnigmaVersion self["EnigmaVersion"] = StaticText(EnigmaVersion) AboutText += "\n" + EnigmaVersion + "\n" AboutText += _( "Kernel version: ") + about.getKernelVersionString() + "\n" AboutText += _( "DVB driver version: ") + about.getDriverInstalledDate() + "\n" GStreamerVersion = _("GStreamer version: " ) + about.getGStreamerVersionString(cpu).replace( "GStreamer", "") self["GStreamerVersion"] = StaticText(GStreamerVersion) AboutText += GStreamerVersion + "\n" AboutText += _( "Python version: ") + about.getPythonVersionString() + "\n" AboutText += _( "Enigma (re)starts: %d\n") % config.misc.startCounter.value AboutText += _("Enigma debug level: %d\n") % eGetEnigmaDebugLvl() fp_version = getFPVersion() if fp_version is None: fp_version = "" else: fp_version = _("Frontprocessor version: %s") % fp_version AboutText += fp_version + "\n" self["FPVersion"] = StaticText(fp_version) AboutText += _('Skin & Resolution: %s (%sx%s)\n') % ( config.skin.primary_skin.value.split('/')[0], getDesktop(0).size().width(), getDesktop(0).size().height()) self["TunerHeader"] = StaticText(_("Detected NIMs:")) AboutText += "\n" + _("Detected NIMs:") + "\n" nims = nimmanager.nimListCompressed() for count in range(len(nims)): if count < 4: self["Tuner" + str(count)] = StaticText(nims[count]) else: self["Tuner" + str(count)] = StaticText("") AboutText += nims[count] + "\n" self["HDDHeader"] = StaticText(_("Detected HDD:")) AboutText += "\n" + _("Detected HDD:") + "\n" hddlist = harddiskmanager.HDDList() hddinfo = "" if hddlist: formatstring = hddsplit and "%s:%s, %.1f %sB %s" or "%s\n(%s, %.1f %sB %s)" for count in range(len(hddlist)): if hddinfo: hddinfo += "\n" hdd = hddlist[count][1] if int(hdd.free()) > 1024: hddinfo += formatstring % (hdd.model(), hdd.capacity(), hdd.free() / 1024.0, "G", _("free")) else: hddinfo += formatstring % (hdd.model(), hdd.capacity(), hdd.free(), "M", _("free")) else: hddinfo = _("none") self["hddA"] = StaticText(hddinfo) AboutText += hddinfo + "\n\n" + _("Network Info:") for x in about.GetIPsFromNetworkInterfaces(): AboutText += "\n" + x[0] + ": " + x[1] self["AboutScrollLabel"] = ScrollLabel(AboutText) self["key_green"] = Button(_("Translations")) self["key_red"] = Button(_("Latest Commits")) self["key_yellow"] = Button(_("Troubleshoot")) self["key_blue"] = Button(_("Memory Info")) self["actions"] = ActionMap( ["ColorActions", "SetupActions", "DirectionActions"], { "cancel": self.close, "ok": self.close, "red": self.showCommits, "green": self.showTranslationInfo, "blue": self.showMemoryInfo, "yellow": self.showTroubleshoot, "up": self["AboutScrollLabel"].pageUp, "down": self["AboutScrollLabel"].pageDown })
class threeMainMenu(Screen): wsize = getDesktop(0).size().width() - 200 hsize = getDesktop(0).size().height() - 300 skin = """ <screen position="100,150" size=\"""" + str(wsize) + "," + str(hsize) + """\" title="3Player - Main Menu" > <widget name="threeMainMenu" position="10,10" size=\"""" + str(wsize - 20) + "," + str(hsize - 20) + """\" scrollbarMode="showOnDemand" /> </screen>""" def __init__(self, session, action, value): self.imagedir = "/tmp/openThreeImg/" self.session = session self.action = action self.value = value osdList = [] if self.action is "start": osdList.append((_("Search"), "search")) osdList.append((_("Most Talked About"), "talked")) osdList.append((_("Straight Off The Telly"), "straight")) osdList.append((_("Going, Going..."), "going")) osdList.append((_("All Shows"), "all_shows")) osdList.append((_("Back"), "exit")) Screen.__init__(self, session) self["threeMainMenu"] = MenuList(osdList) self["myActionMap"] = ActionMap(["SetupActions"], { "ok": self.go, "cancel": self.cancel }, -1) def go(self): returnValue = self["threeMainMenu"].l.getCurrentSelection()[1] if returnValue is "exit": self.removeFiles(self.imagedir) self.close(None) elif self.action is "start": if returnValue is "talked": self.session.open(StreamsThumb, "talked", "Most Talked About", "http://www.tv3.ie/3player") elif returnValue is "straight": self.session.open(StreamsThumb, "straight", "Straight Off The Telly", "http://www.tv3.ie/3player") elif returnValue is "going": self.session.open(StreamsThumb, "going", "Going Going...", "http://www.tv3.ie/3player") elif returnValue is "all_shows": self.session.open(StreamsThumb, "all_shows", "All Shows", "http://www.tv3.ie/3player/allshows") elif returnValue is "search": self.session.open(StreamsThumb, "search", "Search", "http://www.tv3.ie/player/assets/php/search.php") def cancel(self): self.removeFiles(self.imagedir) self.close(None) def removeFiles(self, targetdir): for root, dirs, files in os_walk(targetdir): for name in files: os_remove(os_path.join(root, name))
class EG_InternetAddons(Screen): ALLOW_SUSPEND = True STATE_IDLE = 0 STATE_DOWNLOAD = 1 STATE_INSTALL = 2 screenwidth = getDesktop(0).size().width() if screenwidth and screenwidth == 1920: skin = '\n\t\t\t<screen name="EG_InternetAddons" position="center,center" size="920,850" >\n\t\t\t\t<widget name="status" position="10,10" size="900,30" font="Regular;30" valign="center" halign="center"/>\n\t\t\t\t<ePixmap name="border" pixmap="skin_default/div-h.png" position="10,45" size="900,4"/>\n\t\t\t\t<widget name="menu" position="10,80" size="900,650" scrollbarMode="showOnDemand"/>\n\t\t\t\t<ePixmap name="border" pixmap="skin_default/div-h.png" position="10,760" size="900,4"/>\n\t\t\t\t<ePixmap position="40,790" size="100,40" zPosition="0" pixmap="buttons/red.png" transparent="1" alphatest="blend"/>\n\t\t\t\t<ePixmap position="240,790" size="100,40" zPosition="0" pixmap="buttons/green.png" transparent="1" alphatest="blend"/>\n\t\t\t\t<widget name="key_red" position="80,790" zPosition="1" size="270,35" font="Regular;32" valign="top" halign="left" backgroundColor="red" transparent="1" />\n\t\t\t\t<widget name="key_green" position="280,790" zPosition="1" size="270,35" font="Regular;32" valign="top" halign="left" backgroundColor="green" transparent="1" />\n\t\t\t</screen>' else: skin = '\n\t\t\t<screen name="EG_InternetAddons" position="center,center" size="620,550" title="EGAMI Management Addons - Internet Addons" >\n\t\t\t\t<ePixmap name="border" pixmap="skin_default/div-h.png" position="10,45" size="800,4"/>\n\t\t\t\t<widget name="menu" position="10,60" size="610,420" scrollbarMode="showOnDemand"/>\n\t\t\t\t<widget name="status" position="30,10" size="400,25" font="Regular;21" valign="center" halign="center"/>\n\t\t\t\t<ePixmap name="border" pixmap="skin_default/div-h.png" position="10,485" size="800,4"/>\n\t\t\t\t<ePixmap position="30,509" zPosition="0" size="35,25" pixmap="skin_default/buttons/button_red.png" transparent="1" alphatest="on" />\n\t\t\t\t<widget name="key_red" position="65,509" size="200,25" font="Regular;18"/>\n\t\t\t\t<ePixmap position="430,509" zPosition="0" size="35,25" pixmap="skin_default/buttons/button_blue.png" transparent="1" alphatest="on" />\n\t\t\t\t<widget name="key_blue" position="470,509" size="200,25" font="Regular;20" />\n\t\t\t</screen>' def __init__(self, session, parent, childNode, url): Screen.__init__(self, session) Screen.setTitle(self, _('EGAMI On Line Addons Installation')) menuList = [] self.multi = False self.url = url try: header = parent.getAttribute('text').encode('UTF-8') menuType = parent.getAttribute('type').encode('UTF-8') if menuType == 'multi': self.multi = True else: self.multi = False menuList = self.buildMenuTree(childNode) except: tracefp = StringIO.StringIO() traceback.print_exc(file=tracefp) message = tracefp.getvalue() if self.multi: self['menu'] = EGListaAddonow(menuList) else: self['menu'] = MenuList(menuList) self['actions'] = ActionMap( ['ColorActions', 'OkCancelActions', 'MovieSelectionActions'], { 'ok': self.nacisniecieOK, 'red': self.nacisniecieOK, 'cancel': self.closeNonRecursive, 'exit': self.closeRecursive, 'green': self.showAddonInfo }) self['status'] = Label(_('Please, choose addon to install:')) self['key_red'] = Label(_('Download')) self['key_green'] = Label(_('Preview')) self.state = self.STATE_IDLE self.StateTimer = eTimer() self.StateTimer.stop() self.StateTimer.timeout.get().append(self.uruchomInstalator) def uruchomInstalator(self): if self.state == self.STATE_DOWNLOAD: self.state = self.STATE_IDLE self.fileUrl = 'http://egami-feed.com/plugins/' + self.saved_url print self.fileUrl if os.path.exists('/tmp/Addon.ipk'): os.system('rm /tmp/Addon.ipk') if self.fileUrl.endswith('.tgz') or self.fileUrl.endswith( '.tar.gz') or self.fileUrl.endswith('.tar.bz2'): os.system('wget -q ' + self.fileUrl + ' -O /tmp/Addon.tgz') else: os.system('wget -q ' + self.fileUrl + ' -O /tmp/Addon.ipk') message = str( _('Do You want to install') + ' ' + self.saved_item_name + '?') if os.path.exists('/tmp/Addon.ipk'): installBox = self.session.openWithCallback( self.instalujIPK, MessageBox, _(message), MessageBox.TYPE_YESNO) installBox.setTitle(_('IPK Installation...')) else: if os.path.exists('/tmp/Addon.tgz'): installBox = self.session.openWithCallback( self.instalujTGZ, MessageBox, _(message), MessageBox.TYPE_YESNO) installBox.setTitle(_('EGAMI Package Installation...')) else: errorBox = self.session.open( MessageBox, _('Failed to download an Addon...'), MessageBox.TYPE_ERROR) errorBox.setTitle(_('Failed...')) return if self.state == self.STATE_INSTALL: if os.path.exists('/tmp/Addon.ipk'): os.system( 'opkg -force-overwrite install /tmp/Addon.ipk ; rm /tmp/Addon.ipk' ) self['status'].setText(_('Addon installed sucessfully !')) self.state = self.STATE_IDLE self.StateTimer.stop() return if os.path.exists('/tmp/Addon.tgz'): resultFile = os.popen( 'cd /; tar -xz -f /tmp/Addon.tgz ; rm /tmp/Addon.tgz;rm /usr/sbin/nab_e2_restart.sh; chmod 755 /tmp/egami_e2_installer.sh; /2tmp/egami_e2_installer.sh; rm /tmp/egami_e2_installer.sh' ) if fileExists('/tmp/restartgui'): infoBox = self.session.openWithCallback( self.rebootGUI, MessageBox, _('Addon installed sucessfully !\nTo get it on plugin list, You need to reload GUI. Would You like to do it right now ?' ), MessageBox.TYPE_YESNO) else: infoBox = self.session.open( MessageBox, _('Addon installed sucessfully !'), MessageBox.TYPE_INFO, 5) infoBox.setTitle(_('Success...')) self['status'].setText(_('Addon installed sucessfully !')) self.state = self.STATE_IDLE self.StateTimer.stop() else: if self.state == self.STATE_IDLE: self['status'].setText( _('Please, choose an addon to install:')) self.StateTimer.stop() return return def rebootGUI(self, yesno): if yesno: os.system('killall -9 enigma2') else: self['status'].setText(_('Remember to reload enigma2 !')) def pobierzIPK(self, item, url, size_str): self.saved_item_name = item self.saved_url = url self.state = self.STATE_DOWNLOAD self['status'].setText(_('Downloading an addon... Please wait...')) self.StateTimer.start(200, True) def instalujIPK(self, yesno): if yesno: self.state = self.STATE_INSTALL self['status'].setText(_('Installing an addon... Please wait...')) self.StateTimer.start(200, True) else: infoBox = self.session.open(MessageBox, _('Installation aborted !'), MessageBox.TYPE_INFO) self.state = self.STATE_IDLE return return def instalujTGZ(self, yesno): if yesno: self.state = self.STATE_INSTALL self['status'].setText(_('Installing an addon... Please wait...')) self.StateTimer.start(200, True) else: infoBox = self.session.open(MessageBox, _('Installation aborted !'), MessageBox.TYPE_INFO) self.state = self.STATE_IDLE return return def nacisniecieOK(self): try: if self.multi: selection = self['menu'].getCurrent() selection[0][1]() else: selection = self['menu'].l.getCurrentSelection() selection[1]() except: tracefp = StringIO.StringIO() traceback.print_exc(file=tracefp) message = tracefp.getvalue() def zamknijMenu(self, *res): if len(res) and res[0]: plugins.readPluginList(resolveFilename(SCOPE_PLUGINS)) self.close(True) def showAddonInfo(self): try: if self.multi: selection = self['menu'].getCurrent() info_txt = selection[0][2] info_pic = selection[0][3] else: selection = self['menu'].l.getCurrentSelection() info_txt = selection[2] info_pic = selection[3] except: info_txt = '' info_pic = '' if selection: info_txt = str(info_txt) info_pic = str(info_pic) self.root_url = 'http://egami-feed.com/plugins/' infoBox = self.session.open(EGAddonInfo, str(self.root_url + info_txt), str(self.root_url + info_pic)) if self.multi: selection = self['menu'].getCurrent() infoBox.setTitle(_(selection[0][0])) else: selection = self['menu'].l.getCurrentSelection() infoBox.setTitle(_(selection[0])) def noweMenu(self, destList, node): menuTitle = node.getAttribute('text').encode('UTF-8') menuDesc = node.getAttribute('desc').encode('UTF-8') menuIcon = node.getAttribute('menu_pic').encode('UTF-8') info_arch = node.getAttribute('arch').encode('UTF-8') if info_arch == '': info_arch = 'all' a = BoundFunction(self.session.openWithCallback, self.zamknijMenu, EG_InternetAddons, node, node.childNodes, self.url) if info_arch in (getStbArch(), 'all'): if self.multi: destList.append( EGAddonMenuEntry(menuTitle, menuDesc, a, menuIcon)) else: destList.append((menuTitle, a)) def addItem(self, destList, node): item_text = node.getAttribute('text').encode('UTF-8') item_url = node.getAttribute('url').encode('UTF-8') item_desc = node.getAttribute('desc').encode('UTF-8') item_author = node.getAttribute('author').encode('UTF-8') item_version = node.getAttribute('version').encode('UTF-8') item_size = node.getAttribute('size').encode('UTF-8') info_txt = node.getAttribute('info_txt').encode('UTF-8') info_pic = node.getAttribute('info_pic').encode('UTF-8') menu_pic = node.getAttribute('menu_pic').encode('UTF-8') info_arch = node.getAttribute('arch').encode('UTF-8') if info_arch == '': info_arch = 'all' a = BoundFunction(self.pobierzIPK, item_text, item_url, item_size) if info_arch in (getStbArch(), 'all'): if self.multi: destList.append( EGAddonEntry(item_text, item_desc, item_author, item_version, item_size, info_txt, info_pic, menu_pic, a)) else: destList.append((item_text, a, info_txt, info_pic)) def buildMenuTree(self, childNode): list = [] for x in childNode: if x.nodeType != xml.dom.minidom.Element.nodeType: pass elif x.tagName == 'item': self.addItem(list, x) elif x.tagName == 'menu': self.noweMenu(list, x) return list def closeNonRecursive(self): plugins.readPluginList(resolveFilename(SCOPE_PLUGINS)) downfile = '/tmp/.catalog.xml' if fileExists(downfile): os.remove(downfile) self.close(False) def closeRecursive(self): plugins.readPluginList(resolveFilename(SCOPE_PLUGINS)) downfile = '/tmp/.catalog.xml' if fileExists(downfile): os.remove(downfile) self.close(True)
try: os.remove("/tmp/EmailClient.log") except OSError: pass def debug(message): if config.plugins.emailimap.debug.value: try: deb = open("/tmp/EmailClient.log", "aw") deb.write(time.ctime() + ': ' + message + "\n") deb.close() except Exception, e: debug("%s (retried debug: %s)" %(repr(message), str(e))) from enigma import getDesktop DESKTOP_WIDTH = getDesktop(0).size().width() DESKTOP_HEIGHT = getDesktop(0).size().height() def scaleH(y2, y1): if y2 == -1: y2 = y1*1280/720 elif y1 == -1: y1 = y2*720/1280 return scale(y2, y1, 1280, 720, DESKTOP_WIDTH) def scaleV(y2, y1): if y2 == -1: y2 = y1*720/576 elif y1 == -1: y1 = y2*576/720 return scale(y2, y1, 720, 576, DESKTOP_HEIGHT) def scale(y2, y1, x2, x1, x): return (y2 - y1) * (x - x1) / (x2 - x1) + y1
from Screens.Screen import Screen from Screens.MessageBox import MessageBox from Components.ActionMap import ActionMap from Components.ScrollLabel import ScrollLabel from Components.Sources.List import List from Components.Sources.StaticText import StaticText from RSSList import RSSFeedList from enigma import getDesktop HD = False FULLHD = False if getDesktop(0).size().width() >= 1920: FULLHD = True elif getDesktop(0).size().width() >= 1280: HD = True class RSSSummary(Screen): skin = """ <screen position="0,0" size="132,64"> <widget source="parent.Title" render="Label" position="6,4" size="120,21" font="Regular;18" /> <widget source="entry" render="Label" position="6,25" size="120,21" font="Regular;16" /> <widget source="global.CurrentTime" render="Label" position="56,46" size="82,18" font="Regular;16" > <convert type="ClockToText">WithSeconds</convert> </widget> </screen>"""
def populate(self): self["lab1"] = StaticText(_("Open Black Hole")) self["lab2"] = StaticText(_("From the BH Team")) model = None AboutText = "" self["lab3"] = StaticText(_("Support at %s") % "www.vuplus-community.net") AboutText += _("Model:\t%s %s\n") % (getMachineBrand(), getMachineName()) if about.getChipSetString() != _("unavailable"): if SystemInfo["HasHiSi"]: AboutText += _("Chipset:\tHiSilicon %s\n") % about.getChipSetString().upper() elif about.getIsBroadcom(): AboutText += _("Chipset:\tBroadcom %s\n") % about.getChipSetString().upper() else: AboutText += _("Chipset:\t%s\n") % about.getChipSetString().upper() AboutText += _("CPU:\t%s %s %s\n") % (about.getCPUArch(), about.getCPUSpeedString(), about.getCpuCoresString()) imageSubBuild = "" if getImageType() != 'release': imageSubBuild = ".%s" % getImageDevBuild() AboutText += _("Image:\t%s.%s%s (%s)\n") % (getImageVersion(), getImageBuild(), imageSubBuild, getImageType().title()) if SystemInfo["canMultiBoot"]: image = GetCurrentImage() bootmode = "" part = "" if SystemInfo["canMode12"]: bootmode = "bootmode = %s" %GetCurrentImageMode() if SystemInfo["HasHiSi"]: if image != 0: part = "%s%s" %(SystemInfo["canMultiBoot"][2], image*2) image += 1 else: part = "MMC" image += 1 AboutText += _("Image Slot:\t%s") % "STARTUP_" + str(image) + " " + part + " " + bootmode + "\n" skinWidth = getDesktop(0).size().width() skinHeight = getDesktop(0).size().height() string = getDriverDate() year = string[0:4] month = string[4:6] day = string[6:8] driversdate = '-'.join((year, month, day)) AboutText += _("Drivers:\t%s\n") % driversdate AboutText += _("Kernel:\t%s\n") % about.getKernelVersionString() AboutText += _("GStreamer:\t%s\n") % about.getGStreamerVersionString().replace("GStreamer ","") AboutText += _("Python:\t%s\n") % about.getPythonVersionString() AboutText += _("Installed:\t%s\n") % about.getFlashDateString() AboutText += _("Last update:\t%s\n") % getEnigmaVersionString() AboutText += _("E2 (re)starts:\t%s\n") % config.misc.startCounter.value AboutText += _("Skin:\t%s") % config.skin.primary_skin.value[0:-9] + _(" (%s x %s)") % (skinWidth, skinHeight) + "\n" tempinfo = "" if path.exists('/proc/stb/sensors/temp0/value'): f = open('/proc/stb/sensors/temp0/value', 'r') tempinfo = f.read() f.close() elif path.exists('/proc/stb/fp/temp_sensor'): f = open('/proc/stb/fp/temp_sensor', 'r') tempinfo = f.read() f.close() elif path.exists('/proc/stb/sensors/temp/value'): f = open('/proc/stb/sensors/temp/value', 'r') tempinfo = f.read() f.close() if tempinfo and int(tempinfo.replace('\n', '')) > 0: mark = str('\xc2\xb0') AboutText += _("System temp:\t%s") % tempinfo.replace('\n', '').replace(' ','') + mark + "C\n" tempinfo = "" if path.exists('/proc/stb/fp/temp_sensor_avs'): f = open('/proc/stb/fp/temp_sensor_avs', 'r') tempinfo = f.read() f.close() elif path.exists('/sys/devices/virtual/thermal/thermal_zone0/temp'): try: f = open('/sys/devices/virtual/thermal/thermal_zone0/temp', 'r') tempinfo = f.read() tempinfo = tempinfo[:-4] f.close() except: tempinfo = "" elif path.exists('/proc/hisi/msp/pm_cpu'): try: for line in open('/proc/hisi/msp/pm_cpu').readlines(): line = [x.strip() for x in line.strip().split(":")] if line[0] in ("Tsensor"): temp = line[1].split("=") temp = line[1].split(" ") tempinfo = temp[2] except: tempinfo = "" if tempinfo and int(tempinfo.replace('\n', '')) > 0: mark = str('\xc2\xb0') AboutText += _("Processor temp:\t%s") % tempinfo.replace('\n', '').replace(' ','') + mark + "C\n" AboutLcdText = AboutText.replace('\t', ' ') fp_version = getFPVersion() if fp_version is None: fp_version = "" elif fp_version != 0: fp_version = _("FP version:\t%s") % fp_version AboutText += fp_version + "\n" bootloader = "" if path.exists('/sys/firmware/devicetree/base/bolt/tag'): f = open('/sys/firmware/devicetree/base/bolt/tag', 'r') bootloader = f.readline().replace('\x00', '').replace('\n', '') f.close() AboutText += _("Bootloader:\t%s\n") % (bootloader) self["AboutScrollLabel"] = ScrollLabel(AboutText)
from Tools.Directories import fileExists, pathExists from Tools.LoadPixmap import LoadPixmap from Tools.HardwareInfo import HardwareInfo from ServiceReference import ServiceReference from enigma import eListboxPythonMultiContent, gFont, getDesktop, eTimer, RT_HALIGN_LEFT, RT_HALIGN_CENTER, RT_VALIGN_CENTER, RT_WRAP, RT_HALIGN_RIGHT, RT_VALIGN_TOP from time import localtime, time, mktime EINbaseInfoBarPlugins__init__ = None EINStartOnlyOneTime = False EINsession = None EINposition = 0 InfoBar_instance = None mepg_config_initialized = False sz_w = getDesktop(0).size().width() if sz_w == 1280: SKINTYPE = 3 elif sz_w == 1024: SKINTYPE = 2 else: SKINTYPE = 1 CHOICELIST=[("no", _("Disabled")), ("eventinfo", _("Event info")), ("singleepg", _("Single EPG")), ("multiepg", _("Multi EPG")), ("easypg", _("Easy-PG")), ("graphepg", _("Graphik multi-EPG")),
class YouTubeDownloadList(Screen): screenWidth = getDesktop(0).size().width() if screenWidth and screenWidth == 1920: skin = """<screen position="center,center" size="945,555"> <widget source="list" render="Listbox" position="center,45" size="900,405" \ scrollbarMode="showOnDemand" > <convert type="TemplatedMultiContent" > {"template": [ MultiContentEntryText(pos=(15,1), size=(465,33), \ font=0, flags=RT_HALIGN_LEFT, text=1), # Title MultiContentEntryText(pos=(345,1), size=(225,33), \ font=0, flags=RT_HALIGN_RIGHT, text=2), # State MultiContentEntryProgress(pos=(585,6), size=(150,33), \ percent=-3), # Progress MultiContentEntryText(pos=(750,1), size=(120,33), \ font=0, flags=RT_HALIGN_LEFT, text=4), # Percentage ], "fonts": [gFont("Regular",30)], "itemHeight": 45} </convert> </widget> <ePixmap position="center,484" size="210,60" pixmap="%s/buttons/red.png" \ transparent="1" alphatest="on" /> <widget source="key_red" render="Label" position="center,485" zPosition="2" \ size="210,60" valign="center" halign="center" font="Regular;33" transparent="1" /> </screen>""" % BUTTONS_FOLDER else: skin = """<screen position="center,center" size="630,370"> <widget source="list" render="Listbox" position="center,30" size="600,270" \ scrollbarMode="showOnDemand" > <convert type="TemplatedMultiContent" > {"template": [ MultiContentEntryText(pos=(5,1), size=(270,22), \ font=0, flags=RT_HALIGN_LEFT, text=1), # Title MultiContentEntryText(pos=(280,1), size=(120,22), \ font=0, flags=RT_HALIGN_RIGHT, text=2), # State MultiContentEntryProgress(pos=(410,4), size=(100,22), \ percent=-3), # Progress MultiContentEntryText(pos=(520,1), size=(80,22), \ font=0, flags=RT_HALIGN_LEFT, text=4), # Percentage ], "fonts": [gFont("Regular",20)], "itemHeight": 30} </convert> </widget> <ePixmap position="center,323" size="140,40" pixmap="skin_default/buttons/red.png" \ transparent="1" alphatest="on" /> <widget source="key_red" render="Label" position="center,328" zPosition="2" \ size="140,30" valign="center" halign="center" font="Regular;22" transparent="1" /> </screen>""" def __init__(self, session): Screen.__init__(self, session) self['key_red'] = StaticText(_('Exit')) self['list'] = List([]) self['actions'] = ActionMap(['SetupActions', 'ColorActions'], { 'cancel': self.close, 'ok': self.ok, 'red': self.close }, -2) self.onLayoutFinish.append(self.layoutFinished) self.onClose.append(self.cleanVariables) self.progressTimer = eTimer() self.progressTimer.callback.append(self.updateDownloadList) def layoutFinished(self): self.setTitle(_('Active video downloads')) self.updateDownloadList() def cleanVariables(self): del self.progressTimer def updateDownloadList(self): self.progressTimer.stop() downloadList = [] for job in job_manager.getPendingJobs(): progress = job.progress / float(job.end) * 100 downloadList.append((job, job.name + ' ...', job.getStatustext(), int(progress), str(progress) + "%")) self['list'].updateList(downloadList) if downloadList: self.progressTimer.startLongTimer(2) def ok(self): current = self['list'].getCurrent() if current: from Screens.TaskView import JobView self.session.open(JobView, current[0])
def __init__(self, session, filelist, index, path, startslide): self.textcolor = config.plugins.mc_pp.textcolor.value self.bgcolor = config.plugins.mc_pp.bgcolor.value space = config.plugins.mc_pp.framesize.value size_w = getDesktop(0).size().width() size_h = getDesktop(0).size().height() self.skin = "<screen position=\"0,0\" size=\"" + str( size_w ) + "," + str(size_h) + "\" flags=\"wfNoBorder\" > \ <eLabel position=\"0,0\" zPosition=\"0\" size=\"" + str(size_w) + "," + str( size_h ) + "\" backgroundColor=\"" + self.bgcolor + "\" /><widget name=\"pic\" position=\"" + str( space) + "," + str(space) + "\" size=\"" + str( size_w - (space * 2)) + "," + str( size_h - (space * 2) ) + "\" zPosition=\"1\" alphatest=\"on\" /> \ <widget name=\"point\" position=\"" + str(space + 5) + "," + str( space + 2 ) + "\" size=\"20,20\" zPosition=\"2\" pixmap=\"skin_default/icons/record.png\" alphatest=\"on\" /> \ <widget name=\"play_icon\" position=\"" + str(space + 25) + "," + str( space + 2 ) + "\" size=\"20,20\" zPosition=\"2\" pixmap=\"skin_default/icons/ico_mp_play.png\" alphatest=\"on\" /> \ <widget name=\"file\" position=\"" + str(space + 45) + "," + str( space ) + "\" size=\"" + str( size_w - (space * 2) - 50 ) + ",25\" font=\"Regular;20\" halign=\"left\" foregroundColor=\"" + self.textcolor + "\" zPosition=\"2\" noWrap=\"1\" transparent=\"1\" /></screen>" Screen.__init__(self, session) InfoBarBase.__init__(self) InfoBarSeek.__init__(self, actionmap="MediaPlayerSeekActions") self["actions"] = ActionMap( [ "OkCancelActions", "ColorActions", "DirectionActions", "MovieSelectionActions" ], { "cancel": self.Exit, "green": self.PlayPause, "yellow": self.PlayPause, "blue": self.nextPic, "red": self.prevPic, "left": self.prevPic, "right": self.nextPic, "showEventInfo": self.StartExif, }, -1) self["point"] = Pixmap() self["pic"] = Pixmap() self["play_icon"] = Pixmap() self["file"] = Label(_("please wait, loading picture...")) self.old_index = 0 self.filelist = [] self.lastindex = index self.currPic = [] self.shownow = True self.dirlistcount = 0 for x in filelist: if len(filelist[0]) == 3: #orig. filelist if x[0][1] == False: self.filelist.append(path + x[0][0]) else: self.dirlistcount += 1 else: # thumbnaillist self.filelist.append(x[T_FULL]) self.maxentry = len(self.filelist) - 1 self.index = index - self.dirlistcount if self.index < 0: self.index = 0 self.picload = ePicLoad() self.picload.PictureData.get().append(self.finish_decode) self.slideTimer = eTimer() self.slideTimer.callback.append(self.slidePic) if self.maxentry >= 0: self.onLayoutFinish.append(self.setPicloadConf) self.__event_tracker = ServiceEventTracker(screen=self, eventmap={ iPlayableService.evEOF: self.doEOF, }) if startslide == True: self.PlayPause() if config.plugins.mc_pp.musicenable.value == True and config.plugins.mc_pp.music.value != "none": if pathExists(config.plugins.mc_pp.music.value): self.session.nav.playService( eServiceReference(4097, 0, config.plugins.mc_pp.music.value))
def runScreenTest(): config.misc.startCounter.value += 1 profile("readPluginList") enigma.pauseInit() plugins.readPluginList(resolveFilename(SCOPE_PLUGINS)) enigma.resumeInit() profile("Init:Session") nav = Navigation(config.misc.nextWakeup.value) session = Session(desktop = enigma.getDesktop(0), summary_desktop = enigma.getDesktop(1), navigation = nav) CiHandler.setSession(session) profile("wizards") screensToRun = [] RestoreSettings = None if os.path.exists("/media/hdd/images/config/settings") and config.misc.firstrun.value: if autorestoreLoop(): RestoreSettings = True from Plugins.SystemPlugins.SoftwareManager.BackupRestore import RestoreScreen session.open(RestoreScreen, runRestore = True) else: screensToRun = [ p.__call__ for p in plugins.getPlugins(PluginDescriptor.WHERE_WIZARD) ] screensToRun += wizardManager.getWizards() else: if os.path.exists("/media/hdd/images/config/autorestore"): os.system('rm -f /media/hdd/images/config/autorestore') screensToRun = [ p.__call__ for p in plugins.getPlugins(PluginDescriptor.WHERE_WIZARD) ] screensToRun += wizardManager.getWizards() screensToRun.append((100, InfoBar.InfoBar)) screensToRun.sort() print screensToRun enigma.ePythonConfigQuery.setQueryFunc(configfile.getResolvedKey) def runNextScreen(session, screensToRun, *result): if result: print "[mytest.py] quitMainloop #3" enigma.quitMainloop(*result) return screen = screensToRun[0][1] args = screensToRun[0][2:] if screensToRun: session.openWithCallback(boundFunction(runNextScreen, session, screensToRun[1:]), screen, *args) else: session.open(screen, *args) if not RestoreSettings: runNextScreen(session, screensToRun) profile("Init:VolumeControl") vol = VolumeControl(session) profile("Init:PowerKey") power = PowerKey(session) if boxtype in ('alien5','osninopro','osnino','osninoplus','alphatriple','spycat4kmini','tmtwin4k','mbmicrov2','revo4k','force3uhd','wetekplay', 'wetekplay2', 'wetekhub', 'dm7020hd', 'dm7020hdv2', 'osminiplus', 'osmega', 'sf3038', 'spycat', 'e4hd', 'e4hdhybrid', 'mbmicro', 'et7500', 'mixosf5', 'mixosf7', 'mixoslumi', 'gi9196m', 'maram9', 'ixussone', 'ixusszero', 'uniboxhd1', 'uniboxhd2', 'uniboxhd3', 'sezam5000hd', 'mbtwin', 'sezam1000hd', 'mbmini', 'atemio5x00', 'beyonwizt3', '9910lx', '9911lx', '9920lx') or getBrandOEM() in ('fulan') or getMachineBuild() in ('u41','dags7362','dags73625','dags5','ustym4kpro','beyonwizv2','viper4k','sf8008','cc1','gbmv200'): profile("VFDSYMBOLS") import Components.VfdSymbols Components.VfdSymbols.SymbolsCheck(session) # we need session.scart to access it from within menu.xml session.scart = AutoScartControl(session) profile("Init:Trashcan") import Tools.Trashcan Tools.Trashcan.init(session) profile("Init:AutoVideoMode") import Screens.VideoMode Screens.VideoMode.autostart(session) profile("RunReactor") profile_final() if boxtype in ('sf8', 'classm', 'axodin', 'axodinc', 'starsatlx', 'genius', 'evo'): f = open("/dev/dbox/oled0", "w") f.write('-E2-') f.close() print "lastshutdown=%s (True = last shutdown was OK)" % config.usage.shutdownOK.value print "NOK shutdown action=%s" % config.usage.shutdownNOK_action.value print "bootup action=%s" % config.usage.boot_action.value if not config.usage.shutdownOK.value and not config.usage.shutdownNOK_action.value == 'normal' or not config.usage.boot_action.value == 'normal': print "last shutdown = %s" % config.usage.shutdownOK.value import Screens.PowerLost Screens.PowerLost.PowerLost(session) if not RestoreSettings: config.usage.shutdownOK.setValue(False) config.usage.shutdownOK.save() configfile.save() # kill showiframe if it is running (sh4 hack...) if getMachineBuild() in ('spark' , 'spark7162'): os.system("killall -9 showiframe") runReactor() print "[mytest.py] normal shutdown" config.misc.startCounter.save() config.usage.shutdownOK.setValue(True) config.usage.shutdownOK.save() profile("wakeup") #get currentTime nowTime = time() # if not config.misc.SyncTimeUsing.value == "0" or getBrandOEM() == 'gigablue': if not config.misc.SyncTimeUsing.value == "0" or boxtype.startswith('gb') or getBrandOEM().startswith('ini'): print "dvb time sync disabled... so set RTC now to current linux time!", strftime("%Y/%m/%d %H:%M", localtime(nowTime)) setRTCtime(nowTime) #recordtimer if session.nav.isRecordTimerImageStandard: #check RecordTimer instance tmp = session.nav.RecordTimer.getNextRecordingTime(getNextStbPowerOn = True) nextRecordTime = tmp[0] nextRecordTimeInStandby = tmp[1] else: nextRecordTime = session.nav.RecordTimer.getNextRecordingTime() nextRecordTimeInStandby = session.nav.RecordTimer.isNextRecordAfterEventActionAuto() #zaptimer nextZapTime = session.nav.RecordTimer.getNextZapTime() nextZapTimeInStandby = 0 #powertimer tmp = session.nav.PowerTimer.getNextPowerManagerTime(getNextStbPowerOn = True) nextPowerTime = tmp[0] nextPowerTimeInStandby = tmp[1] #plugintimer tmp = plugins.getNextWakeupTime(getPluginIdent = True) nextPluginTime = tmp[0] nextPluginIdent = tmp[1] #"pluginname | pluginfolder" tmp = tmp[1].lower() #start in standby, depending on plugin type if "epgrefresh" in tmp: nextPluginName = "EPGRefresh" nextPluginTimeInStandby = 1 elif "vps" in tmp: nextPluginName = "VPS" nextPluginTimeInStandby = 1 elif "serienrecorder" in tmp: nextPluginName = "SerienRecorder" nextPluginTimeInStandby = 0 # plugin function for deep standby from standby not compatible (not available) elif "elektro" in tmp: nextPluginName = "Elektro" nextPluginTimeInStandby = 1 elif "minipowersave" in tmp: nextPluginName = "MiniPowersave" nextPluginTimeInStandby = 1 elif "enhancedpowersave" in tmp: nextPluginName = "EnhancedPowersave" nextPluginTimeInStandby = 1 else: #default for plugins nextPluginName = nextPluginIdent nextPluginTimeInStandby = 0 wakeupList = [ x for x in ((nextRecordTime, 0, nextRecordTimeInStandby), (nextZapTime, 1, nextZapTimeInStandby), (nextPowerTime, 2, nextPowerTimeInStandby), (nextPluginTime, 3, nextPluginTimeInStandby)) if x[0] != -1 ] wakeupList.sort() print "="*100 if wakeupList and wakeupList[0][0] > 0: startTime = wakeupList[0] # wakeup time before timer begins wptime = startTime[0] - (config.workaround.wakeuptime.value * 60) if (wptime - nowTime) < 120: # no time to switch box back on wptime = int(nowTime) + 120 # so switch back on in 120 seconds #check for plugin-, zap- or power-timer to enable the 'forced' record-timer wakeup forceNextRecord = 0 setStandby = startTime[2] if startTime[1] != 0 and nextRecordTime > 0: #when next record starts in 15 mins if abs(nextRecordTime - startTime[0]) <= 900: setStandby = forceNextRecord = 1 #by vps-plugin elif startTime[1] == 3 and nextPluginName == "VPS": setStandby = forceNextRecord = 1 if startTime[1] == 3: nextPluginName = " (%s)" % nextPluginName else: nextPluginName = "" print "[mytest.py] set next wakeup type to '%s'%s %s" % ({0:"record-timer",1:"zap-timer",2:"power-timer",3:"plugin-timer"}[startTime[1]], nextPluginName, {0:"and starts normal",1:"and starts in standby"}[setStandby]) if forceNextRecord: print "[mytest.py] set from 'vps-plugin' or just before a 'record-timer' starts, set 'record-timer' wakeup flag" print "[mytest.py] set next wakeup time to", strftime("%a, %Y/%m/%d %H:%M:%S", localtime(wptime)) #set next wakeup setFPWakeuptime(wptime) #set next standby only after shutdown in deep standby if Screens.Standby.quitMainloopCode != 1 and Screens.Standby.quitMainloopCode != 45: setStandby = 2 # 0=no standby, but get in standby if wakeup to timer start > 60 sec (not for plugin-timer, here is no standby), 1=standby, 2=no standby, when before was not in deep-standby config.misc.nextWakeup.value = "%d,%d,%d,%d,%d,%d,%d" % (int(nowTime),wptime,startTime[0],startTime[1],setStandby,nextRecordTime,forceNextRecord) else: config.misc.nextWakeup.value = "%d,-1,-1,0,0,-1,0" % (int(nowTime)) if not boxtype.startswith('azboxm'): #skip for Azbox (mini)ME - setting wakeup time to past reboots box setFPWakeuptime(int(nowTime) - 3600) #minus one hour -> overwrite old wakeup time print "[mytest.py] no set next wakeup time" config.misc.nextWakeup.save() print "="*100 profile("stopService") session.nav.stopService() profile("nav shutdown") session.nav.shutdown() profile("configfile.save") configfile.save() from Screens import InfoBarGenerics InfoBarGenerics.saveResumePoints() return 0
from Components.Sources.List import List from Components.Sources.StaticText import StaticText from Components.config import config, configfile, getConfigListEntry from Components.ConfigList import ConfigList, ConfigListScreen from Components.MenuList import MenuList from Tools.LoadPixmap import LoadPixmap from enigma import eTimer, RT_HALIGN_LEFT, eListboxPythonMultiContent, gFont, getDesktop, eSize, ePoint from xml.etree import ElementTree from operator import itemgetter import os, time import urllib2 fb = getDesktop(0).size() if fb.width() > 1024: sizeH = fb.width() - 100 HDSKIN = True else: # sizeH = fb.width() - 50 sizeH = 700 HDSKIN = False class OscamInfo: def __init__(self): pass TYPE = 0 NAME = 1 PROT = 2
profile("stopService") session.nav.stopService() profile("nav shutdown") session.nav.shutdown() profile("configfile.save") configfile.save() from Screens import InfoBarGenerics InfoBarGenerics.saveResumePoints() return 0 profile("Init:skin") import skin skin.loadSkinData(enigma.getDesktop(0)) profile("InputDevice") import Components.InputDevice Components.InputDevice.InitInputDevices() import Components.InputHotplug profile("AVSwitch") import Components.AVSwitch Components.AVSwitch.InitAVSwitch() Components.AVSwitch.InitiVideomodeHotplug() profile("HdmiRecord") import Components.HdmiRecord Components.HdmiRecord.InitHdmiRecord()
class ConfigBaseWidget(Screen, ConfigListScreen): screenwidth = getDesktop(0).size().width() if screenwidth and screenwidth == 1920: skin = """ <screen name="IPTVConfigBaseWidget" position="center,center" size="920,860" title="" > <widget name="config" position="10,70" size="900,780" zPosition="1" transparent="1" scrollbarMode="showOnDemand" /> <widget name="key_red" position="10,10" zPosition="2" size="600,35" valign="center" halign="left" font="Regular;28" transparent="1" foregroundColor="red" /> <widget name="key_ok" position="10,10" zPosition="2" size="600,35" valign="center" halign="center" font="Regular;28" transparent="1" foregroundColor="white" /> <widget name="key_green" position="10,10" zPosition="2" size="600,35" valign="center" halign="right" font="Regular;28" transparent="1" foregroundColor="green" /> <widget name="key_blue" position="0,0" zPosition="2" size="600,35" valign="center" halign="right" font="Regular;28" transparent="1" foregroundColor="green" /> <widget name="key_yellow" position="0,0" zPosition="2" size="600,35" valign="center" halign="right" font="Regular;28" transparent="1" foregroundColor="green" /> </screen>""" else: skin = """ <screen name="IPTVConfigBaseWidget" position="center,center" size="620,440" title="" > <widget name="config" position="10,50" size="600,370" zPosition="1" transparent="1" scrollbarMode="showOnDemand" /> <widget name="key_red" position="10,10" zPosition="2" size="600,35" valign="center" halign="left" font="Regular;22" transparent="1" foregroundColor="red" /> <widget name="key_ok" position="10,10" zPosition="2" size="600,35" valign="center" halign="center" font="Regular;22" transparent="1" foregroundColor="white" /> <widget name="key_green" position="10,10" zPosition="2" size="600,35" valign="center" halign="right" font="Regular;22" transparent="1" foregroundColor="green" /> <widget name="key_blue" position="0,0" zPosition="2" size="600,35" valign="center" halign="right" font="Regular;22" transparent="1" foregroundColor="green" /> <widget name="key_yellow" position="0,0" zPosition="2" size="600,35" valign="center" halign="right" font="Regular;22" transparent="1" foregroundColor="green" /> </screen>""" def __init__(self, session): printDBG("ConfigBaseWidget.__init__ -------------------------------") Screen.__init__(self, session) self.onChangedEntry = [] self.list = [] ConfigListScreen.__init__(self, self.list, session=session, on_change=self.changedEntry) self.setup_title = "IPTV Player - ustawienia" self["key_green"] = Label(_("Save")) self["key_ok"] = Label(_(" ")) self["key_red"] = Label(_("Cancel")) self["key_blue"] = Label() self["key_yellow"] = Label() self["key_blue"].hide() self["key_yellow"].hide() self["actions"] = ActionMap( [ "SetupActions", "ColorActions", "WizardActions", "ListboxActions", "IPTVPlayerListActions" ], { "cancel": self.keyExit, "green": self.keySave, "ok": self.keyOK, "red": self.keyCancel, "yellow": self.keyYellow, "blue": self.keyBlue, "menu": self.keyMenu, "up": self.keyUp, "down": self.keyDown, "moveUp": self.keyUp, "moveDown": self.keyDown, "moveTop": self.keyHome, "moveEnd": self.keyEnd, "home": self.keyHome, "end": self.keyEnd, "pageUp": self.keyPageUp, "pageDown": self.keyPageDown }, -2) self.onLayoutFinish.append(self.layoutFinished) self.onClose.append(self.__onClose) self.isOkEnabled = False self.hiddenOptionsSecretCode = "" def __del__(self): printDBG("ConfigBaseWidget.__del__ -------------------------------") def __onClose(self): printDBG("ConfigBaseWidget.__onClose -----------------------------") self.onClose.remove(self.__onClose) self.onLayoutFinish.remove(self.layoutFinished) if self.onSelectionChanged in self["config"].onSelectionChanged: self["config"].onSelectionChanged.remove(self.onSelectionChanged) def layoutFinished(self): self.setTitle("IPTV Player - ustawienia") if not self.onSelectionChanged in self["config"].onSelectionChanged: self["config"].onSelectionChanged.append(self.onSelectionChanged) self.runSetup() def onSelectionChanged(self): self.isOkEnabled = self.isOkActive() self.isSelectable = self.isSelectableActive() self.setOKLabel() def isHiddenOptionsUnlocked(self): if "ybybyybb" == self.hiddenOptionsSecretCode: return True else: return False def setOKLabel(self): if self.isSelectable: labelText = "< %s >" else: labelText = " %s " if self.isOkEnabled: labelText = labelText % "OK" else: labelText = labelText % " " self["key_ok"].setText(_(labelText)) def isOkActive(self): if self["config"].getCurrent() is not None: currItem = self["config"].getCurrent()[1] if isinstance(currItem, ConfigText) or isinstance( currItem, ConfigPassword): return True return False def isSelectableActive(self): if self["config"].getCurrent() is not None: currItem = self["config"].getCurrent()[1] if currItem and isinstance(currItem, ConfigSelection) or isinstance( currItem, ConfigBoolean): return True return False def runSetup(self): self["config"].list = self.list self["config"].setList(self.list) def isChanged(self): bChanged = False for x in self["config"].list: if x[1].isChanged(): bChanged = True break printDBG("ConfigMenu.isChanged bChanged[%r]" % bChanged) return bChanged def askForSave(self, callbackYesFun, callBackNoFun): self.session.openWithCallback(boundFunction(self.saveOrCancelChanges, callbackYesFun, callBackNoFun), MessageBox, text=_("Save changes?"), type=MessageBox.TYPE_YESNO) return def saveOrCancelChanges(self, callbackFun=None, failCallBackFun=None, answer=None): if answer: self.save() if callbackFun: callbackFun() else: self.cancel() if failCallBackFun: failCallBackFun() def keySave(self): self.save() self.close() def saveOrCancel(self, operation="save"): for x in self["config"].list: if "save" == operation: x[1].save() else: x[1].cancel() if "save" == operation: configfile.save() def save(self): self.saveOrCancel("save") def cancel(self): self.saveOrCancel("cancel") self.runSetup() def saveAndClose(self): self.save() self.close() def cancelAndClose(self): self.cancel() self.close() def keyOK(self): if not self.isOkEnabled: return curIndex = self["config"].getCurrentIndex() currItem = self["config"].list[curIndex][1] if isinstance(currItem, ConfigDirectory): def SetDirPathCallBack(curIndex, newPath): if None != newPath: self["config"].list[curIndex][1].value = newPath self.session.openWithCallback(boundFunction( SetDirPathCallBack, curIndex), IPTVDirectorySelectorWidget, currDir=currItem.value, title="Wybierz katalog") return elif isinstance(currItem, ConfigText): def VirtualKeyBoardCallBack(curIndex, newTxt): if isinstance(newTxt, basestring): self["config"].list[curIndex][1].value = newTxt self.session.openWithCallback(boundFunction( VirtualKeyBoardCallBack, curIndex), VirtualKeyBoard, title=(_("Wprowadź wartość")), text=currItem.value) return ConfigListScreen.keyOK(self) def keyExit(self): if self.isChanged(): self.askForSave(self.saveAndClose, self.cancelAndClose) else: self.close() def keyCancel(self): self.cancelAndClose() def keyYellow(self): self.hiddenOptionsSecretCode += "y" self.runSetup() def keyBlue(self): self.hiddenOptionsSecretCode += "b" self.runSetup() def keyMenu(self): pass def keyUp(self): if self["config"].instance is not None: self["config"].instance.moveSelection( self["config"].instance.moveUp) def keyDown(self): if self["config"].instance is not None: self["config"].instance.moveSelection( self["config"].instance.moveDown) def keyPageUp(self): pass def keyPageDown(self): pass def keyHome(self): pass def keyEnd(self): pass def keyLeft(self): ConfigListScreen.keyLeft(self) def keyRight(self): ConfigListScreen.keyRight(self) def getSubOptionsList(self): tab = [] return tab def changeSubOptions(self): if self["config"].getCurrent()[1] in self.getSubOptionsList(): self.runSetup() def changedEntry(self): self.changeSubOptions() for x in self.onChangedEntry: x()
class DLNAImageViewer(Screen): s, w, h = 30, getDesktop(0).size().width(), getDesktop(0).size().height() skin = """ <screen position="0,0" size="%d,%d" flags="wfNoBorder"> <eLabel position="0,0" zPosition="0" size="%d,%d" backgroundColor="#00000000" /> <widget name="image" position="%d,%d" size="%d,%d" zPosition="1" alphatest="on" /> <widget name="status" position="%d,%d" size="20,20" zPosition="2" pixmap="icons/record.png" alphatest="on" /> <widget name="icon" position="%d,%d" size="20,20" zPosition="2" pixmap="icons/ico_mp_play.png" alphatest="on" /> <widget source="message" render="Label" position="%d,%d" size="%d,25" font="Regular;20" halign="left" foregroundColor="#0038FF48" zPosition="2" noWrap="1" transparent="1" /> </screen> """ % (w, h, w, h, s, s, w - (s * 2), h - (s * 2), s + 5, s + 2, s + 25, s + 2, s + 45, s, w - (s * 2) - 50) def __init__(self, session, fileList, index, path): Screen.__init__(self, session) self["actions"] = ActionMap( [ "OkCancelActions", "ColorActions", "DirectionActions", "MovieSelectionActions" ], { "cancel": self.keyCancel, "left": self.keyLeft, "right": self.keyRight, "blue": self.keyBlue, "yellow": self.keyYellow, }, -1) self["icon"] = Pixmap() self["image"] = Pixmap() self["status"] = Pixmap() self["message"] = StaticText(_("Please wait, Loading image.")) self.fileList = [] self.currentImage = [] self.lsatIndex = index self.fileListLen = 0 self.currentIndex = 0 self.directoryCount = 0 self.displayNow = True self.makeFileList(fileList, path) self.pictureLoad = ePicLoad() self.pictureLoad.PictureData.get().append(self.finishDecode) self.slideShowTimer = eTimer() self.slideShowTimer.callback.append(self.cbSlideShow) self.onLayoutFinish.append(self.layoutFinished) def layoutFinished(self): if self.fileListLen >= 0: self.setPictureLoadPara() def keyLeft(self): self.currentImage = [] self.currentIndex = self.lsatIndex self.currentIndex -= 1 if self.currentIndex < 0: self.currentIndex = self.fileListLen self.startDecode() self.displayNow = True def keyRight(self): self.displayNow = True self.showPicture() def keyYellow(self): if self.fileListLen < 0: return from Plugins.Extensions.PicturePlayer.plugin import Pic_Exif self.session.open( Pic_Exif, self.pictureLoad.getInfo(self.fileList[self.lsatIndex])) def keyBlue(self): if self.slideShowTimer.isActive(): self.slideShowTimer.stop() self["icon"].hide() else: global DLNA_CONFIG_SLIDESHOW self.slideShowTimer.start(DLNA_CONFIG_SLIDESHOW) self["icon"].show() self.keyRight() def keyCancel(self): del self.pictureLoad self.close(self.lsatIndex + self.directoryCount) def setPictureLoadPara(self): sc = AVSwitch().getFramebufferScale() self.pictureLoad.setPara([ self["image"].instance.size().width(), self["image"].instance.size().height(), sc[0], sc[1], 0, int(config.pic.resize.value), '#00000000' ]) self["icon"].hide() if config.pic.infoline.value == False: self["message"].setText("") self.startDecode() def makeFileList(self, fileList, path): for x in fileList: l = len(fileList[0]) if l == 3: if x[0][1] == False: self.fileList.append(path + x[0][0]) else: self.directoryCount += 1 elif l == 2: if x[0][1] == False: self.fileList.append(x[0][0]) else: self.directoryCount += 1 else: self.fileList.append(x[4]) self.currentIndex = self.lsatIndex - self.directoryCount if self.currentIndex < 0: self.currentIndex = 0 self.fileListLen = len(self.fileList) - 1 def showPicture(self): if self.displayNow and len(self.currentImage): self.displayNow = False self["message"].setText(self.currentImage[0]) self.lsatIndex = self.currentImage[1] self["image"].instance.setPixmap(self.currentImage[2].__deref__()) self.currentImage = [] self.currentIndex += 1 if self.currentIndex > self.fileListLen: self.currentIndex = 0 self.startDecode() def finishDecode(self, picInfo=""): self["status"].hide() ptr = self.pictureLoad.getData() if ptr != None: text = "" try: text = picInfo.split('\n', 1) text = "(" + str(self.currentIndex + 1) + "/" + str( self.fileListLen + 1) + ") " + text[0].split('/')[-1] except: pass self.currentImage = [] self.currentImage.append(text) self.currentImage.append(self.currentIndex) self.currentImage.append(ptr) self.showPicture() def startDecode(self): self.pictureLoad.startDecode(self.fileList[self.currentIndex]) self["status"].show() def cbSlideShow(self): print("slide to next Picture index=" + str(self.lsatIndex)) if config.pic.loop.value == False and self.lsatIndex == self.fileListLen: self.PlayPause() self.displayNow = True self.showPicture()
r = eRect(0,0,0,0) v = margin.attrib.get("left") if v: r.setLeft(int(v)) v = margin.attrib.get("top") if v: r.setTop(int(v)) v = margin.attrib.get("right") if v: r.setRight(int(v)) v = margin.attrib.get("bottom") if v: r.setBottom(int(v)) # the "desktop" parameter is hardcoded to the UI screen, so we must ask # for the one that this actually applies to. getDesktop(style_id).setMargins(r) dom_screens = {} def loadSkin(name, scope = SCOPE_SKIN): # Now a utility for plugins to add skin data to the screens global dom_screens, display_skin_id filename = resolveFilename(scope, name) if fileExists(filename): path = os.path.dirname(filename) + "/" file = open(filename, 'r') for elem in xml.etree.cElementTree.parse(file).getroot(): if elem.tag == 'screen': name = elem.attrib.get('name', None) if name: sid = elem.attrib.get('id', None)
class EmuManager(Screen): screenwidth = getDesktop(0).size().width() if screenwidth and screenwidth == 1920: skin = '<screen name="EmuManager" position="center,center" size="1040,680" >\n\t\t\t\t<widget name="choose_cam" position="180,10" size="280,35" font="Regular;32" />\n\t\t\t\t<widget name="config" position="530,10" itemHeight="50" font="Regular;28" size="180,30" transparent="1" />\n\t\t\t\t<ePixmap pixmap="/usr/lib/enigma2/python/EGAMI/icons/egami_icons/default_cam.png" position="500,8" size="800,60" transparent="1" alphatest="on"/>\n\t\t\t\t<widget name="lb_provider" position="180,75" size="280,28" font="Regular;28" />\n\t\t\t\t<widget name="lb_channel" position="180,110" size="280,28" font="Regular;28" />\n\t\t\t\t<widget name="lb_aspectratio" position="180,145" size="280,28" font="Regular;28" />\n\t\t\t\t<widget name="lb_videosize" position="180,180" size="280,28" font="Regular;28" />\n\t\t\t\t<widget name="ecminfo" position="180,225" size="400,290" font="Regular;28" />\n\t\t\t\t<ePixmap pixmap="skin_default/div-h.png" position="10,583" size="1000,4" />\n\t\t\t\t<ePixmap pixmap="skin_default/icons/dish_scan.png" zPosition="0" position="30,65" size="200,200" transparent="1" alphatest="on"/>\n\t\t\t\t<ePixmap pixmap="/usr/lib/enigma2/python/EGAMI/icons/egami_icons/icon_camd.png" zPosition="0" position="20,240" size="200,200" transparent="1" alphatest="on" />\n\t\t\t\t<ePixmap position="40,604" size="100,40" zPosition="0" pixmap="buttons/red.png" transparent="1" alphatest="blend"/>\n\t\t\t\t<ePixmap position="200,604" size="100,40" zPosition="0" pixmap="buttons/green.png" transparent="1" alphatest="blend"/>\n\t\t\t\t<ePixmap position="410,604" size="100,40" zPosition="0" pixmap="buttons/yellow.png" transparent="1" alphatest="blend"/>\n\t\t\t\t<ePixmap position="690,604" size="100,40" zPosition="0" pixmap="buttons/blue.png" transparent="1" alphatest="blend"/>\n\t\t\t\t<widget name="key_red" position="80,604" zPosition="1" size="270,35" font="Regular;32" valign="top" halign="left" backgroundColor="red" transparent="1" />\n\t\t\t\t<widget name="key_green" position="240,604" zPosition="1" size="270,35" font="Regular;32" valign="top" halign="left" backgroundColor="green" transparent="1" />\n\t\t\t\t<widget name="key_yellow" position="450,604" zPosition="1" size="270,35" font="Regular;32" valign="top" halign="left" backgroundColor="yellow" transparent="1" />\n\t\t\t\t<widget name="key_blue" position="730,604" zPosition="1" size="270,35" font="Regular;32" valign="top" halign="left" backgroundColor="blue" transparent="1" />\n\t\t\t</screen>' else: skin = '<screen name="EmuManager" position="center,center" size="780,550" >\n\t\t\t\t<widget name="choose_cam" position="180,10" size="280,30" font="Regular;22" />\n\t\t\t\t<widget name="config" position="410,10" size="180,30" transparent="1" />\n\t\t\t\t<ePixmap pixmap="/usr/lib/enigma2/python/EGAMI/icons/egami_icons/default_cam.png" position="380,8" size="800,60" transparent="1" alphatest="on"/>\n\t\t\t\t<widget name="lb_provider" position="180,75" size="280,20" font="Regular;18" />\n\t\t\t\t<widget name="lb_channel" position="180,95" size="280,20" font="Regular;18" />\n\t\t\t\t<widget name="lb_aspectratio" position="180,115" size="280,20" font="Regular;18" />\n\t\t\t\t<widget name="lb_videosize" position="180,135" size="280,20" font="Regular;18" />\n\t\t\t\t<widget name="ecminfo" position="180,215" size="400,290" font="Regular;18" />\n\t\t\t\t<ePixmap pixmap="skin_default/div-h.png" position="10,483" size="800,4" />\n\t\t\t\t<ePixmap pixmap="skin_default/icons/dish_scan.png" zPosition="0" position="30,55" size="200,200" transparent="1" alphatest="on"/>\n\t\t\t\t<ePixmap pixmap="/usr/lib/enigma2/python/EGAMI/icons/egami_icons/icon_camd.png" zPosition="0" position="20,225" size="200,200" transparent="1" alphatest="on" />\n\t\t\t\t<ePixmap position="40,504" size="100,40" zPosition="0" pixmap="skin_default/buttons/button_red.png" transparent="1" alphatest="on"/>\n\t\t\t\t<ePixmap position="200,504" size="100,40" zPosition="0" pixmap="skin_default/buttons/button_green.png" transparent="1" alphatest="on"/>\n\t\t\t\t<ePixmap position="360,504" size="100,40" zPosition="0" pixmap="skin_default/buttons/button_yellow.png" transparent="1" alphatest="on"/>\n\t\t\t\t<ePixmap position="550,504" size="100,40" zPosition="0" pixmap="skin_default/buttons/button_blue.png" transparent="1" alphatest="on"/>\n\t\t\t\t<widget name="key_red" position="60,504" zPosition="1" size="170,25" font="Regular;20" valign="top" halign="left" backgroundColor="red" transparent="1" />\n\t\t\t\t<widget name="key_green" position="220,504" zPosition="1" size="170,25" font="Regular;20" valign="top" halign="left" backgroundColor="green" transparent="1" />\n\t\t\t\t<widget name="key_yellow" position="380,504" zPosition="1" size="170,25" font="Regular;20" valign="top" halign="left" backgroundColor="yellow" transparent="1" />\n\t\t\t\t<widget name="key_blue" position="570,504" zPosition="1" size="170,25" font="Regular;20" valign="top" halign="left" backgroundColor="blue" transparent="1" />\n\t\t\t</screen>' def __init__(self, session): Screen.__init__(self, session) Screen.setTitle(self, _('EGAMI Blue Panel')) self['actions'] = ActionMap( ['OkCancelActions', 'ColorActions', 'CiSelectionActions'], { 'left': self.keyLeft, 'right': self.keyRight, 'ok': self.keyRed, 'cancel': self.cancel, 'red': self.keyRed, 'green': self.keyGreen, 'yellow': self.keyYellow, 'blue': self.keyBlue }, -1) self.softcamchoices = [] self['config'] = MenuList(self.softcamchoices) self.createSetup() self.onShow.append(self.createConfig) self.onShow.append(self.createSetup2) def createConfig(self): self.camnames = {} self.softcamchoices = [] cams = listdir('/usr/emu_scripts') for fil in cams: if fil.find('Ncam_') != -1 or fil.find('EGcam_') != -1: f = open('/usr/emu_scripts/' + fil, 'r') for line in f.readlines(): line = line.strip() if line.find('CAMNAME=') != -1: name = line[9:-1] self.softcamchoices.append(name) self.camnames[name] = '/usr/emu_scripts/' + fil f.close() self['config'].setList(self.softcamchoices) def createSetup(self): self['choose_cam'] = Label(_('Set Default CAM')) self['key_red'] = Label(_('Save')) self['key_green'] = Label(_('Cam Info')) self['key_yellow'] = Label(_('Download Cam')) self['key_blue'] = Label(_('EGAMI Panel')) try: service = self.session.nav.getCurrentService() info = service and service.info() videosize = str(info.getInfo( iServiceInformation.sVideoWidth)) + 'x' + str( info.getInfo(iServiceInformation.sVideoHeight)) aspect = info.getInfo(iServiceInformation.sAspect) if aspect in (1, 2, 5, 6, 9, 10, 13, 14): aspect = '4:3' else: aspect = '16:9' provider = info.getInfoString(iServiceInformation.sProvider) chname = ServiceReference( self.session.nav.getCurrentlyPlayingServiceReference( )).getServiceName() self['lb_provider'] = Label(_('Provider: ') + provider) self['lb_channel'] = Label(_('Name: ') + chname) self['lb_aspectratio'] = Label(_('Aspect Ratio: ') + aspect) self['lb_videosize'] = Label(_('Video Size: ') + videosize) except: self['lb_provider'] = Label(_('Provider: n/a')) self['lb_channel'] = Label(_('Name: n/a')) self['lb_aspectratio'] = Label(_('Aspect Ratio: n/a')) self['lb_videosize'] = Label(_('Video Size: n/a')) self['ecminfo'] = Label(readEcmFile()) def createSetup2(self): self.defaultcam = '/usr/emu_scripts/EGcam_Ci.sh' if fileExists('/etc/EGCamConf'): f = open('/etc/EGCamConf', 'r') for line in f.readlines(): parts = line.strip().split('|') if parts[0] == 'deldefault': self.defaultcam = parts[1] f.close() self.defCamname = 'Common Interface' for c in self.camnames.keys(): if self.camnames[c] == self.defaultcam: self.defCamname = c pos = 0 for x in self.softcamchoices: if x == self.defCamname: self['config'].moveToIndex(pos) break pos += 1 def keyLeft(self): self['config'].up() def keyRight(self): self['config'].down() def keyYellow(self): # m = eEGAMI.getInstance().checkkernel() if getBoxType in ('vusolo2'): staturl = catalogXmlUrl() downfile = '/tmp/.catalog.xml' if fileExists(downfile): os.remove(downfile) self.session.openWithCallback(self.EGConnectionCallback, EGConnectionAnimation, staturl, downfile) else: self.session.open( MessageBox, _('Sorry: Wrong image in flash found. You have to install in flash EGAMI Image' ), MessageBox.TYPE_INFO, 3) def keyBlue(self): # m = eEGAMI.getInstance().checkkernel() if getBoxType in ('vusolo2'): self.session.open(EgamiMainPanel) else: self.session.open( MessageBox, _('Sorry: Wrong image in flash found. You have to install in flash EGAMI Image' ), MessageBox.TYPE_INFO, 3) def EGConnectionCallback(self): downfile = '/tmp/.catalog.xml' if fileExists(downfile): self.session.open(EG_PrzegladaczAddonow, '/tmp/.catalog.xml') else: self.session.open(MessageBox, _('Sorry, Connection Failed'), MessageBox.TYPE_INFO) def myclose(self): self.close() def keyRed(self): # m = eEGAMI.getInstance().checkkernel() if getBoxType in ('vusolo2'): emuname = self['config'].getCurrent() self.newcam = self.camnames[emuname] out = open('/etc/EGCamConf', 'w') out.write('deldefault|' + self.newcam + '\n') out.close() out = open('/etc/CurrentEGCamName', 'w') out.write(emuname) out.close() out = open('/etc/egami/emuname', 'w') out.write(emuname) out.close() cmd = 'cp -f ' + self.newcam + ' /usr/bin/StartEGCam' system(cmd) cmd = 'STOP_CAMD,' + self.defaultcam sendCommandToEmud(cmd) cmd = 'NEW_CAMD,' + self.newcam sendCommandToEmud(cmd) oldcam = self.camnames[emuname] self.session.openWithCallback(self.myclose, EGEmuManagerStarting, emuname) unload_modules(__name__) else: self.session.open( MessageBox, _('Sorry: Wrong image in flash found. You have to install in flash EGAMI Image' ), MessageBox.TYPE_INFO, 3) def keyGreen(self): # m = eEGAMI.getInstance().checkkernel() if getBoxType in ('vusolo2'): self.session.open(EGSoftCamInfo) else: self.session.open( MessageBox, _('Sorry: Wrong image in flash found. You have to install in flash EGAMI Image' ), MessageBox.TYPE_INFO, 3) def cancel(self): unload_modules(__name__) self.close()
class Transmission(Screen): if getDesktop(0).size().width() >= 1920: skin = """ <screen position="center,center" size="1020,600" title="Transmission menu" > <widget name="menu" position="10,10" size="1000,600" font="Regular;30" itemHeight="36" scrollbarMode="showOnDemand" /> </screen>""" else: skin = """ <screen position="center,center" size="720,440" title="Transmission menu" > <widget name="menu" position="10,10" size="700,420" scrollbarMode="showOnDemand" /> </screen>""" def __init__(self, session): Screen.__init__(self, session) self.session = session self.setTitle(_("Transmission menu")) list = [] list.append((_("Information transmission download"), "info")) list.append((_("Start transmission"), "start")) list.append((_("Stop transmission"), "stop")) list.append((_("Restart transmission"), "restart")) list.append((_("Enable transmission autostart"), "enable")) list.append((_("Disable transmission autostart"), "disable")) list.append((_("Pause all downloads"), "pause")) list.append((_("Unpause all downloads"), "unpause")) list.append((_("Enable auto queue downloads"), "on")) list.append((_("Disable auto queue downloads"), "off")) list.append((_("Enabled SWAP when start transmission"), "enabled")) list.append((_("Create SWAP '/media/hdd/swapfile'"), "create")) list.append((_("Not enabled SWAP when start transmission"), "disabled")) list.append((_("Stop transmission after downloads (only queue works)"), "stop_trans")) list.append((_("Don't stop transmission after downloads (only queue works)"), "dont_stop_trans")) list.append((_("About transmission version"), "about_transmission")) self["menu"] = MenuList(list) self["actions"] = ActionMap(["OkCancelActions"], {"ok": self.run, "cancel": self.close}, -1) def run(self): returnValue = self["menu"].l.getCurrentSelection() and self["menu"].l.getCurrentSelection()[1] if returnValue is not None: if fileExists("/etc/init.d/transmission-daemon"): os.system("update-rc.d -f transmission-daemon remove && sleep 1 && rm -rf /etc/init.d/transmission-daemon") cmd = "cp /usr/lib/enigma2/python/Plugins/Extensions/Transmission/transmission.sh %s && chmod 755 %s" % (transmission_sh, transmission_sh) os.system(cmd) if returnValue is "info": self.session.open(Console, _("Information transmission download"), ["chmod 755 %s && %s" % (transinfo_sh, transinfo_sh)]) elif returnValue is "pause": self.session.open(Console, _("Pause all downloads"), ["chmod 755 %s && %s pause" % (pause_sh, pause_sh)]) elif returnValue is "unpause": self.session.open(Console, _("Unpause all downloads"), ["chmod 755 %s && %s unpause" % (pause_sh, pause_sh)]) elif returnValue is "start": self.session.open(Console, _("Start transmission"), ["%s start" % transmission_sh]) elif returnValue is "stop": self.session.open(Console, _("Stop transmission"), ["%s stop" % transmission_sh]) elif returnValue is "restart": self.session.open(Console, _("Restart transmission"), ["%s restart" % transmission_sh]) elif returnValue is "enable": self.session.open(Console, _("Enable transmission autostart"), ["%s enable" % transmission_sh]) elif returnValue is "disable": self.session.open(Console, _("Disable transmission autostart"), ["%s disable" % transmission_sh]) elif returnValue is "on": self.session.open(Console, _("Enable auto queue downloads"), ["chmod 755 %s && %s on" % (swap_sh, swap_sh)]) elif returnValue is "off": self.session.open(Console, _("Disable auto queue downloads"), ["chmod 755 %s && %s off" % (swap_sh, swap_sh)]) elif returnValue is "enabled": self.session.open(Console, _("Enabled SWAP when start transmission"), ["chmod 755 %s && %s enabled" % (swap_sh, swap_sh)]) elif returnValue is "create": self.session.open(Console, _("Create SWAP '/media/hdd/swapfile'"), ["chmod 755 %s && %s create" % (swap_sh, swap_sh)]) elif returnValue is "disabled": self.session.open(Console, _("Not enabled SWAP when start transmission"), ["chmod 755 %s && %s disabled" % (swap_sh, swap_sh)]) elif returnValue is "stop_trans": self.session.open(Console, _("Stop transmission after downloads (only queue works)"), ["chmod 755 %s && %s stop_trans" % (swap_sh, swap_sh)]) elif returnValue is "dont_stop_trans": self.session.open(Console, _("Don't stop transmission after downloads (only queue works)"), ["chmod 755 %s && %s dont_stop_trans" % (swap_sh, swap_sh)]) elif returnValue is "about_transmission": if fileExists("/usr/bin/transmission-daemon"): self.session.open(Console, _("About transmission version"), ["transmission-daemon -V \n", "echo Default login:root/password:root"]) else: self.session.openWithCallback(self.InstallNow, MessageBox, _("transmission-daemon not installed!\nInstall now?"), MessageBox.TYPE_YESNO) def InstallNow(self, answer): if answer: self.session.openWithCallback(self.close, Console, _("transmission-daemon"), ["opkg update && opkg install transmission && opkg install transmission-client"])
def __init__(self, session): Screen.__init__(self, session) SelectionEventInfo.__init__(self) CoolWide = getDesktop(0).size().width() skinpath = str(resolveFilename) self.skinName = "MovieSelectionSP" if CoolWide == 720: skin = "/usr/lib/enigma2/python/Plugins/Extensions/Suomipoeka/CoolSkin/MovieSelectionSP_720.xml" elif CoolWide == 1024: skin = "/usr/lib/enigma2/python/Plugins/Extensions/Suomipoeka/CoolSkin/MovieSelectionSP_1024.xml" else: skin = "/usr/lib/enigma2/python/Plugins/Extensions/Suomipoeka/CoolSkin/MovieSelectionSP_1280.xml" Cool = open(skin) self.skin = Cool.read() Cool.close() self.wasClosed = True self.playerInstance = None self.selectIdx = -1 self.cursorDir = 0 self.currentGrnText = _("Alpha sort") self["wait"] = Label(_("Reading directory...")) self["list"] = MovieList() self["key_red"] = Button() self["key_green"] = Button() self["key_yellow"] = Button() self["key_blue"] = Button() global gMS gMS = self self["actions"] = HelpableActionMap( self, "PluginMovieSelectionActions", { "bOK": (self.movieSelected, _("Play selected movie(s)")), "bOKL": (self.unUsed, "-"), "bEXIT": (self.abort, _("Close movie list")), "bMENU": (self.openMenu, _("Open menu")), "bINFO": (self.showEventInformation, _("Show event info")), "bINFOL": (self.unUsed, "-"), "bRed": (self.deleteFile, _("Delete file or empty dir")), "bGreen": (self.toggleSort, _("Toggle sort mode")), "bYellow": (self.moveMovie, _("Move selected movie(s)")), "bBlue": (self.blueFunc, _("Movie home / Play last (configurable)")), "bRedL": (self.unUsed, "-"), "bGreenL": (self.unUsed, "-"), "bYellowL": (self.openScriptMenu, _("Open shell script menu")), "bBlueL": (self.openBookmarks, _("Open bookmarks")), "bLeftUp": (self.keyPress, _("Move cursor page up")), "bRightUp": (self.keyPress, _("Move cursor page down")), "bUpUp": (self.keyPressU, _("Move cursor up")), "bDownUp": (self.keyPressD, _("Move cursor down")), "bBqtPlus": (self.bouquetPlus, _("Move cursor 1/2 page up")), "bBqtMnus": (self.bouquetMinus, _("Move cursor 1/2 page down")), "bArrowR": (self.unUsed, "-"), "bArrowRL": (self.unUsed, "-"), "bArrowL": (self.unUsed, "-"), "bArrowLL": (self.unUsed, "-"), "bVIDEO": (self.selectionToggle, _("Toggle service selection")), "bAUDIO": (self.openMenuPlugins, _("Available plugins menu")), "bAUDIOL": (self.unUsed, "-"), "bMENUL": (self.openMenuPlugins, _("Available plugins menu")), "bTV": (self.reloadList, _("Reload movie file list")), "bTVL": (self.unUsed, "-"), "bRADIO": (self.viewedToggle, _("Toggle viewed / not viewed")), "bRADIOL": (self.unUsed, "-"), "bTEXT": (self.multiSelect, _("Start / end multiselection")), "bTEXTL": (self.unUsed, "-") }) self["actions"].csel = self HelpableScreen.__init__(self) self.currentPathSel = config.suomipoeka.movie_homepath.value self.parentStack = [] self.onExecBegin.append(self.onDialogShow)
class JobViewNew(InfoBarNotifications, Screen, ConfigListScreen): try: sz_w = getDesktop(0).size().width() if sz_w == 1280: fullHD_Res = False elif sz_w == 1920: fullHD_Res = True else: fullHD_Res = False except: fullHD_Res = False if fullHD_Res == True: skin = ' <screen position="center,center" size="1920,1080" title=" " > <widget name="pixmap" position="1413,558" size="300,300" zPosition="1" alphatest="on" />\n\n\t\t<widget source="job_name" render="Label" position="150,150" size="720,150" font="Regular;42" backgroundColor="#40000000" />\n\t\t<!--widget source="job_task" render="Label" position="150,225" size="720,75" font="Regular;36" backgroundColor="#40000000" /-->\n\t\t<widget source="job_progress" render="Progress" position="210,375" size="720,54" borderWidth="2" backgroundColor="#40000000" />\n\t\t<widget source="job_progress" render="Label" position="150,525" size="420,48" font="Regular;42" backgroundColor="#40000000" zPosition="2" halign="center" transparent="1" >\n\t\t\t<convert type="ProgressToText" />\n\t\t</widget>\n\t\t<widget source="job_status" render="Label" position="150,600" size="720,45" font="Regular;34" backgroundColor="#40000000" />\n\t\t<widget name="config" position="150,725" size="775,60" foregroundColor="#cccccc" backgroundColor="#40000000" /> <eLabel position="225,1090" zPosition="1" size="300,45" backgroundColor="#f23d21" /> <eLabel position="226,993" zPosition="1" size="294,39" backgroundColor="#40000000" /> <eLabel position="525,990" zPosition="1" size="300,45" backgroundColor="#389416" /> <eLabel position="528,993" zPosition="1" size="294,39" backgroundColor="#40000000" /> <eLabel position="825,990" zPosition="1" size="600,45" backgroundColor="#0064c7" /> <eLabel position="828,993" zPosition="1" size="594,39" backgroundColor="#40000000" /> <widget source="cancelable" render="FixedLabel" text="Stop download" position="225,990" size="300,45" valign="center" halign="center" zPosition="4" foregroundColor="#ffffff" font="Regular;30" transparent="1" shadowColor="#25062748" shadowOffset="-2,-2" > <convert type="ConditionalShowHide" />\n\t</widget>\n\t<widget source="finished" render="FixedLabel" text="OK" position="525,990" size="300,45" valign="center" halign="center" zPosition="4" foregroundColor="#ffffff" font="Regular;30" transparent="1" shadowColor="#25062748" shadowOffset="-2,-2" > <convert type="ConditionalShowHide" />\n\t</widget>\n\t<widget source="backgroundable" render="FixedLabel" text="Continue in background" position="825,990" size="600,45" valign="center" halign="center" zPosition="4" foregroundColor="#ffffff" font="Regular;30" transparent="1" shadowColor="#25062748" shadowOffset="-2,-2" >\n\t\t\t<convert type="ConditionalShowHide" />\n\t</widget> </screen>' else: skin = '\n <screen position="center,center" size="1280,720" title=" " >\n \n <widget name="pixmap" position="942,372" size="200,200" zPosition="1" alphatest="on" />\n\n\t\t<widget source="job_name" render="Label" position="100,100" size="480,100" font="Regular;28" backgroundColor="#40000000" />\n\t\t<!--widget source="job_task" render="Label" position="100,150" size="480,50" font="Regular;23" backgroundColor="#40000000" /-->\n\t\t<widget source="job_progress" render="Progress" position="140,250" size="480,36" borderWidth="2" backgroundColor="#40000000" />\n\t\t<widget source="job_progress" render="Label" position="100,350" size="280,32" font="Regular;28" backgroundColor="#40000000" zPosition="2" halign="center" transparent="1" >\n\t\t\t<convert type="ProgressToText" />\n\t\t</widget>\n\t\t<widget source="job_status" render="Label" position="100,400" size="480,30" font="Regular;23" backgroundColor="#40000000" />\n\t\t<widget name="config" position="100,500" size="550,40" foregroundColor="#cccccc" backgroundColor="#40000000" />\n\t\n \n <eLabel position="150,660" zPosition="1" size="200,30" backgroundColor="#f23d21" /> \n <eLabel position="152,662" zPosition="1" size="196,26" backgroundColor="#40000000" /> \n <eLabel position="350,660" zPosition="1" size="200,30" backgroundColor="#389416" />\n <eLabel position="352,662" zPosition="1" size="196,26" backgroundColor="#40000000" />\n <eLabel position="550,660" zPosition="1" size="400,30" backgroundColor="#0064c7" />\n <eLabel position="552,662" zPosition="1" size="396,26" backgroundColor="#40000000" />\n\n \t<widget source="cancelable" render="FixedLabel" text="Stop download" position="150,660" size="200,30" valign="center" halign="center" zPosition="4" foregroundColor="#ffffff" font="Regular;20" transparent="1" shadowColor="#25062748" shadowOffset="-2,-2" > \n\t\t\t<convert type="ConditionalShowHide" />\n\t</widget>\n\t<widget source="finished" render="FixedLabel" text="OK" position="350,660" size="200,30" valign="center" halign="center" zPosition="4" foregroundColor="#ffffff" font="Regular;20" transparent="1" shadowColor="#25062748" shadowOffset="-2,-2" > \n\t\t\t<convert type="ConditionalShowHide" />\n\t</widget>\n\t<widget source="backgroundable" render="FixedLabel" text="Continue in background" position="550,660" size="400,30" valign="center" halign="center" zPosition="4" foregroundColor="#ffffff" font="Regular;20" transparent="1" shadowColor="#25062748" shadowOffset="-2,-2" >\n\t\t\t<convert type="ConditionalShowHide" />\n\t</widget> \n \n\t</screen>' def __init__(self, session, job, parent = None, cancelable = True, backgroundable = True, afterEventChangeable = True): from Components.Sources.StaticText import StaticText from Components.Sources.Progress import Progress from Components.Sources.Boolean import Boolean from Components.ActionMap import ActionMap Screen.__init__(self, session, parent) InfoBarNotifications.__init__(self) ConfigListScreen.__init__(self, []) self.parent = parent self.session = session try: txt=open("/tmp/filesize").read() self.size="Size "+str(int(txt)/(1024*1024))+"MB" except: self.size="000" self.job = job self['pixmap'] = Pixmap() self['job_name'] = StaticText(job.name) self['job_progress'] = Progress() self['job_task'] = StaticText() self['summary_job_name'] = StaticText(job.name) self['summary_job_progress'] = Progress() self['summary_job_task'] = StaticText() self['job_status'] = StaticText(job.name) self['finished'] = Boolean() self['cancelable'] = Boolean(cancelable) self['cancelable'].boolean = True self['backgroundable'] = Boolean(backgroundable) self['key_blue'] = StaticText(_('Background')) self.onShow.append(self.windowShow) self.onHide.append(self.windowHide) self['setupActions'] = ActionMap(['ColorActions', 'SetupActions'], {'green': self.ok, 'red': self.abort, 'blue': self.background, 'cancel': self.ok, 'ok': self.ok}, -2) self.settings = ConfigSubsection() if SystemInfo['DeepstandbySupport']: shutdownString = _('go to standby') else: shutdownString = _('shut down') self.settings.afterEvent = ConfigSelection(choices=[('nothing', _('do nothing')), ('close', _('Close')), ('standby', _('go to idle mode')), ('deepstandby', shutdownString)], default=self.job.afterEvent or 'nothing') self.job.afterEvent = self.settings.afterEvent.getValue() self.afterEventChangeable = afterEventChangeable self.setupList() self.state_changed() def setupList(self): if self.afterEventChangeable: self['config'].setList([getConfigListEntry(_('After event'), self.settings.afterEvent)]) else: self['config'].hide() self.job.afterEvent = self.settings.afterEvent.getValue() def keyLeft(self): ConfigListScreen.keyLeft(self) self.setupList() def keyRight(self): ConfigListScreen.keyRight(self) self.setupList() def windowShow(self): pic1 = THISPLUG + '/skin/images/download.png' self['pixmap'].instance.setPixmapFromFile(pic1) self.job.state_changed.append(self.state_changed) def windowHide(self): if len(self.job.state_changed) > 0: self.job.state_changed.remove(self.state_changed) def state_changed(self): j = self.job self['job_progress'].range = j.end self['summary_job_progress'].range = j.end self['job_progress'].value = j.progress self['summary_job_progress'].value = j.progress self['job_status'].text = self.size +" "+j.getStatustext() if j.status == j.IN_PROGRESS: self['job_task'].text = j.tasks[j.current_task].name self['summary_job_task'].text = j.tasks[j.current_task].name else: self['job_task'].text = '' self['summary_job_task'].text = j.getStatustext() if j.status in (j.FINISHED, j.FAILED): self.performAfterEvent() self['backgroundable'].boolean = False if j.status == j.FINISHED: self['finished'].boolean = True self['cancelable'].boolean = False elif j.status == j.FAILED: self['cancelable'].boolean = True def background(self): if self['backgroundable'].boolean == True: self.close(False) def ok(self): if self.job.status in (self.job.FINISHED, self.job.FAILED): self.close(False) def abort(self): if self.job.status == self.job.NOT_STARTED: job_manager.active_jobs.remove(self.job) self.close(False) elif self.job.status == self.job.IN_PROGRESS and self['cancelable'].boolean == True: from Screens.MessageBox import MessageBox self.session.openWithCallback(self.stop_job, MessageBox, _('Stop download now,downloaded file will be deleted.'), MessageBox.TYPE_YESNO) else: self.close(False) def stop_job(self, result): if result: self.job.cancel() print '167', self.job.name downloadfolder = config.plugins.tstube.downloadlocation.value print '168', downloadfolder + '/' + self.job.name try: os.remove(downloadfolder + self.job.name) cmd1 = 'killall -9 rtmpdump' cmd2 = 'killall -9 wget' os.system(cmd1) os.system(cmd2) except: print 'failed to stop download' self.close(True) def performAfterEvent(self): self['config'].hide() if self.settings.afterEvent.getValue() == 'nothing': return if self.settings.afterEvent.getValue() == 'close' and self.job.status == self.job.FINISHED: self.close(False) from Screens.MessageBox import MessageBox if self.settings.afterEvent.getValue() == 'deepstandby': if not Screens.Standby.inTryQuitMainloop: Notifications.AddNotificationWithCallback(self.sendTryQuitMainloopNotification, MessageBox, _('A sleep timer wants to shut down\nyour Dreambox. Shutdown now?'), timeout=20, domain='JobManager') elif self.settings.afterEvent.getValue() == 'standby': if not Screens.Standby.inStandby: Notifications.AddNotificationWithCallback(self.sendStandbyNotification, MessageBox, _('A sleep timer wants to set your\nDreambox to standby. Do that now?'), timeout=20, domain='JobManager') def checkNotifications(self): self.close(False) def sendStandbyNotification(self, answer): if answer: Notifications.AddNotification(Screens.Standby.Standby, domain='JobManager') def sendTryQuitMainloopNotification(self, answer): if answer: Notifications.AddNotification(Screens.Standby.TryQuitMainloop, 1, domain='JobManager')
class BBCiMenu(Screen): wsize = getDesktop(0).size().width() - 200 hsize = getDesktop(0).size().height() - 300 skin = """ <screen position="100,150" size=\"""" + str(wsize) + "," + str( hsize) + """\" title="BBC iPlayer" > <widget name="BBCiMenu" position="10,10" size=\"""" + str( wsize - 20) + "," + str(hsize - 20) + """\" scrollbarMode="showOnDemand" /> </screen>""" def __init__(self, session, action, value): self.imagedir = "/tmp/onDemandImg/" self.session = session self.action = action self.value = value osdList = [] if self.action is "start": osdList.append((_("Search"), "search")) osdList.append((_("TV Highlights"), "bbchighlights")) osdList.append((_("Most Popular TV"), "bbcpopular")) osdList.append((_("Drama"), "bbcdrama")) osdList.append((_("Entertainment"), "bbcentertainment")) osdList.append((_("Movies"), "film")) osdList.append((_("Factual"), "bbcfactual")) osdList.append((_("Comedy"), "bbccomedy")) osdList.append((_("Soaps"), "bbcsoaps")) osdList.append((_("Childrens"), "bbckids")) osdList.append((_("News"), "bbcnews")) osdList.append((_("Sport"), "bbcsport")) osdList.append((_("Music"), "bbcmusic")) osdList.append((_("Health And Wellbeing"), "bbchealth")) osdList.append((_("Religion"), "bbcreligous")) osdList.append((_("Signed"), "bbcsigned")) osdList.append((_("BBC Northern Ireland"), "bbcni")) osdList.append((_("BBC Wales"), "bbcwales")) osdList.append((_("BBC Scotland"), "bbcscotland")) osdList.append((_("BBC One"), "bbc1")) osdList.append((_("BBC Two"), "bbc2")) osdList.append((_("BBC Three"), "bbc3")) osdList.append((_("BBC Four"), "bbc4")) osdList.append((_("CBBC"), "cbbc")) osdList.append((_("Cbeebies"), "cbeeb")) osdList.append((_("BBC Parliamanent"), "bbcp")) osdList.append((_("BBC News"), "bbcn")) osdList.append((_("BBC Alba"), "bbca")) osdList.append((_("BBC HD"), "bbchd")) osdList.append((_("Back"), "exit")) Screen.__init__(self, session) self["BBCiMenu"] = MenuList(osdList) self["myActionMap"] = ActionMap(["SetupActions"], { "ok": self.go, "cancel": self.cancel }, -1) def go(self): returnValue = self["BBCiMenu"].l.getCurrentSelection()[1] returnValue2 = self["BBCiMenu"].l.getCurrentSelection( )[1] + "," + self["BBCiMenu"].l.getCurrentSelection()[0] if returnValue is "exit": self.removeFiles(self.imagedir) self.close(None) elif self.action is "start": if returnValue is "bbc1": self.session.open( StreamsThumb, "bbc1", "BBC One", "http://feeds.bbc.co.uk/iplayer/bbc_one/list") elif returnValue is "bbc2": self.session.open( StreamsThumb, "bbc2", "BBC Two", "http://feeds.bbc.co.uk/iplayer/bbc_two/list") elif returnValue is "bbc3": self.session.open( StreamsThumb, "bbc3", "BBC Three", "http://feeds.bbc.co.uk/iplayer/bbc_three/list") elif returnValue is "bbc4": self.session.open( StreamsThumb, "bbc4", "BBC Four", "http://feeds.bbc.co.uk/iplayer/bbc_four/list") elif returnValue is "cbbc": self.session.open(StreamsThumb, "cbbc", "CBBC", "http://feeds.bbc.co.uk/iplayer/cbbc/list") elif returnValue is "cbeeb": self.session.open( StreamsThumb, "cbeeb", "Cbeebies", "http://feeds.bbc.co.uk/iplayer/cbeebies/list") elif returnValue is "bbcp": self.session.open( StreamsThumb, "bbcp", "BBC Parliamanent", "http://feeds.bbc.co.uk/iplayer/bbc_parliament/list") elif returnValue is "bbcn": self.session.open( StreamsThumb, "bbcn", "BBC News", "http://feeds.bbc.co.uk/iplayer/bbc_news24/list") elif returnValue is "bbca": self.session.open( StreamsThumb, "bbca", "BBC Alba", "http://feeds.bbc.co.uk/iplayer/bbc_alba/list") elif returnValue is "bbchd": self.session.open( StreamsThumb, "bbchd", "BBC HD", "http://feeds.bbc.co.uk/iplayer/bbc_hd/list") elif returnValue is "bbchighlights": self.session.open( StreamsThumb, "bbchighlights", "TV Highlights", "http://feeds.bbc.co.uk/iplayer/highlights/tv") elif returnValue is "bbcpopular": self.session.open(StreamsThumb, "bbcpopular", "Most Popular TV", "http://feeds.bbc.co.uk/iplayer/popular/tv") elif returnValue is "bbcdrama": self.session.open( StreamsThumb, "bbcdrama", "Drama", "http://feeds.bbc.co.uk/iplayer/categories/drama/tv/list") elif returnValue is "bbcentertainment": self.session.open( StreamsThumb, "bbcentertainment", "Entertainment", "http://feeds.bbc.co.uk/iplayer/categories/entertainment/tv/list" ) elif returnValue is "bbcfactual": self.session.open( StreamsThumb, "bbcfactual", "Factual", "http://feeds.bbc.co.uk/iplayer/categories/factual/tv/list" ) elif returnValue is "bbcsigned": self.session.open( StreamsThumb, "bbcsigned", "Signed", "http://feeds.bbc.co.uk/iplayer/categories/signed/tv/list") elif returnValue is "bbconedrama": self.session.open( StreamsThumb, "bbconedrama", "BBC One Drama", "http://feeds.bbc.co.uk/iplayer/bbc_one/drama/tv/list") elif returnValue is "bbccomedy": self.session.open( StreamsThumb, "bbccomedy", "Comedy", "http://feeds.bbc.co.uk/iplayer/comedy/tv/list") elif returnValue is "bbchealth": self.session.open( StreamsThumb, "bbchealth", "Health And Wellbeing", "http://feeds.bbc.co.uk/iplayer/bbc_three/factual/health_and_wellbeing/tv/list" ) elif returnValue is "bbcwales": self.session.open( StreamsThumb, "bbcwales", "BBC Wales", "http://feeds.bbc.co.uk/iplayer/wales/tv/list") elif returnValue is "bbcscotland": self.session.open( StreamsThumb, "bbcscotland", "BBC Scotland", "http://feeds.bbc.co.uk/iplayer/scotland/tv/list") elif returnValue is "bbcni": self.session.open( StreamsThumb, "bbcni", "BBC Northern Ireland", "http://feeds.bbc.co.uk/iplayer/northern_ireland/tv/list") elif returnValue is "film": self.session.open( StreamsThumb, "film", "Movies", "http://feeds.bbc.co.uk/iplayer/films/tv/list") elif returnValue is "bbckids": self.session.open( StreamsThumb, "bbckids", "Kids", "http://feeds.bbc.co.uk/iplayer/childrens/tv/list") elif returnValue is "bbcnews": self.session.open( StreamsThumb, "bbcnews", "BBC News", "http://feeds.bbc.co.uk/iplayer/news/tv/list/") elif returnValue is "bbcmusic": self.session.open( StreamsThumb, "bbcmusic", "Music", "http://feeds.bbc.co.uk/iplayer/music/tv/list") elif returnValue is "bbcsoaps": self.session.open( StreamsThumb, "bbcsoaps", "Soaps", "http://feeds.bbc.co.uk/iplayer/soaps/tv/list") elif returnValue is "bbcsport": self.session.open( StreamsThumb, "bbcsport", "Sport", "http://feeds.bbc.co.uk/iplayer/categories/sport/tv/list") elif returnValue is "bbcreligous": self.session.open( StreamsThumb, "bbcreligous", "Religion", "http://feeds.bbc.co.uk/iplayer/religion_and_ethics/tv/list" ) elif returnValue is "search": self.session.open( StreamsThumb, "search", "Search", "http://feeds.bbc.co.uk/iplayer/search/tv/?q=") def cancel(self): self.removeFiles(self.imagedir) self.close(None) def removeFiles(self, targetdir): for root, dirs, files in os_walk(targetdir): for name in files: os_remove(os_path.join(root, name))
def __close(self): gMainDC.getInstance().setResolution(self.xres, self.yres) getDesktop(0).resize(eSize(self.xres, self.yres))
class StartImage(Screen): screenwidth = getDesktop(0).size().width() if screenwidth and screenwidth == 1920: skin = """<screen position="center, center" size="1241, 850" title="NeoBoot"> \n\t\t\t<ePixmap position="491, 673" zPosition="-2" size="355, 150" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/matrixhd.png" /> <widget source="list" render="Listbox" position="20, 171" size="1194, 290" scrollbarMode="showOnDemand">\n\t\t\t\t<convert type="TemplatedMultiContent"> \n \t\t{"template": [ \n \t\t\tMultiContentEntryText(pos = (90, 1), size = (920, 66), flags = RT_HALIGN_CENTER|RT_VALIGN_CENTER, text = 0), \n \t\t\tMultiContentEntryPixmapAlphaTest(pos = (8, 4), size = (66, 66), png = 1), \n \t\t\t], \n \t\t\t"fonts": [gFont("Regular", 40)],\n \t\t\t"itemHeight": 66\n \t\t} \n \t\t</convert>\n\t\t</widget> \n <widget name="label1" position="21, 29" zPosition="1" size="1184, 116" font="Regular;35" halign="center" valign="center" backgroundColor="black" transparent="1" foregroundColor="red" /> \n\t\t <widget name="label2" position="22, 480" zPosition="-2" size="1205, 168" font="Regular;35" halign="center" valign="center" backgroundColor="black" transparent="1" foregroundColor="red" /> \n\t\t </screen>""" else: skin = """<screen position="center, center" size="835, 500" title="NeoBoot"> \n\t\t\t <ePixmap position="0,0" zPosition="-1" size="835,500" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/frame835x500.png" /> <widget source="list" render="Listbox" position="16, 150" size="800, 40" selectionPixmap="/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/listselection800x35.png" scrollbarMode="showOnDemand"> \n\t\t\t\t<convert type="TemplatedMultiContent"> \n \t\t{"template": [ \n \t\t\tMultiContentEntryText(pos = (180, 0), size = (520, 36), flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER, text = 0), \n \t\t\tMultiContentEntryPixmapAlphaTest(pos = (4, 2), size = (36, 36), png = 1), \n \t\t\t],\n \t\t\t"fonts": [gFont("Regular", 22)], \n \t\t\t"itemHeight": 35\n \t\t}\n \t\t</convert> \n\t\t</widget>\n<widget name="label1" font="Regular; 26" position="15, 70" size="803, 58" halign="center" valign="center" backgroundColor="black" transparent="1" foregroundColor="#00cc99" /> <widget name="label2" position="40, 232" zPosition="2" size="806, 294" font="Regular;25" halign="center" valign="center" backgroundColor="black" transparent="1" foregroundColor="#00cc99" /> \n\t\t </screen>""" __module__ = __name__ def __init__(self, session): Screen.__init__(self, session) self.list = [] self['list'] = List(self.list) self.select() self['actions'] = ActionMap(['WizardActions', 'ColorActions'], { 'ok': self.KeyOk, 'back': self.close }) self['label1'] = Label(_('Start the chosen system now ?')) self['label2'] = Label(_('Select OK to run the image.')) def select(self): self.list = [] mypath = '' + LinkNeoBoot + '' if not fileExists(mypath + 'icons'): mypixmap = '' + LinkNeoBoot + '/images/ok.png' png = LoadPixmap(mypixmap) res = (_('OK Start image...'), png, 0) self.list.append(res) self['list'].list = self.list def KeyOk(self): if getImageNeoBoot() != "Flash": os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % (getNeoLocation(), getImageNeoBoot())) self.StartImageInNeoBoot() else: os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % (getNeoLocation(), getImageNeoBoot())) self.StartImageInNeoBoot() #--------------------------------------------- getMountPointNeo2() #--------------------------------------------- def StartImageInNeoBoot(self): if getImageNeoBoot() != "Flash": if fileExists('%sImageBoot/%s/.control_ok' % (getNeoLocation(), getImageNeoBoot())): system('touch /tmp/.control_ok ') else: system('touch %sImageBoot/%s/.control_boot_new_image ' % (getNeoLocation(), getImageNeoBoot())) if fileExists('/.multinfo') and getCPUtype() == "ARMv7": if getBoxVuModel() == "uno4kse" or getBoxVuModel( ) == "uno4k" or getBoxVuModel() == "ultimo4k" or getBoxVuModel( ) == "solo4k": os.system( 'mkdir -p /media/InternalFlash; mount /dev/mmcblk0p4 /media/InternalFlash' ) system('chmod 755 ' + LinkNeoBoot + '/files/kernel.sh') self.sel = self['list'].getCurrent() if self.sel: self.sel = self.sel[2] if self.sel == 0: if fileExists('/media/InternalFlash/etc/init.d/neobootmount.sh'): os.system( 'rm -f /media/InternalFlash/etc/init.d/neobootmount.sh;') if not fileExists('/bin/busybox.nosuid'): os.system('ln -sf "busybox" "/bin/busybox.nosuid" ') #VUPLUS ARM ultimo4k, solo4k, uno4k, uno4kse - mmcblk0p1.sh if getCPUtype() == "ARMv7" and getBoxHostName( ) == "vuultimo4k" or getBoxHostName( ) == "vusolo4k" or getBoxHostName() == "vuuno4k" or getBoxHostName( ) == "vuuno4kse": if not fileExists( '%sImagesUpload/.kernel/flash-kernel-%s.bin' % (getNeoLocation(), getBoxHostName())): mess = (_( 'Error - in the location %sImagesUpload/.kernel/ \nkernel file not found flash-kernel-%s.bin' ) % (getNeoLocation(), getBoxHostName())) self.session.open(MessageBox, mess, MessageBox.TYPE_INFO) else: if getImageNeoBoot() == "Flash": if fileExists("/.multinfo"): cmd = "echo -e '\n\n%s '" % _( '...............NEOBOOT - REBOOT...............\nPlease wait, in a moment the decoder will be restarted...' ) cmd1 = 'cd /media/InternalFlash; ln -sf "init.sysvinit" "/media/InternalFlash/sbin/init"; ' + LinkNeoBoot + '/files/kernel.sh ' elif not fileExists("/.multinfo"): cmd = "echo -e '\n\n%s '" % _( '...............NEOBOOT - REBOOT...............\nPlease wait, in a moment the decoder will be restarted...' ) cmd1 = 'sleep 5; ln -sf "init.sysvinit" "/sbin/init"; reboot -d -f' elif getImageNeoBoot() != "Flash": if not fileExists("/.multinfo"): if not fileExists( '%sImageBoot/%s/boot/zImage.%s' % (getNeoLocation(), getImageNeoBoot(), getBoxHostName())): cmd = "echo -e '\n\n%s '" % _( '...............NEOBOOT - REBOOT...............\nPlease wait, in a moment the decoder will be restarted...' ) cmd1 = 'sleep 5; ln -sfn /sbin/neoinitarm /sbin/init; reboot -d -f' elif fileExists( '%sImageBoot/%s/boot/zImage.%s' % (getNeoLocation(), getImageNeoBoot(), getBoxHostName())): cmd = "echo -e '\n\n%s '" % _( '...............NEOBOOT - REBOOT...............\nPlease wait, in a moment the decoder will be restarted...' ) cmd1 = 'ln -sfn /sbin/neoinitarmvu /sbin/init; ' + LinkNeoBoot + '/files/kernel.sh ' elif fileExists("/.multinfo"): if not fileExists( '%sImageBoot/%s/boot/zImage.%s' % (getNeoLocation(), getImageNeoBoot(), getBoxHostName())): cmd = "echo -e '\n\n%s '" % _( '...............NEOBOOT - REBOOT...............\nPlease wait, in a moment the decoder will be restarted...' ) cmd1 = 'dd if=' + getNeoLocation( ) + 'ImagesUpload/.kernel/flash-kernel-' + getBoxHostName( ) + '.bin of=/dev/mmcblk0p1; cd /media/InternalFlash; ln -sf "neoinitarm" "/media/InternalFlash/sbin/init" ; sleep 2; reboot -dfhi ' elif fileExists( '%sImageBoot/%s/boot/zImage.%s' % (getNeoLocation(), getImageNeoBoot(), getBoxHostName())): cmd = "echo -e '\n\n%s '" % _( '...............NEOBOOT - REBOOT...............\nPlease wait, in a moment the decoder will be restarted...' ) cmd1 = 'cd /media/InternalFlash; ln -sf "neoinitarmvu" "/media/InternalFlash/sbin/init"; ' + LinkNeoBoot + '/files/kernel.sh ' self.session.open(Console, _('NeoBoot ARM VU+....'), [cmd, cmd1]) self.close() else: os.system('echo "Flash " >> ' + getNeoLocation() + 'ImageBoot/.neonextboot') self.messagebox = self.session.open( MessageBox, _('It looks like it that multiboot does not support this STB.' ), MessageBox.TYPE_INFO, 8) self.close()