From 6f27b0286526e0e8142ef41e1c117128f995024a Mon Sep 17 00:00:00 2001 From: theo Date: Sat, 28 Jan 2012 23:30:40 +0100 Subject: [PATCH] Add all backends at once When no backends are loaded, a prompt pops up and suggest to add some. This patch adds the possibility to select all at once. Signed-off-by: theo Signed-off-by: Romain Bignon --- weboob/tools/application/console.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/weboob/tools/application/console.py b/weboob/tools/application/console.py index daf786af..69ba5ec1 100644 --- a/weboob/tools/application/console.py +++ b/weboob/tools/application/console.py @@ -138,8 +138,9 @@ class ConsoleApplication(BaseApplication): loaded += 1 print '%s%d)%s [%s] %s%-15s%s %s' % (self.BOLD, len(modules), self.NC, loaded, self.BOLD, name, self.NC, info.description) + print '\n%sa) --all--%s install all backends\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)$') + r = self.ask('Select a backend to create (q to stop)', regexp='^(\d+|q|a)$') if str(r).isdigit(): i = int(r) - 1 @@ -153,6 +154,16 @@ class ConsoleApplication(BaseApplication): self.load_backends(names=[inst]) except (KeyboardInterrupt, EOFError): print '\nAborted.' + if r == 'a': + for i in range( len(modules) ): + name = modules[i] + print "\n%sInstalling %s%s" % (self.BOLD, name, self.NC) + try: + inst = self.add_backend(name, default_config) + if inst: + self.load_backends(names=[inst]) + except (KeyboardInterrupt, EOFError): + print '\nAborted.' print 'Right right!'