enhancements of the 'a' choice in menu of first launch
- Don't add backends already existing - ^C stop all backends adding - Better presentation - Exit menu after using 'a'
This commit is contained in:
parent
6f27b02865
commit
0c1b79cd42
1 changed files with 15 additions and 12 deletions
|
|
@ -138,7 +138,7 @@ class ConsoleApplication(BaseApplication):
|
||||||
loaded += 1
|
loaded += 1
|
||||||
print '%s%d)%s [%s] %s%-15s%s %s' % (self.BOLD, len(modules), self.NC, loaded,
|
print '%s%d)%s [%s] %s%-15s%s %s' % (self.BOLD, len(modules), self.NC, loaded,
|
||||||
self.BOLD, name, self.NC, info.description)
|
self.BOLD, name, self.NC, info.description)
|
||||||
print '\n%sa) --all--%s install all backends\n' % (self.BOLD, self.NC)
|
print '%sa) --all--%s install all backends' % (self.BOLD, self.NC)
|
||||||
print '%sq)%s --stop--\n' % (self.BOLD, self.NC)
|
print '%sq)%s --stop--\n' % (self.BOLD, self.NC)
|
||||||
r = self.ask('Select a backend to create (q to stop)', regexp='^(\d+|q|a)$')
|
r = self.ask('Select a backend to create (q to stop)', regexp='^(\d+|q|a)$')
|
||||||
|
|
||||||
|
|
@ -154,18 +154,20 @@ class ConsoleApplication(BaseApplication):
|
||||||
self.load_backends(names=[inst])
|
self.load_backends(names=[inst])
|
||||||
except (KeyboardInterrupt, EOFError):
|
except (KeyboardInterrupt, EOFError):
|
||||||
print '\nAborted.'
|
print '\nAborted.'
|
||||||
if r == 'a':
|
elif r == 'a':
|
||||||
for i in range( len(modules) ):
|
try:
|
||||||
name = modules[i]
|
for name in modules:
|
||||||
print "\n%sInstalling %s%s" % (self.BOLD, name, self.NC)
|
if name in [b.NAME for b in self.weboob.iter_backends()]:
|
||||||
try:
|
continue
|
||||||
inst = self.add_backend(name, default_config)
|
inst = self.add_backend(name, default_config)
|
||||||
if inst:
|
if inst:
|
||||||
self.load_backends(names=[inst])
|
self.load_backends(names=[inst])
|
||||||
except (KeyboardInterrupt, EOFError):
|
except (KeyboardInterrupt, EOFError):
|
||||||
print '\nAborted.'
|
print '\nAborted.'
|
||||||
|
else:
|
||||||
|
break
|
||||||
|
|
||||||
print 'Right right!'
|
print 'Right right!'
|
||||||
|
|
||||||
def _handle_options(self):
|
def _handle_options(self):
|
||||||
self.load_default_backends()
|
self.load_default_backends()
|
||||||
|
|
@ -303,14 +305,15 @@ class ConsoleApplication(BaseApplication):
|
||||||
for key, value in config.iteritems():
|
for key, value in config.iteritems():
|
||||||
if not asked_config:
|
if not asked_config:
|
||||||
asked_config = True
|
asked_config = True
|
||||||
print 'Configuration of backend'
|
print ''
|
||||||
print '------------------------'
|
print 'Configuration of backend %s' % module.name
|
||||||
|
print '-------------------------%s' % ('-' * len(module.name))
|
||||||
if key not in params or edit:
|
if key not in params or edit:
|
||||||
params[key] = self.ask(value, default=params[key] if (key in params) else value.default)
|
params[key] = self.ask(value, default=params[key] if (key in params) else value.default)
|
||||||
else:
|
else:
|
||||||
print u' [%s] %s: %s' % (key, value.description, '(masked)' if value.masked else params[key])
|
print u' [%s] %s: %s' % (key, value.description, '(masked)' if value.masked else params[key])
|
||||||
if asked_config:
|
if asked_config:
|
||||||
print '------------------------'
|
print '-------------------------%s' % ('-' * len(module.name))
|
||||||
|
|
||||||
while not edit and self.weboob.backends_config.backend_exists(name):
|
while not edit and self.weboob.backends_config.backend_exists(name):
|
||||||
print >>sys.stderr, 'Backend instance "%s" already exists in "%s"' % (name, self.weboob.backends_config.confpath)
|
print >>sys.stderr, 'Backend instance "%s" already exists in "%s"' % (name, self.weboob.backends_config.confpath)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue