def addHost(name): s = ConfigSubsection() s.name = ConfigText(default=name, fixed_size=False) s.enable_incoming = ConfigYesNo(default=False) s.enable_outgoing = ConfigYesNo(default=False) s.address = ConfigText(fixed_size=False) s.password = ConfigPassword() s.protocol = ConfigSelection( default="growl", choices=[ ("growl", "Growl"), ("gntp", "GNTP"), ("snarl", "Snarl"), ("prowl", "Prowl"), ("syslog", "Syslog UDP"), ], ) s.level = ConfigSelection( default="-1", choices=[ ("-1", _("Low (Yes/No)")), ("0", _("Normal (Information)")), ("1", _("High (Warning)")), ("2", _("Highest (Emergency)")), ], ) s.blacklist = ConfigSet(choices=[]) config.plugins.growlee.hosts.append(s) return s
def ftpserverFromURI(uri, name = "", save = True): scheme, host, port, path, username, password = _parse(uri, defaultPort = 21) newServer = ConfigSubsection() if save: config.plugins.ftpbrowser.server.append(newServer) newServer.name = ConfigText(fixed_size = False) newServer.name.value = name or host newServer.address = ConfigText(fixed_size = False) newServer.address.value = host newServer.username = ConfigText(fixed_size = False) newServer.username.value = username newServer.password = ConfigPassword() newServer.password.value = password newServer.port = ConfigInteger(0, (0, 65535)) newServer.port.value = port newServer.passive = ConfigYesNo(False) newServer.connectiontype = ConfigYesNo(False) if save: newServer.save() config.plugins.ftpbrowser.servercount.value += 1 config.plugins.ftpbrowser.servercount.save() return FTPServer(newServer)
def addHost(name): s = ConfigSubsection() s.name = ConfigText(default=name, fixed_size=False) s.enable_incoming = ConfigYesNo(default=False) s.enable_outgoing = ConfigYesNo(default=False) s.address = ConfigText(fixed_size=False) s.password = ConfigPassword() s.protocol = ConfigSelection(default="growl", choices=[("growl", "Growl"), ("snarl", "Snarl"), ("prowl", "Prowl"), ("syslog", "Syslog UDP")]) s.level = ConfigSelection(default="-1", choices=[("-1", _("Low (Yes/No)")), ("0", _("Normal (Information)")), ("1", _("High (Warning)")), ("2", _("Highest (Emergency)"))]) s.blacklist = ConfigSet(choices=[]) config.plugins.growlee.hosts.append(s) return s
def add(self): newServer = ConfigSubsection() config.plugins.ftpbrowser.server.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) config.plugins.ftpbrowser.servercount.value += 1 config.plugins.ftpbrowser.servercount.save() self.updateServerList() self.changed = True
def add(self): newServer = ConfigSubsection() config.plugins.ftpbrowser.server.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) config.plugins.ftpbrowser.servercount.value += 1 config.plugins.ftpbrowser.servercount.save() self.updateServerList() self.changed = True
def ftpserverFromURI(uri, name="", save=True): scheme, host, port, path, username, password = _parse(uri, defaultPort=21) newServer = ConfigSubsection() if save: config.plugins.ftpbrowser.server.append(newServer) newServer.name = ConfigText(fixed_size=False) newServer.name.value = name or host newServer.address = ConfigText(fixed_size=False) newServer.address.value = host newServer.username = ConfigText(fixed_size=False) newServer.username.value = username newServer.password = ConfigPassword() newServer.password.value = password newServer.port = ConfigInteger(0, (0, 65535)) newServer.port.value = port newServer.passive = ConfigYesNo(False) if save: newServer.save() config.plugins.ftpbrowser.servercount.value += 1 config.plugins.ftpbrowser.servercount.save() return FTPServer(newServer)
config.plugins.growlee.hosts.append(s) 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)")), ], )
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=True) apModeConfig.address = ConfigIP(default=[0, 0, 0, 0]) apModeConfig.netmask = ConfigIP(default=[255, 0, 0, 0]) apModeConfig.gateway = ConfigIP(default=[0, 0, 0, 0]) class WirelessAccessPoint(Screen, ConfigListScreen): skin = """ <screen position="center,center" size="590,450" title="Wireless Access Point" > <ePixmap pixmap="skin_default/buttons/red.png" position="20,0" size="140,40" alphatest="on" /> <ePixmap pixmap="skin_default/buttons/green.png" position="160,0" size="140,40" alphatest="on" /> <ePixmap pixmap="skin_default/buttons/yellow.png" position="300,0" size="140,40" alphatest="on" /> <ePixmap pixmap="skin_default/buttons/blue.png" position="440,0" size="140,40" alphatest="on" /> <widget source="key_red" render="Label" position="20,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" foregroundColor="#ffffff" backgroundColor="#9f1313" transparent="1" /> <widget source="key_green" render="Label" position="160,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" foregroundColor="#ffffff" backgroundColor="#1f771f" transparent="1" /> <widget source="key_yellow" render="Label" position="300,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" foregroundColor="#ffffff" backgroundColor="#a08500" transparent="1" />
from . import _ # 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
config.plugins.growlee.hosts.append(s) 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
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]) apModeConfig.netmask = ConfigIP(default = [255,0,0,0]) apModeConfig.gateway = ConfigIP(default = [0,0,0,0]) apModeConfig.nameserver = ConfigIP(default = [0,0,0,0]) class WirelessAccessPoint(Screen,ConfigListScreen): skin = """ <screen position="center,center" size="590,450" title="Wireless Access Point" > <ePixmap pixmap="skin_default/buttons/red.png" position="20,0" size="140,40" alphatest="on" /> <ePixmap pixmap="skin_default/buttons/green.png" position="160,0" size="140,40" alphatest="on" /> <ePixmap pixmap="skin_default/buttons/yellow.png" position="300,0" size="140,40" alphatest="on" /> <ePixmap pixmap="skin_default/buttons/blue.png" position="440,0" size="140,40" alphatest="on" /> <widget source="key_red" render="Label" position="20,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" foregroundColor="#ffffff" backgroundColor="#9f1313" transparent="1" /> <widget source="key_green" render="Label" position="160,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" foregroundColor="#ffffff" backgroundColor="#1f771f" transparent="1" /> <widget source="key_yellow" render="Label" position="300,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" foregroundColor="#ffffff" backgroundColor="#a08500" transparent="1" />
from . import _ # 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) newServer.connectiontype = ConfigYesNo(False) i += 1 del newServer del append, i from FTPBrowser import FTPBrowser from FTPServerManager import ftpserverFromURI ftpbrowser = None