Skip to content

Commit

Permalink
perf scripts python: exported-sql-viewer.py: Add ability to shrink / …
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
Adrian Hunter authored and Arnaldo Carvalho de Melo committed Oct 23, 2018
1 parent ebd70c7 commit 82f68e2
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tools/perf/scripts/python/exported-sql-viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,20 @@ def Update(self):
def setActiveSubWindow(self, nr):
self.mdi_area.setActiveSubWindow(self.mdi_area.subWindowList()[nr - 1])

# Font resize

def ResizeFont(widget, diff):
font = widget.font()
sz = font.pointSize()
font.setPointSize(sz + diff)
widget.setFont(font)

def ShrinkFont(widget):
ResizeFont(widget, -1)

def EnlargeFont(widget):
ResizeFont(widget, 1)

# Unique name for sub-windows

def NumberedWindowName(name, nr):
Expand Down Expand Up @@ -765,6 +779,8 @@ def __init__(self, glb, parent=None):

edit_menu = menu.addMenu("&Edit")
edit_menu.addAction(CreateAction("&Find...", "Find items", self.Find, self, QKeySequence.Find))
edit_menu.addAction(CreateAction("&Shrink Font", "Make text smaller", self.ShrinkFont, self, [QKeySequence("Ctrl+-")]))
edit_menu.addAction(CreateAction("&Enlarge Font", "Make text bigger", self.EnlargeFont, self, [QKeySequence("Ctrl++")]))

reports_menu = menu.addMenu("&Reports")
reports_menu.addAction(CreateAction("Context-Sensitive Call &Graph", "Create a new window containing a context-sensitive call graph", self.NewCallGraph, self))
Expand All @@ -779,6 +795,14 @@ def Find(self):
except:
pass

def ShrinkFont(self):
win = self.mdi_area.activeSubWindow()
ShrinkFont(win.view)

def EnlargeFont(self):
win = self.mdi_area.activeSubWindow()
EnlargeFont(win.view)

def NewCallGraph(self):
CallGraphWindow(self.glb, self)

Expand Down

0 comments on commit 82f68e2

Please sign in to comment.