forked from M-Labs/artiq
gui/datasets: tree view
This commit is contained in:
parent
107d8f0ffa
commit
9c5db288a5
|
@ -8,7 +8,7 @@ from pyqtgraph import dockarea
|
||||||
from pyqtgraph import LayoutWidget
|
from pyqtgraph import LayoutWidget
|
||||||
|
|
||||||
from artiq.tools import short_format
|
from artiq.tools import short_format
|
||||||
from artiq.gui.models import DictSyncModel
|
from artiq.gui.models import DictSyncTreeSepModel
|
||||||
from artiq.gui.displays import *
|
from artiq.gui.displays import *
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -20,17 +20,14 @@ except AttributeError:
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class Model(DictSyncModel):
|
class Model(DictSyncTreeSepModel):
|
||||||
def __init__(self, init):
|
def __init__(self, init):
|
||||||
DictSyncModel.__init__(self, ["Dataset", "Persistent", "Value"], init)
|
DictSyncTreeSepModel.__init__(self, ".",
|
||||||
|
["Dataset", "Persistent", "Value"],
|
||||||
def sort_key(self, k, v):
|
init)
|
||||||
return k
|
|
||||||
|
|
||||||
def convert(self, k, v, column):
|
def convert(self, k, v, column):
|
||||||
if column == 0:
|
if column == 1:
|
||||||
return k
|
|
||||||
elif column == 1:
|
|
||||||
return "Y" if v[0] else "N"
|
return "Y" if v[0] else "N"
|
||||||
elif column == 2:
|
elif column == 2:
|
||||||
return short_format(v[1])
|
return short_format(v[1])
|
||||||
|
@ -58,10 +55,9 @@ class DatasetsDock(dockarea.Dock):
|
||||||
self.search.editingFinished.connect(self._search_datasets)
|
self.search.editingFinished.connect(self._search_datasets)
|
||||||
grid.addWidget(self.search, 0, 0)
|
grid.addWidget(self.search, 0, 0)
|
||||||
|
|
||||||
self.table = QtGui.QTableView()
|
self.table = QtGui.QTreeView()
|
||||||
self.table.setSelectionMode(QtGui.QAbstractItemView.NoSelection)
|
self.table.setSelectionMode(QtGui.QAbstractItemView.NoSelection)
|
||||||
self.table.horizontalHeader().setResizeMode(
|
self.table.header().setResizeMode(QtGui.QHeaderView.ResizeToContents)
|
||||||
QtGui.QHeaderView.ResizeToContents)
|
|
||||||
grid.addWidget(self.table, 1, 0)
|
grid.addWidget(self.table, 1, 0)
|
||||||
|
|
||||||
self.table_model = Model(dict())
|
self.table_model = Model(dict())
|
||||||
|
|
Loading…
Reference in New Issue