renamed BackendsLoader to ModulesLoader
This commit is contained in:
parent
f0ea8829a2
commit
9f5c9aeebc
9 changed files with 301 additions and 252 deletions
|
|
@ -77,7 +77,10 @@ class BaseApplication(object):
|
|||
# Default storage tree
|
||||
STORAGE = {}
|
||||
# Synopsis
|
||||
SYNOPSIS = 'Usage: %prog [options (-h for help)] ...'
|
||||
SYNOPSIS = 'Usage: %prog [-h] [-dqv] [-b backends] ...'
|
||||
SYNOPSIS += ' %prog [--help] [--version]'
|
||||
# Description
|
||||
DESCRIPTION = None
|
||||
# Version
|
||||
VERSION = None
|
||||
# Copyright
|
||||
|
|
@ -109,6 +112,8 @@ class BaseApplication(object):
|
|||
self._parser = OptionParser(self.SYNOPSIS, version=self._get_optparse_version())
|
||||
else:
|
||||
self._parser = option_parser
|
||||
if self.DESCRIPTION:
|
||||
self._parser.description = self.DESCRIPTION
|
||||
self._parser.add_option('-b', '--backends', help='what backend(s) to enable (comma separated)')
|
||||
logging_options = OptionGroup(self._parser, 'Logging Options')
|
||||
logging_options.add_option('-d', '--debug', action='store_true', help='display debug messages')
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import subprocess
|
|||
import sys
|
||||
|
||||
from weboob.core import CallErrors
|
||||
from weboob.core.backends import BackendsConfig
|
||||
from weboob.core.backendscfg import BackendsConfig
|
||||
|
||||
from .base import BackendNotFound, BaseApplication
|
||||
from .formatters.load import formatters, load_formatter
|
||||
|
|
@ -44,7 +44,8 @@ class ConsoleApplication(BaseApplication):
|
|||
Base application class for CLI applications.
|
||||
"""
|
||||
|
||||
SYNOPSIS = 'Usage: %prog [options (-h for help)] command [parameters...]'
|
||||
SYNOPSIS = 'Usage: %prog [-dqv] [-b backends] [-cnfs] command [arguments..]\n'
|
||||
SYNOPSIS += ' %prog [--help] [--version]'
|
||||
|
||||
def __init__(self):
|
||||
option_parser = OptionParser(self.SYNOPSIS, version=self._get_optparse_version())
|
||||
|
|
@ -62,6 +63,8 @@ class ConsoleApplication(BaseApplication):
|
|||
|
||||
if self._parser.description is None:
|
||||
self._parser.description = ''
|
||||
else:
|
||||
self._parser.description += '\n\n'
|
||||
self._parser.description += 'Available commands:\n'
|
||||
for name, arguments, doc_string in self._commands:
|
||||
command = '%s %s' % (name, arguments)
|
||||
|
|
|
|||
|
|
@ -45,12 +45,12 @@ class BackendCfg(QDialog):
|
|||
# is_enabling is a counter to prevent race conditions.
|
||||
self.is_enabling = 0
|
||||
|
||||
self.weboob.backends_loader.load_all()
|
||||
self.weboob.modules_loader.load_all()
|
||||
|
||||
self.ui.configuredBackendsList.header().setResizeMode(QHeaderView.ResizeToContents)
|
||||
self.ui.configFrame.hide()
|
||||
|
||||
for name, backend in self.weboob.backends_loader.loaded.iteritems():
|
||||
for name, backend in self.weboob.modules_loader.loaded.iteritems():
|
||||
if not self.caps or backend.has_caps(*self.caps):
|
||||
item = QListWidgetItem(name.capitalize())
|
||||
|
||||
|
|
@ -74,10 +74,8 @@ class BackendCfg(QDialog):
|
|||
def loadConfiguredBackendsList(self):
|
||||
self.ui.configuredBackendsList.clear()
|
||||
for instance_name, name, params in self.weboob.backends_config.iter_backends():
|
||||
if name not in self.weboob.backends_loader.loaded:
|
||||
continue
|
||||
backend = self.weboob.backends_loader.loaded[name]
|
||||
if self.caps and not backend.has_caps(*self.caps):
|
||||
backend = self.weboob.modules_loader.get_or_load_module(name)
|
||||
if not backend or self.caps and not backend.has_caps(*self.caps):
|
||||
continue
|
||||
|
||||
item = QTreeWidgetItem(None, [instance_name, name])
|
||||
|
|
@ -195,7 +193,12 @@ class BackendCfg(QDialog):
|
|||
self.tr('Please select a backend'))
|
||||
return
|
||||
|
||||
backend = self.weboob.backends_loader.loaded[unicode(selection[0].text()).lower()]
|
||||
backend = self.weboob.modules_loader.get_or_load_module(unicode(selection[0].text()).lower())
|
||||
|
||||
if not backend:
|
||||
QMessageBox.critical(self, self.tr('Unable to add a configured backend'),
|
||||
self.tr('The selected backend does not exist.'))
|
||||
return
|
||||
|
||||
params = {}
|
||||
missing = []
|
||||
|
|
@ -261,7 +264,7 @@ class BackendCfg(QDialog):
|
|||
if not selection:
|
||||
return
|
||||
|
||||
backend = self.weboob.backends_loader.loaded[unicode(selection[0].text()).lower()]
|
||||
backend = self.weboob.modules_loader.loaded[unicode(selection[0].text()).lower()]
|
||||
|
||||
if backend.icon_path:
|
||||
img = QImage(backend.icon_path)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue