From: Adrian Hunter <adrian.hunter@intel.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>, linux-kernel@vger.kernel.org
Subject: [PATCH 3/8] perf scripts python: exported-sql-viewer.py: Add support for pyside2
Date: Fri, 12 Apr 2019 14:38:25 +0300 [thread overview]
Message-ID: <20190412113830.4126-4-adrian.hunter@intel.com> (raw)
In-Reply-To: <20190412113830.4126-1-adrian.hunter@intel.com>
pyside2 is the future for pyside support.
Note pyside use Qt4 whereas pyside2 uses Qt5.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
.../scripts/python/exported-sql-viewer.py | 28 ++++++++++++++-----
1 file changed, 21 insertions(+), 7 deletions(-)
diff --git a/tools/perf/scripts/python/exported-sql-viewer.py b/tools/perf/scripts/python/exported-sql-viewer.py
index 0fb0acc94058..c586abfb2b46 100755
--- a/tools/perf/scripts/python/exported-sql-viewer.py
+++ b/tools/perf/scripts/python/exported-sql-viewer.py
@@ -105,10 +105,23 @@ except ImportError:
glb_nsz = 16
import re
import os
-from PySide.QtCore import *
-from PySide.QtGui import *
-from PySide.QtSql import *
+
pyside_version_1 = True
+if not "--pyside-version-1" in sys.argv:
+ try:
+ from PySide2.QtCore import *
+ from PySide2.QtGui import *
+ from PySide2.QtSql import *
+ from PySide2.QtWidgets import *
+ pyside_version_1 = False
+ except:
+ pass
+
+if pyside_version_1:
+ from PySide.QtCore import *
+ from PySide.QtGui import *
+ from PySide.QtSql import *
+
from decimal import *
from ctypes import *
from multiprocessing import Process, Array, Value, Event
@@ -2502,7 +2515,7 @@ class WindowMenu():
action = self.window_menu.addAction(label)
action.setCheckable(True)
action.setChecked(sub_window == self.mdi_area.activeSubWindow())
- action.triggered.connect(lambda x=nr: self.setActiveSubWindow(x))
+ action.triggered.connect(lambda a=None,x=nr: self.setActiveSubWindow(x))
self.window_menu.addAction(action)
nr += 1
@@ -2793,14 +2806,14 @@ class MainWindow(QMainWindow):
event = event.split(":")[0]
if event == "branches":
label = "All branches" if branches_events == 1 else "All branches " + "(id=" + dbid + ")"
- reports_menu.addAction(CreateAction(label, "Create a new window displaying branch events", lambda x=dbid: self.NewBranchView(x), self))
+ reports_menu.addAction(CreateAction(label, "Create a new window displaying branch events", lambda a=None,x=dbid: self.NewBranchView(x), self))
label = "Selected branches" if branches_events == 1 else "Selected branches " + "(id=" + dbid + ")"
- reports_menu.addAction(CreateAction(label, "Create a new window displaying branch events", lambda x=dbid: self.NewSelectedBranchView(x), self))
+ reports_menu.addAction(CreateAction(label, "Create a new window displaying branch events", lambda a=None,x=dbid: self.NewSelectedBranchView(x), self))
def TableMenu(self, tables, menu):
table_menu = menu.addMenu("&Tables")
for table in tables:
- table_menu.addAction(CreateAction(table, "Create a new window containing a table view", lambda t=table: self.NewTableView(t), self))
+ table_menu.addAction(CreateAction(table, "Create a new window containing a table view", lambda a=None,t=table: self.NewTableView(t), self))
def NewCallGraph(self):
CallGraphWindow(self.glb, self)
@@ -3039,6 +3052,7 @@ def Main():
usage_str = "exported-sql-viewer.py [--pyside-version-1] <database name>\n" \
" or: exported-sql-viewer.py --help-only"
ap = argparse.ArgumentParser(usage = usage_str, add_help = False)
+ ap.add_argument("--pyside-version-1", action='store_true')
ap.add_argument("dbname", nargs="?")
ap.add_argument("--help-only", action='store_true')
args = ap.parse_args()
--
2.17.1
next prev parent reply other threads:[~2019-04-12 11:39 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-12 11:38 [PATCH 0/8] perf scripts python: Support pyside2 and misc Intel PT Adrian Hunter
2019-04-12 11:38 ` [PATCH 1/8] perf scripts python: exported-sql-viewer.py: Change python2 to python Adrian Hunter
2019-05-30 8:17 ` [tip:perf/core] " tip-bot for Adrian Hunter
2019-04-12 11:38 ` [PATCH 2/8] perf scripts python: exported-sql-viewer.py: Use argparse module for argument parsing Adrian Hunter
2019-05-30 8:18 ` [tip:perf/core] " tip-bot for Adrian Hunter
2019-04-12 11:38 ` Adrian Hunter [this message]
2019-05-30 8:19 ` [tip:perf/core] perf scripts python: exported-sql-viewer.py: Add support for pyside2 tip-bot for Adrian Hunter
2019-04-12 11:38 ` [PATCH 4/8] perf scripts python: export-to-sqlite.py: " Adrian Hunter
2019-05-30 8:19 ` [tip:perf/core] " tip-bot for Adrian Hunter
2019-04-12 11:38 ` [PATCH 5/8] perf scripts python: export-to-postgresql.py: " Adrian Hunter
2019-05-30 8:20 ` [tip:perf/core] " tip-bot for Adrian Hunter
2019-04-12 11:38 ` [PATCH 6/8] perf tools: perf-with-kcore.sh: Always allow fix_buildid_cache_permissions Adrian Hunter
2019-05-30 7:52 ` [tip:perf/core] " tip-bot for Adrian Hunter
2019-04-12 11:38 ` [PATCH 7/8] perf intel-pt: Improve sync_switch Adrian Hunter
2019-05-30 8:21 ` [tip:perf/core] perf intel-pt: Improve sync_switch by processing PERF_RECORD_SWITCH* in events tip-bot for Adrian Hunter
2019-04-12 11:38 ` [PATCH 8/8] perf intel-pt: Rationalize intel_pt_sync_switch()'s use of next_tid Adrian Hunter
2019-05-30 8:21 ` [tip:perf/core] " tip-bot for Adrian Hunter
2019-04-29 7:28 ` [PATCH 0/8] perf scripts python: Support pyside2 and misc Intel PT Adrian Hunter
2019-05-20 14:39 ` Arnaldo Carvalho de Melo
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=20190412113830.4126-4-adrian.hunter@intel.com \
--to=adrian.hunter@intel.com \
--cc=acme@kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).