aarronc / hutton-helper

data collection tool to aid in better management of the BGS
9 stars 4 forks source link

EDMC theme is not applied to Large Friendly Letters #88

Open ElSaico opened 5 months ago

ElSaico commented 5 months ago

A recurrent exception on my EDMC logs was puzzling me for a while, because it doesn't say the actual plugin which causes it - only an opaque reference to its frame:

2024-05-25 15:54:11.671 UTC - ERROR - 13500:25948:25948 theme._Theme._update_widget:393: Plugin widget issue ? widget=<widgets.FrontCover object .edmarketconnector.plugin_8.!frame.!frontcover>
Traceback (most recent call last):
  File "theme.pyc", line 378, in _update_widget
  File "tkinter\__init__.pyc", line 1713, in __setitem__
TypeError: FrontCover.configure() takes 1 positional argument but 2 were given

Some grepping later, I found out that this FrontCover widget is the Hutton Helper's

DON'T PANIC!

label, and the bug comes from the aforementioned method's signature:

    def configure(self, **kwargs):

When EDMC applies a theme, it iterates through all of the main window's widgets and overrides their color attributes. And, since Tkinter can sometimes be an insufferable [voice gets drowned out by a nearby truck's very loud horn], their dict-like syntax for this is implemented as a poorly documented, positional argument to configure():

    def __setitem__(self, key, value):
        self.configure({key: value})

Since the label's method does not accept anything positional, its theming fails. Thankfully, the solution is very simple - just add an *args parameter to its configure() and pass it along to the super() call.