def nH_widgetBuilder(cls, ast, astTools): # Make the frame widget = QFrame() layout = QVBoxLayout() widget.setLayout(layout) terminalsDict = {} # Save the last_intro_node widget.last_intro_node = 66 # Set up the title titleString = 'De-La-Mo Initialization' titleLabel = simpleWidgets.simpleLabel(titleString) titleLabel.setAlignment(Qt.AlignHCenter) intro_dump = '' for i in range(widget.last_intro_node): intro_dump += ast[i].dumps() intro_dump += '\n' titleLabel.setToolTip(intro_dump) layout.addWidget(titleLabel) descriptionText = \ 'This block hides a significant amount of the initialization of the script. It holds \n \ the code that imports de-la-mo modules, loads parameters, and instantiates tools used \n \ in the rest of the script. It is not important to the end user, but if the user is \n \ interested they may right click on the block and select \'Split\' from the menu, or \n \ the user may look at the raw code in a text editor.' description = simpleWidgets.simpleLabel(descriptionText) description.setAlignment(Qt.AlignHCenter) layout.addWidget(description) # input and output lists input_labels_tooltips_nodes = [] output_labels_tooltips_nodes = [] # Example # DM_label = 'DM Object : ' # DM_tooltip = 'Name of the de-la-mo model object' # DM_node = node.value.value[2].value[0] # input_labels_tooltips_nodes.append([DM_label,DM_tooltip,DM_node]) # Node 16 DM_label = 'DM Object : ' DM_tooltip = 'Name of the de-la-mo model object' DM_node = ast[16].target output_labels_tooltips_nodes.append([DM_label, DM_tooltip, DM_node]) # Node 34 ScriptName_label = 'Script Name : ' ScriptName_tooltip = 'Should match the name of the python script open here, with quotes.' ScriptName_node = ast[34].value.value[2][0].value input_labels_tooltips_nodes.append( [ScriptName_label, ScriptName_tooltip, ScriptName_node]) # Node 41 parameter_label = 'Abaqus Parameter File : ' parameter_tooltip = '' parameter_node = ast[41].value[2][0].value input_labels_tooltips_nodes.append( [parameter_label, parameter_tooltip, parameter_node]) # Add a horizontal widget to put the input and output widgets into # Output vertical layout input_output_widget = QWidget() input_output_layout = QHBoxLayout() input_output_widget.setLayout(input_output_layout) # input vertical layout input_widget = QWidget() input_layout = QVBoxLayout() input_widget.setLayout(input_layout) input_Label = simpleWidgets.simpleLabel('Inputs') input_Label.setAlignment(Qt.AlignHCenter) input_layout.addWidget(input_Label) # Build the GUI for label, tooltip, astNode in input_labels_tooltips_nodes: eachWidget, eachLayout = simpleWidgets.simpleWidget() eachLabel = simpleWidgets.simpleLabel(label) eachLabel.setToolTip(tooltip) eachLE = terminalWidgets.LE_terminal() # eachLE = terminalWidgets.COMBO_terminal() eachLE.setup(astNode) eachLayout.addWidget(eachLabel) eachLayout.addWidget(eachLE, 1) # eachLayout.addStretch(1) input_layout.addWidget(eachWidget, 1) terminalsDict.update({id(eachLE): eachLE}) # Outputs # Output vertical layout output_widget = QWidget() output_layout = QVBoxLayout() output_widget.setLayout(output_layout) output_Label = simpleWidgets.simpleLabel('Outputs') output_Label.setAlignment(Qt.AlignHCenter) output_layout.addWidget(output_Label) # Build the GUI for label, tooltip, astNode in output_labels_tooltips_nodes: eachWidget, eachLayout = simpleWidgets.simpleWidget() eachLabel = simpleWidgets.simpleLabel(label) eachLabel.setToolTip(tooltip) eachLE = terminalWidgets.LE_terminal() # eachLE = terminalWidgets.COMBO_terminal() eachLE.setup(astNode) eachLayout.addWidget(eachLabel) eachLayout.addWidget(eachLE, 1) # eachLayout.addStretch(1) output_layout.addWidget(eachWidget, 1) terminalsDict.update({id(eachLE): eachLE}) # Add output and input widgets to the main input_output_layout input_output_layout.addWidget(output_widget) input_output_layout.addWidget(input_widget) # Add input_output_widget to the main layout layout.addWidget(input_output_widget) return widget, terminalsDict