def openDirectoryBrowser(self, path, cfgitem): if os.path.exists("/usr/bin/apt-get"): path = None if cfgitem == "location": try: self.session.openWithCallback( self.openDirectoryBrowserCB, LocationBox, windowTitle=_('Choose Directory:'), text=_('Choose directory'), currDir=path, bookmarks=config.movielist.videodirs) except Exception as e: print(e) ConfigListScreen.keyOK(self) if cfgitem == "downloadlocation": try: self.session.openWithCallback( self.openDirectoryBrowserCB2, LocationBox, windowTitle=_('Choose Directory:'), text=_('Choose directory'), currDir=path, bookmarks=config.movielist.videodirs) except Exception as e: print(e) ConfigListScreen.keyOK(self)
def keyOK(self): ConfigListScreen.keyOK(self) sel = self["config"].getCurrent()[1] if sel == config.plugins.epgrefresh.setup_epg: self.session.open(EPGSaveLoadConfiguration) if sel == config.plugins.epgrefresh.day_profile: self.session.open(EPGRefreshProfile)
def keyGo(self): ConfigListScreen.keyOK(self) sel = self["config"].getCurrent() and self["config"].getCurrent()[1] if sel == self.ST.syncNTPtime: if os.path.exists("/usr/sbin/ntpdate"): cmd = '/usr/sbin/ntpdate -v -u %s && echo "\n"' % self.ST.ip.value self.session.open(MyConsole, _("Time sync with NTP..."), [cmd]) elif os.path.exists("/usr/sbin/ntpd"): cmd = '/usr/sbin/ntpd -dnqp %s' % self.ST.ip.value self.session.open(MyConsole, _("Time sync with NTP..."), [cmd]) else: self.session.open(MessageBox,"'ntpd' / " + _("'ntpdate' not installed !"), MessageBox.TYPE_ERROR, timeout = 3) elif sel == self.ST.syncDVBtime: try: if not self.syncTimer.isActive(): self.old_time = time.time() self.oldtime = strftime("%Y:%m:%d %H:%M",localtime()) eDVBLocalTimeHandler.getInstance().syncDVBTime() self.syncTimer.start(5000, True) except: if os.path.exists("/usr/bin/dvbdate"): cmd = '/usr/bin/dvbdate -p -s -f && echo "\n"' self.session.open(MyConsole, _("Time sync with DVB..."), [cmd]) else: self.session.open(MessageBox,_("'dvbdate' not installed !"), MessageBox.TYPE_ERROR, timeout = 3) elif sel == self.ST.syncManually: ChangeTimeWizzard(self.session)
def keyOK(self): ConfigListScreen.keyOK(self) sel = self["config"].getCurrent()[1] if sel == config.plugins.epgrefresh_extra.manual_save: self.session.openWithCallback(self.setEpgSave, MessageBox,_("Are you sure you want to save the EPG cache to:\n") + config.misc.epgcache_filename.value, MessageBox.TYPE_YESNO) if sel == config.plugins.epgrefresh_extra.manual_load: self.session.openWithCallback(self.setEpgLoad, MessageBox,_("Are you sure you want to load the EPG data from:\n") + config.misc.epgcache_filename.value, MessageBox.TYPE_YESNO) if sel == config.plugins.epgrefresh_extra.manual_reload: self.session.openWithCallback(self.setEpgReload, MessageBox,_("Are you sure you want to save and load the EPG data from:\n") + config.misc.epgcache_filename.value, MessageBox.TYPE_YESNO) if sel == config.plugins.epgrefresh_extra.restore_backup: restore_backup = config.misc.epgcache_filename.value + ".backup" if os.path.exists(restore_backup): try: os.system("cp -f %s %s" % (restore_backup, config.misc.epgcache_filename.value )) os.chmod("%s" % (config.misc.epgcache_filename.value), 0644) self.setEpgLoad(True) self.setEpgSave(True) if os.path.exists(config.misc.epgcache_filename.value): self.session.open(MessageBox, _("Backup file load!"), MessageBox.TYPE_INFO, timeout = 4) else: try: os.system("rm -f %s" % (restore_backup)) self.session.open(MessageBox, _("Backup file is corrupt!\nBackup file will be deleted!"), MessageBox.TYPE_INFO, timeout = 4) except: pass self.updateDestination() except: pass else: self.session.open(MessageBox, _("Backup file is not found!"), MessageBox.TYPE_INFO, timeout = 4) if sel == config.plugins.epgrefresh_extra.epgcachepath: self.setEPGCachePath() if sel == config.plugins.epgrefresh_extra.delete_backup: self.deleteEPG()
def keyOK(self): ConfigListScreen.keyOK(self) sel = self["config"].getCurrent()[1] if sel == config.plugins.elektro.IPenable: self.session.open(ElektroIP) if sel == config.plugins.elektro.NASenable: self.session.open(ElektroNAS)
def keyGo(self): ConfigListScreen.keyOK(self) sel = self["config"].getCurrent() and self["config"].getCurrent()[1] if sel == self.ST.syncNTPtime: if os.path.exists("/usr/sbin/ntpdate"): cmd = '/usr/sbin/ntpdate -v -u %s && echo "\n"' % self.ST.ip.value self.session.open(SystemTimeConsole, _("Syncing with NTP server..."), [cmd]) elif os.path.exists("/usr/sbin/ntpd"): cmd = '/usr/sbin/ntpd -dnqp %s' % self.ST.ip.value self.session.open(SystemTimeConsole, _("Syncing with NTP server..."), [cmd]) else: self.session.open(MessageBox,"'ntpd' / " + _("'ntpdate' is not installed!"), MessageBox.TYPE_ERROR, timeout=3) elif sel == self.ST.syncDVBtime: try: if not self.syncTimer.isActive(): self.old_time = time.time() self.oldtime = time.strftime("%Y:%m:%d %H:%M",time.localtime()) eDVBLocalTimeHandler.getInstance().syncDVBTime() self.messagebox = self.session.openWithCallback(self.messageboxSessionClose, MessageBox, _("Syncing... Please wait."), MessageBox.TYPE_INFO) self.syncTimer.start(5000, True) except: if os.path.exists("/usr/bin/dvbdate"): cmd = '/usr/bin/dvbdate -p -s -f && echo "\n"' self.session.open(SystemTimeConsole, _("Syncing with current transponder..."), [cmd]) else: self.session.open(MessageBox,_("'dvbdate' is not installed!"), MessageBox.TYPE_ERROR, timeout=3) elif sel == self.ST.syncManually: ChangeTimeWizzard(self.session)
def keyOK(self): ConfigListScreen.keyOK(self) sel = self["config"].getCurrent()[1] if sel == config.plugins.epgrefresh.setup_epg: self.session.open(EPGSaveLoadConfiguration) if sel == config.plugins.epgrefresh.day_profile: self.session.open(EPGRefreshProfile)
def keyOK(self): ConfigListScreen.keyOK(self) sel = self["config"].getCurrent()[1] if sel == config.plugins.elektro.IPenable: self.session.open(ElektroIP) if sel == config.plugins.elektro.NASenable: self.session.open(ElektroNAS)
def ok(self): ConfigListScreen.keyOK(self) if self['config'].getCurrent( )[1] == config.plugins.mediainfo.savetopath: self.session.openWithCallback( self.selectedMediaFile, MediaInfoFolderScreen, config.plugins.mediainfo.savetopath.value)
def keyOK(self): ConfigListScreen.keyOK(self) sel = self["config"].getCurrent()[1] if sel == config.plugins.epgrefresh_extra.manual_save: self.session.openWithCallback(self.setEpgSave, MessageBox,_("Are you sure you want to save the EPG Cache to:\n") + config.misc.epgcache_filename.value, MessageBox.TYPE_YESNO) if sel == config.plugins.epgrefresh_extra.manual_load: self.session.openWithCallback(self.setEpgLoad, MessageBox,_("Are you sure you want to load the EPG data from:\n") + config.misc.epgcache_filename.value, MessageBox.TYPE_YESNO) if sel == config.plugins.epgrefresh_extra.manual_reload: self.session.openWithCallback(self.setEpgReload, MessageBox,_("Are you sure you want to save and load the EPG data from:\n") + config.misc.epgcache_filename.value, MessageBox.TYPE_YESNO) if sel == config.plugins.epgrefresh_extra.restore_backup: restore_backup = config.misc.epgcache_filename.value + ".backup" if os.path.exists(restore_backup): try: os.system("cp -f %s %s" % (restore_backup, config.misc.epgcache_filename.value )) os.chmod("%s" % (config.misc.epgcache_filename.value), 0644) self.setEpgLoad(True) self.setEpgSave(True) if os.path.exists(config.misc.epgcache_filename.value): self.session.open(MessageBox, _("Backup file load!"), MessageBox.TYPE_INFO, timeout = 4) else: try: os.system("rm -f %s" % (restore_backup)) self.session.open(MessageBox, _("Backup file is corrupt!\nBackup file will be deleted!"), MessageBox.TYPE_INFO, timeout = 4) except: pass self.updateDestination() except: pass else: self.session.open(MessageBox, _("Backup file is not found!"), MessageBox.TYPE_INFO, timeout = 4) if sel == config.plugins.epgrefresh_extra.epgcachepath: self.setEPGCachePath() if sel == config.plugins.epgrefresh_extra.delete_backup: self.deleteEPG()
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 keyOK(self): if not self.isOkEnabled: return curIndex = self["config"].getCurrentIndex() currItem = self["config"].list[curIndex][1] if isinstance(currItem, ConfigIPTVFileSelection): def SetFilePathCallBack(curIndex, newPath): if None != newPath: self["config"].list[curIndex][1].value = newPath try: if None != currItem.fileMatch: if currItem.ignoreCase: fileMatch = re.compile(currItem.fileMatch, re.IGNORECASE) else: fileMatch = re.compile(currItem.fileMatch) else: fileMatch = None except Exception: printExc() return self.session.openWithCallback( boundFunction(SetFilePathCallBack, curIndex), IPTVFileSelectorWidget, currItem.value, _('Select the file'), fileMatch) return elif 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=_('Select the directory')) 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=(_("Enter a value")), text=currItem.value) return ConfigListScreen.keyOK(self)
def ok(self): ConfigListScreen.keyOK(self) sel = self['config'].getCurrent()[1] if sel and sel == cfg.location: self.openDirectoryBrowser(cfg.location.value, "location") elif sel and sel == cfg.downloadlocation: self.openDirectoryBrowser(cfg.downloadlocation.value, "downloadlocation") else: pass
def keyOK(self): ConfigListScreen.keyOK(self) try: from Screens.LocationBox import LocationBox sel = self["config"].getCurrent()[1] if sel == config.plugins.FanControl.LogPath: self.session.openWithCallback(self.dirSelected, LocationBox, text = _("Choose path"), filename = "", currDir = self["config"].getCurrent()[1].value, minFree = 50) except Exception, e: self.session.open(MessageBox, "Error:\n" + str(e), MessageBox.TYPE_ERROR)
def keyOK(self): ConfigListScreen.keyOK(self) try: from Screens.LocationBox import LocationBox sel = self["config"].getCurrent()[1] if sel == config.plugins.FanControl.LogPath: self.session.openWithCallback(self.dirSelected, LocationBox, text = _("Choose path"), filename = "", currDir = self["config"].getCurrent()[1].value, minFree = 50) except Exception, e: self.session.open(MessageBox, "Error:\n" + str(e), MessageBox.TYPE_ERROR)
def ok(self): cur = self["config"].getCurrent() cur = cur and cur[1] if cur == self.destination: self.chooseDestination() elif cur == self.tags: self.chooseTags() else: ConfigListScreen.keyOK(self)
def ok(self): sel = self['config'].getCurrent()[1] if sel and sel == cfg.location: self.setting = 'playlist' self.openDirectoryBrowser(cfg.location.value) if sel and sel == cfg.m3ulocation: self.setting = 'm3u' self.openDirectoryBrowser(cfg.m3ulocation.value) ConfigListScreen.keyOK(self)
def keyOK(self): if isinstance(self["config"].getCurrent()[1], ConfigTextWithSuggestions): if not self.propagateUpDownNormally: self.propagateUpDownNormally = True self["config"].getCurrent()[1].deactivateSuggestionList() else: if self["config"].getCurrent()[1].activateSuggestionList(): self.propagateUpDownNormally = False self["config"].invalidateCurrent() else: ConfigListScreen.keyOK(self)
def keyOK(self): if isinstance(self["config"].getCurrent()[1], ConfigTextWithSuggestions): if not self.propagateUpDownNormally: self.propagateUpDownNormally = True self["config"].getCurrent()[1].deactivateSuggestionList() else: if self["config"].getCurrent()[1].activateSuggestionList(): self.propagateUpDownNormally = False self["config"].invalidateCurrent() else: ConfigListScreen.keyOK(self)
def ok(self): ConfigListScreen.keyOK(self) sel = self['config'].getCurrent()[1] if sel and sel == cfg.downloadlocation: self.setting = 'download' self.openDirectoryBrowser(cfg.downloadlocation.value) if sel and sel == cfg.locallocation: self.setting = 'local' self.openDirectoryBrowser(cfg.locallocation.value) else: pass
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 keyOK(self): if not self.isOkEnabled: return curIndex = self["config"].getCurrentIndex() currItem = self["config"].list[curIndex][1] if isinstance(currItem, ConfigIPTVFileSelection): def SetFilePathCallBack(curIndex, newPath): if None != newPath: self["config"].list[curIndex][1].value = newPath try: if None != currItem.fileMatch: if currItem.ignoreCase: fileMatch = re.compile(currItem.fileMatch, re.IGNORECASE) else: fileMatch = re.compile(currItem.fileMatch) else: fileMatch = None except: printExc() return self.session.openWithCallback(boundFunction(SetFilePathCallBack, curIndex), IPTVFileSelectorWidget, currItem.value, _('Select the file'), fileMatch) return elif isinstance(currItem, ConfigDirectory): def SetDirPathCallBack(curIndex, newPath): if None != newPath: self["config"].list[curIndex][1].value = newPath if IsExecutable(GetBinDir('lsdir')): printDBG('lsdir found, starting iptv browser') from Plugins.Extensions.IPTVPlayer.components.iptvdirbrowser import IPTVDirectorySelectorWidget else: printDBG('No lsdir utility, starting generic browser') from Plugins.Extensions.IPTVPlayer.components.filebrowserwidget.py import DirectorySelectorWidget as IPTVDirectorySelectorWidget self.session.openWithCallback(boundFunction(SetDirPathCallBack, curIndex), IPTVDirectorySelectorWidget, currDir=currItem.value, title=_('Select the directory')) 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=(_("Enter a value")), text=currItem.value) return ConfigListScreen.keyOK(self)
def keyGo(self): ConfigListScreen.keyOK(self) sel = self["config"].getCurrent() and self["config"].getCurrent()[1] if sel == self.ST.syncNTPtime: if os.path.exists("/usr/sbin/ntpdate"): cmd = '/usr/sbin/ntpdate -v -u %s && echo "\n"' % self.ST.ip.value self.session.open(MyConsole, _("Time sync with NTP..."), [cmd]) elif os.path.exists("/usr/sbin/ntpd"): cmd = '/usr/sbin/ntpd -dnqp %s' % self.ST.ip.value self.session.open(MyConsole, _("Time sync with NTP..."), [cmd]) else: self.session.open(MessageBox,"'ntpd' / " + _("'ntpdate' not installed !"), MessageBox.TYPE_ERROR, timeout = 3) elif sel == self.ST.syncDVBtime: if os.path.exists("/usr/bin/dvbdate"): cmd = '/usr/bin/dvbdate -p -s -f && echo "\n"' self.session.open(MyConsole, _("Time sync with DVB..."), [cmd]) else: self.session.open(MessageBox,_("'dvbdate' not installed !"), MessageBox.TYPE_ERROR, timeout = 3) elif sel == self.ST.syncManually: ChangeTimeWizzard(self.session)
def openDirectoryBrowser(self, path, cfgitem): if cfgitem == "location": try: self.session.openWithCallback( self.openDirectoryBrowserCB, LocationBox, windowTitle=_('Choose Directory:'), text=_('Choose directory'), currDir=str(path), bookmarks=config.movielist.videodirs, autoAdd=False, editDir=True, inhibitDirs=[ '/bin', '/boot', '/dev', '/home', '/lib', '/proc', '/run', '/sbin', '/sys', '/var' ], minFree=15) except Exception as e: print(e) ConfigListScreen.keyOK(self) if cfgitem == "downloadlocation": try: self.session.openWithCallback( self.openDirectoryBrowserCB2, LocationBox, windowTitle=_('Choose Directory:'), text=_('Choose directory'), currDir=str(path), bookmarks=config.movielist.videodirs, autoAdd=False, editDir=True, inhibitDirs=[ '/bin', '/boot', '/dev', '/home', '/lib', '/proc', '/run', '/sbin', '/sys', '/var' ], minFree=15) except Exception as e: print(e) ConfigListScreen.keyOK(self)
def keyGo(self): ConfigListScreen.keyOK(self) sel = self["config"].getCurrent()[1] if sel == self.ST.syncNTPtime: if os.path.exists("/usr/sbin/ntpdate"): cmd = '/usr/sbin/ntpdate -v -u pool.ntp.org && echo "\n"' self.session.open(MyConsole, _("Time sync with NTP..."), [cmd]) else: self.session.open(MessageBox, _("'ntpdate' not installed !"), MessageBox.TYPE_ERROR, timeout=3) if sel == self.ST.syncDVBtime: if os.path.exists("/usr/bin/dvbdate"): cmd = '/usr/bin/dvbdate -p -s -f && echo "\n"' self.session.open(MyConsole, _("Time sync with DVB..."), [cmd]) else: self.session.open(MessageBox, _("'dvbdate' not installed !"), MessageBox.TYPE_ERROR, timeout=3) if sel == self.ST.syncManually: ChangeTimeWizzard(self.session)
def keyOK(self): if not self.isOkEnabled: return curIndex = self["config"].getCurrentIndex() currItem = self["config"].list[curIndex][1] if isinstance(currItem, ConfigIPTVFileSelection): def SetFilePathCallBack(curIndex, newPath): if None != newPath: self["config"].list[curIndex][1].value = newPath try: if None != currItem.fileMatch: if currItem.ignoreCase: fileMatch = re.compile(currItem.fileMatch, re.IGNORECASE) else: fileMatch = re.compile(currItem.fileMatch) else: fileMatch = None except: printExc() return self.session.openWithCallback(boundFunction(SetFilePathCallBack, curIndex), IPTVFileSelectorWidget, currItem.value, _('Select the file'), fileMatch) return elif 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=_('Select the directory')) 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=(_("Enter a value")), text=currItem.value) return ConfigListScreen.keyOK(self)
def keyOK(self): ConfigListScreen.keyOK(self) cur = self["config"].getCurrent() if cur: self.configAction(cur[1], KEY_OK)
def ok(self): ConfigListScreen.keyOK(self)
def keyOK(self): current = self["config"].getCurrent() if current and current[1].sub_page: self.go_into(current[1].sub_page) else: ConfigListScreen.keyOK(self)
def ok(self): ConfigListScreen.keyOK(self) if self['config'].getCurrent()[1] == config.plugins.mediainfo.savetopath: self.session.openWithCallback(self.selectedMediaFile, MediaInfoFolderScreen, config.plugins.mediainfo.savetopath.value)
def okClicked(self): cur = self.getCurrent() if cur == getPiconsPath(): self.__chooseDestination() else: ConfigListScreen.keyOK(self)
def keyOK(self): current = self["config"].getCurrent() if current and current[1].sub_page: self.go_into(current[1].sub_page) else: ConfigListScreen.keyOK(self)
def keyOk(self): ConfigListScreen.keyOK(self) sel = self["config"].getCurrent()[1] if sel and sel == self.EPG.day_profile: self.session.open(EPGImportProfile)
def keyOk(self): ConfigListScreen.keyOK(self) sel = self["config"].getCurrent()[1] if sel and sel == self.EPG.day_profile: self.session.open(EPGImportProfile)