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 2/6] perf scripts python: exported-sql-viewer.py: Add HBoxLayout and VBoxLayout
Date: Wed, 21 Aug 2019 11:32:12 +0300 [thread overview]
Message-ID: <20190821083216.1340-3-adrian.hunter@intel.com> (raw)
In-Reply-To: <20190821083216.1340-1-adrian.hunter@intel.com>
Add layout classes HBoxLayout and VBoxLayout.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
.../scripts/python/exported-sql-viewer.py | 41 ++++++++++++++-----
1 file changed, 31 insertions(+), 10 deletions(-)
diff --git a/tools/perf/scripts/python/exported-sql-viewer.py b/tools/perf/scripts/python/exported-sql-viewer.py
index 18ad04654adc..9767a5f802e5 100755
--- a/tools/perf/scripts/python/exported-sql-viewer.py
+++ b/tools/perf/scripts/python/exported-sql-viewer.py
@@ -980,20 +980,41 @@ class CallTreeModel(CallGraphModelBase):
ids.insert(0, query.value(1))
return ids
-# Vertical widget layout
+# Vertical layout
-class VBox():
+class HBoxLayout(QHBoxLayout):
- def __init__(self, w1, w2, w3=None):
- self.vbox = QWidget()
- self.vbox.setLayout(QVBoxLayout())
+ def __init__(self, *children):
+ super(HBoxLayout, self).__init__()
+
+ self.layout().setContentsMargins(0, 0, 0, 0)
+ for child in children:
+ if child.isWidgetType():
+ self.layout().addWidget(child)
+ else:
+ self.layout().addLayout(child)
+
+# Horizontal layout
+
+class VBoxLayout(QVBoxLayout):
- self.vbox.layout().setContentsMargins(0, 0, 0, 0)
+ def __init__(self, *children):
+ super(VBoxLayout, self).__init__()
- self.vbox.layout().addWidget(w1)
- self.vbox.layout().addWidget(w2)
- if w3:
- self.vbox.layout().addWidget(w3)
+ self.layout().setContentsMargins(0, 0, 0, 0)
+ for child in children:
+ if child.isWidgetType():
+ self.layout().addWidget(child)
+ else:
+ self.layout().addLayout(child)
+
+# Vertical layout widget
+
+class VBox():
+
+ def __init__(self, *children):
+ self.vbox = QWidget()
+ self.vbox.setLayout(VBoxLayout(*children))
def Widget(self):
return self.vbox
--
2.17.1
next prev parent reply other threads:[~2019-08-21 8:33 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-21 8:32 [PATCH 0/6] perf scripts python: exported-sql-viewer.py: Add Time chart by CPU Adrian Hunter
2019-08-21 8:32 ` [PATCH 1/6] perf scripts python: exported-sql-viewer.py: Add LookupModel() Adrian Hunter
2019-10-15 5:31 ` [tip: perf/core] " tip-bot2 for Adrian Hunter
2019-08-21 8:32 ` Adrian Hunter [this message]
2019-10-15 5:31 ` [tip: perf/core] perf scripts python: exported-sql-viewer.py: Add HBoxLayout and VBoxLayout tip-bot2 for Adrian Hunter
2019-08-21 8:32 ` [PATCH 3/6] perf scripts python: exported-sql-viewer.py: Add global time range calculations Adrian Hunter
2019-10-15 5:31 ` [tip: perf/core] " tip-bot2 for Adrian Hunter
2019-08-21 8:32 ` [PATCH 4/6] perf scripts python: exported-sql-viewer.py: Tidy up Call tree call_time Adrian Hunter
2019-10-15 5:31 ` [tip: perf/core] " tip-bot2 for Adrian Hunter
2019-08-21 8:32 ` [PATCH 5/6] perf scripts python: exported-sql-viewer.py: Add ability for Call tree to open at a specified task and time Adrian Hunter
2019-10-15 5:31 ` [tip: perf/core] " tip-bot2 for Adrian Hunter
2019-08-21 8:32 ` [PATCH 6/6] perf scripts python: exported-sql-viewer.py: Add Time chart by CPU Adrian Hunter
2019-10-15 5:31 ` [tip: perf/core] " tip-bot2 for Adrian Hunter
2019-09-06 8:57 ` [PATCH 0/6] " Adrian Hunter
2019-10-03 11:01 ` Adrian Hunter
2019-10-03 13:25 ` Arnaldo Carvalho de Melo
2019-10-03 13:43 ` Arnaldo Carvalho de Melo
2019-10-04 8:33 ` 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=20190821083216.1340-3-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).