Esempio n. 1
0
    def __init__(self, data, summary, parent=None):
        super().__init__(parent)

        layout = QVBoxLayout()
        types = []
        patts.connect()
        try:
            info = self._title_info(data)
            self._title_string = _('Reports.summaryFor').format(info)

            titleLabel = QLabel(self._title_string)
            titleLabelFont = titleLabel.font()
            titleLabelFont.setBold(True)
            titleLabel.setFont(titleLabelFont)
            layout.addWidget(titleLabel)

            sort_types(list(summary.keys()), types)
            for type in types:
                if type not in summary:
                    continue

                type_info = patts.get_type_byid(type)

                resultBox = QHBoxLayout()
                resultBox.addWidget(QLabel(type_info['displayName'] + ':'))
                resultBox.addStretch(1)
                resultBox.addWidget(QLabel(result_stamp(summary[type])))

                layout.addLayout(resultBox)
        finally:
            patts.close()

        self.setWindowTitle(_('Reports.summaryResults'))
        self.setLayout(layout)
Esempio n. 2
0
 def data(self, index, role):
     if role in (Qt.DisplayRole, Qt.EditRole) and index.row() > 0:
         if index.column() == 0:
             type = patts.get_type_byid(self._rows[index.row()][1])
             return type['displayName']
         elif index.column() == 1:
             return self._rows[index.row()][2]
         else:
             return None
Esempio n. 3
0
 def data(self, index, role):
     if role in (Qt.DisplayRole, Qt.EditRole) and index.row() > 0:
         if index.column() == 0:
             type = patts.get_type_byid(self._rows[index.row()][1])
             return type['displayName']
         elif index.column() == 1:
             return self._rows[index.row()][2]
         else:
             return None
Esempio n. 4
0
 def _title_info(self, type):
     type = patts.get_type_byid(type)
     return type['displayName']