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...
Showing the changes to tools/perf/scripts/python (1 of 1 file). Show all
Unified · Split
| @@ -2755,6 +2755,14 @@ class MainWindow(QMainWindow): · 2754 unmodified lines | ||
| 2755 | 2755 | help_menu = menu.addMenu("&Help") |
| 2756 | 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 | 2766 | def Find(self): |
| 2759 | 2767 | win = self.mdi_area.activeSubWindow() |
| 2760 | 2768 | if win: |
| @@ -2772,12 +2780,10 @@ class MainWindow(QMainWindow): · 11 unmodified lines | ||
| 2772 | 2780 | pass |
| 2773 | 2781 | |
| 2774 | 2782 | def ShrinkFont(self): |
| 2775 | − win = self.mdi_area.activeSubWindow() | |
| 2776 | − ShrinkFont(win.view) | |
| 2783 | + self.Try(ShrinkFont) | |
| 2777 | 2784 | |
| 2778 | 2785 | def EnlargeFont(self): |
| 2779 | − win = self.mdi_area.activeSubWindow() | |
| 2780 | − EnlargeFont(win.view) | |
| 2786 | + self.Try(EnlargeFont) | |
| 2781 | 2787 | |
| 2782 | 2788 | def EventMenu(self, events, reports_menu): |
| 2783 | 2789 | branches_events = 0 |