def getInitConfig(self): self.skin_base_dir = "/usr/share/enigma2/%s/" % cur_skin # Farbstile self.default_color_file = "colors_Original.xml" self.color_file = "skin_user_colors.xml" current_color = self.getCurrentColor() color_choices = self.getPossibleColor() default_color = ("default", _("Default")) if current_color is None: current_color = default_color if default_color not in color_choices: color_choices.append(default_color) current_color = current_color[0] self.myColorScheme = NoSave(ConfigSelection( default=current_color, choices=color_choices)) # Schriftart self.default_font_file = "font_Original.xml" self.font_file = "skin_user_header.xml" current_font = self.getCurrentFont() font_choices = self.getPossibleFont() default_font = ("default", _("Default")) if current_font is None: current_font = default_font if default_font not in font_choices: font_choices.append(default_font) current_font = current_font[0] self.myFont = NoSave(ConfigSelection( default=current_font, choices=font_choices))
def response(self, data, response): if (response == self.CHECK_VERSION): jsonData = json.loads(data) self.releasedVersion = str(jsonData['tag_name']) self.log.debug("released version: %s" % self.releasedVersion) self.downloadUrl = str(jsonData['assets'][0]['browser_download_url']) self.fileName = str(jsonData['assets'][0]['name']) # Prüfen ob Version neuer ist # if(self.currentVersion != self.releasedVersion): if(self.compareVersions(self.releasedVersion, self.currentVersion) > 0): self.log.info("new version: %s avaiable" % self.releasedVersion) if(config.plugins.MetrixReloaded.autoDownloadNewVersion.value == True and self.manualMode == False): # AutoUpdate ist aktiviert und kein manueller aufruf self.downloadNewVersion() else: msg = _("A new version of MetrixReloaded skin is available!\n\nInstalled version:\t%s\nNew version:\t%s\n\nWould you like to download the new version in the background?") % (self.currentVersion, self.releasedVersion) # User fragen ob version heruntergeladen werden soll self.session.openWithCallback( self.msgBoxResponseStartDownload, MessageBox, msg, MessageBox.TYPE_YESNO, timeout=30) else: self.log.info("current version %s is up to date!" % self.currentVersion) if(self.manualMode): self.session.open(MessageBox, _( "No new version available.\nMetrixReloaded is up to date!"), MessageBox.TYPE_INFO, timeout=10) elif(response == self.DOWNLOAD): # Zum Ipkg Screen gehen -> Installation if (os.path.exists(self.targetFileName)): self.log.info("new version successful downloaded! filename: %s" % ( self.targetFileName)) msg = _("MetrixReloaded version %s successful downloaded!\n\nWould you like to install the update?") % ( self.releasedVersion) self.session.openWithCallback( self.msgBoxResponseStartInstallation, MessageBox, msg, MessageBox.TYPE_YESNO, timeout=30)
def keyYellow(self): if (path.exists("/usr/lib/enigma2/python/Plugins/Extensions/AtileHD/plugin.py")): if not path.exists("mySkin_off") and path.exists("mySkin"): rename("mySkin", "mySkin_off") if not path.exists("mySkin") and path.exists("mySkin_off"): symlink("mySkin_off", "mySkin") # Atile_HD_Config Screen öffnen from Plugins.Extensions.AtileHD.plugin import * self.session.openWithCallback( self.AtileHDScreenResponse, AtileHDScreens) else: msg = _( "Sorry, but the plugin %s is not installed at your Vu+ STB! Please install it to use this function") % "AtileHD" self.session.open(MessageBox, msg, MessageBox.TYPE_ERROR)
def newVersionInstalled(session): if("MetrixReloaded" in config.skin.primary_skin.value): try: log.debug("newVersionInstalled: waiting") sleep(200) log.info("newVersionInstalled: load info screen") msg = _("MetrixReloaded has been successfully updated to version %s\n\nYou like the MetrixReloaded Skin?\n\nThen support the development in which you actively cooperate. All information can be found under the following link\nhttps://github.com/Scrounger/MetrixReloaded\n\nOr support the MetrixReloaded team with a small donation\n- by Paypal to:\[email protected]\n- via the website:\thttps://github.com/Scrounger/MetrixReloaded\n\nHave fun!\nYour MetrixReloaded Team") msg = msg % myHelper.getVersion() session.open( MessageBox, msg, MessageBox.TYPE_INFO) config.plugins.MetrixReloaded.updated.value = False config.plugins.MetrixReloaded.updated.save() except Exception as e: log.exception("newVersionInstalled: %s", str(e))
def __init__(self, session): Screen.__init__(self, session) self.log = initializeLog("MetrixReloadedSetup") self.log.info("MetrixReloadedSetup open") self.skinParts_changed = False # Summary self.setTitle(_("MetrixReloaded Configuration")) self.onChangedEntry = [] try: self.getInitConfig() self.list = [] ConfigListScreen.__init__( self, self.list, session=session, on_change=self.changed) def selectionChanged(): if self["config"].current: self["config"].current[1].onDeselect(self.session) self["config"].current = self["config"].getCurrent() if self["config"].current: self["config"].current[1].onSelect(self.session) for x in self["config"].onSelectionChanged: x() if self["config"].getCurrent() == self.set_color: self.setPicture(self.myColorScheme.value, self.TYPE_COLOR) elif self["config"].getCurrent() == self.set_font: self.setPicture(self.myFont.value, self.TYPE_FONT) else: self["Picture"].hide() self["config"].selectionChanged = selectionChanged self["config"].onSelectionChanged.append(self.updateHelp) # Initialize Buttons self["key_red"] = StaticText(_("Cancel")) self["key_green"] = StaticText(_("Save")) self["key_yellow"] = StaticText(_("SkinParts configuration")) self["key_blue"] = StaticText(_("Check for updates")) self["help"] = StaticText() self["version"] = StaticText(_("version: %s") % myHelper.getVersion()) # Define Actions self["actions"] = ActionMap(["SetupActions", "ColorActions", "ChannelSelectEPGActions", "HelpActions"], { "cancel": self.keyCancel, "save": self.keySave, "yellow": self.keyYellow, "blue": self.keyBlue, # "showEPGList": self.keyInfo, # "displayHelp": self.showHelp, } ) self["Picture"] = Pixmap() self.generateList() # Trigger change self.changed() except Exception as e: self.log.exception("MetrixReloadedSetup: %s", str(e)) self.close()
def restartGUI(self): # Fragen ob Restart restartbox = self.session.openWithCallback(self.msgBoxResponseRestart, MessageBox, _( "Restart necessary, restart GUI now?"), MessageBox.TYPE_YESNO)
def showMsgBoxCancelConfirm(self): self.session.openWithCallback( self.cancelConfirm, MessageBox, _("Really close without saving settings?") )
def keyOK(self): if (self['config'].getCurrent()[1] == config.plugins.MetrixReloaded.logDirectory): # FileDirBrowser bei Click 'ok' ausführen start_dir = config.plugins.MetrixReloaded.logDirectory.value self.session.openWithCallback(self.fileDirBrowserResponse, FileDirBrowser, initDir=start_dir, title=_( "Choose folder"), getFile=False, getDir=True, showDirectories=True, showFiles=False) if (self['config'].getCurrent()[1] == config.plugins.MetrixReloaded.posterDirectory): # FileDirBrowser bei Click 'ok' ausführen start_dir = config.plugins.MetrixReloaded.posterDirectory.value self.session.openWithCallback(self.fileDirBrowserResponse, FileDirBrowser, initDir=start_dir, title=_( "Choose folder"), getFile=False, getDir=True, showDirectories=True, showFiles=False)
def generateList(self): self.list = [] # Liste Einträge als var, die später gebracuht werden self.set_color = getConfigListEntry(_("Color scheme:"), self.myColorScheme, _("Choose your color scheme")) self.set_font = getConfigListEntry(_("Font"), self.myFont) self.onlineMode = getConfigListEntry(_("Download additional data"), config.plugins.MetrixReloaded.onlineMode, _("Download additional data such as images. Requires internet connection!")) self.posterDownload = getConfigListEntry(_("download posters"), config.plugins.MetrixReloaded.posterDownload, _( "Download addtional posters from themoviedb.org or thetvddb.com")) self.checkForUpdates = getConfigListEntry(_("Check for skin update on startup"), config.plugins.MetrixReloaded.checkNewVersionOnStartUp, _( "Checks on startup (boot or standby) if a new skin version is available to download. Requires internet connection!")) # Listen Einträge erstellen self.list.append(getConfigListEntry( _('skin options'), ConfigDescription(), None)) self.list.append(self.set_color) self.list.append(self.set_font) self.list.append(self.onlineMode) if(config.plugins.MetrixReloaded.onlineMode.value): self.list.append(self.posterDownload) if(config.plugins.MetrixReloaded.posterDownload.value): self.list.append(getConfigListEntry(_("poster dircetory"), config.plugins.MetrixReloaded.posterDirectory, _( "choose the directory where posters are stored"))) self.list.append(getConfigListEntry(_("posters older than x days remove"), config.plugins.MetrixReloaded.posterAutoRemove, _("use 0 for deactivation"))) # Updates self.list.append(getConfigListEntry( _('update options'), ConfigDescription(), None)) self.list.append(self.checkForUpdates) if(config.plugins.MetrixReloaded.checkNewVersionOnStartUp.value): self.list.append(getConfigListEntry(_("Auto download new version"), config.plugins.MetrixReloaded.autoDownloadNewVersion, _( "New version of MetrixReloaded skin will be automatically downloaded. You will get an information if new version is ready to install"))) # Debug Options self.list.append(getConfigListEntry( _('debug options'), ConfigDescription(), None)) self.list.append(getConfigListEntry(_("enable debug"), config.plugins.MetrixReloaded.debug, _("show additional log informations"))) self.list.append(getConfigListEntry(_("log files directory"), config.plugins.MetrixReloaded.logDirectory, _( "choose the directory where log files of skin, components, etc are stored"))) self.list.append(getConfigListEntry( _("log files older than x days remove"), config.plugins.MetrixReloaded.logAutoRemove, _("use 0 for deactivation"))) # Developer Options self.list.append(getConfigListEntry( _('developer options'), ConfigDescription(), None)) self.list.append(getConfigListEntry(_("show screen names"), config.plugins.MetrixReloaded.showScreenNames, _( "Shows the name of the current screen in the bottom right corner"))) self.list.append(getConfigListEntry(_("show selected menu entry name"), config.plugins.MetrixReloaded.showMenuEntryNames, _( "Shows the name of the current selected menu entry"))) self.list.append(getConfigListEntry( _('OpenConverter'), config.plugins.MetrixReloaded.openConverter)) # Liste anzeigen self['config'].setList(self.list)
def responseError(self, e, response): self.log.exception("response: [%s] %s", response, str(e)) msg = _("Error: [%s] %s") % (response, str(e)) self.session.open(MessageBox, msg, MessageBox.TYPE_ERROR, timeout=30)
def restartGUI(self): # Fragen ob Restart self.log.debug("Installation finished") restartbox = self.session.openWithCallback(self.msgBoxResponseRestart, MessageBox, _( "Restart necessary, restart GUI now?"), MessageBox.TYPE_YESNO)