I bought the AWK exercises course and noticed that theme toggling stopped working. This happens because newer versions of the textual library replaced the dark attribute with the theme property.
I updated my local copy of awk_exercises.py to support both newer and older versions.
Here is the update for on_mount:
def on_mount(self):
is_dark = self.user_progress.get(-1, False)
if hasattr(self, 'theme'):
self.theme = 'textual-dark' if is_dark else 'textual-light'
else:
self.dark = is_dark
Here is the update for action_toggle_theme:
def action_toggle_theme(self):
if hasattr(self, 'theme'):
if self.theme == 'textual-dark':
self.theme = 'textual-light'
else:
self.theme = 'textual-dark'
is_dark = (self.theme == 'textual-dark')
else:
self.dark = not self.dark
is_dark = self.dark
self.user_progress[-1] = is_dark
self.write_progress_file()
This fix worked for the AWK application. I haven't tested it on the other applications in the repository. They will likely need a similar update since they seem to use the same logic.
I bought the AWK exercises course and noticed that theme toggling stopped working. This happens because newer versions of the textual library replaced the dark attribute with the theme property.
I updated my local copy of awk_exercises.py to support both newer and older versions.
Here is the update for on_mount:
def on_mount(self):
is_dark = self.user_progress.get(-1, False)
Here is the update for action_toggle_theme:
def action_toggle_theme(self):
if hasattr(self, 'theme'):
if self.theme == 'textual-dark':
self.theme = 'textual-light'
else:
self.theme = 'textual-dark'
is_dark = (self.theme == 'textual-dark')
else:
self.dark = not self.dark
is_dark = self.dark
This fix worked for the AWK application. I haven't tested it on the other applications in the repository. They will likely need a similar update since they seem to use the same logic.