-
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?
Conversation
Not entirely sure if you want some feedback now, but:
For the link stuff (mentioned in the linked issue), https://docs.gtk.org/gtk3/class.Label.html#links would be a start. Edit: Also seeing it now, consider creating a branch in your repository to do the changes rather in your |
…ile directly from the description. Button hiding is now a one liner. Description for file storage updated to be more accurate since it is not a sync service. Remove extraneous print statement from previous commit.
The add panel now has the ability to detect which back-ends failed to initialize on start, and the developer can add corresponding error messages to help the user resolve dependency problems.
I believe most if not all of the requested changes have been applied. I might have misinterpreted the part about hiding the enable / disable button on the default back-end so I would appreciate it if someone can help me review this. edit: typo |
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.
I am not sure if we should make a link to the XML file. At least for me, clicking on it does nothing, and if something did, it may encourage people to modify the file while GTG is still open.
Images would have been nice to look at. Just launch gnome-screenshot -i
, select region, copy to clipboard and paste inside GitHub textbox thing.
After fixing the .append()
issue:
I don't quite like how it looks like. Maybe allow Caldav to be selectable, but name it like "caldav (error)" or something, so if you have multiple backends you can see which ones have an error.
@@ -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 comment
The 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 self.backend.get_path()
should work.
gtg/GTG/backends/backend_localfile.py
Line 100 in 5f72c8a
def get_path(self) -> str: |
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. <a href='{}'>{}</a>.".format(xml_folder, _("Open the XML data file")) |
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.
label = "This is the default file storage backend. <a href='{}'>{}</a>.".format(xml_folder, _("Open the XML data file")) | |
label = _("This is the default file storage backend. <a href='{}'>Open the XML data file</a>.").format(xml_folder) |
The outer text wasn't marked as translatable. Also you can inline the text for more context to the translators.
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
markup = '<big>Error: Python package \'caldev\' not installed.</big>' | |
markup = '<big>{}</big>'.format(_('Error: Python package \'caldav\' not installed.')) |
Typo in caldav
, and make it translatable.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
markup = '<big>Error: An unknown backend could not be loaded.</big>' | |
markup = '<big>{}</big>'.format(_('Error: An unknown backend could not be loaded.')) |
Make it translatable.
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
inactive_modules.append(module_name) | |
inactive_modules.add(module_name) |
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 .add()
since it is a set, not an list.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
inactive_modules.append(module_name) | |
inactive_modules.add(module_name) |
Ditto. You need to use .add()
since it is a set, not an list.
@@ -32,7 +32,7 @@ | |||
from GTG.backends.generic_backend import GenericBackend | |||
|
|||
log = logging.getLogger(__name__) | |||
|
|||
inactive_modules = set() |
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. The Borg
class it inherits is basically making it a singleton (state shared on every instance).
The big refactoring has finally landed (see the pinned 0.7 tracking issue for details)! Please rebase this to the latest |
Once this gets rebased, I would like @jaesivsm to help reviewing this. |
Partially implements #837.
This is my first pull-request (well, first time attempting to contribute to a public open source project in fact). Code changes are minimum so please give me some advice if I am doing something wrong here, any help would be appreciated, just trying to gain some experience.