def __init__(self, data, win_parent=None): """ +---------+ | Painter | +---------+---------+ | Name1 | | Name2 | | Name3 | | Name4 | | | | x by cell ___ | | x by angle ___ | | | | box elements | | | | Add Remove | | | | Apply OK Cancel | +-------------------+ """ QtGui.QDialog.__init__(self, win_parent) self.setWindowTitle('Edit Boundary Conditions') #default self.win_parent = win_parent self.out_data = data self.keys = sorted(data.keys()) keys = self.keys nrows = len(keys) self.active_key = keys[0] self._use_old_table = False items = keys header_labels = ['Groups'] table_model = Model(items, header_labels, self) view = CustomQTableView(self) #Call your custom QTableView here view.setModel(table_model) view.horizontalHeader().setResizeMode(QtGui.QHeaderView.Stretch) self.table = view actor_obj = data[self.active_key] name = actor_obj.name line_width = actor_obj.line_width point_size = actor_obj.point_size opacity = actor_obj.opacity color = actor_obj.color show = actor_obj.is_visible self.representation = actor_obj.representation table = self.table #headers = [QtCore.QString('Groups')] header = table.horizontalHeader() header.setStretchLastSection(True) self._default_is_apply = False self.name = QtGui.QLabel("Name:") self.name_edit = QtGui.QLineEdit(str(name)) self.name_edit.setDisabled(True) self.color = QtGui.QLabel("Color:") self.color_edit = QtGui.QPushButton() #self.color_edit.setFlat(True) color = self.out_data[self.active_key].color qcolor = QtGui.QColor() qcolor.setRgb(*color) #print('color =%s' % str(color)) palette = QtGui.QPalette( self.color_edit.palette()) # make a copy of the palette #palette.setColor(QtGui.QPalette.Active, QtGui.QPalette.Base, \ #qcolor) palette.setColor(QtGui.QPalette.Background, QtGui.QColor('blue')) # ButtonText self.color_edit.setPalette(palette) self.color_edit.setStyleSheet("QPushButton {" "background-color: rgb(%s, %s, %s);" % tuple(color) + #"border:1px solid rgb(255, 170, 255); " "}") self.opacity = QtGui.QLabel("Opacity:") self.opacity_edit = QtGui.QDoubleSpinBox(self) self.opacity_edit.setRange(0.1, 1.0) self.opacity_edit.setDecimals(1) self.opacity_edit.setSingleStep(0.1) self.opacity_edit.setValue(opacity) self.line_width = QtGui.QLabel("Line Width:") self.line_width_edit = QtGui.QSpinBox(self) self.line_width_edit.setRange(1, 10) self.line_width_edit.setSingleStep(1) self.line_width_edit.setValue(line_width) if self.representation in ['point', 'surface']: self.line_width.setEnabled(False) self.line_width_edit.setEnabled(False) self.point_size = QtGui.QLabel("Point Size:") self.point_size_edit = QtGui.QSpinBox(self) self.point_size_edit.setRange(1, 10) self.point_size_edit.setSingleStep(1) self.point_size_edit.setValue(point_size) if self.representation in ['wire', 'surface']: self.point_size.setEnabled(False) self.point_size_edit.setEnabled(False) # show/hide self.checkbox_show = QtGui.QCheckBox("Show") self.checkbox_hide = QtGui.QCheckBox("Hide") self.checkbox_show.setChecked(show) self.checkbox_hide.setChecked(not show) # closing self.apply_button = QtGui.QPushButton("Apply") #if self._default_is_apply: #self.apply_button.setDisabled(True) self.ok_button = QtGui.QPushButton("OK") self.cancel_button = QtGui.QPushButton("Cancel") self.create_layout() self.set_connections()
def __init__(self, data, win_parent=None): """ +---------+ | Painter | +---------+---------+ | Name1 | | Name2 | | Name3 | | Name4 | | | | x by cell ___ | | x by angle ___ | | | | box elements | | | | Add Remove | | | | Apply OK Cancel | +-------------------+ """ QtGui.QDialog.__init__(self, win_parent) self.setWindowTitle('Edit Boundary Conditions') #default self.win_parent = win_parent self.out_data = data self.keys = sorted(data.keys()) keys = self.keys nrows = len(keys) self.active_key = keys[0] self._use_old_table = False items = keys header_labels = ['Groups'] table_model = Model(items, header_labels, self) view = CustomQTableView(self) #Call your custom QTableView here view.setModel(table_model) view.horizontalHeader().setResizeMode(QtGui.QHeaderView.Stretch) self.table = view actor_obj = data[self.active_key] name = actor_obj.name line_width = actor_obj.line_width point_size = actor_obj.point_size opacity = actor_obj.opacity color = actor_obj.color show = actor_obj.is_visible self.representation = actor_obj.representation table = self.table #headers = [QtCore.QString('Groups')] header = table.horizontalHeader() header.setStretchLastSection(True) self._default_is_apply = False self.name = QtGui.QLabel("Name:") self.name_edit = QtGui.QLineEdit(str(name)) self.name_edit.setDisabled(True) self.color = QtGui.QLabel("Color:") self.color_edit = QtGui.QPushButton() #self.color_edit.setFlat(True) color = self.out_data[self.active_key].color qcolor = QtGui.QColor() qcolor.setRgb(*color) #print('color =%s' % str(color)) palette = QtGui.QPalette(self.color_edit.palette()) # make a copy of the palette #palette.setColor(QtGui.QPalette.Active, QtGui.QPalette.Base, \ #qcolor) palette.setColor(QtGui.QPalette.Background, QtGui.QColor('blue')) # ButtonText self.color_edit.setPalette(palette) self.color_edit.setStyleSheet("QPushButton {" "background-color: rgb(%s, %s, %s);" % tuple(color) + #"border:1px solid rgb(255, 170, 255); " "}") self.opacity = QtGui.QLabel("Opacity:") self.opacity_edit = QtGui.QDoubleSpinBox(self) self.opacity_edit.setRange(0.1, 1.0) self.opacity_edit.setDecimals(1) self.opacity_edit.setSingleStep(0.1) self.opacity_edit.setValue(opacity) self.line_width = QtGui.QLabel("Line Width:") self.line_width_edit = QtGui.QSpinBox(self) self.line_width_edit.setRange(1, 10) self.line_width_edit.setSingleStep(1) self.line_width_edit.setValue(line_width) if self.representation in ['point', 'surface']: self.line_width.setEnabled(False) self.line_width_edit.setEnabled(False) self.point_size = QtGui.QLabel("Point Size:") self.point_size_edit = QtGui.QSpinBox(self) self.point_size_edit.setRange(1, 10) self.point_size_edit.setSingleStep(1) self.point_size_edit.setValue(point_size) if self.representation in ['wire', 'surface']: self.point_size.setEnabled(False) self.point_size_edit.setEnabled(False) # show/hide self.checkbox_show = QtGui.QCheckBox("Show") self.checkbox_hide = QtGui.QCheckBox("Hide") self.checkbox_show.setChecked(show) self.checkbox_hide.setChecked(not show) # closing self.apply_button = QtGui.QPushButton("Apply") #if self._default_is_apply: #self.apply_button.setDisabled(True) self.ok_button = QtGui.QPushButton("OK") self.cancel_button = QtGui.QPushButton("Cancel") self.create_layout() self.set_connections()
def __init__(self, data, win_parent=None): """ +-----------------+ | Break Surfaces | +-----------------+------+ | EngineInlet | | EngineOutlet | | | | Name EngineInlet | | RegionMode * RegionID | | * All | | | | AllowedRegions: | | Region ID 3 | | | | PickMode * All | | Pick Mode x On/Off | | Pick Angle 20 deg | | | | Revert | | RenumberRegions | | Close | +------------------------+ """ QtGui.QDialog.__init__(self, win_parent) self.setWindowTitle('Break Surface') #default self.win_parent = win_parent self.out_data = data self.points = data['points'] self.keys = sorted(self.points.keys()) keys = self.keys nrows = len(keys) active_point = data['active_point'] #self.active_key = keys[0] self.active_key = active_point name = self.active_key description = self.points[self.active_key][0] self._use_old_table = False items = ['Node %i' % val for val in keys] header_labels = ['Nodes'] table_model = Model(items, header_labels, self) view = CustomQTableView(self) #Call your custom QTableView here view.setModel(table_model) view.horizontalHeader().setResizeMode(QtGui.QHeaderView.Stretch) self.table = view #self.representation = actor_obj.representation #print('rep =', self.representation) table = self.table #headers = [QtCore.QString('Groups')] header = table.horizontalHeader() header.setStretchLastSection(True) #---------------------------------------------- #self._default_is_apply = False self.mode_header = QtGui.QLabel("Mode:") nregions_max = 10 pick_angle = 20.0 region_id = 4 all_regions = True self.region_id = QtGui.QLabel("Region ID:") self.region_id_edit = QtGui.QSpinBox(self) self.region_id_edit.setRange(1, nregions_max) self.region_id_edit.setSingleStep(1) self.region_id_edit.setValue(region_id) self.pick_angle = QtGui.QLabel("Pick Angle:") self.pick_angle_edit = QtGui.QDoubleSpinBox(self) self.pick_angle_edit.setRange(0.0, 360.0) self.pick_angle_edit.setDecimals(3) self.pick_angle_edit.setSingleStep(0.5) self.pick_angle_edit.setValue(pick_angle) # region IDs/all self.checkbox_region_ids = QtGui.QCheckBox("Region IDs") self.checkbox_region_all = QtGui.QCheckBox("All Regions") self.checkbox_region_all.setChecked(all_regions) self.checkbox_region_ids.setChecked(not all_regions) # pick mode self.checkbox_pick_mode = QtGui.QCheckBox("Pick Mode (Off=label)") self.checkbox_pick_mode.setChecked(False) #---------------------------------------------- self.nodes_header = QtGui.QLabel("Single Node:") self.name = QtGui.QLabel("ID:") self.name_edit = QtGui.QLineEdit('Node %i' % name) self.name_edit.setDisabled(True) #---------------------------------------------- # closing #if self._default_is_apply: #self.apply_button.setDisabled(True) self.close_button = QtGui.QPushButton("Close") self.create_layout()
def __init__(self, data, win_parent=None): """ +-----------------+ | Edit Node Props | +-----------------+------+ | LEwingTip | | Node2 | | Node3 | | Node4 | | | | All Nodes: | | Color red | | PointSize 3 | | Opacity 0.3 | | Show/Hide | | | | Name LEwingTip | | Location X Y Z | | Coord 0 | | CoordType R, C, S | | | | Previous Next | | | | Close | +------------------------+ """ QtGui.QDialog.__init__(self, win_parent) self.setWindowTitle('Edit Node Properties') #default self.win_parent = win_parent self.out_data = data point_properties = data['point_properties'] print(point_properties) #name = point_properties.name point_size = point_properties.point_size opacity = point_properties.opacity color = point_properties.color show = point_properties.is_visible self.points = data['points'] self.keys = sorted(self.points.keys()) keys = self.keys nrows = len(keys) active_point = data['active_point'] #self.active_key = keys[0] self.active_key = active_point name = self.active_key description = self.points[self.active_key][0] self._use_old_table = False items = ['Node %i' % val for val in keys] header_labels = ['Nodes'] table_model = Model(items, header_labels, self) view = CustomQTableView(self) #Call your custom QTableView here view.setModel(table_model) view.horizontalHeader().setResizeMode(QtGui.QHeaderView.Stretch) self.table = view #self.representation = actor_obj.representation #print('rep =', self.representation) table = self.table #headers = [QtCore.QString('Groups')] header = table.horizontalHeader() header.setStretchLastSection(True) #---------------------------------------------- #self._default_is_apply = False self.color = QtGui.QLabel("Color:") self.color_edit = QtGui.QPushButton() #self.color_edit.setFlat(True) color = self.out_data['point_properties'].color opacity = self.out_data['point_properties'].opacity show = self.out_data['point_properties'].is_visible #color = self.out_data[self.active_key].color qcolor = QtGui.QColor() qcolor.setRgb(*color) #print('color =%s' % str(color)) palette = QtGui.QPalette(self.color_edit.palette()) # make a copy of the palette #palette.setColor(QtGui.QPalette.Active, QtGui.QPalette.Base, \ #qcolor) palette.setColor(QtGui.QPalette.Background, QtGui.QColor('blue')) # ButtonText self.color_edit.setPalette(palette) self.color_edit.setStyleSheet("QPushButton {" "background-color: rgb(%s, %s, %s);" % tuple(color) + #"border:1px solid rgb(255, 170, 255); " "}") self.all_nodes_header = QtGui.QLabel("All Nodes:") self.point_size = QtGui.QLabel("Point Size:") self.point_size_edit = QtGui.QSpinBox(self) self.point_size_edit.setRange(1, 10) self.point_size_edit.setSingleStep(1) self.point_size_edit.setValue(point_size) self.opacity = QtGui.QLabel("Opacity:") self.opacity_edit = QtGui.QDoubleSpinBox(self) self.opacity_edit.setRange(0.1, 1.0) self.opacity_edit.setDecimals(1) self.opacity_edit.setSingleStep(0.1) self.opacity_edit.setValue(opacity) # show/hide self.checkbox_show = QtGui.QCheckBox("Show") self.checkbox_hide = QtGui.QCheckBox("Hide") self.checkbox_show.setChecked(show) self.checkbox_hide.setChecked(not show) #---------------------------------------------- self.nodes_header = QtGui.QLabel("Single Node:") self.name = QtGui.QLabel("ID:") self.name_edit = QtGui.QLineEdit('Node %i' % name) self.name_edit.setDisabled(True) self.description = QtGui.QLabel("Description:") self.description_edit = QtGui.QLineEdit(str(description)) #self.description_edit.setDisabled(True) location_x = 0.1 location_y = 0.1 location_z = 0.1 self.location = QtGui.QLabel("Location:") self.location_x_edit = QtGui.QDoubleSpinBox(self) self.location_y_edit = QtGui.QDoubleSpinBox(self) self.location_z_edit = QtGui.QDoubleSpinBox(self) #self.location_x_edit.setDecimals(1) delta_x = abs(location_x) / 100. if location_x != 0.0 else 0.1 delta_y = abs(location_y) / 100. if location_y != 0.0 else 0.1 delta_z = abs(location_z) / 100. if location_z != 0.0 else 0.1 self.location_x_edit.setSingleStep(delta_x) self.location_y_edit.setSingleStep(delta_y) self.location_z_edit.setSingleStep(delta_z) self.location_x_edit.setValue(location_x) self.location_y_edit.setValue(location_y) self.location_z_edit.setValue(location_z) self.coord = QtGui.QLabel("Coord:") self.coord_edit = QtGui.QSpinBox(self) self.coord_edit.setRange(0, 99999999) #self.coord_edit.setSingleStep(1) self.coord_edit.setValue(0) self.coord_type = QtGui.QLabel("Coord Type:") #---------------------------------------------- # closing #if self._default_is_apply: #self.apply_button.setDisabled(True) self.close_button = QtGui.QPushButton("Close") self.create_layout() self.set_connections()