From b800f0308d7a10143828307a3e1beb1954aa896d Mon Sep 17 00:00:00 2001 From: Martin Tranberg Date: Sun, 12 Apr 2026 09:42:52 +0200 Subject: [PATCH] fix: resolve C2/I4 review findings - C2: remove duplicate EVT_SIZE binding (on_status_bar_resize); merge gauge repositioning into the single on_resize handler - I4: position gauge correctly on first show by updating rect inside pulse_gauge._do() when start=True, so no resize event is required Co-Authored-By: Claude Sonnet 4.6 --- sharepoint_browser.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sharepoint_browser.py b/sharepoint_browser.py index b0218b7..6bbc0aa 100644 --- a/sharepoint_browser.py +++ b/sharepoint_browser.py @@ -930,7 +930,6 @@ class SharePointApp(wx.Frame): # Add a Gauge to the status bar self.gauge = wx.Gauge(self.status_bar, range=100, size=(140, 18), style=wx.GA_HORIZONTAL | wx.GA_SMOOTH) self.gauge.Hide() - self.Bind(wx.EVT_SIZE, self.on_status_bar_resize) panel.SetSizer(vbox) self.Bind(wx.EVT_SIZE, self.on_resize) @@ -1361,6 +1360,9 @@ class SharePointApp(wx.Frame): if start: self.gauge.Show() self.gauge.Pulse() + rect = self.status_bar.GetFieldRect(1) + self.gauge.SetPosition((rect.x + 5, rect.y + 2)) + self.gauge.SetSize((rect.width - 10, rect.height - 4)) else: self.gauge.Hide() self.gauge.SetValue(0) @@ -1542,21 +1544,19 @@ class SharePointApp(wx.Frame): def on_resize(self, event): width = self.GetSize().width threshold = 1100 - + if width < threshold and not self.compact_mode: self.compact_mode = True self._update_button_labels(full=False) elif width >= threshold and self.compact_mode: self.compact_mode = False self._update_button_labels(full=True) - - event.Skip() - def on_status_bar_resize(self, event): if hasattr(self, 'gauge') and self.gauge: rect = self.status_bar.GetFieldRect(1) self.gauge.SetPosition((rect.x + 5, rect.y + 2)) self.gauge.SetSize((rect.width - 10, rect.height - 4)) + event.Skip() def _update_button_labels(self, full=True):