def __init__(self, text="Upload Structure", node_class=None, **kwargs):
        """ Upload a structure and store it in AiiDA database.

        :param text: Text to display before upload button
        :type text: str
        :param node_class: AiiDA node class for storing the structure.
            Possible values: 'StructureData', 'CifData' or None (let the user decide).
            Note: If your workflows require a specific node class, better fix it here.

        """

        self.file_upload = FileUploadWidget(text)
        self.viewer = nglview.NGLWidget()
        self.btn_store = ipw.Button(
            description='Store in AiiDA', disabled=True)
        self.structure_description = ipw.Text(
            placeholder="Description (optional)")

        self.structure_ase = None
        self.structure_node = None
        self.data_format = ipw.RadioButtons(
            options=self.DATA_FORMATS, description='Data type:')

        if node_class is None:
            store = ipw.HBox(
                [self.btn_store, self.data_format, self.structure_description])
        elif node_class not in self.DATA_FORMATS:
            raise ValueError("Unknown data format '{}'. Options: {}".format(
                node_class, self.DATA_FORMATS))
        else:
            self.data_format.value = node_class
            store = ipw.HBox([self.btn_store, self.structure_description])

        children = [self.file_upload, self.viewer, store]

        super(StructureUploadWidget, self).__init__(
            children=children, **kwargs)

        self.file_upload.observe(self._on_file_upload, names='data')
        self.btn_store.on_click(self._on_click_store)
def __init__ ( self , text = "Upload Structure" , node_class = None , ** kwargs ) : self . file_upload = FileUploadWidget ( text ) self . viewer = nglview . NGLWidget ( ) self . btn_store = ipw . Button ( description = 'Store in AiiDA' , disabled = True ) self . structure_description = ipw . Text ( placeholder = "Description (optional)" ) self . structure_ase = None self . structure_node = None self . data_format = ipw . RadioButtons ( options = self . DATA_FORMATS , description = 'Data type:' ) if node_class is None : store = ipw . HBox ( [ self . btn_store , self . data_format , self . structure_description ] ) elif node_class not in self . DATA_FORMATS : raise ValueError ( "Unknown data format '{}'. Options: {}" . format ( node_class , self . DATA_FORMATS ) ) else : self . data_format . value = node_class store = ipw . HBox ( [ self . btn_store , self . structure_description ] ) children = [ self . file_upload , self . viewer , store ] super ( StructureUploadWidget , self ) . __init__ ( children = children , ** kwargs ) self . file_upload . observe ( self . _on_file_upload , names = 'data' ) self . btn_store . on_click ( self . _on_click_store )
Upload a structure and store it in AiiDA database.

        :param text: Text to display before upload button
        :type text: str
        :param node_class: AiiDA node class for storing the structure.
            Possible values: 'StructureData', 'CifData' or None (let the user decide).
            Note: If your workflows require a specific node class, better fix it here.