Skip to content

Commit

Permalink
BUGFIX: cope with out-of-order and missing/unused BITMASK key entries
Browse files Browse the repository at this point in the history
  • Loading branch information
amilcarlucas committed Apr 29, 2024
1 parent 11040d4 commit 0fc0646
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions MethodicConfigurator/frontend_tkinter_parameter_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,11 +338,11 @@ def update_label():

# Convert current_value to a set of checked keys
current_value = int(event.widget.get())
checked_keys = {i for i in range(len(bitmask_dict)) if (current_value >> i) & 1}
checked_keys = {key for key, _value in bitmask_dict.items() if (current_value >> key) & 1}

for i, (key, value) in enumerate(bitmask_dict.items()):
var = tk.BooleanVar(value=i in checked_keys)
checkbox_vars[key] = var
var = tk.BooleanVar(value=key in checked_keys)
checkbox_vars[i] = var
checkbox = tk.Checkbutton(window, text=value, variable=var, command=update_label)
checkbox.grid(row=i, column=0, sticky="w")

Expand Down

0 comments on commit 0fc0646

Please sign in to comment.