Skip to content

Commit

Permalink
perf scripts python: exported-sql-viewer.py: Factor out TreeWindowBase
Browse files Browse the repository at this point in the history
Factor out a base class TreeWindowBase from CallGraphWindow, so that
TreeWindowBase can be reused.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: https://lkml.kernel.org/n/tip-ifirw0c0mhkwxg6l12lk6k4p@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
  • Loading branch information
Adrian Hunter authored and Arnaldo Carvalho de Melo committed Mar 1, 2019
1 parent febce6d commit a731cc4
Showing 1 changed file with 31 additions and 19 deletions.
50 changes: 31 additions & 19 deletions tools/perf/scripts/python/exported-sql-viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -693,28 +693,16 @@ def __init__(self, w1, w2, w3=None):
def Widget(self):
return self.vbox

# Context-sensitive call graph window

class CallGraphWindow(QMdiSubWindow):

def __init__(self, glb, parent=None):
super(CallGraphWindow, self).__init__(parent)
# Tree window base

self.model = LookupCreateModel("Context-Sensitive Call Graph", lambda x=glb: CallGraphModel(x))
class TreeWindowBase(QMdiSubWindow):

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())
def __init__(self, parent=None):
super(TreeWindowBase, self).__init__(parent)

AddSubWindow(glb.mainwindow.mdi_area, self, "Context-Sensitive Call Graph")
self.model = None
self.view = None
self.find_bar = None

def DisplayFound(self, ids):
if not len(ids):
Expand Down Expand Up @@ -747,6 +735,30 @@ def FindDone(self, ids):
if not found:
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

class ChildDataItemFinder():
Expand Down

0 comments on commit a731cc4

Please sign in to comment.