From 1d07b088504e8153ae2d512465611841b8839b48 Mon Sep 17 00:00:00 2001 From: Sven Augustin Date: Fri, 5 Dec 2025 12:13:23 +0100 Subject: [PATCH] renamed: on_size -> OnSize; added a reference --- slic/gui/widgets/statusbarx.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/slic/gui/widgets/statusbarx.py b/slic/gui/widgets/statusbarx.py index efbd3abf..b1a40fd1 100644 --- a/slic/gui/widgets/statusbarx.py +++ b/slic/gui/widgets/statusbarx.py @@ -15,17 +15,23 @@ class StatusBarX(wx.StatusBar): """ wx.StatusBar that can hold any number of regular widgets Add, Insert, Remove follow the logic of the wx.Sizer equivalents + + This generically implements the note + > It is possible to create controls and other windows on the status bar. + > Position these windows from an OnSize() event handler. + from here + https://docs.wxpython.org/wx.StatusBar.html """ def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.items = [] - self.Bind(wx.EVT_SIZE, self.on_size) - wx.CallAfter(self.on_size, None) + self.Bind(wx.EVT_SIZE, self.OnSize) + wx.CallAfter(self.OnSize, None) - def on_size(self, event): + def OnSize(self, event): n_fields = len(self.items) or 1 # 0 is not allowed self.SetFieldsCount(n_fields) @@ -51,13 +57,13 @@ class StatusBarX(wx.StatusBar): def Add(self, *args, **kwargs): entry = StatusBarItem(*args, **kwargs) self.items.append(entry) - wx.CallAfter(self.on_size, None) + wx.CallAfter(self.OnSize, None) return entry def Insert(self, index, *args, **kwargs): entry = StatusBarItem(*args, **kwargs) self.items.insert(index, entry) - wx.CallAfter(self.on_size, None) + wx.CallAfter(self.OnSize, None) return entry def Remove(self, index):