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 __runEmu(self): print "[DosBox] - __runEmu" eRCInput.getInstance().lock() fbClass.getInstance().lock() com = "export LANG=" + language.getLanguage() + ".UTF-8;" com += "/usr/bin/dosbox-start;" self.__container.execute(com)
def runPlugin(self, pluginname): eDBoxLCD.getInstance().lock() eRCInput.getInstance().lock() fbClass.getInstance().lock() print "executing:", ("pluginlauncher -x %s" % pluginname) if self.container.execute("pluginlauncher -x %s" % pluginname): self.finishedExecution(None)
def close_vkb(self, data=""): fbClass.getInstance().lock() eRCInput.getInstance().lock() if strIsEmpty(data): data = "" VBController.command("BROWSER_VKB_CLOSE", data)
def __runEmu(self): print "[GnuBoy] - __runEmu", self.__rom eRCInput.getInstance().lock() fbClass.getInstance().lock() com = "export LANG=" + language.getLanguage() + ".UTF-8;" com += "/usr/bin/sdlgnuboy-start '%s';" % self.__rom self.__container.execute(com)
def Start_Flashing(self): print "Start Flashing" cmdlist = [] if os.path.exists(ofgwritePath): text = _("Flashing: ") if self.simulate: text += _("Simulate (no write)") if SystemInfo["HaveMultiBoot"]: if getMachineBuild() in ("gbmv200","cc1","sf8008","ustym4kpro","beyonwizv2","viper4k"): cmdlist.append("%s -r%s -k%s %s > /dev/null 2>&1" % (ofgwritePath, self.MTDROOTFS, self.MTDKERNEL, flashTmp)) elif SystemInfo["HasRootSubdir"]: cmdlist.append("%s -n -f -r -k -m%s %s > /dev/null 2>&1" % (ofgwritePath, self.multi, flashTmp)) else: cmdlist.append("%s -n -r -k -m%s %s > /dev/null 2>&1" % (ofgwritePath, self.multi, flashTmp)) elif getMachineBuild() in ("gbmv200","h9combo","u51","u52","u53","u54","u56","u5","u5pvr","cc1","sf8008","ustym4kpro","beyonwizv2","viper4k","hd60","hd61","v8plus","multibox"): cmdlist.append("%s -n -r%s -k%s %s > /dev/null 2>&1" % (ofgwritePath, MTDROOTFS, MTDKERNEL, flashTmp)) elif getMachineBuild() in ("h9","i55plus","u55","u41"): cmdlist.append("%s -n -f -r -k %s > /dev/null 2>&1" % (ofgwritePath, flashTmp)) else: cmdlist.append("%s -n -r -k %s > /dev/null 2>&1" % (ofgwritePath, flashTmp)) self.close() message = "echo -e '\n" message += _('Show only found image and mtd partitions.\n') message += "'" else: text += _("root and kernel") if SystemInfo["HaveMultiBoot"]: if self.List not in ("STARTUP","cmdline.txt") and not SystemInfo["HasRootSubdir"]: os.system('mkfs.ext4 -F ' + self.devrootfs) if getMachineBuild() in ("gbmv200","cc1","sf8008","ustym4kpro","beyonwizv2","viper4k"): cmdlist.append("%s -r%s -k%s %s > /dev/null 2>&1" % (ofgwritePath, self.MTDROOTFS, self.MTDKERNEL, flashTmp)) elif SystemInfo["HasRootSubdir"]: cmdlist.append("%s -f -r -k -m%s %s > /dev/null 2>&1" % (ofgwritePath, self.multi, flashTmp)) else: cmdlist.append("%s -r -k -m%s %s > /dev/null 2>&1" % (ofgwritePath, self.multi, flashTmp)) elif getMachineBuild() in ("gbmv200","h9combo","u51","u52","u53","u54","u56","u5","u5pvr","cc1","sf8008","ustym4kpro","beyonwizv2","viper4k","hd60","hd61","v8plus","multibox"): cmdlist.append("%s -r%s -k%s %s > /dev/null 2>&1" % (ofgwritePath, MTDROOTFS, MTDKERNEL, flashTmp)) elif getMachineBuild() in ("h9","i55plus","u55","u41"): cmdlist.append("%s -f -r -k %s > /dev/null 2>&1" % (ofgwritePath, flashTmp)) else: cmdlist.append("%s -r -k %s > /dev/null 2>&1" % (ofgwritePath, flashTmp)) message = "echo -e '\n" if self.List not in ("STARTUP","cmdline.txt") and SystemInfo["HaveMultiBoot"] and not SystemInfo["HasRootSubdir"]: message += _('ofgwrite flashing ready.\n') message += _('please press exit to go back to the menu.\n') else: message += _('ofgwrite will stop enigma2 now to run the flash.\n') message += _('Your STB will freeze during the flashing process.\n') message += _('Please: DO NOT reboot your STB and turn off the power.\n') message += _('The image or kernel will be flashing and auto booted in few minutes.\n') if self.box() == 'gb800solo': message += _('GB800SOLO takes about 20 mins !!\n') message += "'" cmdlist.append(message) self.session.open(Console, title = text, cmdlist = cmdlist, finishedCallback = self.quit, closeOnSuccess = False) if not self.simulate: fbClass.getInstance().lock() if self.List not in ("STARTUP","cmdline.txt"): self.close()
def _CB_BROWSER_MENU_OPEN(self, result, packet): if vbcfg.g_browser and vbcfg.g_browser.is_browser_opened: vbcfg.setPosition(vbcfg.g_position) fbClass.getInstance().unlock() eRCInput.getInstance().unlock() vbcfg.g_browser.toggle_browser(packet, self.current_title) return (True, None)
def FlashimageDone(self, data, retval, extra_args): fbClass.getInstance().unlock() self.containerofgwrite = None if retval == 0: self["header"].setText(_("Flashing image successful")) self["summary_header"].setText(self["header"].getText()) self["info"].setText(_("%s\nPress ok to close") % self.imagename) else: self.session.openWithCallback(self.abort, MessageBox, _("Flashing image was not successful\n%s") % self.imagename, type=MessageBox.TYPE_ERROR, simple=True)
def __runEmu(self,rom): print "[Snes] - __runEmu", rom eDBoxLCD.getInstance().lock() eRCInput.getInstance().lock() fbClass.getInstance().lock() com = "export LANG=" + language.getLanguage() + ".UTF-8;" com += "/usr/bin/snes9x-sdl-start '%s';" %rom self.__container.execute(com)
def ok(self): fbClass.getInstance().unlock() if self["header"].text == _("Flashing image successful"): if MultiBoot.canMultiBoot(): self.session.openWithCallback(self.abort, MultiBootManager) else: self.close() else: return 0
def __runEmu(self): print "[Vice] - __runEmu", self.__emu eRCInput.getInstance().lock() fbClass.getInstance().lock() com = "export LANG=" + language.getLanguage() + ".UTF-8;" com += "/usr/bin/vice-start '%s'" %self.__emu if self.__rom != "": com += " '%s'" %self.__rom self.__container.execute(com)
def flashimage(self): self["header"].setText(_("Flashing Image")) self["summary_header"].setText(self["header"].getText()) def findimagefiles(path): for path, subdirs, files in os.walk(path): if not subdirs and files: return checkimagefiles(files) and path imagefiles = findimagefiles(self.unzippedimage) if imagefiles: self.getImageList = self.saveImageList self.MTDKERNEL = GetCurrentKern() self.MTDROOTFS = GetCurrentRoot() if SystemInfo["canMultiBoot"]: if "sd" in self.getImageList[self.multibootslot]['part']: self.MTDKERNEL = "%s%s" % ( SystemInfo["canMultiBoot"][2], int(self.getImageList[self.multibootslot]['part'][3]) - 1) self.MTDROOTFS = "%s" % ( self.getImageList[self.multibootslot]['part']) if SystemInfo["canMultiBoot"]: if getMachineBuild() in ( "gbmv200", "cc1", "sf8008", "ustym4kpro", "beyonwizv2", "viper4k" ): # issue detect kernel device and rootfs on sda print "[FlashImage] detect Kernel:", self.MTDKERNEL print "[FlashImage] detect rootfs:", self.MTDROOTFS command = "/usr/bin/ofgwrite -r%s -k%s %s" % ( self.MTDROOTFS, self.MTDKERNEL, imagefiles) else: command = "/usr/bin/ofgwrite -r -k -m%s %s" % ( self.multibootslot, imagefiles) elif getMachineBuild() in ("u5pvr", "u5", "u51", "u52", "u53", "u532", "u533", "u54", "u56"): # issue detect kernel device print "[FlashImage] detect Kernel:", self.MTDKERNEL print "[FlashImage] detect rootfs:", self.MTDROOTFS command = "/usr/bin/ofgwrite -r%s -k%s %s" % ( self.MTDROOTFS, self.MTDKERNEL, imagefiles) else: if fileExists("%s/rootfs.ubi" % imagefiles) and fileExists( "%s/rootfs.tar.bz2" % imagefiles): os.rename('%s/rootfs.tar.bz2' % imagefiles, '%s/xx.txt' % imagefiles) command = "/usr/bin/ofgwrite -r -k %s" % imagefiles self.containerofgwrite = Console() self.containerofgwrite.ePopen(command, self.FlashimageDone) fbClass.getInstance().lock() else: self.session.openWithCallback( self.abort, MessageBox, _("Image to install is invalid\n%s") % self.imagename, type=MessageBox.TYPE_ERROR, simple=True)
def keyCancel(self): if self.is_browser_opened: fbClass.getInstance().lock() eRCInput.getInstance().lock() self.toggle_top() VBController.command("BROWSER_MENU_CLOSE") return self._cmd_Exit()
def ok(self): fbClass.getInstance().unlock() if self["header"].text == _("Flashing image successful"): if SystemInfo["canMultiBoot"]: self.session.openWithCallback(self.abort, MultiBootSelector) else: self.close() else: return 0
def startBrowser(self): self.timer_start.stop() self.lock = True excute_cmd("killall -15 %s" % (self.browser_name)) excute_cmd("echo 0 > /proc/sys/vm/swappiness") kbd_cmd = " " mouse_cmd = " " extra_cmd = "export VU_DOWNLOAD_DIR=/tmp; " browser_cmd = "%s/%s -qws" % (self.browser_root, self.browser_name) mouse_param = self.mouse.value if self.mouse.value == "mrc": mouse_param = self.rc_mouse elif self.mouse.value == "musb": mouse_param = self.usb_mouse keyboard_param = self.keyboard.value if self.keyboard.value == "krc": keyboard_param = self.rc_keyboard elif self.keyboard.value == "kusb": keyboard_param = self.usb_keyboard if self.getHandlerName(mouse_param)[1:].startswith("dreambox"): enable_rc_mouse(True) #rc-mouse on if str(mouse_param).startswith("event"): mouse_cmd = "export QWS_MOUSE_PROTO=LinuxInput:/dev/input/%s; " % ( str(mouse_param)) keymap_param = "" if self.langs.value == "ch": keymap_param = ":keymap=/usr/share/keymaps/vuplus/ch.qmap" elif self.langs.value == "rc_ch": keymap_param = ":keymap=/usr/share/keymaps/vuplus/de.qmap" elif self.langs.value == "rc_en": keymap_param = ":keymap=/usr/share/keymaps/vuplus/us.qmap" kbd_cmd = "export QWS_KEYBOARD=LinuxInput:/dev/input/%s%s; " % ( str(keyboard_param), keymap_param) cmd = "%s%s%s%s" % (extra_cmd, kbd_cmd, mouse_cmd, browser_cmd) print "prepared command : [%s]" % cmd self.launcher = eConsoleAppContainer() self.launcher.appClosed.append(self.callbackLauncherAppClosed) self.launcher.dataAvail.append(self.callbackLauncherDataAvail) fbClass.getInstance().lock() #eRCInput.getInstance().lock() global alpha_value alpha_value = self.alpha.value change_galpha(set_const=True, set_value=True) self.launcher.execute(cmd) print "started browser..."
def _CB_BROWSER_VKB_OPEN(self, result, packet): if vbcfg.g_browser and vbcfg.g_browser.is_browser_opened: vbcfg.setPosition(vbcfg.g_position) fbClass.getInstance().unlock() eRCInput.getInstance().unlock() if strIsEmpty(packet): packet = "" self._session.openWithCallback(self.close_vkb, VirtualKeyBoard, title=("Please enter URL here"), text=str(packet)) return (True, None)
def finished(self,retval): fbClass.getInstance().unlock() eRCInput.getInstance().unlock() eDBoxLCD.getInstance().unlock() if self.faked_lcd: remove("/dev/dbox/lcd0") rmdir("/dev/dbox") self.close()
def keyRun(self): entry = self["installedimages"].getCurrent()[0] #if self.oldref == None: # self.stopService() excute_cmd('snes_init') excute_cmd('cp /etc/fb.snes /etc/fb.modes') fbClass.getInstance().lock() eRCInput.getInstance().lock() self.session.openWithCallback(self.myback, GoMain, entry) excute_cmd('rm -R /etc/fb.modes')
def osd_unlock(): if fileExists("/usr/bin/config"): try: os.system( 'config -c 1 -visible on; config -c DirectFB -visible off') except Exception as Err: ERR(Err) fbClass.getInstance().unlock() eRCInput.getInstance().unlock()
def Start_Flashing(self): print "Start Flashing" cmdlist = [] if os.path.exists(ofgwritePath): text = _("Flashing: ") if self.simulate: text += _("Simulate (no write)") if SystemInfo["HaveMultiBoot"]: if getMachineBuild() in ("cc1","sf8008","ustym4kpro"): cmdlist.append("%s -r%s -k%s %s > /dev/null 2>&1" % (ofgwritePath, self.MTDROOTFS, self.MTDKERNEL, flashTmp)) else: cmdlist.append("%s -n -r -k -m%s %s > /dev/null 2>&1" % (ofgwritePath, self.multi, flashTmp)) elif getMachineBuild() in ("u51","u52","u53","u5","u5pvr","cc1","sf8008","ustym4kpro","hd60","v8plus"): cmdlist.append("%s -n -r%s -k%s %s > /dev/null 2>&1" % (ofgwritePath, MTDROOTFS, MTDKERNEL, flashTmp)) elif getMachineBuild() in ("h9","i55plus"): cmdlist.append("%s -n -f -r -k %s > /dev/null 2>&1" % (ofgwritePath, flashTmp)) else: cmdlist.append("%s -n -r -k %s > /dev/null 2>&1" % (ofgwritePath, flashTmp)) self.close() message = "echo -e '\n" message += _('Show only found image and mtd partitions.\n') message += "'" else: text += _("root and kernel") if SystemInfo["HaveMultiBoot"]: if self.List not in ("STARTUP","cmdline.txt"): os.system('mkfs.ext4 -F ' + self.devrootfs) if getMachineBuild() in ("cc1","sf8008","ustym4kpro"): cmdlist.append("%s -r%s -k%s %s > /dev/null 2>&1" % (ofgwritePath, self.MTDROOTFS, self.MTDKERNEL, flashTmp)) else: cmdlist.append("%s -r -k -m%s %s > /dev/null 2>&1" % (ofgwritePath, self.multi, flashTmp)) elif getMachineBuild() in ("u51","u52","u53","u5","u5pvr","cc1","sf8008","ustym4kpro","hd60","v8plus"): cmdlist.append("%s -r%s -k%s %s > /dev/null 2>&1" % (ofgwritePath, MTDROOTFS, MTDKERNEL, flashTmp)) elif getMachineBuild() in ("h9","i55plus"): cmdlist.append("%s -f -r -k %s > /dev/null 2>&1" % (ofgwritePath, flashTmp)) else: cmdlist.append("%s -r -k %s > /dev/null 2>&1" % (ofgwritePath, flashTmp)) message = "echo -e '\n" if self.List not in ("STARTUP","cmdline.txt") and SystemInfo["HaveMultiBoot"]: message += _('ofgwrite flashing ready.\n') message += _('please press exit to go back to the menu.\n') else: message += _('ofgwrite will stop enigma2 now to run the flash.\n') message += _('Your STB will freeze during the flashing process.\n') message += _('Please: DO NOT reboot your STB and turn off the power.\n') message += _('The image or kernel will be flashing and auto booted in few minutes.\n') if self.box() == 'gb800solo': message += _('GB800SOLO takes about 20 mins !!\n') message += "'" cmdlist.append(message) self.session.open(Console, title = text, cmdlist = cmdlist, finishedCallback = self.quit, closeOnSuccess = False) if not self.simulate: fbClass.getInstance().lock() if self.List not in ("STARTUP","cmdline.txt"): self.close()
def startBrowser(self): self.timer_start.stop() self.lock = True excute_cmd("killall -15 %s"%(self.browser_name)) excute_cmd("echo 0 > /proc/sys/vm/swappiness") kbd_cmd = " " mouse_cmd = " " extra_cmd = "export VU_DOWNLOAD_DIR=/tmp; " browser_cmd = "%s/%s -qws" % (self.browser_root, self.browser_name) mouse_param = self.mouse.value if self.mouse.value == "mrc": mouse_param = self.rc_mouse elif self.mouse.value == "musb": mouse_param = self.usb_mouse keyboard_param = self.keyboard.value if self.keyboard.value == "krc": keyboard_param = self.rc_keyboard elif self.keyboard.value == "kusb": keyboard_param = self.usb_keyboard if self.getHandlerName(mouse_param)[1:].startswith("dreambox"): enable_rc_mouse(True) #rc-mouse on if str(mouse_param).startswith("event"): mouse_cmd = "export QWS_MOUSE_PROTO=LinuxInput:/dev/input/%s; " % (str(mouse_param)) keymap_param = "" if self.langs.value == "ch": keymap_param = ":keymap=/usr/share/keymaps/vuplus/ch.qmap" elif self.langs.value == "rc_ch": keymap_param = ":keymap=/usr/share/keymaps/vuplus/de.qmap" elif self.langs.value == "rc_en": keymap_param = ":keymap=/usr/share/keymaps/vuplus/us.qmap" kbd_cmd = "export QWS_KEYBOARD=LinuxInput:/dev/input/%s%s; " % (str(keyboard_param), keymap_param) cmd = "%s%s%s%s" % (extra_cmd, kbd_cmd, mouse_cmd, browser_cmd) print "prepared command : [%s]" % cmd self.launcher = eConsoleAppContainer() self.launcher.appClosed.append(self.callbackLauncherAppClosed) self.launcher.dataAvail.append(self.callbackLauncherDataAvail) fbClass.getInstance().lock() #eRCInput.getInstance().lock() global alpha_value alpha_value = self.alpha.value change_galpha(set_const=True, set_value=True) self.launcher.execute(cmd) print "started browser..."
def doExit(self): change_galpha(set_const=False, set_value=False) self.saveConfig() self.service.stop() excute_cmd("killall -15 %s"%(self.browser_name)) excute_cmd("echo 60 > /proc/sys/vm/swappiness") enable_rc_mouse(False) #rc-mouse off language.activateLanguageIndex(self.current_lang_idx) fbClass.getInstance().unlock() #eRCInput.getInstance().unlock() self.close()
def onExit(self): fbClass.getInstance().unlock() eRCInput.getInstance().unlock() global browserinstance browserinstance.onBroadcastPlay.remove(self.onBroadcastPlay) browserinstance.onBroadcastStop.remove(self.onBroadcastStop) browserinstance.onExit.remove(self.onExit) global g_session g_session.nav.stopService() g_session.nav.playService(self.lastservice) self.close()
def setPosition(dst_left, dst_right, dst_top, dst_bottom): if dst_left > 150: dst_left = 150 if dst_right < -150: dst_right = -150 if dst_top > 150: dst_top = 150 if dst_bottom < -150: dst_bottom = -150 fbClass.getInstance().setFBdiff(dst_top, dst_left, dst_right, dst_bottom) fbClass.getInstance().clearFBblit()
def ok(self): fbClass.getInstance().unlock() if self["header"].text == _("Flashing image successful"): if SystemInfo["MBbootdevice"]: from Screens.MultiBootSelector import MultiBootSelector self.session.open(MultiBootSelector) self.close() else: self.close() else: return 0
def finishedExecution(self, retval=1): print("[Tuxbox] PluginRunner retval:", retval) fbClass.getInstance().unlock() eRCInput.getInstance().unlock() eDBoxLCD.getInstance().unlock() if retval is None or retval != 1: self.session.openWithCallback(self.finishedExecution, MessageBox, _("Error executing plugin") % param) else: self.close()
def Start_Flashing(self): print "Start Flashing" cmdlist = [] if os.path.exists(ofgwritePath): text = _("Flashing: ") if self.simulate: text += _("Simulate (no write)") if SystemInfo["HaveMultiBoot"]: cmdlist.append("%s -n -r%s -k%s %s > /dev/null 2>&1" % (ofgwritePath, self.MTDROOTFS, self.MTDKERNEL, flashTmp)) else: cmdlist.append("%s -n -r -k %s > /dev/null 2>&1" % (ofgwritePath, flashTmp)) self.close() message = "echo -e '\n" message += _('Show only found image and mtd partitions.\n') message += "'" else: text += _("root and kernel") if SystemInfo["HaveMultiBoot"]: cmdlist.append("%s -r%s -k%s %s > /dev/null 2>&1" % (ofgwritePath, self.MTDROOTFS, self.MTDKERNEL, flashTmp)) else: cmdlist.append("%s -r -k %s > /dev/null 2>&1" % (ofgwritePath, flashTmp)) message = "echo -e '\n" if self.List not in ("STARTUP", "cmdline.txt" ) and SystemInfo["HaveMultiBoot"]: message += _('ofgwrite flashing ready.\n') message += _('please press exit to go back to the menu.\n') else: message += _( 'ofgwrite will stop enigma2 now to run the flash.\n') message += _( 'Your STB will freeze during the flashing process.\n') message += _( 'Please: DO NOT reboot your STB and turn off the power.\n' ) message += _( 'The image or kernel will be flashing and auto booted in few minutes.\n' ) message += "'" cmdlist.append(message) self.session.open(Console, title=text, cmdlist=cmdlist, finishedCallback=self.quit, closeOnSuccess=False) if not self.simulate: fbClass.getInstance().lock() if self.List not in ("STARTUP", "cmdline.txt"): self.close()
def doExit(self): change_galpha(set_const=False, set_value=False) self.saveConfig() self.service.stop() excute_cmd("killall -15 %s" % (self.browser_name)) excute_cmd("echo 60 > /proc/sys/vm/swappiness") enable_rc_mouse(False) #rc-mouse off language.activateLanguageIndex(self.current_lang_idx) fbClass.getInstance().unlock() #eRCInput.getInstance().unlock() self.close()
def yellow(self): global top global right global bottom global left print '[OSD Adjustment] set Default Screen Settings' top = 0 bottom = 0 left = 0 right = 0 fbClass.getInstance().setFBdiff(0, 0, 0, 0) fbClass.getInstance().clearFBblit()
def flashimage(self): self["header"].setText(_("Flashing Image")) self["summary_header"].setText(self["header"].getText()) def findimagefiles(path): for path, subdirs, files in os.walk(path): if not subdirs and files: return checkimagefiles(files) and path imagefiles = findimagefiles(self.unzippedimage) if imagefiles: self.ROOTFSSUBDIR = "none" bootSlots = MultiBoot.getBootSlots() if bootSlots: self.MTDKERNEL = bootSlots[self.multibootslot]["kernel"].split( '/')[2] if bootSlots[self.multibootslot].get("ubi"): self.MTDROOTFS = bootSlots[self.multibootslot]["device"] else: self.MTDROOTFS = bootSlots[ self.multibootslot]["device"].split('/')[2] if MultiBoot.hasRootSubdir(): self.ROOTFSSUBDIR = bootSlots[ self.multibootslot]["rootsubdir"] else: self.MTDKERNEL = getMachineMtdKernel() self.MTDROOTFS = getMachineMtdRoot() if getMachineBuild( ) in ("dm820", "dm7080"): # temp solution ofgwrite autodetection not ready CMD = "/usr/bin/ofgwrite -rmmcblk0p1 '%s'" % imagefiles elif self.MTDKERNEL == self.MTDROOTFS: # receiver with kernel and rootfs on one partition CMD = "/usr/bin/ofgwrite -r '%s'" % imagefiles else: CMD = "/usr/bin/ofgwrite -r -k '%s'" % imagefiles #normal non multiboot receiver if MultiBoot.canMultiBoot(): if (self.ROOTFSSUBDIR ) is None: # receiver with SD card multiboot CMD = "/usr/bin/ofgwrite -r%s -k%s -m0 '%s'" % ( self.MTDROOTFS, self.MTDKERNEL, imagefiles) else: CMD = "/usr/bin/ofgwrite -r -k -m%s '%s'" % ( self.multibootslot, imagefiles) self.containerofgwrite = Console() self.containerofgwrite.ePopen(CMD, self.FlashimageDone) fbClass.getInstance().lock() else: self.session.openWithCallback( self.abort, MessageBox, _("Image to install is invalid\n%s") % self.imagename, type=MessageBox.TYPE_ERROR, simple=True)
def yellow(self): global top global right global bottom global left print('[OSD Adjustment] set Default Screen Settings') top = 0 bottom = 0 left = 0 right = 0 fbClass.getInstance().setFBdiff(0, 0, 0, 0) fbClass.getInstance().clearFBblit()
def doExit(self): self.volctrl = eDVBVolumecontrol.getInstance() vol = self.volctrl.getVolume() self.volctrl.setVolume(vol, vol) fbClass.getInstance().unlock() eRCInput.getInstance().unlock() global browserinstance gMainDC.getInstance().setResolution(self.xres, self.yres) getDesktop(0).resize(eSize(self.xres, self.yres)) browserinstance.setPosition(0, 0, self.width, self.height) global g_session g_session.nav.playService(self.lastservice) self.close()
def finishedExecution(self, retval = 1): print "PluginRunner retval:", retval fbClass.getInstance().unlock() eRCInput.getInstance().unlock() eDBoxLCD.getInstance().unlock() if retval is None or retval != 1: self.session.openWithCallback( self.finishedExecution, MessageBox, _("Error executing plugin") % param ) else: self.close()
def finished(self, retval): fbClass.getInstance().unlock() eRCInput.getInstance().unlock() eDBoxLCD.getInstance().unlock() if self.faked_lcd: remove("/dev/dbox/lcd0") rmdir("/dev/dbox") #force redraw dsk = getDesktop(0) dsk.resize(dsk.size()) self.close()
def finished(self,retval): fbClass.getInstance().unlock() eRCInput.getInstance().unlock() eDBoxLCD.getInstance().unlock() if self.faked_lcd: remove("/dev/dbox/lcd0") rmdir("/dev/dbox") #force redraw dsk = getDesktop(0) dsk.resize(dsk.size()) self.close()
def flashImage(self): def findImageFiles(path): for path, subDirs, files in walk(path): if not subDirs and files: return checkImageFiles(files) and path self["header"].setText(_("Flashing Image")) self["summary_header"].setText(self["header"].getText()) imageFiles = findImageFiles(self.unzippedImage) if imageFiles: rootSubDir = "none" bootSlots = MultiBoot.getBootSlots() if bootSlots: mtdKernel = bootSlots[self.slotCode]["kernel"].split(sep)[2] mtdRootFS = bootSlots[self.slotCode]["device"] if bootSlots[ self.slotCode].get("ubi") else bootSlots[ self.slotCode]["device"].split(sep)[2] if MultiBoot.hasRootSubdir(): rootSubDir = bootSlots[self.slotCode]["rootsubdir"] else: mtdKernel = BoxInfo.getItem("mtdkernel") mtdRootFS = BoxInfo.getItem("mtdrootfs") if MultiBoot.canMultiBoot( ): # Receiver with SD card MultiBoot if (rootSubDir) is None. cmdArgs = ["-r%s" % mtdRootFS, "-k%s" % mtdKernel, "-m0"] if (rootSubDir) is None else [ "-r", "-k", "-m%s" % self.slotCode ] elif BoxInfo.getItem("model") in ( "dm820", "dm7080" ): # Temp solution ofgwrite auto detection not ready. cmdArgs = ["-rmmcblk0p1"] elif mtdKernel == mtdRootFS: # Receiver with kernel and rootfs on one partition. cmdArgs = ["-r"] else: # Normal non MultiBoot receiver. cmdArgs = ["-r", "-k"] self.containerOFGWrite = Console() self.containerOFGWrite.ePopen([OFGWRITE, OFGWRITE] + cmdArgs + ['%s' % imageFiles], callback=self.flashImageDone) fbClass.getInstance().lock() else: self.session.openWithCallback( self.keyCancel, MessageBox, _("Error: Image '%s' to install is invalid!") % self.imageName, type=MessageBox.TYPE_ERROR, windowTitle=self.getTitle())
def down(self): global top global bottom if rightbottom is False: print '[OSD Adjustment] top' top = int(top) + 5 if top > 150: top = 150 else: print '[OSD Adjustment] bottom' bottom = int(bottom) + 5 if bottom > 0: bottom = 0 fbClass.getInstance().setFBdiff(int(top), int(left), int(right), int(bottom)) fbClass.getInstance().clearFBblit()
def up(self): global top global bottom if rightbottom is False: print '[OSD Adjustment] top' top = int(top) - 5 if top < 0: top = 0 else: print '[OSD Adjustment] bottom' bottom = int(bottom) - 5 if bottom < -150: bottom = -150 fbClass.getInstance().setFBdiff(int(top), int(left), int(right), int(bottom)) fbClass.getInstance().clearFBblit()
def left(self): global right global left if rightbottom is False: print('[SH4OSDAdjustment] left') left = int(left) - 5 if left < 0: left = 0 else: print('[SH4OSDAdjustment] right') right = int(right) - 5 if right < -150: right = -150 fbClass.getInstance().setFBdiff(int(top), int(left), int(right), int(bottom)) fbClass.getInstance().clearFBblit()
def start_hbbtv_application(self): global browserinstance if browserinstance.connectedClients() == 0: self.count += 1 if self.count > 50: self.close() return self.starttimer.stop() fbClass.getInstance().lock() eRCInput.getInstance().lock() browserinstance.onBroadcastPlay.append(self.onBroadcastPlay) browserinstance.onBroadcastStop.append(self.onBroadcastStop) browserinstance.onExit.append(self.onExit)
def right(self): global right global left if rightbottom is False: print '[OSD Adjustment] left' left = int(left) + 5 if left > 150: left = 150 else: print '[OSD Adjustment] right' right = int(right) + 5 if right > 0: right = 0 fbClass.getInstance().setFBdiff(int(top), int(left), int(right), int(bottom)) fbClass.getInstance().clearFBblit()
def doExit(self): self.volctrl = eDVBVolumecontrol.getInstance() vol = self.volctrl.getVolume() self.volctrl.setVolume(vol, vol) fbClass.getInstance().unlock() eRCInput.getInstance().unlock() global browserinstance gMainDC.getInstance().setResolution(self.xres, self.yres) getDesktop(0).resize(eSize(self.xres, self.yres)) open("/proc/stb/fb/dst_left", "w").write(self.left) open("/proc/stb/fb/dst_width", "w").write(self.width) open("/proc/stb/fb/dst_top", "w").write(self.top) open("/proc/stb/fb/dst_height", "w").write(self.height) global g_session g_session.nav.playService(self.lastservice) self.close()
def command(opcodestr, data=""): cmd_fd = None vbcfg.DEBUG("send ipc: [%s]" % opcodestr) try: send_data = VBController.assamble(opcodestr, data) if not os.path.exists(vbcfg.CONTROLFILE): raise Exception("no found controller file.") cmd_fd = os.open(vbcfg.CONTROLFILE, os.O_WRONLY) if cmd_fd is None: raise Exception("fail to open controller file.") os.write(cmd_fd, send_data) except Exception, err: vbcfg.ERR("VBHController: %s" % err) vbcfg.setPosition(vbcfg.g_position) fbClass.getInstance().unlock() eRCInput.getInstance().unlock() return False
def flashImageDone(self, data, retVal, extraArgs): fbClass.getInstance().unlock() self.containerOFGWrite = None if retVal == 0: self["header"].setText(_("Flashing image successful")) self["summary_header"].setText(self["header"].getText()) self["info"].setText( "%s\n\n%s\n%s" % (self.imageName, _("Press OK for MultiBoot selection."), _("Press EXIT to close."))) else: self.session.openWithCallback( self.keyCancel, MessageBox, _("Flashing image '%s' was not successful!") % self.imageName, type=MessageBox.TYPE_ERROR, windowTitle=self.getTitle())
def Start_Flashing(self): print "Start Flashing" cmdlist = [] #######################fix multiboot################### os.system('rm /sbin/init;ln -sfn /sbin/init.sysvinit /sbin/init') if os.path.exists(ofgwritePath): text = _("Flashing: ") if self.simulate: text += _("Simulate (no write)") if SystemInfo["HaveMultiBoot"]: cmdlist.append("%s -n -r -k -m%s %s > /dev/null 2>&1" % (ofgwritePath, self.multi, flashTmp)) else: cmdlist.append("%s -n -r -k %s > /dev/null 2>&1" % (ofgwritePath, flashTmp)) self.close() message = "echo -e '\n" message += _('Show only found image and mtd partitions.\n') message += "'" else: text += _("root and kernel") if SystemInfo["HaveMultiBoot"]: if not self.List == "STARTUP": os.system('mkfs.ext4 -F ' + self.devrootfs) cmdlist.append("%s -r -k -m%s %s > /dev/null 2>&1" % (ofgwritePath, self.multi, flashTmp)) if not self.List == "STARTUP": cmdlist.append("umount -fl /oldroot_bind") cmdlist.append("umount -fl /newroot") else: cmdlist.append("%s -r -k %s > /dev/null 2>&1" % (ofgwritePath, flashTmp)) message = "echo -e '\n" if not self.List == "STARTUP" and SystemInfo["HaveMultiBoot"]: message += _('ofgwrite flashing ready.\n') message += _('please press exit to go back to the menu.\n') else: message += _('ofgwrite will stop enigma2 now to run the flash.\n') message += _('Your STB will freeze during the flashing process.\n') message += _('Please: DO NOT reboot your STB and turn off the power.\n') message += _('The image or kernel will be flashing and auto booted in few minutes.\n') if self.box() == 'gb800solo': message += _('GB800SOLO takes about 20 mins !!\n') message += "'" cmdlist.append(message) self.session.open(Console, title = text, cmdlist = cmdlist, finishedCallback = self.quit, closeOnSuccess = False) if not self.simulate: fbClass.getInstance().lock() if not self.List == "STARTUP": self.close()
def command(opcodestr, data = ""): cmd_fd = None vbcfg.DEBUG("send ipc: [%s]" % opcodestr) try: send_data = VBController.assamble(opcodestr, data) if not os.path.exists(vbcfg.CONTROLFILE): raise Exception("no found controller file.") cmd_fd = os.open(vbcfg.CONTROLFILE, os.O_WRONLY) if cmd_fd is None: raise Exception("fail to open controller file.") os.write(cmd_fd, send_data) except Exception, err: vbcfg.ERR("VBHController: %s" % err) vbcfg.setPosition(vbcfg.g_position) fbClass.getInstance().unlock() eRCInput.getInstance().unlock() return False
def onExit(self): file = open('/proc/stb/vmpeg/0/zorder', 'w') file.write('0') file.close() fbClass.getInstance().unlock() eRCInput.getInstance().unlock() global browserinstance browserinstance.onMediaUrlChanged.remove(self.onMediaUrlChanged) browserinstance.onStopPlaying.remove(self.onStopPlaying) browserinstance.onExit.remove(self.onExit) browserinstance.onPausePlaying.remove(self.onPausePlaying) browserinstance.onResumePlaying.remove(self.onResumePlaying) browserinstance.onSkip.remove(self.onSkip) browserinstance.setPosition(0, 0, self.width, self.height, 0) self.mediatimer.stop() global g_session g_session.nav.playService(self.lastservice) self.close()
def runapp(self): service = self.session.nav.getCurrentService() info = service and service.info() txtpid = info and "%d" %(info.getInfo(iServiceInformation.sTXTPID)) or "" stream = service and service.stream() demux = stream and stream.getStreamingData() demux = demux and demux.get("demux", -1) demux = demux > -1 and "%d" %(demux) or "" eDBoxLCD.getInstance().lock() eRCInput.getInstance().lock() fbClass.getInstance().lock() self.faked_lcd = not path.exists("/dev/dbox") if self.faked_lcd: mkdir("/dev/dbox") symlink("/dev/null", "/dev/dbox/lcd0") if self.container.execute("/usr/bin/tuxtxt " + demux + " " + txtpid): self.finished(-1)
def Start_Flashing(self): print "Start Flashing" cmdlist = [] if os.path.exists(ofgwritePath): text = _("Flashing: ") if self.simulate: text += _("Simulate (no write)") if SystemInfo["HaveMultiBoot"]: cmdlist.append("%s -n -r%s -k%s %s > /dev/null 2>&1" % (ofgwritePath, self.MTDROOTFS, self.MTDKERNEL, flashTmp)) else: cmdlist.append("%s -n -r -k %s > /dev/null 2>&1" % (ofgwritePath, flashTmp)) self.close() message = "echo -e '\n" message += _('Show only found image and mtd partitions.\n') message += "'" else: text += _("root and kernel") if SystemInfo["HaveMultiBoot"]: cmdlist.append("%s -r%s -k%s %s > /dev/null 2>&1" % (ofgwritePath, self.MTDROOTFS, self.MTDKERNEL, flashTmp)) else: cmdlist.append("%s -r -k %s > /dev/null 2>&1" % (ofgwritePath, flashTmp)) message = "echo -e '\n" if self.List not in ("STARTUP","cmdline.txt") and SystemInfo["HaveMultiBoot"]: message += _('ofgwrite flashing ready.\n') message += _('please press exit to go back to the menu.\n') else: message += _('ofgwrite will stop enigma2 now to run the flash.\n') message += _('Your STB will freeze during the flashing process.\n') message += _('Please: DO NOT reboot your STB and turn off the power.\n') message += _('The image or kernel will be flashing and auto booted in few minutes.\n') message += "'" cmdlist.append(message) self.session.open(Console, title = text, cmdlist = cmdlist, finishedCallback = self.quit, closeOnSuccess = False) if not self.simulate: fbClass.getInstance().lock() if self.List not in ("STARTUP","cmdline.txt"): self.close()
def _cb_start_browser(self, data=None, mode=0, opcode='BROWSER_OPENURL'): if not vbcfg.g_main.check_browser(): if self.m_url is not None: if vbcfg.g_service: self.session.nav.playService(vbcfg.g_service) return vbcfg.LOG("open url: %s %d" % (data, mode)) if strIsEmpty(data): return try: if self._cb_set_title not in vbcfg.g_main.vbhandler.onSetTitleCB: vbcfg.g_main.vbhandler.onSetTitleCB.append(self._cb_set_title) except Exception: pass try: if self._cb_close_window not in vbcfg.g_main.vbhandler.onCloseCB: vbcfg.g_main.vbhandler.onCloseCB.append(self._cb_close_window) except Exception: pass vbcfg.g_position = vbcfg.getPosition() fbClass.getInstance().lock() eRCInput.getInstance().lock() self.toggle_top() ret = VBController.command(opcode, data) self._current_url = data if ret: self.is_browser_opened = True else: self.is_browser_opened = False vbcfg.ERR("Failed to open url: %s" % data) vbcfg.g_main.vbhandler.soft_volume = -1
def startBrowser(self): self.timer_start.stop() self.lock = True excute_cmd("killall -15 %s"%(self.browser_name)) excute_cmd("echo 0 > /proc/sys/vm/swappiness") kbd_cmd = " " mouse_cmd = " " extra_cmd = " " browser_cmd = "%s/%s -qws" % (self.browser_root, self.browser_name) mouse_param = self.mouse.value keyboard_param = self.keyboard.value keymap_param = "" if self.langs.value == "de": keymap_param = ":keymap=/usr/share/keymaps/player/de.qmap" cmd = "%s%s%s%s" % (extra_cmd, kbd_cmd, mouse_cmd, browser_cmd) print "prepared command : [%s]" % cmd self.launcher = eConsoleAppContainer() self.launcher.appClosed.append(self.callbackLauncherAppClosed) self.launcher.dataAvail.append(self.callbackLauncherDataAvail) fbClass.getInstance().lock() #eRCInput.getInstance().lock() global alpha_value alpha_value = self.alpha.value change_galpha(set_const=True, set_value=True) self.launcher.execute(cmd) print "started browser..."
def wb_unlock(alpha_on=True): global lock if alpha_on: change_galpha(set_const=True, set_value=False) fbClass.getInstance().lock() lock = False
def __runFinished(self,retval): print "[Vice] - runFinished" fbClass.getInstance().unlock() eRCInput.getInstance().unlock() self.close()