added wx debug mode (enable by setting WXDEBUG env var)
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
from slic.gui.wxdebug import wxdebug as _wxdebug
|
||||
_wxdebug()
|
||||
|
||||
|
||||
from . import core
|
||||
|
||||
|
||||
@@ -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)
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user