

@staticmethod
def create_component(collection):
    'Present user with a dialog to define and add new components.\n\n        Parameters\n        ----------\n        collection : A `DataCollection` to edit\n        '
    widget = CustomComponentWidget(collection)
    while True:
        widget.ui.show()
        if (widget.ui.exec_() == QtGui.QDialog.Accepted):
            if (len(str(widget.ui.expression.toPlainText())) == 0):
                QtGui.QMessageBox.critical(widget.ui, 'Error', 'No expression set', buttons=QtGui.QMessageBox.Ok)
            elif (widget._number_targets == 0):
                QtGui.QMessageBox.critical(widget.ui, 'Error', 'Please specify the target dataset(s)', buttons=QtGui.QMessageBox.Ok)
            elif (len(widget.ui.new_label.text()) == 0):
                QtGui.QMessageBox.critical(widget.ui, 'Error', 'Please specify the new component name', buttons=QtGui.QMessageBox.Ok)
            else:
                link = widget._create_link()
                if link:
                    widget._add_link_to_targets(link)
                break
        else:
            break

dataset/ETHPy150Open glue-viz/glue/glue/dialogs/custom_component/qt/widget.py CustomComponentWidget.create_component/original