def updateLayout(self): self.storeButtons = [] self.flyButtons = [] w = QtGui.QWidget() l = QtGui.QGridLayout(w) for i in range(self.numberOfBookmarks): storeButton = QtGui.QPushButton('set') flyButton = QtGui.QPushButton('fly') textEdit = QtGui.QLineEdit('camera %d' % i) storeButton.connect('clicked()', self.storeMapper, 'map()') flyButton.connect('clicked()', self.flyMapper, 'map()') self.storeMapper.setMapping(storeButton, storeButton) self.flyMapper.setMapping(flyButton, flyButton) self.storeButtons.append(storeButton) self.flyButtons.append(flyButton) l.addWidget(storeButton, i, 0) l.addWidget(flyButton, i, 1) l.addWidget(textEdit, i, 2) flyButton.setEnabled(False) self.flySpeedSpinner = QtGui.QDoubleSpinBox() self.flySpeedSpinner.setMinimum(0) self.flySpeedSpinner.setMaximum(60) self.flySpeedSpinner.setDecimals(1) self.flySpeedSpinner.setSingleStep(0.5) self.flySpeedSpinner.setSuffix(' seconds') self.flySpeedSpinner.setValue(1.0) l.addWidget(QtGui.QLabel('Fly speed:'), i+1, 0, 2) l.addWidget(self.flySpeedSpinner, i+1, 2) self.widget.setWidget(w)
def __init__(self): self.app = ConsoleApp() self.view = self.app.createView() self.robotSystem = robotsystem.create(self.view) self.config = drcargs.getDirectorConfig() jointGroups = self.config['teleopJointGroups'] self.jointTeleopPanel = JointTeleopPanel(self.robotSystem, jointGroups) self.jointCommandPanel = JointCommandPanel(self.robotSystem) self.jointCommandPanel.ui.speedSpinBox.setEnabled(False) self.jointCommandPanel.ui.mirrorArmsCheck.setChecked(self.jointTeleopPanel.mirrorArms) self.jointCommandPanel.ui.mirrorLegsCheck.setChecked(self.jointTeleopPanel.mirrorLegs) self.jointCommandPanel.ui.resetButton.connect('clicked()', self.resetJointTeleopSliders) self.jointCommandPanel.ui.mirrorArmsCheck.connect('clicked()', self.mirrorJointsChanged) self.jointCommandPanel.ui.mirrorLegsCheck.connect('clicked()', self.mirrorJointsChanged) self.widget = QtGui.QWidget() gl = QtGui.QGridLayout(self.widget) gl.addWidget(self.app.showObjectModel(), 0, 0, 4, 1) # row, col, rowspan, colspan gl.addWidget(self.view, 0, 1, 1, 1) gl.addWidget(self.jointCommandPanel.widget, 1, 1, 1, 1) gl.addWidget(self.jointTeleopPanel.widget, 0, 2, -1, 1) gl.setRowStretch(0,1) gl.setColumnStretch(1,1) #self.sub = lcmUtils.addSubscriber('COMMITTED_ROBOT_PLAN', lcmdrc.robot_plan_t, self.onRobotPlan) lcmUtils.addSubscriber('STEERING_COMMAND_POSITION_GOAL', lcmdrc.joint_position_goal_t, self.onSingleJointPositionGoal) lcmUtils.addSubscriber('THROTTLE_COMMAND_POSITION_GOAL', lcmdrc.joint_position_goal_t, self.onSingleJointPositionGoal)
def __init__ (self, parent): super(_RoadmapTab, self).__init__ (parent) self.plugin = parent box = QtGui.QGridLayout(self) box.addWidget(QtGui.QLabel("Number of nodes:"), 0, 0) self.nbNode = QtGui.QLabel() box.addWidget(self.nbNode, 0, 1) box.addWidget(QtGui.QLabel("Number of edges:"), 1, 0) self.nbEdge = QtGui.QLabel() box.addWidget(self.nbEdge, 1, 1) box.addWidget(QtGui.QLabel("Number of connected components :"), 2, 0) self.nbComponent = QtGui.QLabel() box.addWidget(self.nbComponent, 2, 1) self.updateCB = QtGui.QCheckBox("Continuous update") box.addWidget(self.updateCB, 3, 2, 1, 2) self.updateCB.setTristate(False) self.timer = Qt.QTimer(self) self.timer.setInterval(500) self.timer.setSingleShot(False) self.timer.connect("timeout()", self.updateCount) self.updateCB.connect("stateChanged(int)", self.startStopTimer)
def __init__(self, visualizer, parent=None): QtGui.QDialog.__init__(self, parent) self.setWindowTitle("Force Vector Visualization") layout = QtGui.QGridLayout() layout.setColumnStretch(0, 0) layout.setColumnStretch(1, 1) row = 0 # Magnitude representation layout.addWidget(QtGui.QLabel("Magnitude representation"), row, 0) self.magnitude_mode = QtGui.QComboBox() modes = ContactVisModes.get_modes() mode_labels = [ContactVisModes.get_mode_string(m) for m in modes] self.magnitude_mode.addItems(mode_labels) self.magnitude_mode.setCurrentIndex(visualizer.magnitude_mode) mode_tool_tip = 'Determines how force magnitude is visualized:\n' for m in modes: mode_tool_tip += ' - {}: {}\n'.format( ContactVisModes.get_mode_string(m), ContactVisModes.get_mode_docstring(m)) self.magnitude_mode.setToolTip(mode_tool_tip) layout.addWidget(self.magnitude_mode, row, 1) row += 1 # Global scale. layout.addWidget(QtGui.QLabel("Global scale"), row, 0) self.global_scale = QtGui.QLineEdit() self.global_scale.setToolTip( 'All visualized forces are multiplied by this scale factor (must ' 'be non-negative)') validator = QtGui.QDoubleValidator(0, 100, 3, self.global_scale) validator.setNotation(QtGui.QDoubleValidator.StandardNotation) self.global_scale.setValidator(validator) self.global_scale.setText("{:.3f}".format(visualizer.global_scale)) layout.addWidget(self.global_scale, row, 1) row += 1 # Magnitude cut-off. layout.addWidget(QtGui.QLabel("Minimum force"), row, 0) self.min_magnitude = QtGui.QLineEdit() self.min_magnitude.setToolTip('Forces with a magnitude less than this ' 'value will not be visualized (must be ' '> 1e-10)') validator = QtGui.QDoubleValidator(1e-10, 100, 10, self.min_magnitude) validator.setNotation(QtGui.QDoubleValidator.StandardNotation) self.min_magnitude.setValidator(validator) self.min_magnitude.setText("{:.3g}".format(visualizer.min_magnitude)) layout.addWidget(self.min_magnitude, row, 1) row += 1 # Accept/cancel. btns = QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Cancel buttons = QtGui.QDialogButtonBox(btns, QtCore.Qt.Horizontal, self) buttons.connect('accepted()', self.accept) buttons.connect('rejected()', self.reject) layout.addWidget(buttons, row, 0, 1, 2) self.setLayout(layout)
def _setupPropertiesPanel(self): propertyNames = self.driver.params.propertyNames() l = QtGui.QGridLayout(self.ui.paramsOneContainer) l.setMargin(0) self.propertiesPanel = PythonQt.dd.ddPropertiesPanel() self.propertiesPanel.setBrowserModeToWidget() l.addWidget(self.propertiesPanel) self.panelConnector = propertyset.PropertyPanelConnector( self.driver.params.properties, self.propertiesPanel, propertyNames[0:15]) l = QtGui.QGridLayout(self.ui.paramsTwoContainer) l.setMargin(0) self.propertiesPanel = PythonQt.dd.ddPropertiesPanel() self.propertiesPanel.setBrowserModeToWidget() l.addWidget(self.propertiesPanel) self.panelConnector = propertyset.PropertyPanelConnector( self.driver.params.properties, self.propertiesPanel, propertyNames[15:]) self.driver.params.properties.connectPropertyChanged( self.onPropertyChanged)
def __init__(self): super(dlg_sInstance, self).__init__() # - Init # - Widgets self.cmb_prog = QtGui.QComboBox() self.cmb_prog.addItems(text_prog) self.edt_wt0 = QtGui.QLineEdit() self.edt_wt1 = QtGui.QLineEdit() self.spb_weights = QtGui.QSpinBox() self.spb_widths = QtGui.QSpinBox() self.edt_result = WTableView({1:{'Stem':None, 'Weight':None, 'Width':None}}) self.spb_weights.setValue(2) self.spb_widths.setValue(1) self.edt_wt0.setPlaceholderText('Stem width') self.edt_wt1.setPlaceholderText('Stem width') self.btn_calc = QtGui.QPushButton('Calculate instances') self.btn_calc.clicked.connect(self.calculateInstances) # - Build layouts layoutV = QtGui.QGridLayout() layoutV.addWidget(QtGui.QLabel('Stem progression:'), 0, 0, 1, 4) layoutV.addWidget(self.cmb_prog, 1, 0, 1, 4) layoutV.addWidget(QtGui.QLabel('Begin:'), 2, 0, 1, 1) layoutV.addWidget(self.edt_wt0, 2, 1, 1, 1) layoutV.addWidget(QtGui.QLabel('End:'), 2, 2, 1, 1) layoutV.addWidget(self.edt_wt1, 2, 3, 1, 1) layoutV.addWidget(QtGui.QLabel('Weights:'), 3, 0, 1, 1) layoutV.addWidget(self.spb_weights, 3, 1, 1, 1) layoutV.addWidget(QtGui.QLabel('Widths:'), 3, 2, 1, 1) layoutV.addWidget(self.spb_widths, 3, 3, 1, 1) layoutV.addWidget(self.btn_calc, 4, 0, 1, 4) layoutV.addWidget(self.edt_result, 5, 0, 10, 4) # - Set Widget self.setLayout(layoutV) self.setWindowTitle('%s %s' %(app_name, app_version)) self.setGeometry(300, 300, 330, 460) self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) # Always on top!! self.show()
def buildTabWidget(self, jointGroups): self.slidersMap = {} self.labelMap = {} for group in jointGroups: groupName = group['name'] joints = group['joints'] labels = group['labels'] if groupName.lower() == 'base': continue if len(labels) != len(joints): print 'error, joints/labels mismatch for joint group:', name continue jointGroupWidget = QtGui.QWidget() gridLayout = QtGui.QGridLayout(jointGroupWidget) gridLayout.setColumnStretch(0, 1) for jointName, labelText in zip(joints, labels): label = QtGui.QLabel(labelText) numericLabel = QtGui.QLabel('0.0') slider = QtGui.QSlider(QtCore.Qt.Vertical) column = gridLayout.columnCount() gridLayout.addWidget(label, 0, column) gridLayout.addWidget(slider, 1, column) gridLayout.addWidget(numericLabel, 2, column) self.slidersMap[jointName] = slider self.labelMap[slider] = numericLabel gridLayout.setColumnStretch(gridLayout.columnCount(), 1) self.widget.addTab(jointGroupWidget, groupName) self.widget.usesScrollButtons = False self.signalMapper = QtCore.QSignalMapper() self.sliderMax = 1000.0 for jointName, slider in self.slidersMap.iteritems(): slider.connect('valueChanged(int)', self.signalMapper, 'map()') self.signalMapper.setMapping(slider, jointName) slider.setMaximum(self.sliderMax) self.signalMapper.connect('mapped(const QString&)', self.sliderChanged)
def __init__(self): super(dlg_copyKerning, self).__init__() # - Init self.active_font = pFont() self.class_data = {} # - Widgets self.cmb_layer = QtGui.QComboBox() self.cmb_layer.addItems(self.active_font.masters() + ['All masters']) self.btn_loadFile = QtGui.QPushButton('From File') self.btn_loadFont = QtGui.QPushButton('From Font') self.btn_saveExpr = QtGui.QPushButton('Save') self.btn_loadExpr = QtGui.QPushButton('Load') self.btn_exec = QtGui.QPushButton('Execute') self.btn_loadFont.setEnabled(False) self.btn_loadFile.clicked.connect(self.classes_fromFile) self.btn_exec.clicked.connect(self.process) self.btn_saveExpr.clicked.connect(self.expr_toFile) self.btn_loadExpr.clicked.connect(self.expr_fromFile) self.txt_editor = QtGui.QPlainTextEdit() # - Build layouts layoutV = QtGui.QGridLayout() layoutV.addWidget(QtGui.QLabel('Load class kerning data:'), 0, 0, 1, 4) layoutV.addWidget(self.btn_loadFont, 1, 0, 1, 2) layoutV.addWidget(self.btn_loadFile, 1, 2, 1, 2) layoutV.addWidget(QtGui.QLabel('Process font master:'), 2, 0, 1, 2) layoutV.addWidget(self.cmb_layer, 2, 2, 1, 2) layoutV.addWidget(QtGui.QLabel(str_help), 3, 0, 1, 4) layoutV.addWidget(self.txt_editor, 4, 0, 20, 4) layoutV.addWidget(self.btn_saveExpr, 24, 0, 1, 2) layoutV.addWidget(self.btn_loadExpr, 24, 2, 1, 2) layoutV.addWidget(self.btn_exec, 25, 0, 1, 4) # - Set Widget self.setLayout(layoutV) self.setWindowTitle('%s %s' % (app_name, app_version)) self.setGeometry(300, 300, 250, 500) self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) # Always on top!! self.show()
def updateLayout(self): self.storeButtons = [] self.flyButtons = [] self.textEdits = [] w = QtGui.QWidget() l = QtGui.QGridLayout(w) for i in range(self.numberOfBookmarks): storeButton = QtGui.QPushButton("Set") flyButton = QtGui.QPushButton("Fly") textEdit = QtGui.QLineEdit("camera %d" % i) storeButton.connect("clicked()", self.storeMapper, "map()") flyButton.connect("clicked()", self.flyMapper, "map()") self.storeMapper.setMapping(storeButton, storeButton) self.flyMapper.setMapping(flyButton, flyButton) self.storeButtons.append(storeButton) self.flyButtons.append(flyButton) self.textEdits.append(textEdit) l.addWidget(storeButton, i, 0) l.addWidget(flyButton, i, 1) l.addWidget(textEdit, i, 2) flyButton.setEnabled(False) self.flySpeedSpinner = QtGui.QDoubleSpinBox() self.flySpeedSpinner.setMinimum(0) self.flySpeedSpinner.setMaximum(60) self.flySpeedSpinner.setDecimals(1) self.flySpeedSpinner.setSingleStep(0.5) self.flySpeedSpinner.setSuffix(" seconds") self.flySpeedSpinner.setValue(1.0) l.addWidget(QtGui.QLabel("Fly speed:"), i + 1, 0, 2) l.addWidget(self.flySpeedSpinner, i + 1, 2) loadButton = QtGui.QPushButton("Load Stored") loadButton.connect("clicked()", self.loadStoredValues) l.addWidget(loadButton, i + 2, 0, 2) printButton = QtGui.QPushButton("Print Camera") printButton.connect("clicked()", self.printCurrentCamera) l.addWidget(printButton, i + 2, 2) self.widget.setWidget(w)
def UI(self): self.setWindowTitle("HDR Choice") main_layout = gui.QHBoxLayout(self) #Left Layout self.left_group = gui.QGroupBox(self) self.left_group_layout = gui.QGridLayout(self) self.left_group.setLayout(self.left_group_layout) #HDR Combobox self.hdr_combobox = gui.QComboBox() os.chdir(self.hdr_path) for file in glob.glob("*.HDR"): #Get HDR in folder split_file = file.split(".")[0] self.hdr_list.append(split_file) num = 0 for maps in self.hdr_list: #Add Maps in combobox self.hdr_combobox.insertItem(num, maps) num = num + 1 self.left_group_layout.addWidget(self.hdr_combobox) # #Thumbnail viewer self.thumb_view = gui.QLabel() self.selection = self.hdr_combobox.currentText self.pixmap = gui.QPixmap(self.thumb_path + "\\" + self.selection + "_thumb.jpg") self.thumb_view.setPixmap(self.pixmap) self.left_group_layout.addWidget(self.thumb_view) self.hdr_combobox.connect("currentIndexChanged(int)", self.change_hdr_pixmap) #Apply HDR apply_hdr = gui.QPushButton("Apply HDR") self.left_group_layout.addWidget(apply_hdr) apply_hdr.connect("clicked()", self.applyHDR) # Add Layout to main main_layout.addWidget(self.left_group)
def __init__(self): super(dlg_transformFont, self).__init__() # - Init # - Widgets self.cmb_layer = QtGui.QComboBox() self.cmb_transform = QtGui.QComboBox() self.cmb_glyphset = QtGui.QComboBox() self.cmb_layer.addItems(text_layer) self.cmb_transform.addItems(text_transform) self.cmb_glyphset.addItems(text_glyphset) self.edt_x = QtGui.QLineEdit('0.0') self.edt_y = QtGui.QLineEdit('0.0') self.btn_apply = QtGui.QPushButton('Apply Transformation') self.btn_apply.clicked.connect(self.applyTransform) # - Build layouts layoutV = QtGui.QGridLayout() layoutV.addWidget(QtGui.QLabel('Affine Transformations:'), 0, 0, 1, 4) layoutV.addWidget(self.cmb_glyphset, 1, 0, 1, 4) layoutV.addWidget(self.cmb_layer, 2, 0, 1, 4) layoutV.addWidget(self.cmb_transform, 3, 0, 1, 4) layoutV.addWidget(QtGui.QLabel('X:'), 4, 0, 1, 1) layoutV.addWidget(self.edt_x, 4, 1, 1, 1) layoutV.addWidget(QtGui.QLabel('Y:'), 4, 2, 1, 1) layoutV.addWidget(self.edt_y, 4, 3, 1, 1) layoutV.addWidget(self.btn_apply, 5, 0, 1, 4) # - Set Widget self.setLayout(layoutV) self.setWindowTitle('%s %s' % (app_name, app_version)) self.setGeometry(300, 300, 220, 120) self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) # Always on top!! self.show()
##### #endPose, info = s.runIk(fields) #print endPose #print info #ikplanner.RobotPoseGUIWrapper.show() #view.show() w = QtGui.QWidget() l = QtGui.QGridLayout(w) l.addWidget(view, 0, 0) l.addWidget(robotSystem.playbackPanel.widget, 1, 0) l.addWidget(robotSystem.teleopPanel.widget, 0, 1, 2, 1) l.setMargin(0) l.setSpacing(0) w.showMaximized() w.raise_() from director import applogic applogic.resetCamera(viewDirection=[-1,0,0], view=view) app.start()
def build_gui(self): self.setWindowFlags(Qt.Qt.Window) layout = QtGui.QGridLayout() layout.setSpacing(10) # Window layout #layout = QtGui.QVBoxLayout() self.setLayout(layout) self.show_button_neurite = QtGui.QPushButton('Show neurite') self.show_button_selected_neurite = QtGui.QPushButton( 'Add selected neurite(s)') self.show_button_synapse = QtGui.QPushButton('Show synapse') self.clear_knossos_view_button = QtGui.QPushButton('Clear view') self.ssv_selector = QtGui.QListView() self.ssv_selector.setUniformItemSizes(True) # better performance self.ssv_item_model = QtGui.QStandardItemModel(self.ssv_selector) self.syn_selector = QtGui.QListView() self.syn_selector.setUniformItemSizes(True) # better performance self.syn_item_model = QtGui.QStandardItemModel(self.syn_selector) self.direct_ssv_id_input = QtGui.QLineEdit() self.direct_ssv_id_input.setValidator(QtGui.QIntValidator()) self.direct_ssv_id_input.setMaxLength(8) self.direct_syn_id_input = QtGui.QLineEdit() self.direct_syn_id_input.setValidator(QtGui.QIntValidator()) self.direct_syn_id_input.setMaxLength(8) # celltype self.celltype_field = QtGui.QLabel("CellType: ", self) # synapse self.synapse_field1 = QTableWidget() self.synapse_field1.setRowCount(5) self.synapse_field1.setColumnCount(2) self.synapse_field1.setItem(0, 0, QTableWidgetItem("coordinate")) self.synapse_field1.setItem(0, 1, QTableWidgetItem("")) self.synapse_field1.setItem(1, 0, QTableWidgetItem("synaptic type")) self.synapse_field1.setItem(1, 1, QTableWidgetItem("")) self.synapse_field1.setItem(2, 0, QTableWidgetItem("syn. proba.")) self.synapse_field1.setItem(2, 1, QTableWidgetItem("")) self.synapse_field1.setItem(3, 0, QTableWidgetItem("size [um^2]")) self.synapse_field1.setItem(3, 1, QTableWidgetItem("")) self.synapse_field1.setItem(4, 0, QTableWidgetItem("Object ID")) self.synapse_field1.setItem(4, 1, QTableWidgetItem("")) # self.synapse_field1.setEditTriggers(QtWidgets.QTableWidget.NoEditTriggers) # qt5 header = self.synapse_field1.horizontalHeader() header.setSectionResizeMode(0, QtGui.QHeaderView.Stretch) header.setSectionResizeMode(1, QtGui.QHeaderView.ResizeToContents) self.synapse_field1.setEditTriggers( QtGui.QAbstractItemView.NoEditTriggers) self.synapse_field2 = QTableWidget() self.synapse_field2.setRowCount(5) self.synapse_field2.setColumnCount(3) # TODO: sort by pre and post in 'on_syn_selector_changed' and replace neuron1 and neuron2 by pre and post self.synapse_field2.setItem(0, 1, QTableWidgetItem("neuron 1")) self.synapse_field2.setItem(0, 2, QTableWidgetItem("neuron 2")) self.synapse_field2.setItem(1, 0, QTableWidgetItem("SSV ID")) self.synapse_field2.setItem(2, 0, QTableWidgetItem("cell type")) self.synapse_field2.setItem(3, 0, QTableWidgetItem("cell comp.")) self.synapse_field2.setItem(4, 0, QTableWidgetItem("spiness")) # self.synapse_field2.setEditTriggers(QtWidgets.QTableWidget.NoEditTriggers) # qt5 self.synapse_field2.setEditTriggers( QtGui.QAbstractItemView.NoEditTriggers) header = self.synapse_field2.horizontalHeader() header.setSectionResizeMode(0, QtGui.QHeaderView.Stretch) header.setSectionResizeMode(1, QtGui.QHeaderView.ResizeToContents) header.setSectionResizeMode(2, QtGui.QHeaderView.ResizeToContents) self.send_synapsetype_label_button = QtGui.QPushButton('Send') self.synapsetype_label = QtGui.QLabel() self.synapsetype_label.setText( "Synapse type label [-1: inhib.; 0: non-syn.; 1: " "excit.]:") self.synapsetype_label_text = QtGui.QLineEdit() self.send_button_response_label = QtGui.QLabel() self.send_button_response_label.setText(None) #self.exploration_mode_chk_box = QtGui.QCheckBox('Exploration mode') #self.exploration_mode_chk_box.setChecked(True) #self.ssv_selection_model = # QtGui.QItemSelectionModel(self.ssv_select_model) #self.selectionModel = # self.ssv_selector.selectionModel(self.ssv_selector) #self.ssv_selector.setSelectionModel(self.ssv_selection_model) #print('selection model: ' + str(self.ssv_selector.selectionModel())) self.ssv_selector.clicked.connect(self.on_ssv_selector_changed) self.syn_selector.clicked.connect(self.on_syn_selector_changed) self.populate_ssv_list() self.populate_syn_list() print('Connected to SyConnGate.') layout.addWidget(self.direct_ssv_id_input, 1, 0, 1, 1) layout.addWidget(self.direct_syn_id_input, 1, 1, 1, 1) layout.addWidget(self.ssv_selector, 2, 0, 1, 1) layout.addWidget(self.syn_selector, 2, 1, 1, 1) layout.addWidget(self.show_button_neurite, 3, 0, 1, 1) layout.addWidget(self.show_button_synapse, 3, 1, 1, 1) layout.addWidget(self.clear_knossos_view_button, 4, 0, 1, 1) layout.addWidget(self.show_button_selected_neurite, 5, 0, 1, 1) layout.addWidget(self.celltype_field, 1, 2, 1, 2) layout.addWidget(self.synapse_field1, 2, 2, 1, 1) layout.addWidget(self.synapse_field2, 3, 2, 1, 1) layout.addWidget(self.synapsetype_label, 4, 1, 1, 1) layout.addWidget(self.synapsetype_label_text, 4, 2, 1, 2) layout.addWidget(self.send_button_response_label, 5, 1, 1, 1) layout.addWidget(self.send_synapsetype_label_button, 5, 2, 1, 1) #self.ssv_select_model.itemChanged.connect(self.on_ssv_selector_changed) #self.selectionModel.selectionChanged.connect(self.on_ssv_selector_changed) self.show_button_neurite.clicked.connect( self.show_button_neurite_clicked) self.show_button_selected_neurite.clicked.connect( self.show_button_selected_neurite_clicked) self.show_button_synapse.clicked.connect( self.show_button_synapse_clicked) self.clear_knossos_view_button.clicked.connect( self.clear_knossos_view_button_clicked) self.send_synapsetype_label_button.clicked.connect( self.send_synapsetype_label_button_clicked) #self.exploration_mode_chk_box.stateChanged.connect(self.exploration_mode_changed) # self.setGeometry(300, 300, 450, 300) self.setWindowTitle('SyConn Viewer v2') self.show()
def __init__(self, visualizer, show_contact_edges_state, show_pressure_state, show_spatial_force_state, show_traction_vectors_state, show_slip_velocity_vectors_state, max_pressure_observed, reset_max_pressure_observed_functor, parent=None): QtGui.QDialog.__init__(self, parent) self.setWindowTitle('Hydroelastic contact visualization settings') self.reset_max_pressure_observed_functor = \ reset_max_pressure_observed_functor layout = QtGui.QGridLayout() layout.setColumnStretch(0, 0) layout.setColumnStretch(1, 1) row = 0 # Color map selection. layout.addWidget(QtGui.QLabel('Color map'), row, 0) self.color_map_mode = QtGui.QComboBox() modes = ColorMapModes.get_modes() mode_labels = [ColorMapModes.get_mode_string(m) for m in modes] self.color_map_mode.addItems(mode_labels) self.color_map_mode.setCurrentIndex(visualizer.color_map_mode) mode_tool_tip = 'Determines the mapping from pressures to colors:\n' for m in modes: mode_tool_tip += ' - {}: {}\n'.format( ColorMapModes.get_mode_string(m), ColorMapModes.get_mode_docstring(m)) self.color_map_mode.setToolTip(mode_tool_tip) layout.addWidget(self.color_map_mode, row, 1) row += 1 # Minimum pressure. layout.addWidget(QtGui.QLabel('Minimum pressure'), row, 0) self.min_pressure = QtGui.QLineEdit() self.min_pressure.setToolTip('Pressures at or less than this value ' 'will be visualized as the color defined' ' at the minimum value of the color map ' '(must be at least zero).') self.min_pressure_validator = QtGui.QDoubleValidator( 0, 1e20, 2, self.min_pressure) self.min_pressure_validator.setNotation( QtGui.QDoubleValidator.ScientificNotation) self.min_pressure.setValidator(self.min_pressure_validator) self.min_pressure.setText('{:.3g}'.format(visualizer.min_pressure)) # TODO(seancurtis-TRI) This is supposed to automatically update max # pressure. However, changing min pressure to be larger and then # tabbing out of the widget doesn't necessarily send the # editingFinished signal (whether it is sent appears to be arbitrary). # We need to figure this out before we make a modeless configuration # panel. self.min_pressure.editingFinished.connect(self.update_max_validator) layout.addWidget(self.min_pressure, row, 1) row += 1 # Maximum pressure. layout.addWidget(QtGui.QLabel('Maximum pressure'), row, 0) self.max_pressure = QtGui.QLineEdit() self.max_pressure.setToolTip('Pressures at or greater than this value ' 'will be visualized as the color defined' ' at the maximum value of the color map.') self.max_pressure_validator = QtGui.QDoubleValidator( 0, 1e20, 2, self.max_pressure) self.max_pressure_validator.setNotation( QtGui.QDoubleValidator.ScientificNotation) self.max_pressure.setValidator(self.max_pressure_validator) self.max_pressure.setText('{:.3g}'.format(visualizer.max_pressure)) self.max_pressure.editingFinished.connect(self.update_min_validator) layout.addWidget(self.max_pressure, row, 1) row += 1 # Whether to show pressure. layout.addWidget(QtGui.QLabel('Render contact surface with pressure'), row, 0) self.show_pressure = QtGui.QCheckBox() self.show_pressure.setChecked(show_pressure_state) self.show_pressure.setToolTip('Renders filled-in polygons with ' 'interior coloring representing ' 'pressure using the given color map.') layout.addWidget(self.show_pressure, row, 1) row += 1 # Whether to show the contact surface as a wireframe. layout.addWidget(QtGui.QLabel('Render contact surface wireframe'), row, 0) self.show_contact_edges = QtGui.QCheckBox() self.show_contact_edges.setChecked(show_contact_edges_state) self.show_contact_edges.setToolTip('Renders the edges of the ' 'contact surface.') layout.addWidget(self.show_contact_edges, row, 1) row += 1 # Whether to show the force and moment vectors. layout.addWidget(QtGui.QLabel('Render contact forces and moments'), row, 0) self.show_spatial_force = QtGui.QCheckBox() self.show_spatial_force.setChecked(show_spatial_force_state) self.show_spatial_force.setToolTip('Renders the contact forces (in ' 'red) and moments (in blue)') layout.addWidget(self.show_spatial_force, row, 1) row += 1 # Whether to show the per-quadrature-point traction vectors. layout.addWidget(QtGui.QLabel('Render traction vectors'), row, 0) self.show_traction_vectors = QtGui.QCheckBox() self.show_traction_vectors.setChecked(show_traction_vectors_state) self.show_traction_vectors.setToolTip('Renders the traction vectors ' '(per quadrature point) in ' 'magenta') layout.addWidget(self.show_traction_vectors, row, 1) row += 1 # Whether to show the per-quadrature-point slip velocity vectors. layout.addWidget(QtGui.QLabel('Render slip velocity vectors'), row, 0) self.show_slip_velocity_vectors = QtGui.QCheckBox() self.show_slip_velocity_vectors.setChecked( show_slip_velocity_vectors_state) self.show_slip_velocity_vectors.setToolTip('Renders the slip velocity ' 'vectors (per quadrature ' 'point) in cyan') layout.addWidget(self.show_slip_velocity_vectors, row, 1) row += 1 # The maximum pressure value recorded and a button to reset it. self.pressure_value_label = QtGui.QLabel( 'Maximum pressure value observed: {:.5e}'.format( max_pressure_observed)) layout.addWidget(self.pressure_value_label, row, 0) reset_button = QtGui.QPushButton('Reset max observed pressure') reset_button.connect('clicked()', self.reset_max_pressure_observed) layout.addWidget(reset_button, row, 1) row += 1 # Accept/cancel. btns = QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Cancel buttons = QtGui.QDialogButtonBox(btns, QtCore.Qt.Horizontal, self) buttons.connect('accepted()', self.accept) buttons.connect('rejected()', self.reject) layout.addWidget(buttons, row, 0, 1, 2) self.setLayout(layout)
def __init__(self): super(dlg_widthTool, self).__init__() # - Edit Fields self.edt_width = QtGui.QLineEdit() self.edt_height = QtGui.QLineEdit() self.edt_width.setPlaceholderText('Glyph Name') self.edt_height.setPlaceholderText('Glyph Name') # - Spin Box self.spb_width_percent = QtGui.QSpinBox() self.spb_height_percent = QtGui.QSpinBox() self.spb_width_units = QtGui.QSpinBox() self.spb_height_units = QtGui.QSpinBox() self.spb_width_percent.setMaximum(200) self.spb_height_percent.setMaximum(200) self.spb_width_units.setMaximum(200) self.spb_height_units.setMaximum(200) self.spb_width_units.setMinimum(-200) self.spb_height_units.setMinimum(-200) self.spb_width_percent.setSuffix('%') self.spb_height_percent.setSuffix('%') self.spb_width_units.setSuffix(' u') self.spb_height_units.setSuffix(' u') self.spb_width_percent.setMaximumWidth(50) self.spb_height_percent.setMaximumWidth(50) self.spb_width_units.setMaximumWidth(50) self.spb_height_units.setMaximumWidth(50) self.reset_fileds() # - Buttons self.btn_copyBBox_width = QtGui.QPushButton('&Copy Width') self.btn_copyBBox_height = QtGui.QPushButton('&Copy Height') self.btn_copyBBox_width.clicked.connect(lambda: self.copy_bbox(False)) self.btn_copyBBox_height.clicked.connect(lambda: self.copy_bbox(True)) # - Build self.layoutV = QtGui.QGridLayout() self.layoutV.addWidget(QtGui.QLabel('Width:'), 0, 0, 1, 1) self.layoutV.addWidget(self.edt_width, 0, 1, 1, 3) self.layoutV.addWidget(QtGui.QLabel('@'), 0, 4, 1, 1) self.layoutV.addWidget(self.spb_width_percent, 0, 5, 1, 1) self.layoutV.addWidget(QtGui.QLabel('+'), 0, 6, 1, 1) self.layoutV.addWidget(self.spb_width_units, 0, 7, 1, 1) self.layoutV.addWidget(self.btn_copyBBox_width, 0, 8, 1, 1) self.layoutV.addWidget(QtGui.QLabel('Height:'), 1, 0, 1, 1) self.layoutV.addWidget(self.edt_height, 1, 1, 1, 3) self.layoutV.addWidget(QtGui.QLabel('@'), 1, 4, 1, 1) self.layoutV.addWidget(self.spb_height_percent, 1, 5, 1, 1) self.layoutV.addWidget(QtGui.QLabel('+'), 1, 6, 1, 1) self.layoutV.addWidget(self.spb_height_units, 1, 7, 1, 1) self.layoutV.addWidget(self.btn_copyBBox_height, 1, 8, 1, 1) # - Set Widget self.setLayout(self.layoutV) self.setWindowTitle('%s %s' % (app_name, app_version)) self.setGeometry(300, 300, 400, 50) self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) # Always on top!! self.show()
import PythonQt.QtGui as pqt from string import replace def remNewline(): selection = q.getSelectedText() lines = selection.splitlines() selNew = "" for line in lines: selNew = "%s %s" % (selNew, line.rstrip('\n')) q.insertText(selNew.lstrip()) #info and render window w = pqt.QWidget() w.setGeometry(200, 50, 200, 100) l = pqt.QGridLayout(w) w.setLayout(l) w.setWindowTitle("Remove Newlines") renderButton = pqt.QPushButton("Remove!", w) text = pqt.QTextBrowser(w) l.addWidget(renderButton, 2, 0) l.addWidget(text, 1, 0) renderButton.connect("clicked()", remNewline) info = """Removes all newlines in the selected text.""" text.setText(info) w.show()
def setupUi(self): #set Main Window Title. self.setWindowTitle("Define New Type") self.setObjectName("xgNewTypeGUI") self.setEnabled(True) self.resize(400, 220) self.centralwidget = QtGui.QWidget() self.centralwidget.setObjectName("centralwidget") self.master_gridLayout = QtGui.QGridLayout(self.centralwidget) self.master_gridLayout.setObjectName("master_gridLayout") self.options_GroupBox = QtGui.QGroupBox("Options", self.centralwidget) self.options_GroupBox.setObjectName("options_GroupBox") self.master_gridLayout.addWidget(self.options_GroupBox, 0, 0, 1, 1) self.main_GridLayout = QtGui.QGridLayout() self.main_GridLayout.setObjectName("main_GridLayout") self.typeName_label = QtGui.QLabel("Texture Type Name: ", self.centralwidget) self.typeName_label.setObjectName("typeName_label") self.main_GridLayout.addWidget(self.typeName_label, 0, 0, 1, 1) self.ok_button = QtGui.QPushButton("OK", self.centralwidget) self.ok_button.setMinimumSize(QtCore.QSize(0, 45)) self.ok_button.setStyleSheet( "QPushButton{background-color: rgb(50, 200, 185); color: rgb(50,50,50)}" ) self.ok_button.setObjectName("ok_button") self.main_GridLayout.addWidget(self.ok_button, 8, 2, 1, 1) self.cancel_Button = QtGui.QPushButton("Cancel", self.centralwidget) self.cancel_Button.setMinimumSize(QtCore.QSize(0, 45)) self.cancel_Button.setObjectName("cancel_Button") self.main_GridLayout.addWidget(self.cancel_Button, 8, 0, 1, 1) self.nameTag_label = QtGui.QLabel("File Name Tag: ", self.centralwidget) self.nameTag_label.setObjectName("nameTag_label") self.main_GridLayout.addWidget(self.nameTag_label, 1, 0, 1, 1) self.dataType_label = QtGui.QLabel("Texture Data Type: ", self.centralwidget) self.dataType_label.setObjectName("dataType_label") self.main_GridLayout.addWidget(self.dataType_label, 5, 0, 1, 1) self.color_radioButton = QtGui.QRadioButton("Color", self.centralwidget) self.color_radioButton.setObjectName("color_radioButton") self.main_GridLayout.addWidget(self.color_radioButton, 5, 2, 1, 1) self.typeName_lineEdit = QtGui.QLineEdit(self.centralwidget) self.typeName_lineEdit.setMinimumSize(QtCore.QSize(0, 30)) self.typeName_lineEdit.setObjectName("typeName_lineEdit") self.typeName_lineEdit.setText("diffuse") self.main_GridLayout.addWidget(self.typeName_lineEdit, 0, 2, 1, 1) self.nameTag_lineEdit = QtGui.QLineEdit(self.centralwidget) self.nameTag_lineEdit.setMinimumSize(QtCore.QSize(0, 30)) self.nameTag_lineEdit.setMaximumSize(QtCore.QSize(100, 16777215)) self.nameTag_lineEdit.setObjectName("nameTag_lineEdit") self.nameTag_lineEdit.setText("col") self.main_GridLayout.addWidget(self.nameTag_lineEdit, 1, 2, 1, 1) self.noncolor_radioButton = QtGui.QRadioButton("Non-Color", self.centralwidget) self.noncolor_radioButton.setObjectName("noncolor_radioButton") self.main_GridLayout.addWidget(self.noncolor_radioButton, 6, 2, 1, 1) self.master_gridLayout.addLayout(self.main_GridLayout, 1, 0, 1, 1) self.setLayout(self.master_gridLayout)
def __init__(self): super(dlg_CopyLayer, self).__init__() # - Init self.active_font = pFont() self.pMode = 0 # - Basic Widgets self.tab_masters = WTableView(table_dict) self.table_populate() self.edt_checkStr = QtGui.QLineEdit() self.edt_checkStr.setPlaceholderText('DST string') self.edt_checkStr.setToolTip('Enter search criteria for selectively selecting destination masters.') self.btn_refresh = QtGui.QPushButton('Clear') self.btn_checkOn = QtGui.QPushButton('Select') self.btn_execute = QtGui.QPushButton('Execute Selection') self.btn_preset_contrast = QtGui.QPushButton('Copy to Contrast Masters') self.btn_preset_width = QtGui.QPushButton('Copy to Width Masters') self.btn_preset_weight = QtGui.QPushButton('Copy to Weight Masters') self.btn_refresh.clicked.connect(self.table_populate) self.btn_checkOn.clicked.connect(lambda: self.table_populate(True)) self.btn_execute.clicked.connect(self.execute_table) self.btn_preset_contrast.clicked.connect(lambda: self.execute_preset(copy_presets['contrast'])) self.btn_preset_width.clicked.connect(lambda: self.execute_preset(copy_presets['width'])) self.btn_preset_weight.clicked.connect(lambda: self.execute_preset(copy_presets['weight'])) self.rad_glyph = QtGui.QRadioButton('Glyph') self.rad_window = QtGui.QRadioButton('Window') self.rad_selection = QtGui.QRadioButton('Selection') self.rad_font = QtGui.QRadioButton('Font') self.chk_outline = QtGui.QCheckBox('Outline') self.chk_guides = QtGui.QCheckBox('Guides') self.chk_anchors = QtGui.QCheckBox('Anchors') self.chk_lsb = QtGui.QCheckBox('LSB') self.chk_adv = QtGui.QCheckBox('Advance') self.chk_rsb = QtGui.QCheckBox('RSB') self.chk_lnk = QtGui.QCheckBox('Metric Links') self.chk_crlayer = QtGui.QCheckBox('Add layers') # -- Set States self.chk_outline.setCheckState(QtCore.Qt.Checked) self.chk_adv.setCheckState(QtCore.Qt.Checked) self.chk_lsb.setCheckState(QtCore.Qt.Checked) self.chk_anchors.setCheckState(QtCore.Qt.Checked) self.chk_lnk.setCheckState(QtCore.Qt.Checked) self.chk_crlayer.setCheckState(QtCore.Qt.Checked) self.chk_guides.setEnabled(False) self.rad_glyph.setChecked(True) self.rad_glyph.setEnabled(True) self.rad_window.setEnabled(True) self.rad_selection.setEnabled(True) self.rad_font.setEnabled(False) self.rad_glyph.toggled.connect(self.refreshMode) self.rad_window.toggled.connect(self.refreshMode) self.rad_selection.toggled.connect(self.refreshMode) self.rad_font.toggled.connect(self.refreshMode) # - Build layouts layoutV = QtGui.QGridLayout() layoutV.addWidget(QtGui.QLabel('Process Mode:'), 0, 0, 1, 8, QtCore.Qt.AlignBottom) layoutV.addWidget(self.rad_glyph, 1, 0, 1, 2) layoutV.addWidget(self.rad_window, 1, 2, 1, 2) layoutV.addWidget(self.rad_selection, 1, 4, 1, 2) layoutV.addWidget(self.rad_font, 1, 6, 1, 2) layoutV.addWidget(QtGui.QLabel('Copy Options:'), 2, 0, 1, 8, QtCore.Qt.AlignBottom) layoutV.addWidget(self.chk_outline, 3, 0, 1, 2) layoutV.addWidget(self.chk_guides, 3, 2, 1, 2) layoutV.addWidget(self.chk_anchors, 3, 4, 1, 2) layoutV.addWidget(self.chk_crlayer, 3, 6, 1, 2) layoutV.addWidget(self.chk_lsb, 4, 0, 1, 2) layoutV.addWidget(self.chk_adv, 4, 2, 1, 2) layoutV.addWidget(self.chk_rsb, 4, 4, 1, 2) layoutV.addWidget(self.chk_lnk, 4, 6, 1, 2) layoutV.addWidget(QtGui.QLabel('Master Layers: Single source to multiple destinations'), 5, 0, 1, 8, QtCore.Qt.AlignBottom) layoutV.addWidget(QtGui.QLabel('Search:'), 6, 0, 1, 1) layoutV.addWidget(self.edt_checkStr, 6, 1, 1, 3) layoutV.addWidget(self.btn_checkOn, 6, 4, 1, 2) layoutV.addWidget(self.btn_refresh, 6, 6, 1, 2) layoutV.addWidget(self.tab_masters, 7, 0, 15, 8) layoutV.addWidget(self.btn_execute, 22, 0, 1,8) layoutV.addWidget(QtGui.QLabel('Master Layers: Copy Presets'), 23, 0, 1, 8, QtCore.Qt.AlignBottom) layoutV.addWidget(self.btn_preset_weight, 24, 0, 1,8) layoutV.addWidget(self.btn_preset_width, 25, 0, 1,8) layoutV.addWidget(self.btn_preset_contrast, 26, 0, 1,8) # - Set Widget self.setLayout(layoutV) self.setWindowTitle('%s %s' %(app_name, app_version)) self.setGeometry(300, 300, 300, 600) self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) # Always on top!! self.show()
def ui_variables(self): # -----------------------------Boring stuff (AKA VARIABLES ET FONCTIONS)----------------- self.geo_list = mari.geo.list() self.sel_obj = mari.geo.current() self.chk_dict = {} self.chk_liste = [] self.maps_combobox_list = [] self.build_all_checkbox_value = 0 self.build_selected_checkbox_value = 0 diff_chk = gui.QCheckBox("Diffuse", self) bump_chk = gui.QCheckBox("Bump", self) disp_chk = gui.QCheckBox("Displacement", self) spec_chk = gui.QCheckBox("Specular", self) norm_chk = gui.QCheckBox("Normal", self) roug_chk = gui.QCheckBox("Roughness", self) refl_chk = gui.QCheckBox("Reflection", self) refr_chk = gui.QCheckBox("Refraction", self) fres_chk = gui.QCheckBox("Fresnel", self) mask_chk = gui.QCheckBox("Mask", self) self.chk_liste = [ diff_chk, bump_chk, disp_chk, spec_chk, norm_chk, roug_chk, refl_chk, refr_chk, fres_chk, mask_chk ] self.chk_liste_name = [ "diff_chk", "bump_chk", "disp_chk", "spec_chk", "norm_chk", "roug_chk", "refl_chk", "refr_chk", "fres_chk", "mask_chk" ] # -----------------------------Base Layout---------------------------------------------- self.setWindowTitle("Channel Builder") main_layout = gui.QHBoxLayout(self) # Map Checkbox Layout left_group = gui.QGroupBox(self) self.channel_layout = gui.QGridLayout() left_group.setLayout(self.channel_layout) self.lbl = gui.QLabel("<b>Channels To Build</b>") self.channel_layout.addWidget(self.lbl) self.channel_layout.setColumnMinimumWidth(1, 5) # Middle Layout self.mid_group = gui.QGroupBox(self) self.mid_group_layout = gui.QVBoxLayout(self) self.mid_group.setLayout(self.mid_group_layout) # Add Layout to main main_layout.addWidget(left_group) main_layout.addWidget(self.mid_group) # -----------------------------Buttons, Checkbox, and stuff.... you know....------------ # Add Checkbox pour Map et Set to layout temp = 0 for checkbox in self.chk_liste: self.size_for_map = gui.QComboBox() self.size_for_map.insertItem( 0, "1024", ) self.size_for_map.insertItem( 1, "2048", ) self.size_for_map.insertItem( 2, "4096", ) self.size_for_map.insertItem( 3, "8192", ) # self.size_for_map.insertItem(4, "16384", ) #PEUT-ETRE DISPONIBLE UN JOUR QUI SAIT ;_; self.channel_layout.addWidget(self.chk_liste[temp]) self.channel_layout.addWidget(self.size_for_map) temp_name = self.chk_liste_name[temp] temp = temp + 1 self.chk_dict[temp_name] = self.size_for_map self.maps_combobox_list.append(self.size_for_map) # Select All & Select None sel_all = gui.QPushButton("Select All") sel_none = gui.QPushButton("Select None") self.channel_layout.addWidget(sel_all) self.channel_layout.addWidget(sel_none) sel_all.connect("clicked()", self.select_all) sel_none.connect("clicked()", self.select_none) # Build Selected build_selected = gui.QPushButton( "Build Selected") # Bouton Build Selected self.build_selected_same_size_chkbox = gui.QCheckBox( "Use same size for all maps?") self.build_selected_size_combobox = gui.QComboBox() self.build_selected_groupbox = gui.QGroupBox(self) # Creation du cadre self.build_selected_layout = gui.QGridLayout(self) # Layout du cadre self.build_selected_groupbox.setLayout( self.build_selected_layout) # Attribuer le layout au cadre self.build_selected_layout.addWidget( build_selected) # Ajouter bouton au layout self.build_selected_layout.addWidget( self.build_selected_same_size_chkbox) # Ajouter checkbox au layout self.build_selected_layout.addWidget( self.build_selected_size_combobox) # AJouter combobox au layout self.build_selected_size_combobox.insertItem( 0, "1024", ) # Ajouter resolution 1024 self.build_selected_size_combobox.insertItem( 1, "2048", ) # Ajouter resolution 2048 self.build_selected_size_combobox.insertItem( 2, "4096", ) # Ajouter resolution 4096 self.build_selected_size_combobox.insertItem( 3, "8192", ) # Ajouter resolution 8192 self.build_selected_size_combobox.setDisabled(1) self.mid_group_layout.addWidget( self.build_selected_groupbox ) # Ajouter le cadre au layout du milieu build_selected.connect("clicked()", self.build_selected_fc) self.build_selected_same_size_chkbox.connect( "clicked()", self.lock_build_selected_combobox) # Build All build_all = gui.QPushButton("Build All") # Bouton Build All self.build_all_same_size_chkbox = gui.QCheckBox( "Use same size for all maps?") self.build_all_size_combobox = gui.QComboBox() self.build_all_groupbox = gui.QGroupBox(self) # Création du cadre self.build_all_layout = gui.QGridLayout(self) # Layout du cadre self.build_all_groupbox.setLayout( self.build_all_layout) # Attribuer le layout au cadre self.build_all_layout.addWidget( build_all) # Ajouter le bouton au layout self.build_all_layout.addWidget( self.build_all_same_size_chkbox) # Ajouter le checkbox au layout self.build_all_layout.addWidget( self.build_all_size_combobox) # Ajouter la combobox au layout self.build_all_size_combobox.insertItem( 0, "1024", ) # Ajouter resolution 1024 self.build_all_size_combobox.insertItem( 1, "2048", ) # Ajouter resolution 2048 self.build_all_size_combobox.insertItem( 2, "4096", ) # Ajouter resolution 4096 self.build_all_size_combobox.insertItem( 3, "8192", ) # Ajouter resolution 8192 self.build_all_size_combobox.setDisabled(1) self.mid_group_layout.addWidget( self.build_all_groupbox) # Ajouter le cadre au Layout du milieu build_all.connect("clicked()", self.build_all_fc) # Connect bouton a fonction self.build_all_same_size_chkbox.connect("clicked()", self.lock_build_all_combobox)
def __init__(self): super(dlg_BuildAxis, self).__init__() # - Init self.active_font = pFont() self.exclude_list = [] # - Widgets self.cmb_master_name = QtGui.QComboBox() self.cmb_axis_name = QtGui.QComboBox() self.cmb_axis_short = QtGui.QComboBox() self.cmb_axis_tag = QtGui.QComboBox() self.spb_italic_angle = QtGui.QSpinBox() self.spb_italic_shift = QtGui.QSpinBox() self.tab_masters = WTableView(table_dict) self.btn_exclude_file = QtGui.QPushButton('Select glyph exclude list') self.btn_populate = QtGui.QPushButton('Populate Master Table') self.btn_execute = QtGui.QPushButton('Execute') self.cmb_master_name.setEditable(True) self.cmb_axis_name.setEditable(True) self.cmb_axis_short.setEditable(True) self.cmb_axis_tag.setEditable(True) self.spb_italic_angle.setMinimum(spinbox_range[0]) self.spb_italic_shift.setMinimum(spinbox_range[0]) self.spb_italic_angle.setMaximum(spinbox_range[1]) self.spb_italic_shift.setMaximum(spinbox_range[1]) self.cmb_master_name.addItems(italic_axis_names_T[0]) self.cmb_axis_name.addItems(italic_axis_names_T[0]) self.cmb_axis_short.addItems(italic_axis_names_T[1]) self.cmb_axis_tag.addItems(italic_axis_names_T[2]) self.spb_italic_angle.setValue(italic_transform_angle) self.spb_italic_shift.setValue(italic_transform_shift) self.cmb_axis_name.currentIndexChanged.connect(self.change_axis_name) self.btn_exclude_file.clicked.connect(self.load_exclude_list) self.btn_populate.clicked.connect(self.table_populate) self.btn_execute.clicked.connect(self.table_execute) # - Build layouts layoutV = QtGui.QGridLayout() layoutV.addWidget(QtGui.QLabel('Build Axis:'), 0, 0, 1, 9, QtCore.Qt.AlignBottom) layoutV.addWidget(QtGui.QLabel('Name:'), 1, 0, 1, 1) layoutV.addWidget(self.cmb_axis_name, 1, 1, 1, 2) layoutV.addWidget(QtGui.QLabel('Short:'), 1, 3, 1, 1) layoutV.addWidget(self.cmb_axis_short, 1, 4, 1, 2) layoutV.addWidget(QtGui.QLabel('Tag:'), 1, 6, 1, 1) layoutV.addWidget(self.cmb_axis_tag, 1, 7, 1, 2) layoutV.addWidget(QtGui.QLabel('Masters:'), 2, 0, 1, 2, QtCore.Qt.AlignBottom) layoutV.addWidget(QtGui.QLabel('Transformation:'), 2, 2, 1, 3, QtCore.Qt.AlignBottom) layoutV.addWidget(QtGui.QLabel('Suffix:'), 3, 0, 1, 1) layoutV.addWidget(self.cmb_master_name, 3, 1, 1, 2) layoutV.addWidget(QtGui.QLabel('Angle:'), 3, 3, 1, 1) layoutV.addWidget(self.spb_italic_angle, 3, 4, 1, 2) layoutV.addWidget(QtGui.QLabel('Shift:'), 3, 6, 1, 1) layoutV.addWidget(self.spb_italic_shift, 3, 7, 1, 2) layoutV.addWidget(QtGui.QLabel('Glyph processing:'), 5, 0, 1, 9, QtCore.Qt.AlignBottom) layoutV.addWidget(self.btn_exclude_file, 6, 0, 1, 9) layoutV.addWidget(QtGui.QLabel('Overview:'), 7, 0, 1, 9, QtCore.Qt.AlignBottom) layoutV.addWidget(self.btn_populate, 8, 0, 1, 9) layoutV.addWidget(self.tab_masters, 9, 0, 25, 9) layoutV.addWidget(self.btn_execute, 34, 0, 1, 9) # - Set Widget self.setLayout(layoutV) self.setWindowTitle('%s %s' % (app_name, app_version)) self.setGeometry(300, 300, 400, 600) self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) # Always on top!! self.show()
def setupUi(self): #set Main Window Title. self.setWindowTitle("xg Texture Exporter") self.setObjectName("xgTextureExportGUI") self.setEnabled(True) self.resize(545, 702) ##===================================== CentralLayout ============================ self.centralwidget = QtGui.QWidget() self.centralwidget.setObjectName("centralwidget") ##===================================== MasterLayout ============================ self.master_GridLayout = QtGui.QGridLayout(self.centralwidget) self.master_GridLayout.setObjectName("master_GridLayout") ##===================================== TopLayout ============================ self.top_GridLayout = QtGui.QGridLayout() self.top_GridLayout.setObjectName("top_GridLayout") ##=======exportPathLine======## self.exportPathLineEdit = QtGui.QLineEdit(self.centralwidget) self.exportPathLineEdit.setMinimumSize(QtCore.QSize(0, 30)) self.exportPathLineEdit.setObjectName("exportPathLineEdit") self.top_GridLayout.addWidget(self.exportPathLineEdit, 2, 0, 1, 1) ##=======FolderLable=======## self.outputFolderLabel = QtGui.QLabel("Output Folder", self.centralwidget) setBold(self.outputFolderLabel) self.outputFolderLabel.setObjectName("outputFolderLabel") self.top_GridLayout.addWidget(self.outputFolderLabel, 0, 0, 1, 1) ##=======BrowseButton=======## self.browseButton = xgPushButton("browseButton", "Browse", 0, "Choose texture output directory.") self.browseButton.setMinimumSize(QtCore.QSize(0, 30)) self.top_GridLayout.addWidget(self.browseButton, 2, 1, 1, 1) self.master_GridLayout.addLayout(self.top_GridLayout, 0, 0, 1, 1) ##===================================== MidLayout ============================ self.mid_HBoxLayout = QtGui.QHBoxLayout() self.mid_HBoxLayout.setObjectName("mid_HBoxLayout") self.midLeft_GridLayout = QtGui.QGridLayout() self.midLeft_GridLayout.setObjectName("midLeft_GridLayout") ##=======channelsLable=======## self.channels_Label = QtGui.QLabel("Channels", self.centralwidget) setBold(self.channels_Label) self.channels_Label.setObjectName("channels_Label") self.midLeft_GridLayout.addWidget(self.channels_Label, 0, 0, 1, 1) ##=======ChannelButtons=======## self.removeChannel_Button = xgPushButton( "removeChannel_Button", "-", 0, "remove selected channels from export list.") self.removeChannel_Button.setMinimumSize(QtCore.QSize(0, 45)) self.addChannel_Button = xgPushButton( "addChannel_Button", "+", 0, "add selected channels to export list.") self.addChannel_Button.setMinimumSize(QtCore.QSize(0, 45)) self.midLeft_GridLayout.addWidget(self.addChannel_Button, 2, 0, 1, 1) self.midLeft_GridLayout.addWidget(self.removeChannel_Button, 2, 1, 1, 1) ##=======ChannelList=======## self.channelsList_ListWidget = ChannelsToExportList() self.channelsList_ListWidget.isSortingEnabled() self.channelsList_ListWidget.setSortingEnabled(False) self.channelsList_ListWidget.setObjectName("channelsList_ListWidget") QtGui.QListWidgetItem(self.channelsList_ListWidget) self.midLeft_GridLayout.addWidget(self.channelsList_ListWidget, 1, 0, 1, 2) self.mid_HBoxLayout.addLayout(self.midLeft_GridLayout) self.options_GroupBox = QtGui.QGroupBox("Options", self.centralwidget) self.options_GroupBox.setObjectName("options_GroupBox") self.outputFormat_Label = QtGui.QLabel("Output Format :", self.options_GroupBox) self.outputFormat_Label.setGeometry(QtCore.QRect(20, 40, 121, 21)) self.outputFormat_Label.setObjectName("outputFormat_Label") self.resolution_Label = QtGui.QLabel("Resolution:", self.options_GroupBox) self.resolution_Label.setGeometry(QtCore.QRect(20, 70, 121, 21)) self.resolution_Label.setObjectName("resolution_Label") self.processTextures_Label = QtGui.QLabel("process textures:", self.options_GroupBox) self.processTextures_Label.setGeometry(QtCore.QRect(20, 130, 121, 21)) self.processTextures_Label.setObjectName("processTextures_Label") ##=======Options=======## self.outFormat_ComboBox = QtGui.QComboBox(self.options_GroupBox) self.outFormat_ComboBox.setToolTip("define output texture format.") self.outFormat_ComboBox.setGeometry(QtCore.QRect(130, 40, 81, 25)) self.outFormat_ComboBox.setEditable(False) self.outFormat_ComboBox.setObjectName("outFormat_ComboBox") self.outFormat_ComboBox.addItem("exr") self.outFormat_ComboBox.addItem("tif") self.outFormat_ComboBox.setCurrentIndex(1) self.resolution_ComboBox = QtGui.QComboBox(self.options_GroupBox) self.resolution_ComboBox.setToolTip( "define output texture resolution.") self.resolution_ComboBox.setGeometry(QtCore.QRect(100, 70, 111, 25)) self.resolution_ComboBox.setObjectName("resolution_ComboBox") self.resolution_ComboBox.addItem("channel res") self.resolution_ComboBox.addItem("full (8K)") self.resolution_ComboBox.addItem("heigh (4K)") self.resolution_ComboBox.addItem("mid (2K)") self.resolution_ComboBox.addItem("low (1K)") self.clearExpChan_CheckBox = QtGui.QCheckBox("Clear export channels", self.options_GroupBox) self.clearExpChan_CheckBox.setGeometry(QtCore.QRect(20, 100, 181, 23)) self.clearExpChan_CheckBox.setChecked(True) self.clearExpChan_CheckBox.setObjectName("clearExpChan_CheckBox") self.clearExpChan_CheckBox.setToolTip( "delete the flattened channels after export.") self.processTextures_ComboBox = QtGui.QComboBox(self.options_GroupBox) self.processTextures_ComboBox.setToolTip( "define textures processing method.") self.processTextures_ComboBox.setGeometry( QtCore.QRect(135, 130, 105, 25)) self.processTextures_ComboBox.setObjectName("processTextures_ComboBox") self.processTextures_ComboBox.addItem("None") self.processTextures_ComboBox.addItem("Local process") #self.processTextures_ComboBox.addItem("Farm process") #self.texturePublish_CheckBox = QtGui.QCheckBox("Publish farm Textures", self.options_GroupBox) #self.texturePublish_CheckBox.setToolTip("process textures on the farm via texturePublish. \n (convert only will not publish.)") #self.texturePublish_CheckBox.setGeometry(QtCore.QRect(20, 160, 181, 23)) #self.texturePublish_CheckBox.setCheckable(False) #self.texturePublish_CheckBox.setObjectName("texturePublish_CheckBox") ''' self.linear_CheckBox = QtGui.QCheckBox("Local process textures.", self.options_GroupBox) self.linear_CheckBox.setToolTip("convert textures to Mipmap exr localy.") self.linear_CheckBox.setGeometry(QtCore.QRect(20, 130, 181, 23)) #self.linear_CheckBox.setChecked(True) self.linear_CheckBox.setObjectName("linear_CheckBox") self.publish_CheckBox = QtGui.QCheckBox("Publish After Export", self.options_GroupBox) self.publish_CheckBox.setGeometry(QtCore.QRect(20, 190, 181, 23)) self.publish_CheckBox.setCheckable(False) self.publish_CheckBox.setObjectName("publish_CheckBox") ''' self.mid_HBoxLayout.addWidget(self.options_GroupBox) self.master_GridLayout.addLayout(self.mid_HBoxLayout, 1, 0, 1, 1) self.bottom_VBoxLayout = QtGui.QVBoxLayout() self.bottom_VBoxLayout.setObjectName("bottom_VBoxLayout") self.exportChannels_Label = QtGui.QLabel("Channels For Export", self.centralwidget) self.exportChannels_Label.setObjectName("exportChannels_Label") setBold(self.exportChannels_Label) self.bottom_VBoxLayout.addWidget(self.exportChannels_Label) ##======table=======## self.exportChannelsList_tableWidget = QtGui.QTableWidget( self.centralwidget) self.exportChannelsList_tableWidget.setWordWrap(True) self.exportChannelsList_tableWidget.setCornerButtonEnabled(True) #self.exportChannelsList_tableWidget.setRowCount(2) self.exportChannelsList_tableWidget.setObjectName( "exportChannelsList_tableWidget") self.exportChannelsList_tableWidget.setColumnCount(5) self.exportChannelsList_tableWidget.setRowCount(0) self.exportChannelsList_tableWidget.setSelectionBehavior( QtGui.QAbstractItemView.SelectRows) self.exportChannelsList_tableWidget.setSelectionMode( QtGui.QAbstractItemView.SingleSelection) self.exportChannelsList_tableWidget.horizontalHeader().setVisible(True) self.exportChannelsList_tableWidget.horizontalHeader( ).setCascadingSectionResizes(False) self.exportChannelsList_tableWidget.horizontalHeader( ).setMinimumSectionSize(25) self.exportChannelsList_tableWidget.horizontalHeader( ).setSortIndicatorShown(False) #self.exportChannelsList_tableWidget.horizontalHeader().setStretchLastSection(True) self.exportChannelsList_tableWidget.verticalHeader( ).setCascadingSectionResizes(False) self.exportChannelsList_tableWidget.verticalHeader( ).setDefaultSectionSize(28) self.exportChannelsList_tableWidget.verticalHeader( ).setMinimumSectionSize(10) self.itemLine0 = QtGui.QLineEdit("channel") self.item0 = QtGui.QTableWidgetItem(self.itemLine0.text) self.exportChannelsList_tableWidget.setHorizontalHeaderItem( 0, self.item0) self.itemLine1 = QtGui.QLineEdit("type") self.item1 = QtGui.QTableWidgetItem(self.itemLine1.text) self.exportChannelsList_tableWidget.setHorizontalHeaderItem( 1, self.item1) self.itemLine2 = QtGui.QLineEdit("version") self.item2 = QtGui.QTableWidgetItem(self.itemLine2.text) self.exportChannelsList_tableWidget.setHorizontalHeaderItem( 2, self.item2) self.itemLine3 = QtGui.QLineEdit("non_color") self.item3 = QtGui.QTableWidgetItem(self.itemLine3.text) self.exportChannelsList_tableWidget.setHorizontalHeaderItem( 3, self.item3) self.itemLine4 = QtGui.QLineEdit("variation") self.item4 = QtGui.QTableWidgetItem(self.itemLine4.text) self.exportChannelsList_tableWidget.setHorizontalHeaderItem( 4, self.item4) self.exportChannelsList_tableWidget.horizontalHeader( ).setCascadingSectionResizes(False) self.bottom_VBoxLayout.addWidget(self.exportChannelsList_tableWidget) self.exportButton_HBoxLayout = QtGui.QHBoxLayout() self.exportButton_HBoxLayout.setObjectName("exportButton_HBoxLayout") self.cancel_Button = xgPushButton("cancel_Button", "Cancel", 1) self.cancel_Button.setMinimumSize(QtCore.QSize(0, 45)) self.exportButton_HBoxLayout.addWidget(self.cancel_Button) self.exportPatch_Button = xgPushButton("exportPatch_Button", "Export Selected Patches", 1) self.exportPatch_Button.setMinimumSize(QtCore.QSize(200, 45)) self.exportButton_HBoxLayout.addWidget(self.exportPatch_Button) self.export_Button = xgPushButton("export_Button", "Export", 0) self.export_Button.setMinimumSize(QtCore.QSize(200, 45)) self.exportButton_HBoxLayout.addWidget(self.export_Button) self.bottom_VBoxLayout.addLayout(self.exportButton_HBoxLayout) self.master_GridLayout.addLayout(self.bottom_VBoxLayout, 2, 0, 1, 1) self.setLayout(self.master_GridLayout)
def __init__(self, visualizer, parent=None): QtGui.QDialog.__init__(self, parent) self.setWindowTitle('Hydroelastic contact visualization settings') self.reset_max_pressure_observed_functor = \ visualizer.reset_max_pressure_observed layout = QtGui.QGridLayout() layout.setColumnStretch(0, 0) layout.setColumnStretch(1, 1) row = 0 # Color map selection. layout.addWidget(QtGui.QLabel('Color map'), row, 0) self.color_map_mode = QtGui.QComboBox() modes = ColorMapModes.get_modes() mode_labels = [ColorMapModes.get_mode_string(m) for m in modes] self.color_map_mode.addItems(mode_labels) self.color_map_mode.setCurrentIndex(visualizer.color_map_mode) mode_tool_tip = 'Determines the mapping from pressures to colors:\n' for m in modes: mode_tool_tip += ' - {}: {}\n'.format( ColorMapModes.get_mode_string(m), ColorMapModes.get_mode_docstring(m)) self.color_map_mode.setToolTip(mode_tool_tip) layout.addWidget(self.color_map_mode, row, 1) row += 1 # Minimum pressure. layout.addWidget(QtGui.QLabel('Minimum pressure'), row, 0) self.min_pressure = QtGui.QLineEdit() self.min_pressure.setToolTip('Pressures at or less than this value ' 'will be visualized as the color defined' ' at the minimum value of the color map ' '(must be at least zero).') self.min_pressure_validator = QtGui.QDoubleValidator( 0, 1e20, 2, self.min_pressure) self.min_pressure_validator.setNotation( QtGui.QDoubleValidator.ScientificNotation) self.min_pressure.setValidator(self.min_pressure_validator) self.min_pressure.setText('{:.3g}'.format(visualizer.min_pressure)) # TODO(seancurtis-TRI) This is supposed to automatically update max # pressure. However, changing min pressure to be larger and then # tabbing out of the widget doesn't necessarily send the # editingFinished signal (whether it is sent appears to be arbitrary). # We need to figure this out before we make a modeless configuration # panel. self.min_pressure.editingFinished.connect(self.update_max_validator) layout.addWidget(self.min_pressure, row, 1) row += 1 # Maximum pressure. layout.addWidget(QtGui.QLabel('Maximum pressure'), row, 0) self.max_pressure = QtGui.QLineEdit() self.max_pressure.setToolTip('Pressures at or greater than this value ' 'will be visualized as the color defined' ' at the maximum value of the color map.') self.max_pressure_validator = QtGui.QDoubleValidator( 0, 1e20, 2, self.max_pressure) self.max_pressure_validator.setNotation( QtGui.QDoubleValidator.ScientificNotation) self.max_pressure.setValidator(self.max_pressure_validator) self.max_pressure.setText('{:.3g}'.format(visualizer.max_pressure)) self.max_pressure.editingFinished.connect(self.update_min_validator) layout.addWidget(self.max_pressure, row, 1) row += 1 # Whether to show pressure. layout.addWidget(QtGui.QLabel('Render contact surface with pressure'), row, 0) self.show_pressure = QtGui.QCheckBox() self.show_pressure.setChecked(visualizer.show_pressure) self.show_pressure.setToolTip('Renders filled-in polygons with ' 'interior coloring representing ' 'pressure using the given color map.') layout.addWidget(self.show_pressure, row, 1) row += 1 # Whether to show the contact surface as a wireframe. layout.addWidget(QtGui.QLabel('Render contact surface wireframe'), row, 0) self.show_contact_edges = QtGui.QCheckBox() self.show_contact_edges.setChecked(visualizer.show_contact_edges) self.show_contact_edges.setToolTip('Renders the edges of the ' 'contact surface.') layout.addWidget(self.show_contact_edges, row, 1) row += 1 contact_data_grp = QtGui.QGroupBox("Contact data") contact_layout = QtGui.QGridLayout() contact_data_grp.setLayout(contact_layout) contact_layout.setColumnStretch(0, 0) contact_layout.setColumnStretch(1, 1) contact_row = 0 layout.addWidget(contact_data_grp, row, 0, 1, 2) row += 1 # Whether to show the force and moment vectors. contact_layout.addWidget( QtGui.QLabel('Render contact force and moment ' 'vectors'), contact_row, 0) self.show_spatial_force = QtGui.QCheckBox() self.show_spatial_force.setChecked(visualizer.show_spatial_force) self.show_spatial_force.setToolTip('Renders the contact forces (in ' 'red) and moments (in blue)') contact_layout.addWidget(self.show_spatial_force, contact_row, 1) contact_row += 1 # Whether to show the per-quadrature-point traction vectors. contact_layout.addWidget(QtGui.QLabel('Render traction vectors'), contact_row, 0) self.show_traction_vectors = QtGui.QCheckBox() self.show_traction_vectors.setChecked(visualizer.show_traction_vectors) self.show_traction_vectors.setToolTip('Renders the traction vectors ' '(per quadrature point) in ' 'magenta') contact_layout.addWidget(self.show_traction_vectors, contact_row, 1) contact_row += 1 # Whether to show the per-quadrature-point slip velocity vectors. contact_layout.addWidget(QtGui.QLabel('Render slip velocity vectors'), contact_row, 0) self.show_slip_velocity_vectors = QtGui.QCheckBox() self.show_slip_velocity_vectors.setChecked( visualizer.show_slip_velocity_vectors) self.show_slip_velocity_vectors.setToolTip('Renders the slip velocity ' 'vectors (per quadrature ' 'point) in cyan') contact_layout.addWidget(self.show_slip_velocity_vectors, contact_row, 1) contact_row += 1 # TODO(DamrongGuoy): The following three widgets "Magnitude # representation", "Global scale", and "Magnitude cut-off" are copied # and modified from show_point_pair_contact.py _ContactConfigDialog(). # We should have both show_hydroelastic_contact.py and # show_point_pair_contact.py share the code instead of duplication. # Furthermore, we should have this setting for each of force, moment, # traction, and slip vectors. See issue #14680. # Magnitude representation layout.addWidget(QtGui.QLabel("Vector scaling mode"), row, 0) self.magnitude_mode = QtGui.QComboBox() modes = ContactVisModes.get_modes() mode_labels = [ContactVisModes.get_mode_string(m) for m in modes] self.magnitude_mode.addItems(mode_labels) self.magnitude_mode.setCurrentIndex(visualizer.magnitude_mode) mode_tool_tip = 'Determines how the magnitude of all hydroelastic ' \ 'vector quantities are visualized:\n' for m in modes: mode_tool_tip += ' - {}: {}\n'.format( ContactVisModes.get_mode_string(m), ContactVisModes.get_mode_docstring(m)) self.magnitude_mode.setToolTip(mode_tool_tip) layout.addWidget(self.magnitude_mode, row, 1) row += 1 # Global scale. layout.addWidget(QtGui.QLabel("Global scale of all vectors"), row, 0) self.global_scale = QtGui.QLineEdit() self.global_scale.setToolTip( 'All visualized vectors are multiplied by this scale factor (must ' 'be non-negative and at most 100). It is dimensionless.') validator = QtGui.QDoubleValidator(0, 100, 3, self.global_scale) validator.setNotation(QtGui.QDoubleValidator.StandardNotation) self.global_scale.setValidator(validator) self.global_scale.setText("{:.3f}".format(visualizer.global_scale)) layout.addWidget(self.global_scale, row, 1) row += 1 # Magnitude cut-off. layout.addWidget(QtGui.QLabel("Minimum vector"), row, 0) self.min_magnitude = QtGui.QLineEdit() self.min_magnitude.setToolTip('Vectors with a magnitude less than ' 'this value will not be visualized ' '(must be > 1e-10 and at most 100') validator = QtGui.QDoubleValidator(1e-10, 100, 10, self.min_magnitude) validator.setNotation(QtGui.QDoubleValidator.StandardNotation) self.min_magnitude.setValidator(validator) self.min_magnitude.setText("{:.3g}".format(visualizer.min_magnitude)) layout.addWidget(self.min_magnitude, row, 1) row += 1 # The maximum pressure value recorded and a button to reset it. self.pressure_value_label = QtGui.QLabel( 'Maximum pressure value observed: {:.5e}'.format( visualizer.max_pressure_observed)) layout.addWidget(self.pressure_value_label, row, 0) reset_button = QtGui.QPushButton('Reset max observed pressure') reset_button.connect('clicked()', self.reset_max_pressure_observed) layout.addWidget(reset_button, row, 1) row += 1 # Accept/cancel. btns = QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Cancel buttons = QtGui.QDialogButtonBox(btns, QtCore.Qt.Horizontal, self) buttons.connect('accepted()', self.accept) buttons.connect('rejected()', self.reject) layout.addWidget(buttons, row, 0, 1, 2) self.setLayout(layout)
newOrcText = "%s\n%s" % (newOrcText, newline.rstrip()) prev = longComment #reset prev for analysing long comments #remove starting newline newOrcText = newOrcText[1:] if (selection == ""): q.setOrc(newOrcText) # Write all the orchestra section else: q.insertText(newOrcText) # Peplaces the current selection #info and render window w = pqt.QWidget() # Create main widget w.setGeometry(50, 50, 400, 450) l = pqt.QGridLayout(w) # Layout to organize widgets w.setLayout(l) w.setWindowTitle("Csound Code Indentation") space_left = pqt.QSpinBox(w) space_left.setValue(11) l.addWidget(space_left, 2, 0) space_right = pqt.QSpinBox(w) space_right.setValue(22) l.addWidget(space_right, 3, 0) renderButton = pqt.QPushButton("Indent!", w) text = pqt.QTextBrowser(w) l.addWidget(renderButton, 4, 0) l.addWidget(text, 1, 0)
def setupUi(self, Dialog): Dialog.setObjectName(_fromUtf8("Create UI with QtDesigner")) Dialog.setMinimumSize(QtCore.QSize(300, 200)) self.frame = QtGui.QFrame(Dialog) self.frame.setGeometry(QtCore.QRect(4, 4, 268, 63)) self.frame.setObjectName(_fromUtf8("frame")) self.keepPyBox = QtGui.QCheckBox(Dialog) self.keepPyBox.setGeometry(QtCore.QRect(166, 98, 117, 21)) self.keepPyBox.setObjectName(_fromUtf8("keepPyBox")) self.addPyrunBox = QtGui.QCheckBox(Dialog) self.addPyrunBox.setGeometry(QtCore.QRect(21, 98, 141, 21)) self.addPyrunBox.setObjectName(_fromUtf8("addPyrunBox")) self.convertButton = QtGui.QCommandLinkButton(Dialog) self.convertButton.setGeometry(QtCore.QRect(70, 130, 168, 41)) self.convertButton.setObjectName(_fromUtf8("convertButton")) self.line = QtGui.QFrame(Dialog) self.line.setGeometry(QtCore.QRect(21, 80, 262, 16)) self.line.setFrameShape(QtGui.QFrame.HLine) self.line.setFrameShadow(QtGui.QFrame.Sunken) self.line.setObjectName(_fromUtf8("line")) self.layoutWidget = QtGui.QWidget(Dialog) self.layoutWidget.setGeometry(QtCore.QRect(20, 20, 260, 53)) self.layoutWidget.setObjectName(_fromUtf8("layoutWidget")) self.gridLayout = QtGui.QGridLayout(self.layoutWidget) self.gridLayout.setMargin(0) self.gridLayout.setObjectName(_fromUtf8("gridLayout")) self.label = QtGui.QLabel(self.layoutWidget) self.label.setObjectName(_fromUtf8("label")) self.gridLayout.addWidget(self.label, 0, 0, 1, 1) self.uiNameEdit = QtGui.QLineEdit(self.layoutWidget) self.uiNameEdit.setObjectName(_fromUtf8("uiNameEdit")) self.gridLayout.addWidget(self.uiNameEdit, 0, 1, 1, 3) self.newButton = QtGui.QPushButton(self.layoutWidget) icon = QtGui.QIcon.fromTheme(_fromUtf8("document-new")) self.newButton.setIcon(icon) self.newButton.setObjectName(_fromUtf8("newButton")) self.gridLayout.addWidget(self.newButton, 1, 0, 1, 2) self.openButton = QtGui.QPushButton(self.layoutWidget) icon = QtGui.QIcon.fromTheme(_fromUtf8("document-open")) self.openButton.setIcon(icon) self.openButton.setObjectName(_fromUtf8("openButton")) self.gridLayout.addWidget(self.openButton, 1, 2, 1, 1) self.designButton = QtGui.QPushButton(self.layoutWidget) self.designButton.setToolTip(_fromUtf8("")) self.designButton.setWhatsThis(_fromUtf8("")) icon = QtGui.QIcon.fromTheme(_fromUtf8("applications-engineering")) self.designButton.setIcon(icon) self.designButton.setObjectName(_fromUtf8("designButton")) self.gridLayout.addWidget(self.designButton, 1, 3, 1, 1) self.layoutWidget1 = QtGui.QWidget(Dialog) self.layoutWidget1.setGeometry(QtCore.QRect(0, 0, 2, 2)) self.layoutWidget1.setObjectName(_fromUtf8("layoutWidget1")) self.verticalLayout = QtGui.QVBoxLayout(self.layoutWidget1) self.verticalLayout.setMargin(0) self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.splitter = QtGui.QSplitter(Dialog) self.splitter.setGeometry(QtCore.QRect(0, 0, 0, 0)) self.splitter.setOrientation(QtCore.Qt.Horizontal) self.splitter.setObjectName(_fromUtf8("splitter")) self.retranslateUi(Dialog) QtCore.QObject.connect(self.designButton, QtCore.SIGNAL(_fromUtf8("clicked()")), self.runDesigner) QtCore.QObject.connect(self.convertButton, QtCore.SIGNAL(_fromUtf8("clicked()")), self.convert) QtCore.QObject.connect(self.openButton, QtCore.SIGNAL(_fromUtf8("clicked()")), self.openDialog) QtCore.QObject.connect(self.newButton, QtCore.SIGNAL(_fromUtf8("clicked()")), self.newDialog)
def gui_example(self, object): self.set_mdsa(object) dialog = QtGui.QDialog() dialog.setObjectName("dialog") dialog.resize(858, 555) gridLayout_5 = QtGui.QGridLayout(dialog) gridLayout_5.setObjectName("gridLayout_5") avatar_groupBox = QtGui.QGroupBox(dialog) avatar_groupBox.setObjectName("save_groupBox") gridLayout = QtGui.QGridLayout(avatar_groupBox) gridLayout.setObjectName("gridLayout") avatar_load_toolButton = QtGui.QToolButton(avatar_groupBox) avatar_load_toolButton.setObjectName("avatar_load_toolButton") gridLayout.addWidget(avatar_load_toolButton, 0, 0, 1, 1) avatar_refresh_toolButton = QtGui.QToolButton(avatar_groupBox) avatar_refresh_toolButton.setObjectName("avatar_refresh_toolButton") gridLayout.addWidget(avatar_refresh_toolButton, 0, 1, 1, 1) self.avatar_ext_comboBox = QtGui.QComboBox(avatar_groupBox); self.avatar_ext_comboBox.setObjectName("avatar_ext_comboBox"); self.avatar_ext_comboBox.clear(); self.avatar_ext_comboBox.insertItem(0, "avt") self.avatar_ext_comboBox.insertItem(1, "obj") self.avatar_ext_comboBox.insertItem(2, "fbx") self.avatar_ext_comboBox.insertItem(3, "dae") gridLayout.addWidget(self.avatar_ext_comboBox, 0, 2, 1, 1); horizontalSpacer = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) gridLayout.addItem(horizontalSpacer, 0, 3, 1, 1) self.avatar_listWidget = QtGui.QListWidget(avatar_groupBox) self.avatar_listWidget.setObjectName("listWidget") gridLayout.addWidget(self.avatar_listWidget, 1, 0, 1, 3) gridLayout_5.addWidget(avatar_groupBox, 1, 0, 1, 1) garment_groupBox = QtGui.QGroupBox(dialog) garment_groupBox.setObjectName("laod_groupBox") gridLayout_2 = QtGui.QGridLayout(garment_groupBox); gridLayout_2.setObjectName("gridLayout_2") garment_load_toolButton = QtGui.QToolButton(garment_groupBox) garment_load_toolButton.setObjectName("garment_load_toolButton") gridLayout_2.addWidget(garment_load_toolButton, 0, 0, 1, 1) garment_refresh_toolButton = QtGui.QToolButton(garment_groupBox) garment_refresh_toolButton.setObjectName("garment_refresh_toolButton") gridLayout_2.addWidget(garment_refresh_toolButton, 0, 1, 1, 1) self.garment_ext_comboBox = QtGui.QComboBox(garment_groupBox); self.garment_ext_comboBox.setObjectName("garment_ext_comboBox"); self.garment_ext_comboBox.clear(); self.garment_ext_comboBox.insertItem(0, "zpac") self.garment_ext_comboBox.insertItem(1, "pac") gridLayout_2.addWidget(self.garment_ext_comboBox, 0, 2, 1, 1); horizontalSpacer_2 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) gridLayout_2.addItem(horizontalSpacer_2, 0, 3, 1, 1) self.garment_listWidget = QtGui.QListWidget(garment_groupBox) self.garment_listWidget.setObjectName("garment_listWidget") gridLayout_2.addWidget(self.garment_listWidget, 1, 0, 1, 3) gridLayout_5.addWidget(garment_groupBox, 1, 1, 1, 1) animation_groupBox = QtGui.QGroupBox(dialog) animation_groupBox.setObjectName("animation_groupBox") gridLayout_3 = QtGui.QGridLayout(animation_groupBox) gridLayout_3.setObjectName("gridLayout_3") anim_load_toolButton = QtGui.QToolButton(animation_groupBox) anim_load_toolButton.setObjectName("anim_load_toolButton") gridLayout_3.addWidget(anim_load_toolButton, 0, 0, 1, 1) anim_refresh_toolButton = QtGui.QToolButton(animation_groupBox) anim_refresh_toolButton.setObjectName("anim_refresh_toolButton") gridLayout_3.addWidget(anim_refresh_toolButton, 0, 1, 1, 1) self.animation_ext_comboBox = QtGui.QComboBox(animation_groupBox); self.animation_ext_comboBox.setObjectName("animation_ext_comboBox"); self.animation_ext_comboBox.clear(); self.animation_ext_comboBox.insertItem(0, "pos") self.animation_ext_comboBox.insertItem(1, "mtn") self.animation_ext_comboBox.insertItem(2, "abc") self.animation_ext_comboBox.insertItem(3, "mc") self.animation_ext_comboBox.insertItem(4, "pc2") self.animation_ext_comboBox.insertItem(5, "mdd") gridLayout_3.addWidget(self.animation_ext_comboBox, 0, 2, 1, 1); horizontalSpacer_3 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) gridLayout_3.addItem(horizontalSpacer_3, 0, 3, 1, 1) self.animation_listWidget = QtGui.QListWidget(animation_groupBox) self.animation_listWidget.setObjectName("animation_listWidget") gridLayout_3.addWidget(self.animation_listWidget, 1, 0, 1, 3) gridLayout_5.addWidget(animation_groupBox, 1, 2, 1, 1) save_groupBox = QtGui.QGroupBox(dialog) save_groupBox.setObjectName("save_groupBox") gridLayout_4 = QtGui.QGridLayout(save_groupBox) gridLayout_4.setObjectName("gridLayout_4") save_toolButton = QtGui.QToolButton(save_groupBox) save_toolButton.setObjectName("save_toolButton") gridLayout_4.addWidget(save_toolButton, 0, 0, 1, 1) self.save_ext_comboBox = QtGui.QComboBox(save_groupBox); self.save_ext_comboBox.setObjectName("save_ext_comboBox"); self.save_ext_comboBox.clear(); self.save_ext_comboBox.insertItem(0, "zprj") self.save_ext_comboBox.insertItem(1, "zpac") self.save_ext_comboBox.insertItem(2, "obj") self.save_ext_comboBox.insertItem(3, "fbx") self.save_ext_comboBox.insertItem(4, "abc") self.save_ext_comboBox.insertItem(5, "mc") self.save_ext_comboBox.insertItem(6, "pc2") self.save_ext_comboBox.insertItem(7, "mdd") gridLayout_4.addWidget(self.save_ext_comboBox, 0, 1, 1, 1); self.save_listWidget = QtGui.QListWidget(save_groupBox) self.save_listWidget.setObjectName("save_listWidget") gridLayout_4.addWidget(self.save_listWidget, 1, 0, 1, 2) horizontalSpacer_4 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) gridLayout_4.addItem(horizontalSpacer_4, 0, 2, 1, 1) gridLayout_5.addWidget(save_groupBox, 2, 0, 1, 3) horizontalSpacer_5 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) gridLayout_5.addItem(horizontalSpacer_5, 3, 0, 1, 1); process_button = QtGui.QPushButton(dialog) process_button.setObjectName("process_button") gridLayout_5.addWidget(process_button, 3, 1, 1, 1) cancel_button = QtGui.QPushButton(dialog) cancel_button.setObjectName("cancel_button") gridLayout_5.addWidget(cancel_button, 3, 2, 1, 1) horizontalSpacer_6 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) gridLayout_5.addItem(horizontalSpacer_6, 3, 3, 1, 1); sync_button = QtGui.QToolButton(dialog); sync_button.setObjectName("sync_button"); gridLayout_5.addWidget(sync_button, 0, 0, 1, 2); dialog.setWindowTitle("Dialog") avatar_groupBox.setTitle("Avatar") avatar_load_toolButton.setText("Load") avatar_refresh_toolButton.setText("Refresh") garment_groupBox.setTitle("Garement") garment_load_toolButton.setText("Load") garment_refresh_toolButton.setText("Refresh") animation_groupBox.setTitle("Animation") anim_refresh_toolButton.setText("Refresh") anim_load_toolButton.setText("Load") save_groupBox.setTitle("Save File") save_toolButton.setText("Save") process_button.setText("Process") cancel_button.setText("Cancel") sync_button.setText("Sync File List") process_button.connect("clicked(bool)", self.run_process) avatar_load_toolButton.connect("clicked(bool)", self.set_avatar_path_list) garment_load_toolButton.connect("clicked(bool)", self.set_garment_path_list) anim_load_toolButton.connect("clicked(bool)", self.set_animation_path_list) sync_button.connect("clicked(bool)", self.sync_file_list) avatar_refresh_toolButton.connect("clicked(bool)", self.refresh_avatar_list) garment_refresh_toolButton.connect("clicked(bool)", self.refresh_garment_list) anim_refresh_toolButton.connect("clicked(bool)", self.refresh_animation_list) save_toolButton.connect("clicked(bool)", self.set_save_path_list) cancel_button.connect("clicked(bool)", self.cancel) self.widget = dialog return dialog