diff --git a/GTG/backends/__init__.py b/GTG/backends/__init__.py index d7b740e78f..ee797f19ac 100644 --- a/GTG/backends/__init__.py +++ b/GTG/backends/__init__.py @@ -32,7 +32,7 @@ from GTG.backends.generic_backend import GenericBackend log = logging.getLogger(__name__) - +inactive_modules = set() class BackendFactory(Borg): """ @@ -67,10 +67,12 @@ def __init__(self): # Something is wrong with this backend, skipping log.warning("Backend %s could not be loaded: %r", module_name, exception) + inactive_modules.append(module_name) continue except Exception: # Other exception log as errors log.exception("Malformated backend %s:", module_name) + inactive_modules.append(module_name) continue def browse_subclasses(cls): diff --git a/GTG/gtk/backends/addpanel.py b/GTG/gtk/backends/addpanel.py index b6b27320ff..7c6028af21 100644 --- a/GTG/gtk/backends/addpanel.py +++ b/GTG/gtk/backends/addpanel.py @@ -24,6 +24,8 @@ from GTG.backends import BackendFactory from gettext import gettext as _, ngettext +from GTG.backends import inactive_modules + class AddPanel(Gtk.Box): """ @@ -170,7 +172,16 @@ def on_combo_changed(self, widget=None): """ backend_name = self.combo_types.get_selected() if backend_name is None: + if 'backend_caldav' in inactive_modules: + markup = 'Error: Python package \'caldev\' not installed.' + self.label_name.set_markup(markup) + return + + + markup = 'Error: An unknown backend could not be loaded.' + self.label_name.set_markup(markup) return + backend = BackendFactory().get_backend(backend_name) self.label_description.set_markup(backend.Backend.get_description()) diff --git a/GTG/gtk/backends/configurepanel.py b/GTG/gtk/backends/configurepanel.py index e6a67b5939..4173534de5 100644 --- a/GTG/gtk/backends/configurepanel.py +++ b/GTG/gtk/backends/configurepanel.py @@ -16,7 +16,7 @@ # this program. If not, see . # ----------------------------------------------------------------------------- -from gi.repository import Gtk +from gi.repository import Gtk, GLib from gettext import gettext as _ from GTG.gtk.backends.parameters_ui import ParametersUI @@ -139,7 +139,7 @@ def refresh_sync_button(self): """ Refreshes the state of the button that enables the backend """ - self.sync_button.set_sensitive(not self.backend.is_default()) + self.sync_button.set_visible(not self.backend.is_default()) if self.backend.is_enabled(): label = _("Disable syncing") else: @@ -151,7 +151,9 @@ def refresh_sync_status_label(self): Refreshes the Gtk.Label that shows the current state of this backend """ if self.backend.is_default(): - label = _("This is the default synchronization service") + xml_folder = GLib.filename_to_uri("/home/" + GLib.get_user_name() + "/.var/app/org.gnome.GTG/data/gtg/gtg_data.xml") + + label = "This is the default file storage backend. {}.".format(xml_folder, _("Open the XML data file")) else: if self.backend.is_enabled(): label = _("Syncing is enabled.")