1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-12 15:27:14 +03:00

theme.py: Apply .configure() paranoia on button enter/leave

This commit is contained in:
Athanasius 2022-02-20 19:05:41 +00:00
parent 17530c2d2b
commit 520ff5868f
No known key found for this signature in database
GPG Key ID: AE3E527847057C7D

View File

@ -195,17 +195,35 @@ class _Theme(object):
def _enter(self, event, image):
widget = event.widget
if widget and widget['state'] != tk.DISABLED:
widget.configure(state=tk.ACTIVE)
try:
widget.configure(state=tk.ACTIVE)
except Exception:
logger.exception(f'Failure setting widget active: {widget=}')
if image:
image.configure(foreground=self.current['activeforeground'],
background=self.current['activebackground'])
try:
image.configure(foreground=self.current['activeforeground'],
background=self.current['activebackground'])
except Exception:
logger.exception(f'Failure configuring image: {image=}')
def _leave(self, event, image):
widget = event.widget
if widget and widget['state'] != tk.DISABLED:
widget.configure(state=tk.NORMAL)
try:
widget.configure(state=tk.NORMAL)
except Exception:
logger.exception(f'Failure setting widget normal: {widget=}')
if image:
image.configure(foreground=self.current['foreground'], background=self.current['background'])
try:
image.configure(foreground=self.current['foreground'], background=self.current['background'])
except Exception:
logger.exception(f'Failure configuring image: {image=}')
# Set up colors
def _colors(self, root, theme):