def create_widgets(self): """creates the display window""" # Text Size model_name = '' self.nodes_label = QLabel("Nodes:") self.nodes_edit = QNodeEdit(self, model_name, pick_style='area', tab_to_next=False) self.elements_label = QLabel("Elements:") self.elements_edit = QNodeEdit(self, model_name, pick_style='area', tab_to_next=False) #----------------------------------------------------------------------- # Highlight Color #self.highlight_opacity_label = QLabel("Highlight Opacity:") #self.highlight_opacity_edit = QDoubleSpinBox(self) #self.highlight_opacity_edit.setValue(self._highlight_opacity) #self.highlight_opacity_edit.setRange(0.1, 1.0) #self.highlight_opacity_edit.setDecimals(1) #self.highlight_opacity_edit.setSingleStep(0.1) #self.highlight_opacity_button = QPushButton("Default") # Text Color #self.highlight_color_label = QLabel("Highlight Color:") #self.highlight_color_edit = QPushButtonColor(self.highlight_color_int) #----------------------------------------------------------------------- # closing self.show_button = QPushButton("Show") self.close_button = QPushButton("Close")
def create_widgets(self): """creates the display window""" # Text Size model_name = self.model_name self.nodes_label = QLabel('Nodes:') self.nodes_edit = QNodeEdit(self, model_name, pick_style='area', cleanup=True, tab_to_next=False) self.elements_label = QLabel('Elements:') self.elements_edit = QElementEdit(self, model_name, pick_style='area', cleanup=True, tab_to_next=False) #----------------------------------------------------------------------- # Highlight Color if self.menu_type == 'highlight': self.highlight_opacity_label = QLabel('Highlight Opacity:') self.highlight_opacity_edit = QDoubleSpinBox(self) self.highlight_opacity_edit.setValue(self._highlight_opacity) self.highlight_opacity_edit.setRange(0.1, 1.0) self.highlight_opacity_edit.setDecimals(1) self.highlight_opacity_edit.setSingleStep(0.1) self.highlight_opacity_button = QPushButton('Default') # Text Color self.highlight_color_label = QLabel('Highlight Color:') self.highlight_color_edit = QPushButtonColor( self.highlight_color_int) self.point_size_label = QLabel('Point Size:') self.point_size_edit = QSpinBox(self) self.point_size_edit.setValue(self._point_size) self.point_size_edit.setRange(7, 30) #self.point_size_button = QPushButton("Default") elif self.menu_type == 'mark': self.label_size_label = QLabel('Label Size:') self.label_size_edit = QSpinBox(self) self.label_size_edit.setValue(self._default_annotation_size) self.label_size_edit.setRange(7, 30) #self.label_size_button = QPushButton("Default") else: raise NotImplementedError(self.menu_type) #----------------------------------------------------------------------- # closing #if self.menu_type == 'highlight': self.show_button = QPushButton('Show') #elif self.menu_type == 'mark': #self.mark_button = QCheckBox('Mark') #else: #raise NotImplementedError(self.menu_type) self.clear_button = QPushButton('Clear') self.close_button = QPushButton('Close')
def create_widgets(self): """creates the display window""" # Text Size model_name = self.model_name self.nodes_label = QLabel("Nodes:") self.nodes_edit = QNodeEdit(self, model_name, pick_style='area', cleanup=True, tab_to_next=False) self.elements_label = QLabel("Elements:") self.elements_edit = QElementEdit(self, model_name, pick_style='area', cleanup=True, tab_to_next=False) #----------------------------------------------------------------------- # Highlight Color self.highlight_opacity_label = QLabel("Highlight Opacity:") self.highlight_opacity_edit = QDoubleSpinBox(self) self.highlight_opacity_edit.setValue(self._highlight_opacity) self.highlight_opacity_edit.setRange(0.1, 1.0) self.highlight_opacity_edit.setDecimals(1) self.highlight_opacity_edit.setSingleStep(0.1) self.highlight_opacity_button = QPushButton("Default") # Text Color self.highlight_color_label = QLabel("Highlight Color:") self.highlight_color_edit = QPushButtonColor(self.highlight_color_int) self.point_size_label = QLabel("Point Size:") self.point_size_edit = QSpinBox(self) self.point_size_edit.setValue(self._point_size) self.point_size_edit.setRange(7, 30) #self.point_size_button = QPushButton("Default") self.label_size_label = QLabel("Label Size:") self.label_size_edit = QSpinBox(self) self.label_size_edit.setValue(self._default_text_size) self.label_size_edit.setRange(7, 30) #self.label_size_button = QPushButton("Default") #----------------------------------------------------------------------- # closing self.show_button = QPushButton("Show") self.mark_button = QCheckBox("Mark") self.clear_button = QPushButton("Clear") self.close_button = QPushButton("Close")
def __init__(self, data, controls, win_parent=None): """create a cONTROL surface""" PyDialog.__init__(self, data, win_parent) self._updated_menu = False self.controls = controls self.comment_label = QLabel('Comment') self.comment_edit = QLineEdit() self.eid_label = QLabel('Element ID') self.eid_edit = QElementEdit(self, str(''), pick_style='single', tab_to_next=False) self.pid_label = QLabel('Property ID') self.pid_edit = QLineEdit() self.mid_label = QLabel('Material ID') self.mid_edit = QLineEdit() self.n1_label = QLabel('Node 1') self.n2_label = QLabel('Node 2') self.n3_label = QLabel('Node 3') self.n4_label = QLabel('Node 4') self.n5_label = QLabel('Node 5') self.n6_label = QLabel('Node 6') self.n7_label = QLabel('Node 7') self.n8_label = QLabel('Node 8') self.n9_label = QLabel('Node 9') self.n10_label = QLabel('Node 10') self.n1_edit = QNodeEdit(self, str(''), pick_style='single', tab_to_next=True) self.n2_edit = QNodeEdit(self, str(''), pick_style='single', tab_to_next=True) self.n3_edit = QNodeEdit(self, str(''), pick_style='single', tab_to_next=True) self.n4_edit = QNodeEdit(self, str(''), pick_style='single', tab_to_next=True) self.n5_edit = QNodeEdit(self, str(''), pick_style='single', tab_to_next=True) self.n6_edit = QNodeEdit(self, str(''), pick_style='single', tab_to_next=True) self.n7_edit = QNodeEdit(self, str(''), pick_style='single', tab_to_next=True) self.n8_edit = QNodeEdit(self, str(''), pick_style='single', tab_to_next=True) self.n9_edit = QNodeEdit(self, str(''), pick_style='single', tab_to_next=True) self.n10_edit = QNodeEdit(self, str(''), pick_style='single', tab_to_next=True) for inode in range(3, 10 + 1): # 3-10 inode_label = 'n%i_label' % inode inode_edit = 'n%i_edit' % inode getattr(self, inode_label).setVisible(False) getattr(self, inode_edit).setVisible(False) self.mcsid_label = QLabel('Material Coord') self.mcsid_pulldown = QComboBox() self.element_type_label = QLabel('Element Type') self.element_type_pulldown = QComboBox() ELEMENT_TYPES = ['CROD', 'CONROD', 'CTRIA3', 'CQUAD4'] self.element_types = ELEMENT_TYPES for element_type in ELEMENT_TYPES: self.element_type_pulldown.addItem(element_type) self.element_type = ELEMENT_TYPES[0] self.method_type_label = QLabel('Method Type') self.method_type_pulldown = QComboBox() self.method_types = ['Create', 'Edit', 'Delete'] METHOD_TYPES = ['Create', 'Edit', 'Delete'] for method_type in METHOD_TYPES: self.method_type_pulldown.addItem(method_type) self.method_type = METHOD_TYPES[0] #cases = get_cases_from_tree(self.controls) #parent = self #name = 'main' #data = self.controls #choices = cases #self.results_widget_label = QLabel('Results:') #self.results_widget = ResultsWindow( #parent, name, data, choices, #include_clear=False, include_delete=True, #include_results=False) self.add_button = QPushButton('Create') self.delete_button = QPushButton('Delete') self.apply_button = QPushButton('Apply') self.setup_layout() self.setup_connections()
class ElementWindow(PyDialog): """ +------------------------+ | | |- + controls | | | | | +-- name | | | | | +-- name | | | | Create/Edit/Delete | | Type SKIN3 | | eid ____ | | pid ____ | | n1 ____ | | n2 ____ | | n3 ____ | | | | Apply | | | +------------------------+ TODO: handle losing focus not still picking, which can cause the property_id to get set to the element_id/node_id """ def __init__(self, data, controls, win_parent=None): """create a cONTROL surface""" PyDialog.__init__(self, data, win_parent) self._updated_menu = False self.controls = controls self.comment_label = QLabel('Comment') self.comment_edit = QLineEdit() self.eid_label = QLabel('Element ID') self.eid_edit = QElementEdit(self, str(''), pick_style='single', tab_to_next=False) self.pid_label = QLabel('Property ID') self.pid_edit = QLineEdit() self.mid_label = QLabel('Material ID') self.mid_edit = QLineEdit() self.n1_label = QLabel('Node 1') self.n2_label = QLabel('Node 2') self.n3_label = QLabel('Node 3') self.n4_label = QLabel('Node 4') self.n5_label = QLabel('Node 5') self.n6_label = QLabel('Node 6') self.n7_label = QLabel('Node 7') self.n8_label = QLabel('Node 8') self.n9_label = QLabel('Node 9') self.n10_label = QLabel('Node 10') self.n1_edit = QNodeEdit(self, str(''), pick_style='single', tab_to_next=True) self.n2_edit = QNodeEdit(self, str(''), pick_style='single', tab_to_next=True) self.n3_edit = QNodeEdit(self, str(''), pick_style='single', tab_to_next=True) self.n4_edit = QNodeEdit(self, str(''), pick_style='single', tab_to_next=True) self.n5_edit = QNodeEdit(self, str(''), pick_style='single', tab_to_next=True) self.n6_edit = QNodeEdit(self, str(''), pick_style='single', tab_to_next=True) self.n7_edit = QNodeEdit(self, str(''), pick_style='single', tab_to_next=True) self.n8_edit = QNodeEdit(self, str(''), pick_style='single', tab_to_next=True) self.n9_edit = QNodeEdit(self, str(''), pick_style='single', tab_to_next=True) self.n10_edit = QNodeEdit(self, str(''), pick_style='single', tab_to_next=True) for inode in range(3, 10 + 1): # 3-10 inode_label = 'n%i_label' % inode inode_edit = 'n%i_edit' % inode getattr(self, inode_label).setVisible(False) getattr(self, inode_edit).setVisible(False) self.mcsid_label = QLabel('Material Coord') self.mcsid_pulldown = QComboBox() self.element_type_label = QLabel('Element Type') self.element_type_pulldown = QComboBox() ELEMENT_TYPES = ['CROD', 'CONROD', 'CTRIA3', 'CQUAD4'] self.element_types = ELEMENT_TYPES for element_type in ELEMENT_TYPES: self.element_type_pulldown.addItem(element_type) self.element_type = ELEMENT_TYPES[0] self.method_type_label = QLabel('Method Type') self.method_type_pulldown = QComboBox() self.method_types = ['Create', 'Edit', 'Delete'] METHOD_TYPES = ['Create', 'Edit', 'Delete'] for method_type in METHOD_TYPES: self.method_type_pulldown.addItem(method_type) self.method_type = METHOD_TYPES[0] #cases = get_cases_from_tree(self.controls) #parent = self #name = 'main' #data = self.controls #choices = cases #self.results_widget_label = QLabel('Results:') #self.results_widget = ResultsWindow( #parent, name, data, choices, #include_clear=False, include_delete=True, #include_results=False) self.add_button = QPushButton('Create') self.delete_button = QPushButton('Delete') self.apply_button = QPushButton('Apply') self.setup_layout() self.setup_connections() def setup_connections(self): self.element_type_pulldown.currentIndexChanged.connect( self.on_element_type) self.method_type_pulldown.currentIndexChanged.connect( self.on_method_type) def on_element_type(self, value): """ element type pulldown (BEAM, SKIN3, SKIN4) Parameters ---------- value : int index in element_types """ #animation_types = [BEAM, SKIN3, SKIN4] element_type = self.element_types[value] #func_map = { #'CROD': self.on_show_crod, #'CONROD': self.on_show_conrod, #'CTRIA3': self.on_show_shell, #'CQUAD4': self.on_show_shell, #} #func = func_map[element_type] param_map = { 'CROD': ['pid'], 'CONROD': ['mid'], 'CTRIA3': ['pid', 'n3', 'mcsid'], 'CQUAD4': ['pid', 'n3', 'n4', 'mcsid'], } params = param_map[element_type] self._update_func(element_type, params) def _update_func(self, element_type, params): """updates the menu""" is_pid = 'pid' in params is_mid = 'mid' in params is_mcsid = 'mcsid' in params self.pid_label.setVisible(is_pid) self.pid_edit.setVisible(is_pid) self.mid_label.setVisible(is_mid) self.mid_edit.setVisible(is_mid) for inode in range(3, 10 + 1): # 3-10 is_ni = 'n%i' % inode in params inode_label = 'n%i_label' % inode inode_edit = 'n%i_edit' % inode getattr(self, inode_label).setVisible(is_ni) getattr(self, inode_edit).setVisible(is_ni) self.mcsid_label.setVisible(is_mcsid) self.mcsid_pulldown.setVisible(is_mcsid) def on_method_type(self, value): """ element type pulldown (Create, Edit, Delete) Parameters ---------- value : int index in element_types """ #animation_types = [BEAM, SKIN3, SKIN4] method_type = self.method_types[value] enable = True if method_type == 'Create': pass #self.on_show_beam() elif method_type == 'Edit': pass #self.on_show_skin3() elif method_type == 'Delete': enable = False #self.on_show_skin4() else: raise NotImplementedError('value = ', value) self.pid_edit.setEnabled(enable) self.mid_edit.setEnabled(enable) self.n1_edit.setEnabled(enable) self.n2_edit.setEnabled(enable) for inode in range(3, 10 + 1): # 3-10 inode_label = 'n%i_label' % inode inode_edit = 'n%i_edit' % inode getattr(self, inode_label).setEnabled(enable) getattr(self, inode_edit).setEnabled(enable) #self.n3_edit.setEnabled(enable) #self.n4_edit.setEnabled(enable) self.mcsid_pulldown.setEnabled(enable) self.comment_edit.setEnabled(enable) def setup_layout(self): irow = 0 grid = QGridLayout() grid.addWidget(self.method_type_label, irow, 1) grid.addWidget(self.method_type_pulldown, irow, 2) irow += 1 grid.addWidget(self.element_type_label, irow, 1) grid.addWidget(self.element_type_pulldown, irow, 2) irow += 1 grid.addWidget(self.eid_label, irow, 1) grid.addWidget(self.eid_edit, irow, 2) irow += 1 grid.addWidget(self.pid_label, irow, 1) grid.addWidget(self.pid_edit, irow, 2) irow += 1 grid.addWidget(self.mid_label, irow, 1) grid.addWidget(self.mid_edit, irow, 2) irow += 1 for inode in range(1, 10 + 1): # 1-10 inode_label = 'n%i_label' % inode inode_edit = 'n%i_edit' % inode ni_label = getattr(self, inode_label) ni_edit = getattr(self, inode_edit) grid.addWidget(ni_label, irow, 1) grid.addWidget(ni_edit, irow, 2) irow += 1 grid.addWidget(self.mcsid_label, irow, 1) grid.addWidget(self.mcsid_pulldown, irow, 2) irow += 1 grid.addWidget(self.comment_label, irow, 1) grid.addWidget(self.comment_edit, irow, 2) irow += 1 ok_cancel_box = QHBoxLayout() ok_cancel_box.addWidget(self.apply_button) ok_cancel_box.addWidget(self.add_button) ok_cancel_box.addWidget(self.delete_button) vbox = QVBoxLayout() #vbox.addWidget(self.results_widget_label) #vbox.addWidget(self.results_widget) vbox.addLayout(grid) vbox.addStretch() vbox.addLayout(ok_cancel_box) self.setLayout(vbox) self.setWindowTitle('Define Element') self.mid_label.setVisible(False) self.mid_edit.setVisible(False) self.n3_label.setVisible(False) self.n3_edit.setVisible(False) self.n4_label.setVisible(False) self.n4_edit.setVisible(False) self.mcsid_label.setVisible(False) self.mcsid_pulldown.setVisible(False)
def create_widgets(self, show_tol): """creates the display window""" # CORD2R #self.origin_label = QLabel("Origin:") #self.zaxis_label = QLabel("Z Axis:") #self.xz_plane_label = QLabel("XZ Plane:") # Z-Axis Projection self.p1_label = QLabel("Origin/P1:") self.p2_label = QLabel("P2:") self.p3_label = QLabel("End/P3:") self.zaxis_label = QLabel("Z Axis:") self.method_pulldown = QComboBox() for method in self.methods: self.method_pulldown.addItem(method) self.zaxis_method_pulldown = QComboBox() for method in self.zaxis_methods: self.zaxis_method_pulldown.addItem(method) self.cid_label = QLabel("Coordinate System:") self.p1_cid_pulldown = QComboBox() self.p2_cid_pulldown = QComboBox() self.p3_cid_pulldown = QComboBox() self.zaxis_cid_pulldown = QComboBox() cid_global_str = '0/Global' for cid in sorted(self.cids): if cid == 0: cid_str = cid_global_str else: cid_str = str(cid) #print('cid_str = %r' % cid_str) self.p1_cid_pulldown.addItem(cid_str) self.p2_cid_pulldown.addItem(cid_str) self.p3_cid_pulldown.addItem(cid_str) self.zaxis_cid_pulldown.addItem(cid_str) self.p1_cid_pulldown.setCurrentIndex(0) self.p2_cid_pulldown.setCurrentIndex(0) self.p3_cid_pulldown.setCurrentIndex(0) self.zaxis_cid_pulldown.setCurrentIndex(0) if len(self.cids) == 1: self.p1_cid_pulldown.setEnabled(False) self.p2_cid_pulldown.setEnabled(False) self.p3_cid_pulldown.setEnabled(False) self.zaxis_cid_pulldown.setEnabled(False) #self.p1_cid_pulldown.setItemText(0, cid_str) #self.p2_cid_pulldown.setItemText(0, cid_str) #self.zaxis_cid_pulldown.setItemText(0, cid_str) self.p1_cid_pulldown.setToolTip( 'Defines the coordinate system for Point P1') self.p2_cid_pulldown.setToolTip( 'Defines the coordinate system for Point P2') self.p3_cid_pulldown.setToolTip( 'Defines the coordinate system for Point P3') self.zaxis_cid_pulldown.setToolTip( 'Defines the coordinate system for the Z Axis') self.p1_x_edit = QLineEdit('') self.p1_y_edit = QLineEdit('') self.p1_z_edit = QLineEdit('') self.p2_x_edit = QLineEdit('') self.p2_y_edit = QLineEdit('') self.p2_z_edit = QLineEdit('') self.p3_x_edit = QLineEdit('') self.p3_y_edit = QLineEdit('') self.p3_z_edit = QLineEdit('') self.zaxis_x_edit = QLineEdit('') self.zaxis_y_edit = QLineEdit('') self.zaxis_z_edit = QLineEdit('') self.ytol_label = QLabel('Y Tolerance:') self.zero_tol_label = QLabel('Zero Tolerance:') self.ytol_edit = QLineEdit('10.0') self.zero_tol_edit = QLineEdit('1e-5') if not show_tol: self.ytol_label.setVisible(False) self.zero_tol_label.setVisible(False) self.ytol_edit.setVisible(False) self.zero_tol_edit.setVisible(False) self.p2_label = QLabel("P2:") # Plane Color self.plane_color_label = QLabel("Plane Color:") self.plane_color_edit = QPushButtonColor(self.plane_color_int) self.corner_coord_label = QLabel("Show Corner Coordinate System:") self.corner_coord_checkbox = QCheckBox() #self.corner_coord_checkbox.setChecked(self._show_corner_coord) #----------------------------------------------------------------------- self.load_case_label = QLabel('Load Case:') load_cases = ['1', '2'] load_case = '1' self.load_case_pulldown = make_combo_box(load_cases, load_case) self.time_label = QLabel('Time:') times = ['0.', '0.5', '1.', '1.5', '2.'] time = '0.' self.times_pulldown = make_combo_box(times, time) name = 'main' self.node_label = QLabel('Nodes:') #self.node_element_edit = self.node_edit = QNodeEdit(self.win_parent, name, parent=self.gui, pick_style='area', tab_to_next=False) self.element_label = QLabel('Elements:') self.element_edit = QElementEdit(self.win_parent, name, parent=self.gui, pick_style='area', tab_to_next=False) #self.p1_smt_label = QLabel('Point 1 (SMT):') #self.p2_smt_label = QLabel('Point 2 (SMT):') self.node_element_label = QLabel('Nodes/Elements:') self.node_element_edit = QLineEdit() self.node_element_edit.setReadOnly(True) self.nplanes_label = QLabel('Num Planes:') self.nplanes_spinner = QSpinBox() self.nplanes_spinner.setMinimum(2) self.nplanes_spinner.setMaximum(100) self.nplanes_spinner.setValue(20) #----------------------------------------------------------------------- self.add_button = QPushButton('Add') self.remove_button = QPushButton('Remove') #----------------------------------------------------------------------- # closing self.apply_button = QPushButton('Apply') self.cancel_button = QPushButton('Cancel')