Skip to content

Commit

Permalink
Restrict settings order in popup
Browse files Browse the repository at this point in the history
Due to the way confuse maintains settings changes, we can get different
settings orderings in the popup as a function of the previous edits
made.

By editing over the settings present in the DEFAULT source
(src/napari-imagej/config-default.yaml), we get two nice effects:
1. Settings will always appear in the order listed in the default
configuration file
2. Defined settings that are NOT in the default configuration file are
not listed in this popup. This could happen if the user hacked their own
configuration, for example.

Unfortunately, this does not fix the way that settings changes are
dumped into the user's settings. Thus the settings can still appear out
of order in the user's file. More work needed on that one...
  • Loading branch information
gselzer committed Sep 8, 2022
1 parent 277697f commit 65f4133
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/napari_imagej/widgets/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,16 +305,17 @@ def __init__(self, viewer: Viewer):

def _update_settings(self):
args = {}
for k, v in settings.items():
default_source = next(s for s in settings.sources if s.default)
for k, v in default_source.items():
args[k] = {}
args[k]["value"] = v.get()
args[k]["value"] = settings[k].get()
choices = request_values(title="napari-imagej Settings", values=args)
if choices is not None:
any_changed = False
for k, v in choices.items():
if v != settings[k].get():
any_changed = True
settings[k].set(v)
settings[k] = v

if any_changed:
self.setting_change.emit()
Expand Down

0 comments on commit 65f4133

Please sign in to comment.