def __init__(self): super(dlg_copyMetricBinding, self).__init__() # - Init self.srcGlyphBounds = {} # - Combos # -- Mode of operation self.cmb_mode = QtGui.QComboBox() self.cmb_mode.addItems(['Active Layer', 'All Master Layers']) # -- Flag color slector self.cmb_flag = QtGui.QComboBox() colorNames = QtGui.QColor.colorNames() for i in range(len(colorNames)): self.cmb_flag.addItem(colorNames[i]) self.cmb_flag.setItemData(i, QtGui.QColor(colorNames[i]), QtCore.Qt.DecorationRole) self.cmb_flag.setCurrentIndex(colorNames.index('lime')) # - Buttons self.btn_copy = QtGui.QPushButton('&Copy Expressions') self.btn_paste = QtGui.QPushButton('&Paste Expressions') self.btn_export = QtGui.QPushButton('&Export to File') self.btn_import = QtGui.QPushButton('&Import from File') self.btn_importFLC = QtGui.QPushButton('&Import from .FLC') self.btn_copy.clicked.connect(self.copyExpr) self.btn_paste.clicked.connect(self.pasteExpr) self.btn_export.clicked.connect(self.exportExpr) self.btn_import.clicked.connect(self.importExpr) self.btn_importFLC.clicked.connect(self.importExprFLC) self.btn_paste.setEnabled(False) #self.btn_export.setEnabled(False) #self.btn_import.setEnabled(False) # - Build layouts layoutV = QtGui.QVBoxLayout() layoutV.addWidget( QtGui.QLabel('Copy/Paste metric expressions to/from:')) layoutV.addWidget(self.cmb_mode) #layoutV.addWidget(QtGui.QLabel('Mark modified glyphs with:')) #layoutV.addWidget(self.cmb_flag) layoutV.addWidget(self.btn_copy) layoutV.addWidget(self.btn_paste) layoutV.addWidget(self.btn_export) layoutV.addWidget(self.btn_import) layoutV.addWidget(self.btn_importFLC) # - 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()
def __init__(self, parent, plugin): super(_NodeCreator, self).__init__(parent) self.plugin = plugin box = QtGui.QVBoxLayout(self) # Name line edit self.nodeName = QtGui.QLineEdit("nodeName") box.addWidget( self.addWidgetsInHBox([QtGui.QLabel("Node name:"), self.nodeName])) # Create group box.addWidget( self.bindFunctionToButton("Create group", self.createGroup)) # Add to group self.groupNodes = QtGui.QComboBox(self) self.groupNodes.editable = False box.addWidget( self.addWidgetsInHBox([ self.groupNodes, self.bindFunctionToButton("Add to group", self.addToGroup) ])) # Add mesh box.addWidget(self.bindFunctionToButton("Add mesh", self.addMesh)) self.update()
def __init__(self, mode): super(CLCreate, self).__init__() ## Dialog Settings self.setFixedSize(300, 100) self.setWindowTitle('Select Channel') ## Vars self.mode = mode ## Layouts layoutV1 = Gui.QVBoxLayout() layoutH1 = Gui.QHBoxLayout() self.setLayout(layoutV1) ## Widgets self.chanCombo = Gui.QComboBox() self.okBtn = Gui.QPushButton('Ok') self.cancelBtn = Gui.QPushButton('Cancel') ## Populate layoutV1.addWidget(self.chanCombo) layoutV1.addLayout(layoutH1) layoutH1.addWidget(self.cancelBtn) layoutH1.addWidget(self.okBtn) ## Connections self.okBtn.connect("clicked()", self.runCreate) self.cancelBtn.connect("clicked()", self.close) ## Init self.init()
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 __init__(self): self.widget = QtGui.QGroupBox('Drill Planner') self.deltaSpinBoxes = [QtGui.QSpinBox() for i in xrange(3)] for spin in self.deltaSpinBoxes: spin.setMinimum(-100) spin.setMaximum(100) spin.setSingleStep(1) l = QtGui.QVBoxLayout(self.widget) l.addWidget(_makeButton('refit drill', self.refitDrill)) l.addWidget(_makeButton('button preset posture', self.gotoButtonPreset)) l.addWidget(_makeButton('button pre-pose plan', self.buttonPrePosePlan)) l.addWidget(_makeButton('request nominal plan', self.nominalPlan)) l.addWidget( _makeButton('request arm prepose plan', self.armPreposePlan)) l.addWidget(_makeButton('request walking goal', self.walkingGoal)) l.addWidget( _makeButton('request nominal fixed plan', self.nominalFixedPlan)) l.addWidget(_makeButton('request pre-drill plan', self.preDrillPlan)) l.addWidget(_makeButton('request drill-in plan', self.drillInPlan)) l.addWidget(QtGui.QLabel('')) l.addWidget(_makeButton('next drill plan', self.nextDrillPlan)) hw = QtGui.QWidget() hl = QtGui.QHBoxLayout(hw) hl.addWidget(_makeButton('set drill depth', self.setDrillDepth)) self.drillDepthSpin = QtGui.QSpinBox() self.drillDepthSpin.setMinimum(-100) self.drillDepthSpin.setMaximum(100) self.drillDepthSpin.setSingleStep(1) hl.addWidget(self.drillDepthSpin) hl.addWidget(QtGui.QLabel('cm')) l.addWidget(hw) hw = QtGui.QWidget() hl = QtGui.QHBoxLayout(hw) self.drillDeltaCombo = QtGui.QComboBox() self.drillDeltaCombo.addItem('button') self.drillDeltaCombo.addItem('wall') self.drillDeltaButton = _makeButton('drill delta', self.drillDelta) hl.addWidget(self.drillDeltaButton) hl.addWidget(self.drillDeltaCombo) for spin in self.deltaSpinBoxes: hl.addWidget(spin) hl.addWidget(QtGui.QLabel('cm')) hl.addWidget(_makeButton('clear', self.clearDrillDelta)) l.addWidget(QtGui.QLabel('')) l.addWidget(QtGui.QLabel('')) l.addWidget(hw) self.keyPressNav = KeyboardNavigation() self.keyPressNav.callbacks.append(self.onKeyPress) l.addWidget(self.keyPressNav.widget)
def __init__(self): super(mixerHead, self).__init__() self.edt_glyphName = QtGui.QLineEdit() self.edt_stemV0 = QtGui.QLineEdit('1') self.edt_stemV1 = QtGui.QLineEdit('1') self.edt_stemH0 = QtGui.QLineEdit('1') self.edt_stemH1 = QtGui.QLineEdit('1') self.btn_refresh = QtGui.QPushButton('&Get Glyphs') self.btn_setaxis = QtGui.QPushButton('Set &Axis') self.btn_getVstem = QtGui.QPushButton('Get &V Stems') self.btn_getHstem = QtGui.QPushButton('Get &H Stems') self.spb_compV = QtGui.QDoubleSpinBox() self.spb_compH = QtGui.QDoubleSpinBox() self.spb_compV.setValue(0.) self.spb_compH.setValue(0.) self.spb_compV.setSingleStep(.01) self.spb_compH.setSingleStep(.01) self.cmb_0 = QtGui.QComboBox() self.cmb_1 = QtGui.QComboBox() self.addWidget(QtGui.QLabel('Glyph:'), 0, 0, 1, 1) self.addWidget(self.edt_glyphName, 0, 1, 1, 6) self.addWidget(self.btn_refresh, 0, 7, 1, 1) self.addWidget(QtGui.QLabel('Axis:'), 1, 0, 1, 1) self.addWidget(self.cmb_0, 1, 1, 1, 3) self.addWidget(self.cmb_1, 1, 4, 1, 3) self.addWidget(self.btn_setaxis, 1, 7, 1, 1) self.addWidget(QtGui.QLabel('V Stems:'), 2, 0, 1, 1) self.addWidget(self.edt_stemV0, 2, 1, 1, 3) self.addWidget(self.edt_stemV1, 2, 4, 1, 3) self.addWidget(self.btn_getVstem, 2, 7, 1, 1) self.addWidget(QtGui.QLabel('H Stems:'), 3, 0, 1, 1) self.addWidget(self.edt_stemH0, 3, 1, 1, 3) self.addWidget(self.edt_stemH1, 3, 4, 1, 3) self.addWidget(self.btn_getHstem, 3, 7, 1, 1) self.addWidget(QtGui.QLabel('Adj.V/H:'), 4, 0, 1, 1) self.addWidget(self.spb_compV, 4, 1, 1, 3) self.addWidget(self.spb_compH, 4, 4, 1, 3)
def _makeValveWizard(self): wizard = QtGui.QWidget() l = QtGui.QVBoxLayout(wizard) hw = QtGui.QWidget() hl = QtGui.QHBoxLayout(hw) hl.setMargin(0) self.valveMethodCombo = QtGui.QComboBox() self.valveMethodCombo.addItem('auto wall') self.valveMethodCombo.addItem('manual') hl.addWidget(QtGui.QLabel('method:')) hl.addWidget(self.valveMethodCombo) l.addWidget(hw) l.addWidget(_makeButton('segment large valve', self.segmentLargeValve)) l.addWidget(_makeButton('segment small valve', self.segmentSmallValve)) l.addWidget(_makeButton('segment bar', self.segmentLeverValve)) hw = QtGui.QFrame() hl = QtGui.QHBoxLayout(hw) hl.setMargin(0) hl.addWidget( _makeButton('segment value radius:', self.segmentValveCustomRadius)) self.valveRadiusSpin = QtGui.QSpinBox() self.valveRadiusSpin.setMinimum(0) self.valveRadiusSpin.setMaximum(99) self.valveRadiusSpin.setSingleStep(1) hl.addWidget(self.valveRadiusSpin) hl.addWidget(QtGui.QLabel('cm')) l.addWidget(hw) l.addWidget(QtGui.QLabel('')) l.addWidget(_makeButton('refit wall', startRefitWall)) hw = QtGui.QFrame() hl = QtGui.QHBoxLayout(hw) hl.setMargin(0) hl.addWidget( _makeButton('request valve circle plan', self.requestValveCirclePlan)) self.circlePlanAngle = QtGui.QSpinBox() self.circlePlanAngle.setMinimum(-360) self.circlePlanAngle.setMaximum(360) self.circlePlanAngle.setSingleStep(5) hl.addWidget(self.circlePlanAngle) hl.addWidget(QtGui.QLabel('degrees')) l.addWidget(hw) l.addStretch() return wizard
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()
def _makeValveWizard(self): wizard = QtGui.QWidget() l = QtGui.QVBoxLayout(wizard) hw = QtGui.QWidget() hl = QtGui.QHBoxLayout(hw) hl.setMargin(0) self.valveMethodCombo = QtGui.QComboBox() self.valveMethodCombo.addItem("auto wall") self.valveMethodCombo.addItem("manual") hl.addWidget(QtGui.QLabel("method:")) hl.addWidget(self.valveMethodCombo) l.addWidget(hw) l.addWidget(_makeButton("segment large valve", self.segmentLargeValve)) l.addWidget(_makeButton("segment small valve", self.segmentSmallValve)) l.addWidget(_makeButton("segment bar", self.segmentLeverValve)) hw = QtGui.QFrame() hl = QtGui.QHBoxLayout(hw) hl.setMargin(0) hl.addWidget( _makeButton("segment value radius:", self.segmentValveCustomRadius)) self.valveRadiusSpin = QtGui.QSpinBox() self.valveRadiusSpin.setMinimum(0) self.valveRadiusSpin.setMaximum(99) self.valveRadiusSpin.setSingleStep(1) hl.addWidget(self.valveRadiusSpin) hl.addWidget(QtGui.QLabel("cm")) l.addWidget(hw) l.addWidget(QtGui.QLabel("")) l.addWidget(_makeButton("refit wall", startRefitWall)) hw = QtGui.QFrame() hl = QtGui.QHBoxLayout(hw) hl.setMargin(0) self.circlePlanAngle = QtGui.QSpinBox() self.circlePlanAngle.setMinimum(-360) self.circlePlanAngle.setMaximum(360) self.circlePlanAngle.setSingleStep(5) hl.addWidget(self.circlePlanAngle) hl.addWidget(QtGui.QLabel("degrees")) l.addWidget(hw) l.addStretch() return wizard
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 __init__(self, plugin): super(QCPWidget, self).__init__(plugin) self.plugin = plugin layout = QtGui.QVBoxLayout(self) from PythonQt.QCustomPlot import QCustomPlot, QCP self.qcpWidget = QCustomPlot() self.qcpWidget.autoAddPlottableToLegend = True self.qcpWidget.setInteraction(QCP.iRangeDrag, True) # iRangeDrap self.qcpWidget.setInteraction(QCP.iRangeZoom, True) # iRangeZoom self.qcpWidget.setInteraction(QCP.iSelectAxes, True) # iSelectAxes self.qcpWidget.legend().visible = True layout.addWidget(self.qcpWidget, 1) self.qcpWidget.connect(Qt.SIGNAL("mouseDoubleClick(QMouseEvent*)"), self._mouseDoubleClick) self.qcpWidget.xAxis().connect( Qt.SIGNAL("selectionChanged(QCPAxis::SelectableParts)"), self._axesSelectionChanged) self.qcpWidget.yAxis().connect( Qt.SIGNAL("selectionChanged(QCPAxis::SelectableParts)"), self._axesSelectionChanged) buttonbar = QtGui.QWidget() bbLayout = QtGui.QHBoxLayout(buttonbar) button = QtGui.QPushButton("Replot", buttonbar) button.connect(QtCore.SIGNAL("clicked()"), self.refreshPlot) bbLayout.addWidget(button) button = QtGui.QPushButton("Remove", buttonbar) button.connect(QtCore.SIGNAL("clicked()"), self.removePlot) bbLayout.addWidget(button) button = QtGui.QPushButton("Legend", buttonbar) button.checkable = True button.checked = True button.connect(QtCore.SIGNAL("toggled(bool)"), self.toggleLegend) bbLayout.addWidget(button) button = QtGui.QPushButton(QtGui.QIcon.fromTheme("zoom-fit-best"), "", buttonbar) button.setToolTip("Zoom fit best") button.connect(QtCore.SIGNAL("clicked()"), self.qcpWidget.rescaleAxes) bbLayout.addWidget(button) self.xselect = QtGui.QComboBox(self) bbLayout.addWidget(self.xselect, 1) layout.addWidget(buttonbar) self.data = DataQCP(plugin, self.qcpWidget)
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 makeRightPane (self, layout): from PythonQt.QCustomPlot import QCustomPlot, QCP self.qcpWidget = QCustomPlot() self.qcpWidget.autoAddPlottableToLegend = True self.qcpWidget.setInteraction (QCP.iRangeDrag , True) # iRangeDrap self.qcpWidget.setInteraction (QCP.iRangeZoom , True) # iRangeZoom self.qcpWidget.setInteraction (QCP.iSelectAxes, True) # iSelectAxes self.qcpWidget.legend().visible = True layout.addWidget (self.qcpWidget) self.qcpWidget.connect (Qt.SIGNAL("mouseDoubleClick(QMouseEvent*)"), self._mouseDoubleClick) self.qcpWidget.xAxis().connect (Qt.SIGNAL("selectionChanged(QCPAxis::SelectableParts)"), self._axesSelectionChanged) self.qcpWidget.yAxis().connect (Qt.SIGNAL("selectionChanged(QCPAxis::SelectableParts)"), self._axesSelectionChanged) self.xselect = QtGui.QComboBox(self) layout.addWidget (self.xselect) # time index is 0 and is value is -1 self.xselect.addItem ("time", -1)
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, robotNames=[]): """ Initialise the selector object :param robotNames: The names of robots to add to the combobox to start with """ super(RobotSelector, self).__init__() self.objectName = "RobotSelector" self.robotNames = robotNames self.associatedWidgets = ( {}) # associated objects are stored here. Keys are robot names self.robotSelectLabel = QtGui.QLabel("Controlling:") self.robotSelectCombo = QtGui.QComboBox() for robotName in self.robotNames: self.addRobot(robotName) self.horizLayout = QtGui.QHBoxLayout(self) self.horizLayout.addWidget(self.robotSelectLabel) self.horizLayout.addWidget(self.robotSelectCombo) self.robotSelectCombo.connect("currentIndexChanged(QString)", self.showAssociatedComponents)
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_generateUnicode, self).__init__() self.n2u = {} # Insert your default folder for custom NAM files self.namFolder = r'' # Set to True if you want to keep Unicodes for glyphs not in the NAM self.keepUnicodes = True # Enter color flag integer if you want to flag modified glyphs, or None self.flagModified = 1 self.f = CurrentFont() self.fPath = self.f.path self.fFolder = os.path.dirname(self.fPath) self.fPathBase = os.path.splitext(os.path.basename(self.fPath))[0] self.fgnu = fontGlyphNameUnicodes(self.f) if not self.namFolder: if fl.userpath: self.namFolder = fl.userpath else: self.namFolder = self.fFolder # -- Flag color selector self.cmb_flag = QtGui.QComboBox() colorNames = QtGui.QColor.colorNames() for i in range(len(colorNames)): self.cmb_flag.addItem(colorNames[i]) self.cmb_flag.setItemData(i, QtGui.QColor(colorNames[i]), QtCore.Qt.DecorationRole) self.cmb_flag.insertItem(0, 'None') self.cmb_flag.setCurrentIndex(0) # - Options self.chk_keepUnicodes = QtGui.QCheckBox( 'Keep Unicodes for glyphs not in NAM') self.chk_keepUnicodes.setCheckState(QtCore.Qt.Checked) # - Buttons self.btn_open = QtGui.QPushButton('&Open NAM file') self.btn_open.clicked.connect(self.openNamFile) self.btn_save = QtGui.QPushButton('&Save NAM file') self.btn_save.clicked.connect(self.saveNamFile) self.btn_run = QtGui.QPushButton('&Generate Unicodes') self.btn_run.setEnabled(False) self.btn_run.clicked.connect(self.generateUnicodes) # - Build layouts layoutV = QtGui.QVBoxLayout() layoutV.addWidget(self.btn_open) layoutV.addWidget(QtGui.QLabel('Flag modified glyphs:')) layoutV.addWidget(self.cmb_flag) layoutV.addWidget(self.chk_keepUnicodes) layoutV.addWidget(self.btn_run) layoutV.addWidget(self.btn_save) # - Set Widget self.setLayout(layoutV) self.setWindowTitle('%s %s' % (app_name, __version__)) self.setGeometry(300, 300, 220, 120) self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) # Always on top!! self.show()
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 _makeDrillWizard(self): drillWizard = QtGui.QGroupBox('Drill Segmentation') l = QtGui.QVBoxLayout(drillWizard) l.addWidget( _makeButton('segment drill aligned with table', startDrillAutoSegmentationAlignedWithTable)) l.addWidget( _makeButton('segment target using wall center', segmentDrillWallFromWallCenter)) self.drillUpdater = TimerCallback() self.drillUpdater.targetFps = 30 self.drillUpdater.callback = self.moveDrillToHand hw = QtGui.QWidget() hl = QtGui.QHBoxLayout(hw) hl.setMargin(0) self.moveDrillToHandButton = _makeButton('move drill to hand', self.onMoveDrillToHandClicked) self.moveDrillToHandButton.checkable = True hl.addWidget(self.moveDrillToHandButton) self.handCombo = QtGui.QComboBox() self.handCombo.addItem('left') self.handCombo.addItem('right') hl.addWidget(self.handCombo) hl.addWidget(_makeButton('flip z', self.flipDrill)) self.drillFlip = False l.addWidget(hw) # In Degrees self.drillRotationSlider = QtGui.QSlider(QtCore.Qt.Horizontal) self.drillRotationSlider.setMinimum(-90) self.drillRotationSlider.setMaximum(270) self.drillRotationSlider.setValue(90) # All in MM self.drillOffsetSlider = QtGui.QSlider(QtCore.Qt.Horizontal) self.drillOffsetSlider.setMinimum(-100) self.drillOffsetSlider.setMaximum(100) self.drillOffsetSlider.setValue(30) self.drillDepthOffsetSlider = QtGui.QSlider(QtCore.Qt.Horizontal) self.drillDepthOffsetSlider.setMinimum(-10) self.drillDepthOffsetSlider.setMaximum(90) self.drillDepthOffsetSlider.setValue(40) self.drillLateralOffsetSlider = QtGui.QSlider(QtCore.Qt.Horizontal) self.drillLateralOffsetSlider.setMinimum(-50) self.drillLateralOffsetSlider.setMaximum(50) self.drillLateralOffsetSlider.setValue(-23) hw = QtGui.QWidget() hl = QtGui.QHBoxLayout(hw) hl.setMargin(0) hl.addWidget(self.drillRotationSlider) hl.addWidget(self.drillOffsetSlider) hw.connect(self.drillRotationSlider, 'valueChanged(int)', self.moveDrillToHand) hw.connect(self.drillOffsetSlider, 'valueChanged(int)', self.moveDrillToHand) l.addWidget(hw) hw = QtGui.QWidget() hl = QtGui.QHBoxLayout(hw) hl.setMargin(0) hl.addWidget(self.drillDepthOffsetSlider) hl.addWidget(self.drillLateralOffsetSlider) hw.connect(self.drillDepthOffsetSlider, 'valueChanged(int)', self.moveDrillToHand) hw.connect(self.drillLateralOffsetSlider, 'valueChanged(int)', self.moveDrillToHand) l.addWidget(hw) hw = QtGui.QWidget() hl = QtGui.QHBoxLayout(hw) hl.setMargin(0) hl.addWidget( _makeButton('segment button', startDrillButtonSegmentation)) hl.addWidget(_makeButton('segment tip', startPointerTipSegmentation)) self.drillFlip = False l.addWidget(hw) l.addWidget(QtGui.QLabel('')) hw = QtGui.QWidget() hl = QtGui.QHBoxLayout(hw) hl.addWidget(QtGui.QLabel('right angle:')) hl.setMargin(0) self.rightAngleCombo = QtGui.QComboBox() self.rightAngleCombo.addItem(DRILL_TRIANGLE_BOTTOM_LEFT) self.rightAngleCombo.addItem(DRILL_TRIANGLE_BOTTOM_RIGHT) self.rightAngleCombo.addItem(DRILL_TRIANGLE_TOP_LEFT) self.rightAngleCombo.addItem(DRILL_TRIANGLE_TOP_RIGHT) hl.addWidget(self.rightAngleCombo) l.addWidget(hw) l.addWidget( _makeButton('segment drill on table', startDrillAutoSegmentation)) l.addWidget( _makeButton('segment wall', self.segmentDrillWallConstrained)) l.addWidget(_makeButton('refit wall', startRefitWall)) l.addWidget(QtGui.QLabel('')) l.addStretch() return drillWizard
q.loadDocument("Koenig-Essay.py") filepath = q.getFilePath() os.chdir(filepath) # Move to the directory of this file csdFiles = glob.glob("csds/*.csd") # Get list of csd files csdFiles.sort() # Sort the list alphabetically w = pqt.QWidget() # Create main widget w.setGeometry(50,50, 400,500) l = pqt.QGridLayout(w) # Layout to organize widgets w.setLayout(l) w.setWindowTitle("Koenig's Essay Renderer") partBox = pqt.QComboBox(w) srBox = pqt.QComboBox(w) srBox.addItem("44100") srBox.addItem("48000") srBox.addItem("96000") srBox.addItem("192000") sectionBox = pqt.QComboBox(w) renderButton = pqt.QPushButton("Render All",w) stopButton = pqt.QPushButton("Stop Render",w) editButton = pqt.QPushButton("Open in Audacity",w) text = pqt.QTextBrowser(w) statusLabel = pqt.QLabel(w) l.addWidget(pqt.QLabel("Sample Rate"), 0, 0) l.addWidget(srBox, 0, 1) l.addWidget(renderButton, 1, 0) l.addWidget(stopButton, 1, 1)
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)
print('Show Set Color Script') # 创建一个窗口 mainWidget = QtGui.QWidget() mainWidget.setWindowTitle("Color Alpha Set") mainLayout = QtGui.QVBoxLayout(mainWidget) # 创建ComboBox topWidget = QtGui.QWidget() mainLayout.addWidget(topWidget) topLayout = QtGui.QHBoxLayout(topWidget) topLabel = QtGui.QLabel("Attribute Name: ") topLayout.addWidget(topLabel) global attrComboBox attrComboBox = QtGui.QComboBox() attrComboBox.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) topLayout.addWidget(attrComboBox) # 创建Slider bottomWidget = QtGui.QWidget() mainLayout.addWidget(bottomWidget) bottomLayout = QtGui.QHBoxLayout(bottomWidget) global bottomLabel bottomLabel = QtGui.QLabel("Alpha(100%): ") bottomLayout.addWidget(bottomLabel) global alphaSlider alphaSlider = QtGui.QSlider(QtCore.Qt.Horizontal) alphaSlider.setMinimum(0) alphaSlider.setMaximum(255)
def __init__(self): super(dlg_copyMetrics, self).__init__() # - Init self.srcGlyphBounds = {} # - Combos # -- Mode of operation self.cmb_mode = QtGui.QComboBox() self.cmb_mode.addItems(['Active Layer', 'All Master Layers']) # -- Flag color slector self.cmb_flag = QtGui.QComboBox() colorNames = QtGui.QColor.colorNames() for i in range(len(colorNames)): self.cmb_flag.addItem(colorNames[i]) self.cmb_flag.setItemData(i, QtGui.QColor(colorNames[i]), QtCore.Qt.DecorationRole) self.cmb_flag.setCurrentIndex(colorNames.index('lime')) # - Buttons self.btn_copy = QtGui.QPushButton('&Copy Metric values') self.btn_pasteADV = QtGui.QPushButton( '&Paste Metric values: LSB, Advance') self.btn_pasteRSB = QtGui.QPushButton('&Paste Metric values: LSB, RSB') self.btn_export = QtGui.QPushButton('&Export to File (TypeRig *.json)') self.btn_import = QtGui.QPushButton( '&Import from File (TypeRig *.json)') self.btn_importAFM = QtGui.QPushButton( '&Import from Adobe Font Metrics (*.AFM)') self.btn_importAFM.setEnabled(False) self.btn_copy.clicked.connect(self.copyExpr) self.btn_pasteADV.clicked.connect(lambda: self.pasteExpr(sbMode=False)) self.btn_pasteRSB.clicked.connect(lambda: self.pasteExpr(sbMode=True)) self.btn_export.clicked.connect(self.exportExpr) self.btn_import.clicked.connect(self.importExpr) self.btn_importAFM.clicked.connect(self.importExprAFM) self.btn_pasteADV.setEnabled(False) self.btn_pasteRSB.setEnabled(False) #self.btn_export.setEnabled(False) #self.btn_import.setEnabled(False) # - Build layouts layoutV = QtGui.QVBoxLayout() layoutV.addWidget(QtGui.QLabel('Copy/Paste metrics to/from:')) layoutV.addWidget(self.cmb_mode) #layoutV.addWidget(QtGui.QLabel('Mark modified glyphs with:')) #layoutV.addWidget(self.cmb_flag) layoutV.addWidget(self.btn_copy) layoutV.addWidget(self.btn_pasteADV) layoutV.addWidget(self.btn_pasteRSB) layoutV.addWidget(self.btn_export) layoutV.addWidget(self.btn_import) layoutV.addWidget(self.btn_importAFM) # - Set Widget self.setLayout(layoutV) self.setWindowTitle('%s %s' % (app_name, app_version)) self.setGeometry(300, 300, 280, 140) self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) # Always on top!! self.show()
def __init__(self): super(ExportQtGui, self).__init__() #--# Create Groups self.mainGroup = QtGui.QGroupBox('Export List') self.optionGroup = QtGui.QGroupBox('Options') #--# Create Layouts layoutV1_main = QtGui.QVBoxLayout() layoutV2_grp = QtGui.QVBoxLayout() layoutV3_grp = QtGui.QVBoxLayout() layoutH1_wdg = QtGui.QHBoxLayout() layoutH2_wdg = QtGui.QHBoxLayout() layoutH3_wdg = QtGui.QHBoxLayout() layoutH4_wdg = QtGui.QHBoxLayout() layoutH5_wdg = QtGui.QHBoxLayout() ## Build Layouts self.setLayout(layoutV1_main) self.mainGroup.setLayout(layoutV2_grp) self.optionGroup.setLayout(layoutV3_grp) layoutV2_grp.addLayout(layoutH1_wdg) layoutV2_grp.addLayout(layoutH2_wdg) layoutV3_grp.addLayout(layoutH3_wdg) layoutV3_grp.addLayout(layoutH4_wdg) layoutV3_grp.addLayout(layoutH5_wdg) #--# Export List TreeWidget self.exportList = QtGui.QTreeWidget() self.exportList.setSelectionMode( QtGui.QAbstractItemView.ExtendedSelection) self.exportList.setSortingEnabled(True) self.exportList.setAlternatingRowColors(True) #--# Create Widgets self.addBtn = QtGui.QToolButton(self) self.removeBtn = QtGui.QToolButton(self) self.clearBtn = QtGui.QToolButton(self) self.addAllBtn = QtGui.QToolButton(self) self.browseBtn = QtGui.QPushButton('Browse') self.exportBtn = QtGui.QPushButton('Export') self.formatCombo = QtGui.QComboBox() self.exportLabel = QtGui.QLabel('Path: ') self.formatLabel = QtGui.QLabel('Format: ') self.templateLabel = QtGui.QLabel('Template: ') self.templateLn = QtGui.QLineEdit(defaultTemplate) self.exportLn = QtGui.QLineEdit() ## Set Icons self.addBtn.setIcon(QtGui.QIcon('%s/Plus.png' % icon_path)) self.removeBtn.setIcon(QtGui.QIcon('%s/Minus.png' % icon_path)) self.clearBtn.setIcon(QtGui.QIcon('%s/Quit.png' % icon_path)) self.addAllBtn.setIcon(QtGui.QIcon('%s/AddObject.png' % icon_path)) #--# Populate Layouts layoutH1_wdg.addWidget(self.exportList) layoutH2_wdg.addWidget(self.addBtn) layoutH2_wdg.addWidget(self.removeBtn) layoutH2_wdg.addWidget(self.clearBtn) layoutH2_wdg.addWidget(self.addAllBtn) layoutH2_wdg.addStretch() layoutH3_wdg.addWidget(self.exportLabel) layoutH3_wdg.addWidget(self.exportLn) layoutH3_wdg.addWidget(self.browseBtn) layoutH4_wdg.addWidget(self.templateLabel) layoutH4_wdg.addWidget(self.templateLn) layoutH4_wdg.addWidget(self.formatLabel) layoutH4_wdg.addWidget(self.formatCombo) layoutH5_wdg.addWidget(self.exportBtn) ## Final layoutV1_main.addWidget(self.mainGroup) layoutV1_main.addWidget(self.optionGroup) #--# StyleSheets self.setStyleSheet("\ QTreeWidget { alternate-background-color: rgb(100, 100, 100); } \ ") #--# Keyboard shortcuts self.deleteKey = QtGui.QShortcut(QtGui.QKeySequence('Delete'), self) #--# Connections self.addBtn.connect("clicked()", self.addUDIM) self.removeBtn.connect("clicked()", lambda: self.manageTree(remove=True)) self.clearBtn.connect("clicked()", self.clear) self.addAllBtn.connect("clicked()", self.addAllObjects) self.browseBtn.connect("clicked()", self.getExportPath) self.exportBtn.connect("clicked()", self.export) self.deleteKey.connect("activated()", lambda: self.manageTree(remove=True)) self.exportList.connect("itemDoubleClicked (QTreeWidgetItem *,int)", lambda: self.manageTree(pick=True)) #--# Init self.init() self.setHeader()
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 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
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)