From 52daa7a2a9163ec025ed53c6681632ce4d27aec8 Mon Sep 17 00:00:00 2001 From: Annaliese McDermond Date: Sun, 26 Jan 2020 15:19:39 -0800 Subject: [PATCH] Fix funky refresh of the SNR Fix the SNR sizer's resizing. --- ssdrframe.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ssdrframe.py b/ssdrframe.py index 08f6f12..60931a5 100644 --- a/ssdrframe.py +++ b/ssdrframe.py @@ -12,23 +12,23 @@ def __init__(self): self.main_sizer = wx.BoxSizer(wx.VERTICAL) - sbSizer4 = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, u"SNR"), wx.VERTICAL) + self.snr_sizer = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, u"SNR"), wx.VERTICAL) - self.gauge_snr = wx.Gauge(sbSizer4.GetStaticBox(), wx.ID_ANY, 25, wx.DefaultPosition, wx.Size(15, 135), + self.gauge_snr = wx.Gauge(self.snr_sizer.GetStaticBox(), wx.ID_ANY, 25, wx.DefaultPosition, wx.Size(15, 135), wx.GA_SMOOTH | wx.GA_VERTICAL) self.gauge_snr.SetValue(0) self.gauge_snr.SetMinSize(wx.Size(15, 135)) self.gauge_snr.SetMaxSize(wx.Size(15, 135)) - sbSizer4.Add(self.gauge_snr, 1, wx.ALL | wx.FIXED_MINSIZE | wx.ALIGN_CENTER_HORIZONTAL, 5) + self.snr_sizer.Add(self.gauge_snr, 1, wx.ALL | wx.FIXED_MINSIZE | wx.ALIGN_CENTER_HORIZONTAL, 5) - self.text_snr = wx.StaticText(sbSizer4.GetStaticBox(), wx.ID_ANY, u"0.00", wx.DefaultPosition, wx.DefaultSize, + self.text_snr = wx.StaticText(self.snr_sizer.GetStaticBox(), wx.ID_ANY, u"0.00", wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTER_HORIZONTAL | wx.ST_NO_AUTORESIZE) self.text_snr.Wrap(-1) - sbSizer4.Add(self.text_snr, 0, wx.ALIGN_BOTTOM | wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 5) + self.snr_sizer.Add(self.text_snr, 0, wx.ALIGN_BOTTOM | wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 5) - self.main_sizer.Add(sbSizer4, 1, wx.ALL | wx.EXPAND, 5) + self.main_sizer.Add(self.snr_sizer, 1, wx.ALL | wx.EXPAND, 5) self.stats_sizer = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, u"Stats"), wx.VERTICAL) @@ -176,6 +176,7 @@ def snr(self, snr: float) -> None: snr /= 1 << 6 self.text_snr.SetLabel('{:.2f}'.format(snr)) self.text_snr.InvalidateBestSize() + self.snr_sizer.Layout() self.gauge_snr.SetValue(snr) @property