Exemplo n.º 1
0
        def create_table_item(column, itemname, invalid_value_count, log_size,
                              callable, *args):
            item = QStandardItem()
            item.setEditable(False)
            #format if there is invalid data entries
            if invalid_value_count == -1:
                item.setData(DEEP_RED, Qt.BackgroundRole)
                item.setToolTip(
                    "All of the values in the log are marked invalid, none of them are filtered."
                )
            elif invalid_value_count > 0:
                saturation = 10 + (170 * (invalid_value_count /
                                          (log_size + invalid_value_count)))
                item.setData(QColor.fromHsv(0, saturation, 255),
                             Qt.BackgroundRole)
                aux_verb = "is" if invalid_value_count == 1 else "are"
                item.setToolTip(
                    f"{invalid_value_count}/{log_size+invalid_value_count} of the values in the log"
                    f" {aux_verb} marked invalid, and {aux_verb} filtered.")
            try:
                item.setText(callable(*args))
            except Exception as exc:
                logger.warning("Error setting column {} for log {}: {}".format(
                    column, itemname, str(exc)))

            return item
Exemplo n.º 2
0
 def on_debug_message(self, message):
     msg = 'DEBUG - occurred at: [ {} ]\n{}'.format(
         NotificationsWidget._get_time(),
         NotificationsWidget._strip_new_line(message))
     notification_item = QStandardItem()
     notification_item.setText(msg)
     notification_item.setIcon(QIcon.fromTheme('dialog-question'))
     notification_item.setEditable(False)
     self.all_notification_model.appendRow(notification_item)
Exemplo n.º 3
0
        def create_table_item(column, itemname, callable, *args):
            item = QStandardItem()
            item.setEditable(False)
            try:
                item.setText(callable(*args))
            except Exception as exc:
                logger.warning("Error setting column {} for log {}: {}".format(
                    column, itemname, str(exc)))

            return item
Exemplo n.º 4
0
 def on_error_message(self, message):
     msg = 'ERROR - occurred at: [ {} ]\n{}'.format(
         NotificationsWidget._get_time(),
         NotificationsWidget._strip_new_line(message))
     LOG.debug('-----on_error_message called: {}'.format(message))
     notification_item = QStandardItem()
     notification_item.setText(msg)
     notification_item.setIcon(QIcon.fromTheme('dialog-error'))
     notification_item.setEditable(False)
     self.all_notification_model.appendRow(notification_item)
Exemplo n.º 5
0
    def on_debug_message(self, message):
        timestamp = time()
        dt_object = datetime.fromtimestamp(timestamp)

        current_time = str(dt_object)

        msg = 'DEBUG\nTIME {}\n  {}'.format(current_time, message)
        notification_item = QStandardItem()
        notification_item.setText(msg)
        notification_item.setIcon(QIcon.fromTheme('dialog-question'))
        notification_item.setEditable(False)
        self.all_notification_model.appendRow(notification_item)
Exemplo n.º 6
0
 def addItem(self, text, data=None, toolTip=None):
     item = QStandardItem()
     item.setText(text)
     if data is None:
         item.setData(text)
     else:
         item.setData(data)
     if toolTip is not None:
         item.setToolTip(toolTip)
     item.setFlags(Qt.ItemIsEnabled | Qt.ItemIsUserCheckable)
     item.setData(Qt.Checked if text in self.checkItems else Qt.Unchecked, Qt.CheckStateRole)
     self.model().appendRow(item)
Exemplo n.º 7
0
 def getItemModel(self):
     """Return a QModel made from the current workspace. This should be set
     onto a QTableView
     """
     model = QStandardItemModel()
     model.setHorizontalHeaderLabels(["Name", "Type", "Value", "Units"])
     model.setColumnCount(4)
     for key in self.get_log_names():
         log = self.run.getLogData(key)
         name = QStandardItem()
         name.setText(log.name)
         name.setEditable(False)
         log_type = QStandardItem()
         log_type.setText(get_type(log))
         log_type.setEditable(False)
         value = QStandardItem()
         value.setText(str(get_value(log)))
         value.setEditable(False)
         unit = QStandardItem()
         unit.setText(log.units)
         unit.setEditable(False)
         model.appendRow((name, log_type, value, unit))
     model.sort(0)
     return model
Exemplo n.º 8
0
 def getItemModel(self):
     """Return a QModel made from the current workspace. This should be set
     onto a QTableView
     """
     model = QStandardItemModel()
     model.setHorizontalHeaderLabels(["Name", "Type", "Value", "Units"])
     model.setColumnCount(4)
     for key in self.get_log_names():
         log = self.run.getLogData(key)
         name = QStandardItem()
         name.setText(log.name)
         name.setEditable(False)
         log_type = QStandardItem()
         log_type.setText(get_type(log))
         log_type.setEditable(False)
         value = QStandardItem()
         value.setText(str(get_value(log)))
         value.setEditable(False)
         unit = QStandardItem()
         unit.setText(log.units)
         unit.setEditable(False)
         model.appendRow((name, log_type, value, unit))
     model.sort(0)
     return model