From 0a1c1774427f08468374b338b638aba112c9020e Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Sat, 17 Jan 2026 18:03:44 +0100 Subject: [PATCH] Add a flip diff button --- gui/fitDiffFrame.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/gui/fitDiffFrame.py b/gui/fitDiffFrame.py index d8c2528c5..4eb2ec474 100644 --- a/gui/fitDiffFrame.py +++ b/gui/fitDiffFrame.py @@ -61,12 +61,19 @@ class FitDiffFrame(wx.Frame): panel = wx.Panel(self) mainSizer = wx.BoxSizer(wx.VERTICAL) - # Instructions at the top + # Instructions and flip button at the top + topSizer = wx.BoxSizer(wx.HORIZONTAL) instructions = wx.StaticText( panel, label=_t("Paste fits in EFT format to compare") ) - mainSizer.Add(instructions, 0, wx.ALL | wx.EXPAND, 5) + topSizer.Add(instructions, 1, wx.ALL | wx.EXPAND, 5) + + flipButton = wx.Button(panel, label=_t("Flip")) + flipButton.Bind(wx.EVT_BUTTON, self.onFlip) + topSizer.Add(flipButton, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) + + mainSizer.Add(topSizer, 0, wx.EXPAND) # Three panes: Fit 1 | Diff | Fit 2 panesSizer = wx.BoxSizer(wx.HORIZONTAL) @@ -127,6 +134,15 @@ class FitDiffFrame(wx.Frame): self.updateDiff() event.Skip() + def onFlip(self, event): + """Swap Fit 1 and Fit 2.""" + fit1Value = self.fit1Text.GetValue() + fit2Value = self.fit2Text.GetValue() + self.fit1Text.SetValue(fit2Value) + self.fit2Text.SetValue(fit1Value) + self.updateDiff() + event.Skip() + def updateDiff(self): """Calculate and display the differences between the two fits.""" self.diffText.Clear()