Don't use a magicgui widget as a global store for attributes
- Dominant language
- Python
- Stars
- 23
- Forks
- 13
- PR merge metrics
- No merged PRs in 30d
Description
Somehow the code evolved to use a magicgui function not for a gui but for its ability to have bound variables, here:
https://github.com/jni/affinder/blob/393b0c666622fb65835ef056ed5233c2bd1034f2/affinder/affinder.py#L77-L82
and here:
https://github.com/jni/affinder/blob/393b0c666622fb65835ef056ed5233c2bd1034f2/affinder/affinder.py#L141-L142
This is generally a gross abuse of magicgui and the Python programming language. 😂 Since the main widget is stateful, the correct thing to do is to make a class subclassing [FunctionGui](https://napari.org/magicgui/_autosummary/magicgui.widgets.FunctionGui.html#magicgui.widgets.FunctionGui).
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by inspecting the referenced sections of affinder/affinder.py, especially lines 77-82 and 141-142, to understand how the magicgui function currently stores state. Read the linked magicgui FunctionGui documentation before restructuring the stateful main widget. Done means the global attribute store is replaced by a FunctionGui subclass without changing the widget's behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- desktop
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100