Skip to content

Commit

Permalink
Add arrows to navigate the slideshow in simplified
Browse files Browse the repository at this point in the history
mode
  • Loading branch information
mlj5j committed Sep 11, 2024
1 parent f8e4926 commit 1dec421
Showing 1 changed file with 33 additions and 9 deletions.
42 changes: 33 additions & 9 deletions Gui/python/ResultTreeWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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()
Expand All @@ -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),
Expand Down Expand Up @@ -353,4 +377,4 @@ def displayResult(self, canvas, name=None, runNumber=""):
logger.info("Displaying " + svgFile)
except:
logger.error("Failed to display " + svgFile)
pass
pass

0 comments on commit 1dec421

Please sign in to comment.