History

perf scripts python: exported-sql-viewer.py: Add ability to shrink / enlarge font

Shrinking the font allows more information to display. Committer testing: Works, tested with the convenient Control+Shift+'+' and Control+'-' as well with the more cumbersome top menu "Edit" + "Enlarge/Shrink font" options.

Adrian Hunter committed 8 years ago

Commit 82f68e21 parent ebd70c71 file · +24 −0Browse 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+24−0
@@ -706,6 +706,20 @@ class WindowMenu(): · 705 unmodified lines
706 def setActiveSubWindow(self, nr):706 def setActiveSubWindow(self, nr):
707 self.mdi_area.setActiveSubWindow(self.mdi_area.subWindowList()[nr - 1])707 self.mdi_area.setActiveSubWindow(self.mdi_area.subWindowList()[nr - 1])
708 708
709# Font resize
710
711def ResizeFont(widget, diff):
712 font = widget.font()
713 sz = font.pointSize()
714 font.setPointSize(sz + diff)
715 widget.setFont(font)
716
717def ShrinkFont(widget):
718 ResizeFont(widget, -1)
719
720def EnlargeFont(widget):
721 ResizeFont(widget, 1)
722
709# Unique name for sub-windows723# Unique name for sub-windows
710 724
711def NumberedWindowName(name, nr):725def NumberedWindowName(name, nr):
@@ -765,6 +779,8 @@ class MainWindow(QMainWindow): · 53 unmodified lines
765 779
766 edit_menu = menu.addMenu("&Edit")780 edit_menu = menu.addMenu("&Edit")
767 edit_menu.addAction(CreateAction("&Find...", "Find items", self.Find, self, QKeySequence.Find))781 edit_menu.addAction(CreateAction("&Find...", "Find items", self.Find, self, QKeySequence.Find))
782 edit_menu.addAction(CreateAction("&Shrink Font", "Make text smaller", self.ShrinkFont, self, [QKeySequence("Ctrl+-")]))
783 edit_menu.addAction(CreateAction("&Enlarge Font", "Make text bigger", self.EnlargeFont, self, [QKeySequence("Ctrl++")]))
768 784
769 reports_menu = menu.addMenu("&Reports")785 reports_menu = menu.addMenu("&Reports")
770 reports_menu.addAction(CreateAction("Context-Sensitive Call &Graph", "Create a new window containing a context-sensitive call graph", self.NewCallGraph, self))786 reports_menu.addAction(CreateAction("Context-Sensitive Call &Graph", "Create a new window containing a context-sensitive call graph", self.NewCallGraph, self))
@@ -779,6 +795,14 @@ class MainWindow(QMainWindow): · 8 unmodified lines
779 except:795 except:
780 pass796 pass
781 797
798 def ShrinkFont(self):
799 win = self.mdi_area.activeSubWindow()
800 ShrinkFont(win.view)
801
802 def EnlargeFont(self):
803 win = self.mdi_area.activeSubWindow()
804 EnlargeFont(win.view)
805
782 def NewCallGraph(self):806 def NewCallGraph(self):
783 CallGraphWindow(self.glb, self)807 CallGraphWindow(self.glb, self)
784 808