-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve Synchronization UI #897
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Traceback (most recent call last):
File "/app/lib/python3.9/site-packages/GTG/backends/__init__.py", line 65, in __init__
__import__(extended_module_name)
File "/app/lib/python3.9/site-packages/GTG/backends/backend_caldav.py", line 30, in <module>
import caldav
ModuleNotFoundError: No module named 'caldav'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/app/lib/python3.9/site-packages/GTG/gtk/application.py", line 124, in do_startup
for backend_dic in BackendFactory().get_saved_backends_list():
File "/app/lib/python3.9/site-packages/GTG/backends/__init__.py", line 70, in __init__
inactive_modules.append(module_name)
AttributeError: 'set' object has no attribute 'append' You need to use |
||||||
continue | ||||||
except Exception: | ||||||
# Other exception log as errors | ||||||
log.exception("Malformated backend %s:", module_name) | ||||||
inactive_modules.append(module_name) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Ditto. You need to use |
||||||
continue | ||||||
|
||||||
def browse_subclasses(cls): | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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 = '<big>Error: Python package \'caldev\' not installed.</big>' | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Typo in |
||||||
self.label_name.set_markup(markup) | ||||||
return | ||||||
|
||||||
|
||||||
markup = '<big>Error: An unknown backend could not be loaded.</big>' | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Make it translatable. |
||||||
self.label_name.set_markup(markup) | ||||||
return | ||||||
|
||||||
backend = BackendFactory().get_backend(backend_name) | ||||||
self.label_description.set_markup(backend.Backend.get_description()) | ||||||
|
||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -16,7 +16,7 @@ | |||||
# this program. If not, see <http://www.gnu.org/licenses/>. | ||||||
# ----------------------------------------------------------------------------- | ||||||
|
||||||
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") | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't hardcode paths like that, especially this is flatpak only and not everyone uses the flatpak version (such as distros, developers or users who test locally/want the latest version). Seems gtg/GTG/backends/backend_localfile.py Line 100 in 5f72c8a
|
||||||
|
||||||
label = "This is the default file storage backend. <a href='{}'>{}</a>.".format(xml_folder, _("Open the XML data file")) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
The outer text wasn't marked as translatable. Also you can inline the text for more context to the translators. |
||||||
else: | ||||||
if self.backend.is_enabled(): | ||||||
label = _("Syncing is enabled.") | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be better to move this to the
BackendFactory
class below. TheBorg
class it inherits is basically making it a singleton (state shared on every instance).