You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And the PreferencesUpdateListener looks like this:
DEFAULT_PREFERENCES = {"kw": "rae", "max_suggested_items": 10, "max_shown_definitions": 10, "reset_to_default": "-"}
class PreferencesUpdateListener(EventListener):
def on_event(self, event, extension):
if event.id == "reset_to_default" and event.new_value == 'Reset':
for id_, val in DEFAULT_PREFERENCES.items():
extension.preferences[id_] = val
When I toggle the Reset button to reset and save, the extension's behaviour changes but the UI doesn't reflect that.
PreferencesUpdateListener resets the extension.preferences property to its default value and the behaviour changes accordingly. That is, when I use the extension, the new set values are in effect.
However, the extensions settings UI shows the old values.
Expected behavior
When I change the extension.preferences property in a PreferencesUpdateListener, both the behaviour and the values in the settings UI should reflect these new values.
Not sure whether they add much information, but here they are. They correspond to the process shown in the video.
Closing remarks
This might not be a bug. I suspect I have to tell the extension to update the UI once the values are set in the code. I did not find a way to do this, and this template suits the issue the best. Feel free to change the tags.
Thanks!
The text was updated successfully, but these errors were encountered:
Problem
I am trying to implement a reset to default "button" as a select preference. The entry in
manifest.json
looks like this:And the
PreferencesUpdateListener
looks like this:When I toggle the Reset button to reset and save, the extension's behaviour changes but the UI doesn't reflect that.
Source can be found here.
Steps to reproduce
PreferencesUpdateListener
with anon_event
method that updates a preference with a predefined value.on_event
method (in my case, by toggling a button in the preferences menu).See attached video for illustration.
Current behavior
PreferencesUpdateListener
resets theextension.preferences
property to its default value and the behaviour changes accordingly. That is, when I use the extension, the new set values are in effect.However, the extensions settings UI shows the old values.
Expected behavior
When I change the
extension.preferences
property in aPreferencesUpdateListener
, both the behaviour and the values in the settings UI should reflect these new values.Environment
Ulauncher version: 5.11.0
Linux distro: Pop_OS! 20.10
Desktop environment: Gnome 3.38.3
Logs
Not sure whether they add much information, but here they are. They correspond to the process shown in the video.
Closing remarks
This might not be a bug. I suspect I have to tell the extension to update the UI once the values are set in the code. I did not find a way to do this, and this template suits the issue the best. Feel free to change the tags.
Thanks!
The text was updated successfully, but these errors were encountered: