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
2755 help_menu = menu.addMenu("&Help")2755 help_menu = menu.addMenu("&Help")
2756 help_menu.addAction(CreateAction("&Exported SQL Viewer Help", "Helpful information", self.Help, self, QKeySequence.HelpContents))2756 help_menu.addAction(CreateAction("&Exported SQL Viewer Help", "Helpful information", self.Help, self, QKeySequence.HelpContents))
2757 2757
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
2758 def Find(self):2766 def Find(self):
2759 win = self.mdi_area.activeSubWindow()2767 win = self.mdi_area.activeSubWindow()
2760 if win:2768 if win:
@@ -2772,12 +2780,10 @@ class MainWindow(QMainWindow): · 11 unmodified lines
2772 pass2780 pass
2773 2781
2774 def ShrinkFont(self):2782 def ShrinkFont(self):
2775 win = self.mdi_area.activeSubWindow()2783 self.Try(ShrinkFont)
2776 ShrinkFont(win.view)
2777 2784
2778 def EnlargeFont(self):2785 def EnlargeFont(self):
2779 win = self.mdi_area.activeSubWindow()2786 self.Try(EnlargeFont)
2780 EnlargeFont(win.view)
2781 2787
2782 def EventMenu(self, events, reports_menu):2788 def EventMenu(self, events, reports_menu):
2783 branches_events = 02789 branches_events = 0