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
706706 def setActiveSubWindow(self, nr):
707707 self.mdi_area.setActiveSubWindow(self.mdi_area.subWindowList()[nr - 1])
708708
709+# Font resize
710+
711+def ResizeFont(widget, diff):
712+ font = widget.font()
713+ sz = font.pointSize()
714+ font.setPointSize(sz + diff)
715+ widget.setFont(font)
716+
717+def ShrinkFont(widget):
718+ ResizeFont(widget, -1)
719+
720+def EnlargeFont(widget):
721+ ResizeFont(widget, 1)
722+
709723 # Unique name for sub-windows
710724
711725 def NumberedWindowName(name, nr):
@@ -765,6 +779,8 @@ class MainWindow(QMainWindow): · 53 unmodified lines
765779
766780 edit_menu = menu.addMenu("&Edit")
767781 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++")]))
768784
769785 reports_menu = menu.addMenu("&Reports")
770786 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
779795 except:
780796 pass
781797
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+
782806 def NewCallGraph(self):
783807 CallGraphWindow(self.glb, self)
784808