From 321bf5defe57e8699cbc80aae85acfa49c93f351 Mon Sep 17 00:00:00 2001 From: astellhorn Date: Sun, 17 Sep 2023 12:39:24 +0200 Subject: [PATCH 1/2] created submenu for slicers being part of 2604 --- src/sas/qtgui/Plotting/Plotter2D.py | 72 ++++++++++++++++++++--------- 1 file changed, 50 insertions(+), 22 deletions(-) diff --git a/src/sas/qtgui/Plotting/Plotter2D.py b/src/sas/qtgui/Plotting/Plotter2D.py index 1189cbec0a..66cdc0cafe 100644 --- a/src/sas/qtgui/Plotting/Plotter2D.py +++ b/src/sas/qtgui/Plotting/Plotter2D.py @@ -165,7 +165,35 @@ def createContextMenu(self): """ Define common context menu and associated actions for the MPL widget """ + self.defaultContextMenu() + + plot_slicer_menu=self.contextMenu.addMenu('Slicers') + plot_slicer_menu.actionCircularAverage = plot_slicer_menu.addAction("&Perform Circular Average") + plot_slicer_menu.actionCircularAverage.triggered.connect(self.onCircularAverage) + plot_slicer_menu.actionSectorView = plot_slicer_menu.addAction("&Sector [Q View]") + plot_slicer_menu.actionSectorView.triggered.connect(self.onSectorView) + plot_slicer_menu.actionAnnulusView = plot_slicer_menu.addAction("&Annulus [Phi View]") + plot_slicer_menu.actionAnnulusView.triggered.connect(self.onAnnulusView) + plot_slicer_menu.actionBoxSum = plot_slicer_menu.addAction("&Box Sum") + plot_slicer_menu.actionBoxSum.triggered.connect(self.onBoxSum) + plot_slicer_menu.actionBoxAveragingX = plot_slicer_menu.addAction("&Box Averaging in Qx") + plot_slicer_menu.actionBoxAveragingX.triggered.connect(self.onBoxAveragingX) + plot_slicer_menu.actionBoxAveragingY = plot_slicer_menu.addAction("&Box Averaging in Qy") + plot_slicer_menu.actionBoxAveragingY.triggered.connect(self.onBoxAveragingY) + plot_slicer_menu.actionWedgeAveragingQ = plot_slicer_menu.addAction("&Wedge Averaging in Q") + plot_slicer_menu.actionWedgeAveragingQ.triggered.connect(self.onWedgeAveragingQ) + plot_slicer_menu.actionWedgeAveragingPhi = plot_slicer_menu.addAction("&Wedge Averaging in Phi") + plot_slicer_menu.actionWedgeAveragingPhi.triggered.connect(self.onWedgeAveragingPhi) + + plot_slicer_menu.addSeparator() + + # Additional items for slicer interaction + if self.slicer: + plot_slicer_menu.actionClearSlicer = plot_slicer_menu.addAction("&Clear Slicer") + plot_slicer_menu.actionClearSlicer.triggered.connect(self.onClearSlicer) + plot_slicer_menu.actionEditSlicer = plot_slicer_menu.addAction("&Edit Slicer Parameters") + plot_slicer_menu.actionEditSlicer.triggered.connect(self.onEditSlicer) self.contextMenu.addSeparator() self.actionDataInfo = self.contextMenu.addAction("&DataInfo") @@ -177,29 +205,29 @@ def createContextMenu(self): functools.partial(self.onSavePoints, self.data0)) self.contextMenu.addSeparator() - self.actionCircularAverage = self.contextMenu.addAction("&Perform Circular Average") - self.actionCircularAverage.triggered.connect(self.onCircularAverage) - - self.actionSectorView = self.contextMenu.addAction("&Sector [Q View]") - self.actionSectorView.triggered.connect(self.onSectorView) - self.actionAnnulusView = self.contextMenu.addAction("&Annulus [Phi View]") - self.actionAnnulusView.triggered.connect(self.onAnnulusView) - self.actionBoxSum = self.contextMenu.addAction("&Box Sum") - self.actionBoxSum.triggered.connect(self.onBoxSum) - self.actionBoxAveragingX = self.contextMenu.addAction("&Box Averaging in Qx") - self.actionBoxAveragingX.triggered.connect(self.onBoxAveragingX) - self.actionBoxAveragingY = self.contextMenu.addAction("&Box Averaging in Qy") - self.actionBoxAveragingY.triggered.connect(self.onBoxAveragingY) - self.actionWedgeAveragingQ = self.contextMenu.addAction("&Wedge Averaging in Q") - self.actionWedgeAveragingQ.triggered.connect(self.onWedgeAveragingQ) - self.actionWedgeAveragingPhi = self.contextMenu.addAction("&Wedge Averaging in Phi") - self.actionWedgeAveragingPhi.triggered.connect(self.onWedgeAveragingPhi) + #self.actionCircularAverage = self.contextMenu.addAction("&Perform Circular Average") + #self.actionCircularAverage.triggered.connect(self.onCircularAverage) + #self.actionSectorView = self.contextMenu.addAction("&Sector [Q View]") + #self.actionSectorView.triggered.connect(self.onSectorView) + #self.actionAnnulusView = self.contextMenu.addAction("&Annulus [Phi View]") + #self.actionAnnulusView.triggered.connect(self.onAnnulusView) + #self.actionBoxSum = self.contextMenu.addAction("&Box Sum") + #self.actionBoxSum.triggered.connect(self.onBoxSum) + #self.actionBoxAveragingX = self.contextMenu.addAction("&Box Averaging in Qx") + #self.actionBoxAveragingX.triggered.connect(self.onBoxAveragingX) + #self.actionBoxAveragingY = self.contextMenu.addAction("&Box Averaging in Qy") + #self.actionBoxAveragingY.triggered.connect(self.onBoxAveragingY) + #self.actionWedgeAveragingQ = self.contextMenu.addAction("&Wedge Averaging in Q") + #self.actionWedgeAveragingQ.triggered.connect(self.onWedgeAveragingQ) + #self.actionWedgeAveragingPhi = self.contextMenu.addAction("&Wedge Averaging in Phi") + #self.actionWedgeAveragingPhi.triggered.connect(self.onWedgeAveragingPhi) + # Additional items for slicer interaction - if self.slicer: - self.actionClearSlicer = self.contextMenu.addAction("&Clear Slicer") - self.actionClearSlicer.triggered.connect(self.onClearSlicer) - self.actionEditSlicer = self.contextMenu.addAction("&Edit Slicer Parameters") - self.actionEditSlicer.triggered.connect(self.onEditSlicer) + #if self.slicer: + # self.actionClearSlicer = self.contextMenu.addAction("&Clear Slicer") + # self.actionClearSlicer.triggered.connect(self.onClearSlicer) + #self.actionEditSlicer = self.contextMenu.addAction("&Edit Slicer Parameters") + #self.actionEditSlicer.triggered.connect(self.onEditSlicer) self.contextMenu.addSeparator() self.actionColorMap = self.contextMenu.addAction("&2D Color Map") self.actionColorMap.triggered.connect(self.onColorMap) From 70ba195415c075725c26faf967109cc1bd19600b Mon Sep 17 00:00:00 2001 From: astellhorn Date: Mon, 18 Sep 2023 17:29:45 +0200 Subject: [PATCH 2/2] changed the actions to class variables --- src/sas/qtgui/Plotting/Plotter2D.py | 54 +++++++++-------------------- 1 file changed, 16 insertions(+), 38 deletions(-) diff --git a/src/sas/qtgui/Plotting/Plotter2D.py b/src/sas/qtgui/Plotting/Plotter2D.py index 66cdc0cafe..4529b1cfc3 100644 --- a/src/sas/qtgui/Plotting/Plotter2D.py +++ b/src/sas/qtgui/Plotting/Plotter2D.py @@ -169,22 +169,22 @@ def createContextMenu(self): self.defaultContextMenu() plot_slicer_menu=self.contextMenu.addMenu('Slicers') - plot_slicer_menu.actionCircularAverage = plot_slicer_menu.addAction("&Perform Circular Average") - plot_slicer_menu.actionCircularAverage.triggered.connect(self.onCircularAverage) - plot_slicer_menu.actionSectorView = plot_slicer_menu.addAction("&Sector [Q View]") - plot_slicer_menu.actionSectorView.triggered.connect(self.onSectorView) - plot_slicer_menu.actionAnnulusView = plot_slicer_menu.addAction("&Annulus [Phi View]") - plot_slicer_menu.actionAnnulusView.triggered.connect(self.onAnnulusView) - plot_slicer_menu.actionBoxSum = plot_slicer_menu.addAction("&Box Sum") - plot_slicer_menu.actionBoxSum.triggered.connect(self.onBoxSum) - plot_slicer_menu.actionBoxAveragingX = plot_slicer_menu.addAction("&Box Averaging in Qx") - plot_slicer_menu.actionBoxAveragingX.triggered.connect(self.onBoxAveragingX) - plot_slicer_menu.actionBoxAveragingY = plot_slicer_menu.addAction("&Box Averaging in Qy") - plot_slicer_menu.actionBoxAveragingY.triggered.connect(self.onBoxAveragingY) - plot_slicer_menu.actionWedgeAveragingQ = plot_slicer_menu.addAction("&Wedge Averaging in Q") - plot_slicer_menu.actionWedgeAveragingQ.triggered.connect(self.onWedgeAveragingQ) - plot_slicer_menu.actionWedgeAveragingPhi = plot_slicer_menu.addAction("&Wedge Averaging in Phi") - plot_slicer_menu.actionWedgeAveragingPhi.triggered.connect(self.onWedgeAveragingPhi) + self.actionCircularAverage = plot_slicer_menu.addAction("&Perform Circular Average") + self.actionCircularAverage.triggered.connect(self.onCircularAverage) + self.actionSectorView = plot_slicer_menu.addAction("&Sector [Q View]") + self.actionSectorView.triggered.connect(self.onSectorView) + self.actionAnnulusView = plot_slicer_menu.addAction("&Annulus [Phi View]") + self.actionAnnulusView.triggered.connect(self.onAnnulusView) + self.actionBoxSum = plot_slicer_menu.addAction("&Box Sum") + self.actionBoxSum.triggered.connect(self.onBoxSum) + self.actionBoxAveragingX = plot_slicer_menu.addAction("&Box Averaging in Qx") + self.actionBoxAveragingX.triggered.connect(self.onBoxAveragingX) + self.actionBoxAveragingY = plot_slicer_menu.addAction("&Box Averaging in Qy") + self.actionBoxAveragingY.triggered.connect(self.onBoxAveragingY) + self.actionWedgeAveragingQ = plot_slicer_menu.addAction("&Wedge Averaging in Q") + self.actionWedgeAveragingQ.triggered.connect(self.onWedgeAveragingQ) + self.actionWedgeAveragingPhi = plot_slicer_menu.addAction("&Wedge Averaging in Phi") + self.actionWedgeAveragingPhi.triggered.connect(self.onWedgeAveragingPhi) plot_slicer_menu.addSeparator() @@ -205,29 +205,7 @@ def createContextMenu(self): functools.partial(self.onSavePoints, self.data0)) self.contextMenu.addSeparator() - #self.actionCircularAverage = self.contextMenu.addAction("&Perform Circular Average") - #self.actionCircularAverage.triggered.connect(self.onCircularAverage) - #self.actionSectorView = self.contextMenu.addAction("&Sector [Q View]") - #self.actionSectorView.triggered.connect(self.onSectorView) - #self.actionAnnulusView = self.contextMenu.addAction("&Annulus [Phi View]") - #self.actionAnnulusView.triggered.connect(self.onAnnulusView) - #self.actionBoxSum = self.contextMenu.addAction("&Box Sum") - #self.actionBoxSum.triggered.connect(self.onBoxSum) - #self.actionBoxAveragingX = self.contextMenu.addAction("&Box Averaging in Qx") - #self.actionBoxAveragingX.triggered.connect(self.onBoxAveragingX) - #self.actionBoxAveragingY = self.contextMenu.addAction("&Box Averaging in Qy") - #self.actionBoxAveragingY.triggered.connect(self.onBoxAveragingY) - #self.actionWedgeAveragingQ = self.contextMenu.addAction("&Wedge Averaging in Q") - #self.actionWedgeAveragingQ.triggered.connect(self.onWedgeAveragingQ) - #self.actionWedgeAveragingPhi = self.contextMenu.addAction("&Wedge Averaging in Phi") - #self.actionWedgeAveragingPhi.triggered.connect(self.onWedgeAveragingPhi) - # Additional items for slicer interaction - #if self.slicer: - # self.actionClearSlicer = self.contextMenu.addAction("&Clear Slicer") - # self.actionClearSlicer.triggered.connect(self.onClearSlicer) - #self.actionEditSlicer = self.contextMenu.addAction("&Edit Slicer Parameters") - #self.actionEditSlicer.triggered.connect(self.onEditSlicer) self.contextMenu.addSeparator() self.actionColorMap = self.contextMenu.addAction("&2D Color Map") self.actionColorMap.triggered.connect(self.onColorMap)