Skip to content

Commit 82f68e2

Browse files
ahunter6acmel
authored andcommitted
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>
1 parent ebd70c7 commit 82f68e2

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tools/perf/scripts/python/exported-sql-viewer.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,20 @@ def Update(self):
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 @@ def __init__(self, glb, parent=None):
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 @@ def Find(self):
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

0 commit comments

Comments
 (0)