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

perf scripts python: exported-sql-viewer.py: Factor out TreeWindowBase

Factor out a base class TreeWindowBase from CallGraphWindow, so that
TreeWindowBase can be reused.
Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: https://lkml.kernel.org/n/tip-ifirw0c0mhkwxg6l12lk6k4p@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent febce6dc
...@@ -693,28 +693,16 @@ class VBox(): ...@@ -693,28 +693,16 @@ class VBox():
def Widget(self): def Widget(self):
return self.vbox return self.vbox
# Context-sensitive call graph window # Tree window base
class CallGraphWindow(QMdiSubWindow):
def __init__(self, glb, parent=None):
super(CallGraphWindow, self).__init__(parent)
self.model = LookupCreateModel("Context-Sensitive Call Graph", lambda x=glb: CallGraphModel(x)) class TreeWindowBase(QMdiSubWindow):
self.view = QTreeView() def __init__(self, parent=None):
self.view.setModel(self.model) super(TreeWindowBase, self).__init__(parent)
for c, w in ((0, 250), (1, 100), (2, 60), (3, 70), (4, 70), (5, 100)):
self.view.setColumnWidth(c, w)
self.find_bar = FindBar(self, self)
self.vbox = VBox(self.view, self.find_bar.Widget())
self.setWidget(self.vbox.Widget())
AddSubWindow(glb.mainwindow.mdi_area, self, "Context-Sensitive Call Graph") self.model = None
self.view = None
self.find_bar = None
def DisplayFound(self, ids): def DisplayFound(self, ids):
if not len(ids): if not len(ids):
...@@ -747,6 +735,30 @@ class CallGraphWindow(QMdiSubWindow): ...@@ -747,6 +735,30 @@ class CallGraphWindow(QMdiSubWindow):
if not found: if not found:
self.find_bar.NotFound() self.find_bar.NotFound()
# Context-sensitive call graph window
class CallGraphWindow(TreeWindowBase):
def __init__(self, glb, parent=None):
super(CallGraphWindow, self).__init__(parent)
self.model = LookupCreateModel("Context-Sensitive Call Graph", lambda x=glb: CallGraphModel(x))
self.view = QTreeView()
self.view.setModel(self.model)
for c, w in ((0, 250), (1, 100), (2, 60), (3, 70), (4, 70), (5, 100)):
self.view.setColumnWidth(c, w)
self.find_bar = FindBar(self, self)
self.vbox = VBox(self.view, self.find_bar.Widget())
self.setWidget(self.vbox.Widget())
AddSubWindow(glb.mainwindow.mdi_area, self, "Context-Sensitive Call Graph")
# Child data item finder # Child data item finder
class ChildDataItemFinder(): class ChildDataItemFinder():
......
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