added wx debug mode (enable by setting WXDEBUG env var)

This commit is contained in:
2025-05-25 23:58:20 +02:00
parent 2fa3568808
commit 93c5b036ca
2 changed files with 34 additions and 0 deletions
+3
View File
@@ -1,3 +1,6 @@
from slic.gui.wxdebug import wxdebug as _wxdebug
_wxdebug()
from . import core
+31
View File
@@ -0,0 +1,31 @@
import os
from random import randint
import wx
original_add = wx.Sizer.Add
def wxdebug():
if "WXDEBUG" in os.environ:
wx.Sizer.Add = debug_add
def debug_add(self, item, *args, **kwargs):
try:
item.SetBackgroundColour(random_color())
except:
pass
return original_add(self, item, *args, **kwargs)
def random_color():
return wx.Colour(
randint(100, 255),
randint(100, 255),
randint(100, 255)
)