Add a flip diff button

This commit is contained in:
2026-01-17 18:03:44 +01:00
parent a03c2e4091
commit 0a1c177442

View File

@@ -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()