From 1dec42164e844ee8dfda6cbcb9bbf34f3f61ba98 Mon Sep 17 00:00:00 2001 From: mjoyce Date: Wed, 11 Sep 2024 13:12:20 -0400 Subject: [PATCH] Add arrows to navigate the slideshow in simplified mode --- Gui/python/ResultTreeWidget.py | 42 ++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/Gui/python/ResultTreeWidget.py b/Gui/python/ResultTreeWidget.py index a136757..d2f50d8 100644 --- a/Gui/python/ResultTreeWidget.py +++ b/Gui/python/ResultTreeWidget.py @@ -141,8 +141,15 @@ def setupUi(self): self.TreeRoot.setText(0, "Files..") else: self.TestLabel = QLabel("Test") + self.ControlButtom = QPushButton("Pause") self.ControlButtom.clicked.connect(self.controlDisplay) + + self.rightArrow = QPushButton("->") + self.rightArrow.clicked.connect(self.rightArrowFunc) + self.leftArrow = QPushButton("<-") + self.leftArrow.clicked.connect(self.leftArrowFunc) + self.SVGWidget = QtSvg.QSvgWidget() minHeight = 400 ratio = 1.5 @@ -163,7 +170,9 @@ def setupUi(self): self.mainLayout.addWidget(self.OutputTree, 0, 2, 10, 2) else: self.mainLayout.addWidget(self.TestLabel, 0, 2, 1, 2) - self.mainLayout.addWidget(self.ControlButtom, 0, 4, 1, 1) + self.mainLayout.addWidget(self.ControlButtom, 0, 5, 1, 1) + self.mainLayout.addWidget(self.rightArrow, 0, 4, 1, 1) + self.mainLayout.addWidget(self.leftArrow, 0, 3, 1, 1) self.mainLayout.addWidget(self.SVGWidget, 1, 2, 9, 3) if not self.master.expertMode: @@ -244,14 +253,29 @@ def updateDisplayList(self, step, resultDict): def showNextPlot(self): self.timer.start(3000) if len(self.displayList) > 0: - if self.displayIndex == len(self.displayList): - self.allDisplayed = True - self.displayIndex = self.displayIndex % len(self.displayList) - step, displayPlot = self.displayList[self.displayIndex] - self.TestLabel.setText("Step{}".format(step)) - self.SVGWidget.load(displayPlot) + self.showPlot() self.displayIndex += 1 + def showPlot(self): + if self.displayIndex == len(self.displayList): + self.allDisplayed = True + self.displayIndex = self.displayIndex % len(self.displayList) + step, displayPlot = self.displayList[self.displayIndex] + self.TestLabel.setText("Step{}".format(step)) + self.SVGWidget.load(displayPlot) + + def rightArrowFunc(self): + self.timer.start(3000) + if len(self.displayList) > 0: + self.displayIndex += 1 + self.showPlot() + + def leftArrowFunc(self): + self.timer.start(3000) + if len(self.displayList) > 0: + self.displayIndex -= 1 + self.showPlot() + def controlDisplay(self): if self.ControlButtom.text() == "Pause": self.timer.stop() @@ -261,7 +285,7 @@ def controlDisplay(self): self.timer.start() self.timerFrozen = False self.ControlButtom.setText("Pause") - + def updateResult(self, sourceFolder): process = subprocess.run( 'find {0} -type f -name "*.root" '.format(sourceFolder), @@ -353,4 +377,4 @@ def displayResult(self, canvas, name=None, runNumber=""): logger.info("Displaying " + svgFile) except: logger.error("Failed to display " + svgFile) - pass + pass \ No newline at end of file