Exemple #1
0
 def on_component_execution_error(self, message, component):
     widget = self.get_component_widget(component)
     if widget:
         widget.set_color(ComponentWidget.error_color)
     msg = QtWidgets.QMessageBox(self)
     msg.setWindowTitle('Execution Error')
     msg.setText('Component {0} failed to execute.'.format(component.name()))
     msg.setDetailedText(message)
     msg.setIcon(QtWidgets.QMessageBox.Critical)
     # Need to use spacer to set the message box width since setFixedWidth does not work.
     spacer = QtWidgets.QSpacerItem(500, 0, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
     layout = msg.layout()
     layout.addItem(spacer, layout.rowCount(), 0, 1, layout.columnCount())
     msg.show()
Exemple #2
0
    def remove(self, prompt=False):
        """Remove this Component from the queue.

        :param prompt: True to display a message box confirming the removal of the Component.
        """
        if prompt:
            msg_box = QtWidgets.QMessageBox()
            msg_box.setIcon(QtWidgets.QMessageBox.Question)
            msg_box.setText('Are you sure you want to remove this component?')
            msg_box.setStandardButtons(QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.Cancel)
            if msg_box.exec_() != QtWidgets.QMessageBox.Yes:
                return
        index = self.queue.index(self.comp)
        self.queue.remove(index)
        self.queue_layout.takeAt(index)
        self.deleteLater()