aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/scripts/python/exported-sql-viewer.py
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@intel.com>2018-10-01 02:28:49 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2018-10-23 13:34:40 -0400
commit82f68e2898e634b8b0efc7ddd57e037ef75ea114 (patch)
tree0ef77e090823471509a982f54f45b6fb1fa93391 /tools/perf/scripts/python/exported-sql-viewer.py
parentebd70c7dc2f5f57315e19d959ddc9cb05e9d48e1 (diff)
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. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Jiri Olsa <jolsa@redhat.com> Link: http://lkml.kernel.org/r/20181001062853.28285-16-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/scripts/python/exported-sql-viewer.py')
-rwxr-xr-xtools/perf/scripts/python/exported-sql-viewer.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tools/perf/scripts/python/exported-sql-viewer.py b/tools/perf/scripts/python/exported-sql-viewer.py
index 0386a600ffc7..310ba7147583 100755
--- a/tools/perf/scripts/python/exported-sql-viewer.py
+++ b/tools/perf/scripts/python/exported-sql-viewer.py
@@ -706,6 +706,20 @@ class WindowMenu():
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-windows 723# Unique name for sub-windows
710 724
711def NumberedWindowName(name, nr): 725def NumberedWindowName(name, nr):
@@ -765,6 +779,8 @@ class MainWindow(QMainWindow):
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):
779 except: 795 except:
780 pass 796 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