6 from Vispa.Views.AbstractView
import AbstractView
9 """ Holds a table to compare event contents.
13 logging.debug(self.__class__.__name__ +
": __init__()")
14 AbstractView.__init__(self)
15 QTableWidget.__init__(self, parent)
19 self.setSelectionMode(QTableWidget.SingleSelection)
24 QTableWidget.clear(self)
25 self.setColumnCount(1)
26 self.setHorizontalHeaderLabels([
'no file selected'])
27 self.horizontalHeaderItem(0).setTextAlignment(Qt.AlignLeft)
28 self.verticalHeader().hide()
30 self.setRowCount(self.
_rows)
33 """ Adds a row to the EventContentView.
39 self.setItem(self.
_rows - 1, i, item)
41 for entry, color
in items:
43 self.setItem(self.
_rows - 1, i, item)
50 """ Fill the EventContentView using the ContentsDict.
52 logging.debug(
'EventContentView: updateContent()')
55 self.setSortingEnabled(
False)
56 names = [
"Type",
"Label",
"Product",
"Process"]
61 if not self.dataAccessor().inContent(entry,allContent):
63 allContent.sort(
lambda x, y: cmp(self.dataAccessor().
label(x).lower(), self.dataAccessor().
label(y).lower()))
64 self.setColumnCount(len(names))
65 self.setHorizontalHeaderLabels(names)
66 for i
in range(len(names)):
67 self.horizontalHeaderItem(i).setTextAlignment(Qt.AlignLeft)
68 self.setRowCount(len(allContent))
69 for entry
in allContent:
73 this_column=self.dataAccessor().inContent(entry,content)
78 if "_".
join(entry)
in comment.keys():
79 text+=
" ("+comment[
"_".
join(entry)]+
")"
84 input=
"Input: " in name
85 output=
"Output: " in name
86 if column_before!=
None:
88 if this_column
and not column_before:
90 if not this_column
and column_before:
104 column_before=this_column
105 items += [(text, color)]
108 self.setSortingEnabled(
True)
112 """ Mark an item in the TableView as selected.
115 self.setCurrentItem(item)
118 """ Return an item in the TableView with a certain object.
121 for positionName, item
in self._itemDict.items():
122 if item.object == self.dataAccessor().
label(object):
123 items += [(positionName, item)]
125 return sorted(items)[0][1]
130 """ A QTableWidgetItem with a convenient constructor.
135 QTableWidgetItem.__init__(self, name)
136 self.setToolTip(tooltip)
137 self.setFlags(Qt.ItemIsEnabled)
138 self.setBackgroundColor(color)
static std::string join(char **cmd)