def __init__(self, session, args = None): global connected global conn self.skin = ModemSetup.skin secret = getSecretString() user = secret[:secret.find('*')] password = secret[secret.find('*')+1:] self.username = ConfigText(user, fixed_size=False) self.password = ConfigPassword(password, fixed_size=False) self.phone = ConfigText(getTelephone(), fixed_size=False) self.phone.setUseableChars(u"0123456789") lst = [ (_("Username"), self.username), (_("Password"), self.password), (_("Phone number"), self.phone) ] self["list"] = ConfigList(lst) self["key_green"] = Button("") self["key_red"] = Button("") self["state"] = Label("") self["actions"] = NumberActionMap(["ModemActions"], { "cancel": self.close, "left": self.keyLeft, "right": self.keyRight, "connect": self.connect, "disconnect": self.disconnect, "deleteForward": self.deleteForward, "deleteBackward": self.deleteBackward, "0": self.keyNumber, "1": self.keyNumber, "2": self.keyNumber, "3": self.keyNumber, "4": self.keyNumber, "5": self.keyNumber, "6": self.keyNumber, "7": self.keyNumber, "8": self.keyNumber, "9": self.keyNumber }, -1) self["ListActions"] = ActionMap(["ListboxDisableActions"], { "moveUp": self.nothing, "moveDown": self.nothing, "moveTop": self.nothing, "moveEnd": self.nothing, "pageUp": self.nothing, "pageDown": self.nothing }, -1) self.stateTimer = eTimer() self.stateTimer.callback.append(self.stateLoop) conn.appClosed.append(self.pppdClosed) conn.dataAvail.append(self.dataAvail) Screen.__init__(self, session) self.onClose.append(self.__closed) self.onLayoutFinish.append(self.__layoutFinished)
weplist.append("HEX") config.plugins.wlan = ConfigSubsection() config.plugins.wlan.essid = NoSave(ConfigText(default="home", fixed_size=False)) config.plugins.wlan.hiddenessid = NoSave( ConfigText(default="home", fixed_size=False)) config.plugins.wlan.encryption = ConfigSubsection() config.plugins.wlan.encryption.enabled = NoSave(ConfigYesNo(default=True)) config.plugins.wlan.encryption.type = NoSave( ConfigSelection(list, default="WPA/WPA2")) config.plugins.wlan.encryption.wepkeytype = NoSave( ConfigSelection(weplist, default="ASCII")) config.plugins.wlan.encryption.psk = NoSave( ConfigPassword(default="mysecurewlan", fixed_size=False)) class Wlan: def __init__(self, iface): a = '' b = '' for i in range(0, 255): a = a + chr(i) if i < 32 or i > 127: b = b + ' ' else: b = b + chr(i) self.iface = iface self.wlaniface = {}
def createConfig(self): self.mountusingEntry = None self.sharenameEntry = None self.mounttypeEntry = None self.activeEntry = None self.ipEntry = None self.sharedirEntry = None self.optionsEntry = None self.usernameEntry = None self.passwordEntry = None self.hdd_replacementEntry = None self.mountusing = [] self.mountusing.append(("autofs", _("AUTOFS (mount as needed)"))) self.mountusing.append(("fstab", _("FSTAB (mount at boot)"))) self.mountusing.append(("enigma2", _("Enigma2 (mount using enigma2)"))) self.mountusing.append( ("old_enigma2", _("Enigma2 old format (mount using linux)"))) self.sharetypelist = [] self.sharetypelist.append(("cifs", _("CIFS share"))) self.sharetypelist.append(("nfs", _("NFS share"))) mountusing_default = "fstab" if getImageDistro() in ("openvix", "easy-gui-aus", "beyonwiz"): mountusing_default = "autofs" if self.mountinfo.has_key('mountusing'): mountusing = self.mountinfo['mountusing'] if mountusing is False: mountusing = mountusing_default else: mountusing = mountusing_default if self.mountinfo.has_key('mounttype'): mounttype = self.mountinfo['mounttype'] if mounttype is False: mounttype = "nfs" else: mounttype = "nfs" if self.mountinfo.has_key('active'): active = self.mountinfo['active'] if active == 'True': active = True if active == 'False': active = False else: active = True if self.mountinfo.has_key('ip'): if self.mountinfo['ip'] is False: ip = [192, 168, 0, 0] else: ip = self.convertIP(self.mountinfo['ip']) else: ip = [192, 168, 0, 0] if mounttype == "nfs": defaultOptions = "rw,nolock,tcp" else: defaultOptions = "rw,utf8" if self.mountinfo['sharename'] and self.mountinfo.has_key('sharename'): sharename = re_sub("\W", "", self.mountinfo['sharename']) self.old_sharename = sharename else: sharename = "" self.old_sharename = None if self.mountinfo.has_key('sharedir'): sharedir = self.mountinfo['sharedir'] self.old_sharedir = sharedir else: sharedir = "" self.old_sharedir = None if self.mountinfo.has_key('options'): options = self.mountinfo['options'] else: options = defaultOptions if self.mountinfo.has_key('username'): username = self.mountinfo['username'] else: username = "" if self.mountinfo.has_key('password'): password = self.mountinfo['password'] else: password = "" if self.mountinfo.has_key('hdd_replacement'): hdd_replacement = self.mountinfo['hdd_replacement'] if hdd_replacement == 'True': hdd_replacement = True if hdd_replacement == 'False': hdd_replacement = False else: hdd_replacement = False if sharename is False: sharename = "" if sharedir is False: sharedir = "" if username is False: username = "" if password is False: password = "" self.mountusingConfigEntry = NoSave( ConfigSelection(self.mountusing, default=mountusing)) self.activeConfigEntry = NoSave(ConfigEnableDisable(default=active)) self.ipConfigEntry = NoSave(ConfigIP(default=ip)) self.sharenameConfigEntry = NoSave( ConfigText(default=sharename, visible_width=50, fixed_size=False)) self.sharedirConfigEntry = NoSave( ConfigText(default=sharedir, visible_width=50, fixed_size=False)) self.optionsConfigEntry = NoSave( ConfigText(default=defaultOptions, visible_width=50, fixed_size=False)) if options is not False: self.optionsConfigEntry.value = options self.usernameConfigEntry = NoSave( ConfigText(default=username, visible_width=50, fixed_size=False)) self.passwordConfigEntry = NoSave( ConfigPassword(default=password, visible_width=50, fixed_size=False)) self.mounttypeConfigEntry = NoSave( ConfigSelection(self.sharetypelist, default=mounttype)) self.hdd_replacementConfigEntry = NoSave( ConfigYesNo(default=hdd_replacement))
simpleRSS.interval = ConfigNumber(default=15) simpleRSS.feedcount = ConfigNumber(default=0) simpleRSS.autostart = ConfigEnableDisable(default=False) simpleRSS.keep_running = ConfigEnableDisable(default=True) simpleRSS.feed = ConfigSubList() i = 0 while i < simpleRSS.feedcount.value: s = ConfigSubsection() s.uri = ConfigText(default="http://", fixed_size=False) s.autoupdate = ConfigEnableDisable(default=True) simpleRSS.feed.append(s) i += 1 del s simpleRSS.enable_google_reader = ConfigYesNo(default=False) simpleRSS.google_username = ConfigText(default="", fixed_size=False) simpleRSS.google_password = ConfigPassword(default="") del simpleRSS, i # Global Poller-Object rssPoller = None # Main Function def main(session, **kwargs): # Get Global rssPoller-Object global rssPoller # Create one if we have none (no autostart) if rssPoller is None:
list.append("WPA2") list.append("WPA/WPA2") weplist = [] weplist.append("ASCII") weplist.append("HEX") config.plugins.wlan = ConfigSubsection() config.plugins.wlan.essid = NoSave(ConfigText(default = "home", fixed_size = False)) config.plugins.wlan.hiddenessid = NoSave(ConfigText(default = "home", fixed_size = False)) config.plugins.wlan.encryption = ConfigSubsection() config.plugins.wlan.encryption.enabled = NoSave(ConfigYesNo(default = False)) config.plugins.wlan.encryption.type = NoSave(ConfigSelection(list, default = "WPA/WPA2" )) config.plugins.wlan.encryption.wepkeytype = NoSave(ConfigSelection(weplist, default = "ASCII")) config.plugins.wlan.encryption.psk = NoSave(ConfigPassword(default = "mysecurewlan", fixed_size = False)) class WlanStatus(Screen): skin = """ <screen name="WlanStatus" position="center,center" size="560,400" title="Wireless Network State" > <ePixmap pixmap="skin_default/buttons/red.png" position="0,0" size="140,40" alphatest="on" /> <widget source="key_red" render="Label" position="0,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" /> <widget source="LabelBSSID" render="Label" position="10,60" size="250,25" valign="left" font="Regular;20" transparent="1" foregroundColor="#FFFFFF" /> <widget source="LabelESSID" render="Label" position="10,100" size="250,25" valign="center" font="Regular;20" transparent="1" foregroundColor="#FFFFFF" /> <widget source="LabelQuality" render="Label" position="10,140" size="250,25" valign="center" font="Regular;20" transparent="1" foregroundColor="#FFFFFF" /> <widget source="LabelSignal" render="Label" position="10,180" size="250,25" valign="center" font="Regular;20" transparent="1" foregroundColor="#FFFFFF" /> <widget source="LabelBitrate" render="Label" position="10,220" size="250,25" valign="center" font="Regular;20" transparent="1" foregroundColor="#FFFFFF" /> <widget source="LabelEnc" render="Label" position="10,260" size="250,25" valign="center" font="Regular;20" transparent="1" foregroundColor="#FFFFFF" />
from Wlan import iWlan, iStatus, getWlanConfigName plugin_path = eEnv.resolve( "${libdir}/enigma2/python/Plugins/SystemPlugins/WirelessLan") list = ["Unencrypted", "WEP", "WPA", "WPA/WPA2", "WPA2"] weplist = ["ASCII", "HEX"] config.plugins.wlan = ConfigSubsection() config.plugins.wlan.essid = NoSave(ConfigText(default="", fixed_size=False)) config.plugins.wlan.hiddenessid = NoSave(ConfigYesNo(default=False)) config.plugins.wlan.encryption = NoSave(ConfigSelection(list, default="WPA2")) config.plugins.wlan.wepkeytype = NoSave( ConfigSelection(weplist, default="ASCII")) config.plugins.wlan.psk = NoSave(ConfigPassword(default="", fixed_size=False)) class WlanStatus(Screen): skin = """ <screen name="WlanStatus" position="center,center" size="560,400" title="Wireless network status" > <ePixmap pixmap="skin_default/buttons/red.png" position="0,0" size="140,40" alphatest="on" /> <widget source="key_red" render="Label" position="0,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" /> <widget source="LabelBSSID" render="Label" position="10,60" size="200,25" valign="left" font="Regular;20" transparent="1" foregroundColor="#FFFFFF" /> <widget source="LabelESSID" render="Label" position="10,100" size="200,25" valign="center" font="Regular;20" transparent="1" foregroundColor="#FFFFFF" /> <widget source="LabelQuality" render="Label" position="10,140" size="200,25" valign="center" font="Regular;20" transparent="1" foregroundColor="#FFFFFF" /> <widget source="LabelSignal" render="Label" position="10,180" size="200,25" valign="center" font="Regular;20" transparent="1" foregroundColor="#FFFFFF" /> <widget source="LabelBitrate" render="Label" position="10,220" size="200,25" valign="center" font="Regular;20" transparent="1" foregroundColor="#FFFFFF" /> <widget source="LabelEnc" render="Label" position="10,260" size="200,25" valign="center" font="Regular;20" transparent="1" foregroundColor="#FFFFFF" /> <widget source="BSSID" render="Label" position="220,60" size="330,25" valign="center" font="Regular;20" transparent="1" foregroundColor="#FFFFFF" />
apModeConfig.encrypt = ConfigYesNo(default=False) apModeConfig.method = ConfigSelection(default="0", choices=[("0", _("WEP")), ("1", _("WPA")), ("2", _("WPA2")), ("3", _("WPA/WPA2"))]) apModeConfig.wep = ConfigYesNo(default=False) #apModeConfig.wep_default_key = ConfigSelection(default = "0", choices = [ ("0", "0"), ("1", "1"), ("2", "2"), ("3", "3") ] ) apModeConfig.wep_default_key = fixedValue(value="0") apModeConfig.wepType = ConfigSelection( default="64", choices=[("64", _("Enable 64 bit (Input 10 hex keys)")), ("128", _("Enable 128 bit (Input 26 hex keys)"))]) apModeConfig.wep_key0 = ConfigPassword(default="", visible_width=50, fixed_size=False) apModeConfig.wpa = ConfigSelection(default="0", choices=[("0", _("not set")), ("1", _("WPA")), ("2", _("WPA2")), ("3", _("WPA/WPA2"))]) apModeConfig.wpa_passphrase = ConfigPassword(default="", visible_width=50, fixed_size=False) apModeConfig.wpagrouprekey = ConfigInteger(default=600, limits=(0, 3600)) apModeConfig.wpa_key_mgmt = fixedValue(value="WPA-PSK") apModeConfig.wpa_pairwise = fixedValue(value="TKIP CCMP") apModeConfig.rsn_pairwise = fixedValue(value="CCMP") apModeConfig.usedhcp = ConfigYesNo(default=False) apModeConfig.address = ConfigIP(default=[0, 0, 0, 0])
def createConfig(self): self.sharenameEntry = None self.mounttypeEntry = None self.activeEntry = None self.ipEntry = None self.sharedirEntry = None self.optionsEntry = None self.usernameEntry = None self.passwordEntry = None self.hdd_replacementEntry = None self.sharetypelist = [] self.sharetypelist.append(("nfs", _("NFS share"))) self.sharetypelist.append(("cifs", _("CIFS share"))) if self.mountinfo.has_key('mounttype'): mounttype = self.mountinfo['mounttype'] else: mounttype = "nfs" if self.mountinfo.has_key('active'): active = self.mountinfo['active'] if active == 'True': active = True if active == 'False': active = False else: active = True if self.mountinfo.has_key('ip'): if self.mountinfo['ip'] is False: ip = [192, 168, 0, 0] else: ip = self.convertIP(self.mountinfo['ip']) else: ip = [192, 168, 0, 0] if self.mountinfo.has_key('sharename'): sharename = self.mountinfo['sharename'] else: sharename = "Sharename" if self.mountinfo.has_key('sharedir'): sharedir = self.mountinfo['sharedir'] else: sharedir = "/export/hdd" if self.mountinfo.has_key('options'): options = self.mountinfo['options'] else: options = "rw,nolock,tcp" if self.mountinfo.has_key('username'): username = self.mountinfo['username'] else: username = "" if self.mountinfo.has_key('password'): password = self.mountinfo['password'] else: password = "" if self.mountinfo.has_key('hdd_replacement'): hdd_replacement = self.mountinfo['hdd_replacement'] if hdd_replacement == 'True': hdd_replacement = True if hdd_replacement == 'False': hdd_replacement = False else: hdd_replacement = False if sharename is False: sharename = "Sharename" if sharedir is False: sharedir = "/export/hdd" if options is False: if mounttype == "nfs": options = "rw,nolock,tcp" else: options = "rw" if username is False: username = "" if password is False: password = "" if mounttype is False: mounttype = "nfs" self.activeConfigEntry = NoSave(ConfigEnableDisable(default = active)) self.ipConfigEntry = NoSave(ConfigIP(default = ip)) self.sharenameConfigEntry = NoSave(ConfigText(default = sharename, visible_width = 50, fixed_size = False)) self.sharedirConfigEntry = NoSave(ConfigText(default = sharedir, visible_width = 50, fixed_size = False)) self.optionsConfigEntry = NoSave(ConfigText(default = options, visible_width = 50, fixed_size = False)) self.usernameConfigEntry = NoSave(ConfigText(default = username, visible_width = 50, fixed_size = False)) self.passwordConfigEntry = NoSave(ConfigPassword(default = password, visible_width = 50, fixed_size = False)) self.mounttypeConfigEntry = NoSave(ConfigSelection(self.sharetypelist, default = mounttype )) self.hdd_replacementConfigEntry = NoSave(ConfigYesNo(default = hdd_replacement))
}.get((getMachineBrand(), getMachineName()), 39) config.plugins.icetv = ConfigSubsection() config.plugins.icetv.server = ConfigSubsection() config.plugins.icetv.server.name = ConfigText(default="api.icetv.com.au") config.plugins.icetv.member = ConfigSubsection() config.plugins.icetv.member.email_address = ConfigText(show_help=False, fixed_size=False) config.plugins.icetv.member.token = ConfigText() config.plugins.icetv.member.id = ConfigNumber() config.plugins.icetv.member.region_id = ConfigNumber() config.plugins.icetv.member.country = ConfigText(default="AUS") config.plugins.icetv.member.send_logs = ConfigYesNo(default=True) config.plugins.icetv.member.password = NoSave(ConfigPassword(censor="●", show_help=False, fixed_size=False)) config.plugins.icetv.device = ConfigSubsection() config.plugins.icetv.device.label = ConfigText(default="%s %s" % (getMachineBrand(), getMachineName()), show_help=False) config.plugins.icetv.device.id = ConfigNumber() config.plugins.icetv.device.type_id = ConfigNumber(default=getIceTVDeviceType()) config.plugins.icetv.last_update_time = ConfigNumber() if config.plugins.icetv.last_update_time.value != 0: config.plugins.icetv.last_update_time.value = 0 config.plugins.icetv.last_update_time.save() configfile.save() config.plugins.icetv.last_update_time.disableSave() config.plugins.icetv.enable_epg = ConfigYesNo(default=False) config.plugins.icetv.configured = ConfigYesNo(default=False)
def createConfig(self): self.sharenameEntry = None self.mounttypeEntry = None self.activeEntry = None self.ipEntry = None self.hostEntry = None self.sharedirEntry = None self.optionsEntry = None self.usernameEntry = None self.passwordEntry = None self.hdd_replacementEntry = None self.sharetypelist = [("nfs", _("NFS share")), ("cifs", _("CIFS share"))] mounttype = self.mountinfo.get('mounttype') if not mounttype: mounttype = "nfs" active = self.mountinfo.get('active', 'True') == 'True' # Not that "host" takes precedence over "ip" host = self.mountinfo.get('host', "") if not host: # In case host is something funky like False or None host = '' try: ip = convertIP(self.mountinfo['ip']) except Exception as ex: print("[NWB] Invalid IP", ex) ip = [0, 0, 0, 0] sharename = self.mountinfo.get('sharename', "Sharename") sharedir = self.mountinfo.get('sharedir', "/media/hdd") username = self.mountinfo.get('username', "") password = self.mountinfo.get('password', "") hdd_replacement = self.mountinfo.get('hdd_replacement', False) if hdd_replacement == 'True': hdd_replacement = True else: hdd_replacement = False if sharename is False: sharename = "Sharename" if sharedir is False: sharedir = "/media/hdd" if mounttype == "nfs": defaultOptions = "rw,nolock,soft" else: defaultOptions = "rw" if username is False: username = "" if password is False: password = "" options = self.mountinfo.get('options', defaultOptions) self.activeConfigEntry = NoSave(ConfigEnableDisable(default=active)) self.ipConfigEntry = NoSave(ConfigIP(default=ip)) self.hostConfigEntry = NoSave( ConfigText(default=host, visible_width=50, fixed_size=False)) self.sharenameConfigEntry = NoSave( ConfigText(default=sharename, visible_width=50, fixed_size=False)) self.sharedirConfigEntry = NoSave( ConfigText(default=sharedir, visible_width=50, fixed_size=False)) self.optionsConfigEntry = NoSave( ConfigText(default=defaultOptions, visible_width=50, fixed_size=False)) if options is not False: self.optionsConfigEntry.value = options self.usernameConfigEntry = NoSave( ConfigText(default=username, visible_width=50, fixed_size=False)) self.passwordConfigEntry = NoSave( ConfigPassword(default=password, visible_width=50, fixed_size=False)) self.mounttypeConfigEntry = NoSave( ConfigSelection(self.sharetypelist, default=mounttype)) self.hdd_replacementConfigEntry = NoSave( ConfigYesNo(default=hdd_replacement))
("Beyonwiz", "T3"): 22, ("Beyonwiz", "T4"): 30, ("Beyonwiz", "U4"): 36, }.get((getMachineBrand(), getMachineName()), 22) config.plugins.icetv = ConfigSubsection() config.plugins.icetv.member = ConfigSubsection() config.plugins.icetv.member.email_address = ConfigText(show_help=False, fixed_size=False) config.plugins.icetv.member.token = ConfigText() config.plugins.icetv.member.id = ConfigNumber() config.plugins.icetv.member.region_id = ConfigNumber() config.plugins.icetv.member.password = NoSave( ConfigPassword(censor="●", show_help=False, fixed_size=False)) config.plugins.icetv.device = ConfigSubsection() config.plugins.icetv.device.label = ConfigText( default="%s %s" % (getMachineBrand(), getMachineName()), show_help=False) config.plugins.icetv.device.id = ConfigNumber() config.plugins.icetv.device.type_id = ConfigNumber( default=getIceTVDeviceType()) config.plugins.icetv.last_update_time = ConfigNumber() if config.plugins.icetv.last_update_time.value != 0: config.plugins.icetv.last_update_time.value = 0 config.plugins.icetv.last_update_time.save() configfile.save() config.plugins.icetv.last_update_time.disableSave()
def createConfig(self): self.mountusingEntry = None self.sharenameEntry = None self.mounttypeEntry = None self.activeEntry = None self.ipEntry = None self.sharedirEntry = None self.optionsEntry = None self.smbprotoEntry = None self.usernameEntry = None self.passwordEntry = None self.hdd_replacementEntry = None self.smb_proto_versions = [] self.smb_proto_versions.append(("", _("Default"))) if getMachineBuild != "inihdx": self.smb_proto_versions.append((",vers=1.0", _("1.0"))) self.smb_proto_versions.append((",vers=2.1", _("2.1"))) self.mountusing = [] self.mountusing.append(("autofs", _("AUTOFS (mount as needed)"))) self.mountusing.append(("fstab", _("FSTAB (mount at boot)"))) self.mountusing.append(("enigma2", _("Enigma2 (mount using enigma2)"))) self.sharetypelist = [] self.sharetypelist.append(("cifs", _("CIFS share"))) self.sharetypelist.append(("nfs", _("NFS share"))) mountusing_default = "fstab" if getImageDistro() in ("openvix", "easy-gui-aus", "beyonwiz", "openatv", "openhdf"): mountusing_default = "autofs" if 'mountusing' in self.mountinfo: mountusing = self.mountinfo['mountusing'] if mountusing is False: mountusing = mountusing_default else: mountusing = mountusing_default if 'mounttype' in self.mountinfo: mounttype = self.mountinfo['mounttype'] if mounttype is False: mounttype = "nfs" else: mounttype = "nfs" if 'active' in self.mountinfo: active = self.mountinfo['active'] if active == 'True': active = True if active == 'False': active = False else: active = True if 'ip' in self.mountinfo: if self.mountinfo['ip'] is False: ip = [192, 168, 0, 0] else: ip = self.convertIP(self.mountinfo['ip']) else: ip = [192, 168, 0, 0] defaultOptions = default_mount_options[mounttype] if self.mountinfo.get('sharename'): sharename = self.cleanSharename(self.mountinfo['sharename']) self.old_sharename = self.mountinfo['sharename'] else: sharename = "" self.old_sharename = None if 'sharedir' in self.mountinfo: sharedir = self.mountinfo['sharedir'] self.old_sharedir = sharedir else: sharedir = "" self.old_sharedir = None def parseOptions(options): s = str(options) if ",vers=1.0" in s: smb = ",vers=1.0" opt = s.replace(",vers=1.0", "") elif ",vers=2.1" in s: smb = ",vers=2.1" opt = s.replace(",vers=2.1", "") else: smb = "" opt = options return (smb, opt) if 'options' in self.mountinfo: smbdefault, options = parseOptions(self.mountinfo['options']) else: options = defaultOptions smbdefault = "" if 'username' in self.mountinfo: username = self.mountinfo['username'] else: username = "" if 'password' in self.mountinfo: password = self.mountinfo['password'] else: password = "" if 'hdd_replacement' in self.mountinfo: hdd_replacement = self.mountinfo['hdd_replacement'] if hdd_replacement == 'True': hdd_replacement = True if hdd_replacement == 'False': hdd_replacement = False else: hdd_replacement = False if sharename is False: sharename = "" if sharedir is False: sharedir = "" if username is False: username = "" if password is False: password = "" def removeSpaces(configEntry): t = configEntry.value.translate(None, " \t\r\n") if t != configEntry.value: configEntry.value = t self.mountusingConfigEntry = NoSave( ConfigSelection(self.mountusing, default=mountusing)) self.activeConfigEntry = NoSave(ConfigEnableDisable(default=active)) self.ipConfigEntry = NoSave(ConfigIP(default=ip)) self.sharenameConfigEntry = NoSave( ConfigText(default=sharename, visible_width=50, fixed_size=False)) self.sharenameConfigEntry.addNotifier(removeSpaces) self.sharedirConfigEntry = NoSave( ConfigText(default=sharedir, visible_width=50, fixed_size=False)) self.sharedirConfigEntry.addNotifier(removeSpaces) self.optionsConfigEntry = NoSave( ConfigText(default=defaultOptions, visible_width=50, fixed_size=False)) if options is not False: self.optionsConfigEntry.value = options self.optionsConfigEntry.addNotifier(removeSpaces) self.smbprotoConfigEntry = NoSave( ConfigSelection(self.smb_proto_versions, default=smbdefault)) self.usernameConfigEntry = NoSave( ConfigText(default=username, visible_width=50, fixed_size=False)) self.usernameConfigEntry.addNotifier(removeSpaces) self.passwordConfigEntry = NoSave( ConfigPassword(default=password, visible_width=50, fixed_size=False)) self.passwordConfigEntry.addNotifier(removeSpaces) self.mounttypeConfigEntry = NoSave( ConfigSelection(self.sharetypelist, default=mounttype)) self.hdd_replacementConfigEntry = NoSave( ConfigYesNo(default=hdd_replacement))
class ModemSetup(Screen): skin = """ <screen position="180,100" size="320,300" title="Modem" > <ePixmap pixmap="buttons/green.png" position="10,10" size="140,40" alphatest="on" /> <ePixmap pixmap="buttons/red.png" position="160,10" size="140,40" alphatest="on" /> <widget name="key_green" position="10,10" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" /> <widget name="key_red" position="160,10" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" /> <widget name="list" position="10,60" size="300,120" /> <widget name="state" position="10,210" size="300,80" font="Regular;20" /> </screen>""" def nothing(self): print "nothing!" def __init__(self, session, args=None): global connected global conn self.skin = ModemSetup.skin secret = getSecretString() user = secret[:secret.find('*')] password = secret[secret.find('*') + 1:] self.username = ConfigText(user, fixed_size=False) self.password = ConfigPassword(password, fixed_size=False) self.phone = ConfigText(getTelephone(), fixed_size=False) self.phone.setUseableChars(u"0123456789") lst = [(_("Username"), self.username), (_("Password"), self.password), (_("Phone number"), self.phone)] self["list"] = ConfigList(lst) self["key_green"] = Button("") self["key_red"] = Button("") self["state"] = Label("") self["actions"] = NumberActionMap( ["ModemActions"], { "cancel": self.close, "left": self.keyLeft, "right": self.keyRight, "connect": self.connect, "disconnect": self.disconnect, "deleteForward": self.deleteForward, "deleteBackward": self.deleteBackward, "0": self.keyNumber, "1": self.keyNumber, "2": self.keyNumber, "3": self.keyNumber, "4": self.keyNumber, "5": self.keyNumber, "6": self.keyNumber, "7": self.keyNumber, "8": self.keyNumber, "9": self.keyNumber }, -1) self["ListActions"] = ActionMap( ["ListboxDisableActions"], { "moveUp": self.nothing, "moveDown": self.nothing, "moveTop": self.nothing, "moveEnd": self.nothing, "pageUp": self.nothing, "pageDown": self.nothing }, -1) self.stateTimer = eTimer() self.stateTimer.callback.append(self.stateLoop) conn.appClosed.append(self.pppdClosed) conn.dataAvail.append(self.dataAvail) Screen.__init__(self, session) self.onClose.append(self.__closed) self.onLayoutFinish.append(self.__layoutFinished) def __layoutFinished(self): global conn if conn.running(): self["state"].setText(_("Connected!")) self.green_function = NONE self.red_function = DISCONNECT else: self.green_function = CONNECT self.red_function = NONE self.updateGui() def __closed(self): global connected conn.appClosed.remove(self.pppdClosed) conn.dataAvail.remove(self.dataAvail) if not connected: conn.sendCtrlC() setOptions(self.phone.getText(), self.username.getText()) setSecretString(self.username.getText() + ' * ' + self.password.getText()) def stateLoop(self): txt = self["state"].getText() txt += '.' self["state"].setText(txt) def connect(self): if self.green_function == CONNECT: global gateway gateway = getDefaultGateway() self["state"].setText(_("Dialing:")) system("route del default") system("modprobe ppp_async") self.stateTimer.start(1000, False) setOptions(self.phone.getText(), self.username.getText()) setSecretString(self.username.getText() + ' * ' + self.password.getText()) ret = conn.execute("pppd", "pppd", "-d", "-detach") if ret: print "execute pppd failed!" self.pppdClosed(ret) pppdClosed(ret) self.green_function = NONE self.red_function = ABORT self.updateGui() def disconnect(self): conn.sendCtrlC() self.red_function = NONE self.updateGui() def keyLeft(self): if self.green_function == CONNECT: self["list"].handleKey(KEY_LEFT) def keyRight(self): if self.green_function == CONNECT: self["list"].handleKey(KEY_RIGHT) def keyNumber(self, number): if self.green_function == CONNECT: self["list"].handleKey(KEY_0 + number) def deleteForward(self): if self.green_function == CONNECT: self["list"].handleKey(KEY_DELETE) def deleteBackward(self): if self.green_function == CONNECT: self["list"].handleKey(KEY_BACKSPACE) def pppdClosed(self, retval): global connected self.stateTimer.stop() self.red_function = NONE self.green_function = CONNECT self["state"].setText("") self.updateGui() connected = False def dataAvail(self, text): if text.find("Serial connection established") != -1: tmp = self["state"].getText() tmp += "OK\nLogin:"******"state"].setText(tmp) if text.find("PAP authentication succeeded") != -1: tmp = self["state"].getText() tmp += "OK\n" self["state"].setText(tmp) self.stateTimer.stop() if text.find("ip-up finished") != -1: global connected tmp = self["state"].getText() tmp += "Connected :)\n" self["state"].setText(tmp) self.red_function = DISCONNECT connected = True if text.find("Connect script failed") != -1: tmp = self["state"].getText() tmp += "FAILED\n" self["state"].setText(tmp) self.stateTimer.stop() self.red_function = NONE self.green_function = CONNECT self.updateGui() def updateGui(self): if self.red_function == NONE: self["key_red"].setText("") elif self.red_function == DISCONNECT: self["key_red"].setText(_("Disconnect")) elif self.red_function == ABORT: self["key_red"].setText(_("Abort")) if self.green_function == NONE: self["key_green"].setText("") elif self.green_function == CONNECT: self["key_green"].setText(_("Connect")) focus_enabled = self.green_function == CONNECT self["list"].instance.setSelectionEnable(focus_enabled) self["ListActions"].setEnabled(not focus_enabled)
for line in open('/proc/mounts'): if '/dev/sd' in line or '/dev/disk/by-uuid/' in line or '/dev/mmc' in line or '/dev/mtdblock' in line: pathmp.append(line.split()[1].replace('\\040', ' ') + '/') pathmp.append('/tmp/') return pathmp config.plugins.m2b = ConfigSubsection() config.plugins.m2b.path = ConfigSelection(choices = mountp()) config.plugins.m2b.m3ufile = ConfigSelection(choices = get_m3u_name()) config.plugins.m2b.type = ConfigSelection(default = "LiveStreamerhls", choices = [ ("LiveStreamerhls", _("LiveStreamer/hls")), ("LiveStreamerhlsvariant", _("LiveStreamer/hlsvariant")), ("Gstreamer", _("Gstreamer")), ("Multicast", _("Multicast")), ]) config.plugins.m2b.passw = ConfigPassword(default='', visible_width = 50, fixed_size = False) ############################################################################## class m2b_setup(ConfigListScreen, Screen): skin = """ <screen name="m2b_setup" position="center,160" size="750,147" title="2boom's m3u/xml bouquet converter"> <widget position="15,5" size="720,100" name="config" scrollbarMode="showOnDemand" /> <ePixmap position="10,140" zPosition="1" size="165,2" pixmap="~/images/red.png" alphatest="blend" /> <widget source="key_red" render="Label" position="10,110" zPosition="2" size="165,30" font="Regular;20" halign="center" valign="center" backgroundColor="background" foregroundColor="foreground" transparent="1" /> <ePixmap position="175,140" zPosition="1" size="165,2" pixmap="~/images/green.png" alphatest="blend" /> <widget source="key_green" render="Label" position="175,110" zPosition="2" size="165,30" font="Regular;20" halign="center" valign="center" backgroundColor="background" foregroundColor="foreground" transparent="1" /> </screen>""" def __init__(self, session): self.session = session Screen.__init__(self, session) self.skin_path = resolveFilename(SCOPE_PLUGINS, "Extensions/m2b")
from xpowerut import ixpowerUt, xpowerUt # Configuration config.plugins.xpower = ConfigSubsection() config.plugins.xpower.name = NoSave( ConfigText(default=_("PC"), fixed_size=False)) config.plugins.xpower.ip = NoSave(ConfigIP(default=[192, 168, 1, 100])) config.plugins.xpower.mac = NoSave(ConfigText(default="00:00:00:00:00:00")) config.plugins.xpower.system = NoSave( ConfigSelection(default="0", choices=[("0", _("XP")), ("1", _("Win7")), ("2", _("Linux")), ("5", _("XP NET RPC"))])) config.plugins.xpower.user = NoSave( ConfigText(default="administrator", fixed_size=False)) config.plugins.xpower.passwd = NoSave( ConfigPassword(default="password", fixed_size=False)) config.plugins.xpower.bqdn = NoSave( ConfigSelection(default="0", choices=[("0", _("Shutdown")), ("1", _("Suspend")), ("2", _("Hybernate"))])) config.plugins.xpower.close = ConfigYesNo(default=False) cfg = config.plugins.xpower class xpowerEdit(Screen, ConfigListScreen, HelpableScreen): skin = """ <screen position="center,center" size="560,275" title="XPower Configuration PC" > <ePixmap name="red" position="0,0" zPosition="2" size="140,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on" /> <ePixmap name="green" position="140,0" zPosition="2" size="140,40" pixmap="skin_default/buttons/green.png" transparent="1" alphatest="on" /> <ePixmap name="yellow" position="280,0" zPosition="2" size="140,40" pixmap="skin_default/buttons/yellow.png" transparent="1" alphatest="on" />
def createConfig(self): self.sharenameEntry = None self.mounttypeEntry = None self.activeEntry = None self.ipEntry = None self.sharedirEntry = None self.optionsEntry = None self.usernameEntry = None self.passwordEntry = None self.hdd_replacementEntry = None self.sharetypelist = [("nfs", _("NFS share")), ("cifs", _("CIFS share"))] if 'mounttype' in self.mountinfo: mounttype = self.mountinfo['mounttype'] if not mounttype: mounttype = "nfs" else: mounttype = "nfs" if 'active' in self.mountinfo: active = self.mountinfo['active'] if active == 'True': active = True if active == 'False': active = False else: active = True if 'ip' in self.mountinfo: if self.mountinfo['ip'] is False: ip = [192, 168, 0, 0] else: ip = self.convertIP(self.mountinfo['ip']) else: ip = [192, 168, 0, 0] if 'sharename' in self.mountinfo: sharename = self.mountinfo['sharename'] else: sharename = "Sharename" if 'sharedir' in self.mountinfo: sharedir = self.mountinfo['sharedir'] else: sharedir = "/export/hdd" if 'options' in self.mountinfo: options = self.mountinfo['options'] else: options = "rw,nolock,soft" if 'username' in self.mountinfo: username = self.mountinfo['username'] else: username = "" if 'password' in self.mountinfo: password = self.mountinfo['password'] else: password = "" if 'hdd_replacement' in self.mountinfo: hdd_replacement = self.mountinfo['hdd_replacement'] if hdd_replacement == 'True': hdd_replacement = True if hdd_replacement == 'False': hdd_replacement = False else: hdd_replacement = False if sharename is False: sharename = "Sharename" if sharedir is False: sharedir = "/export/hdd" if mounttype == "nfs": defaultOptions = "rw,nolock,soft" else: defaultOptions = "rw" if username is False: username = "" if password is False: password = "" self.activeConfigEntry = NoSave(ConfigEnableDisable(default=active)) self.ipConfigEntry = NoSave(ConfigIP(default=ip)) self.sharenameConfigEntry = NoSave( ConfigText(default=sharename, visible_width=50, fixed_size=False)) self.sharedirConfigEntry = NoSave( ConfigText(default=sharedir, visible_width=50, fixed_size=False)) self.optionsConfigEntry = NoSave( ConfigText(default=defaultOptions, visible_width=50, fixed_size=False)) if options is not False: self.optionsConfigEntry.value = options self.usernameConfigEntry = NoSave( ConfigText(default=username, visible_width=50, fixed_size=False)) self.passwordConfigEntry = NoSave( ConfigPassword(default=password, visible_width=50, fixed_size=False)) self.mounttypeConfigEntry = NoSave( ConfigSelection(self.sharetypelist, default=mounttype)) self.hdd_replacementConfigEntry = NoSave( ConfigYesNo(default=hdd_replacement))
# Config from Components.config import config, ConfigInteger, ConfigSubList, \ ConfigSubsection, ConfigText, ConfigPassword, ConfigYesNo config.plugins.ftpbrowser = ConfigSubsection() config.plugins.ftpbrowser.server = ConfigSubList() config.plugins.ftpbrowser.servercount = ConfigInteger(0) i = 0 append = config.plugins.ftpbrowser.server.append while i < config.plugins.ftpbrowser.servercount.value: newServer = ConfigSubsection() append(newServer) newServer.name = ConfigText("Name", fixed_size=False) newServer.address = ConfigText("192.168.2.12", fixed_size=False) newServer.username = ConfigText("root", fixed_size=False) newServer.password = ConfigPassword("dreambox") newServer.port = ConfigInteger(21, (1, 65535)) newServer.passive = ConfigYesNo(False) i += 1 del newServer del append, i from FTPBrowser import FTPBrowser from FTPServerManager import ftpserverFromURI ftpbrowser = None def createSingleton(session): global ftpbrowser
config.plugins.LastFM.menu = ConfigSelection(default="plugin", choices=[("plugin", _("Plugin menu")), ("extensions", _("Extensions menu"))]) config.plugins.LastFM.name = ConfigText(default=_("Last.FM"), fixed_size=False, visible_width=20) config.plugins.LastFM.description = ConfigText( default=_("Listen to Last.FM Internet Radio"), fixed_size=False, visible_width=80) config.plugins.LastFM.showcoverart = ConfigYesNo(default=True) config.plugins.LastFM.username = ConfigText("user", fixed_size=False) config.plugins.LastFM.password = ConfigPassword(default="passwd", fixed_size=False) config.plugins.LastFM.timeoutstatustext = ConfigInteger(3, limits=(0, 10)) config.plugins.LastFM.timeouttabselect = ConfigInteger(2, limits=(0, 10)) config.plugins.LastFM.metadatarefreshinterval = ConfigInteger(1, limits=(0, 100)) config.plugins.LastFM.recommendedlevel = ConfigInteger(3, limits=(0, 100)) config.plugins.LastFM.sendSubmissions = ConfigYesNo(default=False) config.plugins.LastFM.useproxy = ConfigYesNo(default=False) config.plugins.LastFM.proxyport = ConfigInteger(6676, limits=(1, 65536)) config.plugins.LastFM.sreensaver = ConfigSubsection() config.plugins.LastFM.sreensaver.use = ConfigYesNo(default=True) config.plugins.LastFM.sreensaver.wait = ConfigInteger(30, limits=(0, 1000)) config.plugins.LastFM.sreensaver.showcoverart = ConfigYesNo(default=True) config.plugins.LastFM.sreensaver.coverartanimation = ConfigYesNo(default=True)
return s i = 0 while i < growlee.hostcount.value: addHost(str(i + 1)) i += 1 # XXX: change to new config format # NOTE: after some time, remove this and hardcode default length to 1 # since internally we assume to have at least 1 host configured if growlee.hostcount.value == 0: growlee.enable_outgoing = ConfigYesNo(default=False) growlee.enable_incoming = ConfigYesNo(default=False) growlee.address = ConfigText(fixed_size=False) growlee.password = ConfigPassword() password = growlee.password.value growlee.prowl_api_key = ConfigText() growlee.protocol = ConfigSelection(default="growl", choices=[("growl", "Growl"), ("snarl", "Snarl"), ("prowl", "Prowl")]) growlee.level = ConfigSelection(default="-1", choices=[("-1", _("Low (Yes/No)")), ("0", _("Normal (Information)")), ("1", _("High (Warning)")), ("2", _("Highest (Emergency)"))]) growlee.blacklist = ConfigSet(choices=[]) if growlee.protocol.value == "prowl": password = growlee.prowl_api_key.value
#pragma mark - Config from Components.config import config, ConfigSubsection, ConfigText, \ ConfigPassword, ConfigLocations, ConfigSet, ConfigNumber, \ ConfigSelection from Tools.Directories import resolveFilename, SCOPE_HDD config.plugins.ecasa = ConfigSubsection() config.plugins.ecasa.google_username = ConfigText(default="", fixed_size=False) config.plugins.ecasa.google_password = ConfigPassword(default="") config.plugins.ecasa.cachedirs = ConfigLocations( default=[resolveFilename(SCOPE_HDD, "ecasa")]) config.plugins.ecasa.cache = ConfigText(default="/media/hdd/ecasa") config.plugins.ecasa.user = ConfigText(default='default') config.plugins.ecasa.searchhistory = ConfigSet(choices=[]) config.plugins.ecasa.userhistory = ConfigSet(choices=[]) config.plugins.ecasa.searchlimit = ConfigNumber(default=15) config.plugins.ecasa.cachesize = ConfigNumber(default=15) config.plugins.ecasa.slideshow_interval = ConfigNumber(default=30) config.plugins.ecasa.flickr_api_key = ConfigText(default="", fixed_size=False) config.plugins.ecasa.last_backend = ConfigSelection( default='picasa', choices=['picasa', 'flickr'])
def createConfig(self): self.mountusingEntry = None self.sharenameEntry = None self.mounttypeEntry = None self.activeEntry = None self.ipEntry = None self.sharedirEntry = None self.optionsEntry = None self.usernameEntry = None self.passwordEntry = None self.hdd_replacementEntry = None self.mountusing = [] self.mountusing.append(('fstab', _('FSTAB (mount using linux)'))) self.mountusing.append(('enigma2', _('Enigma2 (mount using enigma2)'))) self.mountusing.append(('old_enigma2', _('Enigma2 old format (mount using linux)'))) self.sharetypelist = [] self.sharetypelist.append(('nfs', _('NFS share'))) self.sharetypelist.append(('cifs', _('CIFS share'))) if self.mountinfo.has_key('mountusing'): mountusing = self.mountinfo['mountusing'] if mountusing is False: mountusing = 'fstab' else: mountusing = 'fstab' if self.mountinfo.has_key('mounttype'): mounttype = self.mountinfo['mounttype'] if mounttype is False: mounttype = 'nfs' else: mounttype = 'nfs' if self.mountinfo.has_key('active'): active = self.mountinfo['active'] if active == 'True': active = True if active == 'False': active = False else: active = True if self.mountinfo.has_key('ip'): if self.mountinfo['ip'] is False: ip = [192, 168, 0, 0] else: ip = self.convertIP(self.mountinfo['ip']) else: ip = [192, 168, 0, 0] if mounttype == 'nfs': defaultOptions = 'rw,nolock,tcp' else: defaultOptions = 'rw,utf8' if self.mountinfo['sharename'] and self.mountinfo.has_key('sharename'): sharename = re_sub('\\W', '', self.mountinfo['sharename']) else: sharename = 'Sharename' if self.mountinfo.has_key('sharedir'): sharedir = self.mountinfo['sharedir'] else: sharedir = '/export/hdd' if self.mountinfo.has_key('options'): options = self.mountinfo['options'] else: options = defaultOptions if self.mountinfo.has_key('username'): username = self.mountinfo['username'] else: username = '' if self.mountinfo.has_key('password'): password = self.mountinfo['password'] else: password = '' if self.mountinfo.has_key('hdd_replacement'): hdd_replacement = self.mountinfo['hdd_replacement'] if hdd_replacement == 'True': hdd_replacement = True if hdd_replacement == 'False': hdd_replacement = False else: hdd_replacement = False if sharename is False: sharename = 'Sharename' if sharedir is False: sharedir = '/export/hdd' if username is False: username = '' if password is False: password = '' self.mountusingConfigEntry = NoSave(ConfigSelection(self.mountusing, default=mountusing)) self.activeConfigEntry = NoSave(ConfigEnableDisable(default=active)) self.ipConfigEntry = NoSave(ConfigIP(default=ip)) self.sharenameConfigEntry = NoSave(ConfigText(default=sharename, visible_width=50, fixed_size=False)) self.sharedirConfigEntry = NoSave(ConfigText(default=sharedir, visible_width=50, fixed_size=False)) self.optionsConfigEntry = NoSave(ConfigText(default=defaultOptions, visible_width=50, fixed_size=False)) if options is not False: self.optionsConfigEntry.value = options self.usernameConfigEntry = NoSave(ConfigText(default=username, visible_width=50, fixed_size=False)) self.passwordConfigEntry = NoSave(ConfigPassword(default=password, visible_width=50, fixed_size=False)) self.mounttypeConfigEntry = NoSave(ConfigSelection(self.sharetypelist, default=mounttype)) self.hdd_replacementConfigEntry = NoSave(ConfigYesNo(default=hdd_replacement))
class ModemSetup(Screen): skin = """ <screen position="180,100" size="320,300" title="Modem" > <ePixmap pixmap="buttons/green.png" position="10,10" size="140,40" alphatest="on" /> <ePixmap pixmap="buttons/red.png" position="160,10" size="140,40" alphatest="on" /> <widget name="key_green" position="10,10" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" /> <widget name="key_red" position="160,10" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" /> <widget name="list" position="10,60" size="300,120" /> <widget name="state" position="10,210" size="300,80" font="Regular;20" /> </screen>""" def nothing(self): print "nothing!" def __init__(self, session, args = None): global connected global conn self.skin = ModemSetup.skin secret = getSecretString() user = secret[:secret.find('*')] password = secret[secret.find('*')+1:] self.username = ConfigText(user, fixed_size=False) self.password = ConfigPassword(password, fixed_size=False) self.phone = ConfigText(getTelephone(), fixed_size=False) self.phone.setUseableChars(u"0123456789") lst = [ (_("Username"), self.username), (_("Password"), self.password), (_("Phone number"), self.phone) ] self["list"] = ConfigList(lst) self["key_green"] = Button("") self["key_red"] = Button("") self["state"] = Label("") self["actions"] = NumberActionMap(["ModemActions"], { "cancel": self.close, "left": self.keyLeft, "right": self.keyRight, "connect": self.connect, "disconnect": self.disconnect, "deleteForward": self.deleteForward, "deleteBackward": self.deleteBackward, "0": self.keyNumber, "1": self.keyNumber, "2": self.keyNumber, "3": self.keyNumber, "4": self.keyNumber, "5": self.keyNumber, "6": self.keyNumber, "7": self.keyNumber, "8": self.keyNumber, "9": self.keyNumber }, -1) self["ListActions"] = ActionMap(["ListboxDisableActions"], { "moveUp": self.nothing, "moveDown": self.nothing, "moveTop": self.nothing, "moveEnd": self.nothing, "pageUp": self.nothing, "pageDown": self.nothing }, -1) self.stateTimer = eTimer() self.stateTimer.callback.append(self.stateLoop) conn.appClosed.append(self.pppdClosed) conn.dataAvail.append(self.dataAvail) Screen.__init__(self, session) self.onClose.append(self.__closed) self.onLayoutFinish.append(self.__layoutFinished) def __layoutFinished(self): global conn if conn.running(): self["state"].setText(_("Connected!")) self.green_function = NONE self.red_function = DISCONNECT else: self.green_function = CONNECT self.red_function = NONE self.updateGui() def __closed(self): global connected conn.appClosed.remove(self.pppdClosed) conn.dataAvail.remove(self.dataAvail) if not connected: conn.sendCtrlC() setOptions(self.phone.getText(), self.username.getText()) setSecretString(self.username.getText() + ' * ' + self.password.getText()) def stateLoop(self): txt = self["state"].getText() txt += '.' self["state"].setText(txt) def connect(self): if self.green_function == CONNECT: global gateway gateway = getDefaultGateway() self["state"].setText(_("Dialing:")) system("route del default") system("modprobe ppp_async") self.stateTimer.start(1000,False) setOptions(self.phone.getText(), self.username.getText()) setSecretString(self.username.getText() + ' * ' + self.password.getText()) ret = conn.execute("pppd", "pppd", "-d", "-detach") if ret: print "execute pppd failed!" self.pppdClosed(ret) pppdClosed(ret) self.green_function = NONE self.red_function = ABORT self.updateGui() def disconnect(self): conn.sendCtrlC() self.red_function = NONE self.updateGui() def keyLeft(self): if self.green_function == CONNECT: self["list"].handleKey(KEY_LEFT) def keyRight(self): if self.green_function == CONNECT: self["list"].handleKey(KEY_RIGHT) def keyNumber(self, number): if self.green_function == CONNECT: self["list"].handleKey(KEY_0 + number) def deleteForward(self): if self.green_function == CONNECT: self["list"].handleKey(KEY_DELETE) def deleteBackward(self): if self.green_function == CONNECT: self["list"].handleKey(KEY_BACKSPACE) def pppdClosed(self, retval): global connected self.stateTimer.stop() self.red_function = NONE self.green_function = CONNECT self["state"].setText("") self.updateGui() connected = False def dataAvail(self, text): if text.find("Serial connection established") != -1: tmp = self["state"].getText() tmp += "OK\nLogin:"******"state"].setText(tmp) if text.find("PAP authentication succeeded") != -1: tmp = self["state"].getText() tmp += "OK\n" self["state"].setText(tmp) self.stateTimer.stop() if text.find("ip-up finished") != -1: global connected tmp = self["state"].getText() tmp += "Connected :)\n" self["state"].setText(tmp) self.red_function = DISCONNECT connected=True if text.find("Connect script failed") != -1: tmp = self["state"].getText() tmp += "FAILED\n" self["state"].setText(tmp) self.stateTimer.stop() self.red_function = NONE self.green_function = CONNECT self.updateGui() def updateGui(self): if self.red_function == NONE: self["key_red"].setText("") elif self.red_function == DISCONNECT: self["key_red"].setText(_("Disconnect")) elif self.red_function == ABORT: self["key_red"].setText(_("Abort")) if self.green_function == NONE: self["key_green"].setText("") elif self.green_function == CONNECT: self["key_green"].setText(_("Connect")) focus_enabled = self.green_function == CONNECT self["list"].instance.setSelectionEnable(focus_enabled) self["ListActions"].setEnabled(not focus_enabled)
from os import path, remove from shutil import move from Components.config import getConfigListEntry, config, \ ConfigSubsection, ConfigText, ConfigIP, ConfigYesNo, \ ConfigPassword, ConfigNumber, KEY_LEFT, KEY_RIGHT, KEY_0, ConfigClock from time import time, strftime, mktime, localtime now = localtime() autoCopy = mktime(( now.tm_year, now.tm_mon, now.tm_mday, 06, 00, \ 0, now.tm_wday, now.tm_yday, now.tm_isdst) ) config.plugins.epgCopy = ConfigSubsection() config.plugins.epgCopy.username = ConfigText(default="root", fixed_size=False) config.plugins.epgCopy.password = ConfigPassword(default="", fixed_size=False) config.plugins.epgCopy.ip = ConfigIP(default=[0, 0, 0, 0]) config.plugins.epgCopy.copytime = ConfigClock(default=int(autoCopy)) def myPrint(txt, prefix=None): print("\033[91m[EPGCopy] %s\033[m " % txt) def myFtp(): directory_local = '/tmp/' directory = '/etc/enigma2/' fileQuelle = 'epg.db' fileZiel = 'epgSync.db' if path.isfile(directory_local + fileZiel):