History

perf scripts python: exported-sql-viewer.py: Fix error when shrinking / enlarging font

Fix the following error if shrink / enlarge font is used with the help window. Traceback (most recent call last): File "tools/perf/scripts/python/exported-sql-viewer.py", line 2791, in ShrinkFont ShrinkFont(win.view) AttributeError: 'HelpWindow' object has no attribute 'view' Committer testing: Before, matches above output: $ python ~acme/libexec/perf-core/scripts/python/exported-sql-viewer.py ~/c/adrian.hunter/simple-retpoline.db Traceback (most recent call last): File "/home/acme/libexec/perf-core/scripts/python/exported-sql-viewer.py", line 2780, in EnlargeFont EnlargeFont(win.view) AttributeError: 'HelpWindow' object has no attribute 'view' $ After: No more tracebacks, but the fonts don't get enlarged, which is kinda frustrating...

Adrian Hunter committed 7 years ago

Commit 4b208451 parent be6e7471 file · +10 −4Browse files

Showing the changes to tools/perf/scripts/python (1 of 1 file). Show all

Unified · Split

tools/perf/scripts/python/exported-sql-viewer.py+10−4
@@ -2755,6 +2755,14 @@ class MainWindow(QMainWindow): · 2754 unmodified lines
27552755 help_menu = menu.addMenu("&Help")
27562756 help_menu.addAction(CreateAction("&Exported SQL Viewer Help", "Helpful information", self.Help, self, QKeySequence.HelpContents))
27572757
2758+ def Try(self, fn):
2759+ win = self.mdi_area.activeSubWindow()
2760+ if win:
2761+ try:
2762+ fn(win.view)
2763+ except:
2764+ pass
2765+
27582766 def Find(self):
27592767 win = self.mdi_area.activeSubWindow()
27602768 if win:
@@ -2772,12 +2780,10 @@ class MainWindow(QMainWindow): · 11 unmodified lines
27722780 pass
27732781
27742782 def ShrinkFont(self):
2775− win = self.mdi_area.activeSubWindow()
2776− ShrinkFont(win.view)
2783+ self.Try(ShrinkFont)
27772784
27782785 def EnlargeFont(self):
2779− win = self.mdi_area.activeSubWindow()
2780− EnlargeFont(win.view)
2786+ self.Try(EnlargeFont)
27812787
27822788 def EventMenu(self, events, reports_menu):
27832789 branches_events = 0