public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>
To: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/6] perf scripts python: exported-sql-viewer.py: Fix error when shrinking / enlarging font
Date: Mon, 13 May 2019 16:57:32 -0300	[thread overview]
Message-ID: <20190513195732.GC3198@kernel.org> (raw)
In-Reply-To: <20190503120828.25326-2-adrian.hunter@intel.com>

Em Fri, May 03, 2019 at 03:08:23PM +0300, Adrian Hunter escreveu:
> 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'

Humm, this is kinda frustrating, I tried it and expected it to either
enlarge/shrink or tell me that that is not possible, and why :-\

Anyway, if you think this is the best approach, applied.

- Arnaldo
 
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
>  tools/perf/scripts/python/exported-sql-viewer.py | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/perf/scripts/python/exported-sql-viewer.py b/tools/perf/scripts/python/exported-sql-viewer.py
> index c586abfb2b46..289e8dbd1444 100755
> --- a/tools/perf/scripts/python/exported-sql-viewer.py
> +++ b/tools/perf/scripts/python/exported-sql-viewer.py
> @@ -2770,6 +2770,14 @@ class MainWindow(QMainWindow):
>  		help_menu = menu.addMenu("&Help")
>  		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):
>  		win = self.mdi_area.activeSubWindow()
>  		if win:
> @@ -2787,12 +2795,10 @@ class MainWindow(QMainWindow):
>  				pass
>  
>  	def ShrinkFont(self):
> -		win = self.mdi_area.activeSubWindow()
> -		ShrinkFont(win.view)
> +		self.Try(ShrinkFont)
>  
>  	def EnlargeFont(self):
> -		win = self.mdi_area.activeSubWindow()
> -		EnlargeFont(win.view)
> +		self.Try(EnlargeFont)
>  
>  	def EventMenu(self, events, reports_menu):
>  		branches_events = 0
> -- 
> 2.17.1

-- 

- Arnaldo

  reply	other threads:[~2019-05-13 19:57 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-03 12:08 [PATCH 0/6] perf scripts python: exported-sql-viewer.py: Minor improvements Adrian Hunter
2019-05-03 12:08 ` [PATCH 1/6] perf scripts python: exported-sql-viewer.py: Fix error when shrinking / enlarging font Adrian Hunter
2019-05-13 19:57   ` Arnaldo Carvalho de Melo [this message]
2019-05-18  8:55   ` [tip:perf/core] " tip-bot for Adrian Hunter
2019-05-03 12:08 ` [PATCH 2/6] perf scripts python: exported-sql-viewer.py: Move view creation Adrian Hunter
2019-05-18  8:54   ` [tip:perf/core] " tip-bot for Adrian Hunter
2019-05-03 12:08 ` [PATCH 3/6] perf scripts python: exported-sql-viewer.py: Add tree level Adrian Hunter
2019-05-18  8:55   ` [tip:perf/core] " tip-bot for Adrian Hunter
2019-05-03 12:08 ` [PATCH 4/6] perf scripts python: exported-sql-viewer.py: Add copy to clipboard Adrian Hunter
2019-05-13 20:03   ` Arnaldo Carvalho de Melo
2019-05-18  8:56   ` [tip:perf/core] " tip-bot for Adrian Hunter
2019-05-03 12:08 ` [PATCH 5/6] perf scripts python: exported-sql-viewer.py: Add context menu Adrian Hunter
2019-05-13 20:09   ` Arnaldo Carvalho de Melo
2019-05-18  8:57   ` [tip:perf/core] " tip-bot for Adrian Hunter
2019-05-03 12:08 ` [PATCH 6/6] perf scripts python: exported-sql-viewer.py: Add 'About' dialog box Adrian Hunter
2019-05-13 20:12   ` Arnaldo Carvalho de Melo
2019-05-18  8:58   ` [tip:perf/core] " tip-bot for Adrian Hunter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190513195732.GC3198@kernel.org \
    --to=arnaldo.melo@gmail.com \
    --cc=adrian.hunter@intel.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox