Commit 4b208453 authored by Adrian Hunter's avatar Adrian Hunter Committed by Arnaldo Carvalho de Melo

perf scripts python: exported-sql-viewer.py: Fix error when shrinking / enlarging font

Fix the following error if shrink / enlarge font is used with the help
window.

  Traceback (most recent call last):
    File "tools/perf/scripts/python/exported-sql-viewer.py", line 2791, in ShrinkFont
      ShrinkFont(win.view)
  AttributeError: 'HelpWindow' object has no attribute 'view'

Committer testing:

Before, matches above output:

  $ python ~acme/libexec/perf-core/scripts/python/exported-sql-viewer.py ~/c/adrian.hunter/simple-retpoline.db
  Traceback (most recent call last):
    File "/home/acme/libexec/perf-core/scripts/python/exported-sql-viewer.py", line 2780, in EnlargeFont
      EnlargeFont(win.view)
  AttributeError: 'HelpWindow' object has no attribute 'view'
  $

After:

No more tracebacks, but the fonts don't get enlarged, which is kinda
frustrating...
Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/20190503120828.25326-2-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent be6e7471
...@@ -2755,6 +2755,14 @@ class MainWindow(QMainWindow): ...@@ -2755,6 +2755,14 @@ class MainWindow(QMainWindow):
help_menu = menu.addMenu("&Help") help_menu = menu.addMenu("&Help")
help_menu.addAction(CreateAction("&Exported SQL Viewer Help", "Helpful information", self.Help, self, QKeySequence.HelpContents)) help_menu.addAction(CreateAction("&Exported SQL Viewer Help", "Helpful information", self.Help, self, QKeySequence.HelpContents))
def Try(self, fn):
win = self.mdi_area.activeSubWindow()
if win:
try:
fn(win.view)
except:
pass
def Find(self): def Find(self):
win = self.mdi_area.activeSubWindow() win = self.mdi_area.activeSubWindow()
if win: if win:
...@@ -2772,12 +2780,10 @@ class MainWindow(QMainWindow): ...@@ -2772,12 +2780,10 @@ class MainWindow(QMainWindow):
pass pass
def ShrinkFont(self): def ShrinkFont(self):
win = self.mdi_area.activeSubWindow() self.Try(ShrinkFont)
ShrinkFont(win.view)
def EnlargeFont(self): def EnlargeFont(self):
win = self.mdi_area.activeSubWindow() self.Try(EnlargeFont)
EnlargeFont(win.view)
def EventMenu(self, events, reports_menu): def EventMenu(self, events, reports_menu):
branches_events = 0 branches_events = 0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment