/usr/lib/python2.7/dist-packages/pyqtgraph/examples/TreeWidget.py is in python-pyqtgraph 0.9.10-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | # -*- coding: utf-8 -*-
"""
Simple demonstration of TreeWidget, which is an extension of QTreeWidget
that allows widgets to be added and dragged within the tree more easily.
"""
import initExample ## Add path to library (just for examples; you do not need this)
import pyqtgraph as pg
from pyqtgraph.Qt import QtCore, QtGui
import numpy as np
app = QtGui.QApplication([])
w = pg.TreeWidget()
w.setColumnCount(2)
w.show()
w.setWindowTitle('pyqtgraph example: TreeWidget')
i1 = QtGui.QTreeWidgetItem(["Item 1"])
i11 = QtGui.QTreeWidgetItem(["Item 1.1"])
i12 = QtGui.QTreeWidgetItem(["Item 1.2"])
i2 = QtGui.QTreeWidgetItem(["Item 2"])
i21 = QtGui.QTreeWidgetItem(["Item 2.1"])
i211 = pg.TreeWidgetItem(["Item 2.1.1"])
i212 = pg.TreeWidgetItem(["Item 2.1.2"])
i22 = pg.TreeWidgetItem(["Item 2.2"])
i3 = pg.TreeWidgetItem(["Item 3"])
i4 = pg.TreeWidgetItem(["Item 4"])
i5 = pg.TreeWidgetItem(["Item 5"])
b5 = QtGui.QPushButton('Button')
i5.setWidget(1, b5)
w.addTopLevelItem(i1)
w.addTopLevelItem(i2)
w.addTopLevelItem(i3)
w.addTopLevelItem(i4)
w.addTopLevelItem(i5)
i1.addChild(i11)
i1.addChild(i12)
i2.addChild(i21)
i21.addChild(i211)
i21.addChild(i212)
i2.addChild(i22)
b1 = QtGui.QPushButton("Button")
w.setItemWidget(i1, 1, b1)
## Start Qt event loop unless running in interactive mode or using pyside.
if __name__ == '__main__':
import sys
if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
QtGui.QApplication.instance().exec_()
|