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 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)
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 if not ftpbrowser: ftpbrowser = session.instantiateDialog(FTPBrowser)
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 def createSingleton(session): global ftpbrowser if not ftpbrowser: ftpbrowser = session.instantiateDialog(FTPBrowser)