def initWidget(self): box = QtGui.QVBoxLayout(self) random = QtGui.QPushButton(self) box.addWidget(random) applyConstraints = QtGui.QPushButton(self) box.addWidget(applyConstraints) setFrom = QtGui.QPushButton(self) box.addWidget(setFrom) setTo = QtGui.QPushButton(self) box.addWidget(setTo) self.validatePath = QtGui.QCheckBox(self) box.addWidget(self.validatePath) self.projectPath = QtGui.QCheckBox(self) box.addWidget(self.projectPath) makePath = QtGui.QPushButton(self) box.addWidget(makePath) random.text = "Shoot random config" applyConstraints.text = "Apply constraints" setFrom.text = 'Save config as origin' setTo.text = 'Save config as destination' self.validatePath.text = 'Validate path' self.projectPath.text = "Project path" makePath.text = 'Create path' random.connect('clicked()', self.shootRandom) applyConstraints.connect('clicked()', self.applyConstraints) setFrom.connect('clicked()', self.getFrom) setTo.connect('clicked()', self.getTo) makePath.connect('clicked()', self.makePath)
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 refreshJointList(self): self.jointNames = self.client.robot.getJointNames() # Left pane saLayout = QtGui.QVBoxLayout() self.yselectcb = list() rank = 0 for n in self.jointNames: size = self.client.robot.getJointConfigSize(n) if size == 1: cb = QtGui.QCheckBox(formats[0] % (n, "q")) self.yselectcb.append((cb, rank)) saLayout.addWidget(cb) else: for i in range(size): cb = QtGui.QCheckBox(formats[1] % (n, "q", i)) self.yselectcb.append((cb, rank + i)) saLayout.addWidget(cb) rank = rank + size for type in ("v", "a"): saLayout.addSpacing(5) for n in self.jointNames: size = self.client.robot.getJointNumberDof(n) if size == 1: cb = QtGui.QCheckBox(formats[0] % (n, type)) self.yselectcb.append((cb, rank)) saLayout.addWidget(cb) else: for i in range(size): cb = QtGui.QCheckBox(formats[1] % (n, type, i)) self.yselectcb.append((cb, rank + i)) saLayout.addWidget(cb) rank = rank + size saContent = QtGui.QWidget(self) saContent.setLayout(saLayout) self.scrollArea.setWidget(saContent) # Right pane jointCfgSize = [ self.client.robot.getJointConfigSize(n) for n in self.jointNames ] jointNbDof = [ self.client.robot.getJointNumberDof(n) for n in self.jointNames ] for w in self.qcpWidgets: w.refreshJointList(self.jointNames, jointCfgSize, jointNbDof)
def __init__(self): super(dlg_selectGlyphsWithAnchor, self).__init__() self.f = pFont() self.edt_anchorName = AComboBox(findAllAnchors(self.f)) self.chk_allMasters = QtGui.QCheckBox('Search in all masters') self.chk_allMasters.setChecked(True) self.btn_select = QtGui.QPushButton('&Select') self.btn_select.setStatusTip('Select glyphs that have the anchor') self.btn_select.clicked.connect(self.selectGlyphsWithAnchor) layoutV = QtGui.QVBoxLayout() layoutV.addWidget(self.edt_anchorName) layoutV.addWidget(self.chk_allMasters) layoutV.addWidget(self.btn_select) self.setLayout(layoutV) self.setWindowTitle('%s %s' % (app_name, app_version)) self.setGeometry(300, 300, 300, 120) self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) self.show()
def __init__(self, mainWindow): super(Plugin, self).__init__("Coordinates viewer plugin", mainWindow) self.setObjectName("Coordinates viewer plugin") self.client = Client() self.le_name = QtGui.QLineEdit() self.le_name.setReadOnly(True) self.transform = QtGui.QLineEdit() self.transform.setReadOnly(True) self.local = QtGui.QCheckBox() self.local.setChecked(True) self.point = QtGui.QLineEdit() self.point.setReadOnly(True) self.normal = QtGui.QLineEdit() self.normal.setReadOnly(True) layout = QtGui.QFormLayout() layout.addRow('Name', self.le_name) layout.addRow('Transform', self.transform) layout.addRow('Local frame', self.local) layout.addRow('Point', self.point) layout.addRow('Normal', self.normal) # Initialize the widget widget = QtGui.QWidget(self) widget.setLayout(layout) # This avoids having a widget bigger than what it needs. It avoids having # a big dock widget and a small osg widget when creating the main osg widget. p = Qt.QSizePolicy.Maximum widget.setSizePolicy( Qt.QSizePolicy(Qt.QSizePolicy.Expanding, Qt.QSizePolicy.Maximum)) self.setWidget(widget) mainWindow.bodyTree().connect('bodySelected(SelectionEvent*)', self.selected)
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, 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 refreshJointList (self): jointNames = self.client.robot.getJointNames () # Left pane saLayout = QtGui.QVBoxLayout () formats = ( "%s (%s)", "%s (%s, %i)") self.yselectcb = list () rank = 0 for n in jointNames: size = self.client.robot.getJointConfigSize (n) if size == 1: cb = QtGui.QCheckBox (formats[0] % (n,"q") ) self.yselectcb.append ((cb, rank)) saLayout.addWidget (cb) else: for i in range (size): cb = QtGui.QCheckBox (formats[1] % (n, "q", i)) self.yselectcb.append ((cb, rank + i)) saLayout.addWidget (cb) rank = rank + size for type in ("v", "a"): saLayout.addSpacing(5) for n in jointNames: size = self.client.robot.getJointNumberDof (n) if size == 1: cb = QtGui.QCheckBox (formats[0] % (n,type) ) self.yselectcb.append ((cb, rank)) saLayout.addWidget (cb) else: for i in range (size): cb = QtGui.QCheckBox (formats[1] % (n,type,i)) self.yselectcb.append ((cb, rank + i)) saLayout.addWidget (cb) rank = rank + size saContent = QtGui.QWidget (self) saContent.setLayout (saLayout) self.scrollArea.setWidget (saContent) # Right pane self.xselect.clear() # time index is 0 and is value is -1 self.xselect.addItem ("time", -1) rank = 0 for n in jointNames: size = self.client.robot.getJointConfigSize (n) if size == 1: self.xselect.addItem (formats[0] % (n,"q"), rank) else: for i in range (size): self.xselect.addItem (formats[1] % (n,"q",i), rank + i) rank = rank + size for type in ("v", "a"): for n in jointNames: size = self.client.robot.getJointNumberDof (n) if size == 1: self.xselect.addItem (formats[0] % (n,type), rank) else: for i in range (size): self.xselect.addItem (formats[1] % (n,type,i), rank + i) rank = rank + size
def ui_n_stuff(self): # Variables necessaires self.geo_list = mari.geo.list() obj = mari.geo.current() obj_name = str(obj.name()) obj_name = obj_name.split("_")[0] self.path_export = "Z:\\Groupes-cours\\NAND999-A15-N01\\Nature\\assets\\tex\\" + obj_name + "\\" self.nomenclature = "$CHANNEL.png" # Construire la fenetre et le layout de base self.setWindowTitle("Export Manager") main_layout = gui.QHBoxLayout(self) close_layout = gui.QVBoxLayout(self) # Layout pour section du top top_group = gui.QGroupBox() top_group_layout = gui.QVBoxLayout() top_group.setLayout(top_group_layout) # Layout pour section du bot bottom_group = gui.QGroupBox() bottom_group_layout = gui.QVBoxLayout() bottom_group.setLayout(bottom_group_layout) # Ajouter Group Widget au main Layout main_layout.addWidget(top_group) main_layout.addWidget(bottom_group) # Channel Header, Label et Widgets channel_label = gui.QLabel("<strong>Channels To Export</strong>") channel_layout = gui.QVBoxLayout() channel_header_layout = gui.QHBoxLayout() # Layout Channel channel_header_layout.addWidget(channel_label) channel_header_layout.addStretch() channel_layout.addLayout(channel_header_layout) top_group_layout.addLayout(channel_layout) # -----------------------------BUTTON & WIDGETS--------------------------------- # Repopulate the earth chan_dict = {} self.checkbox_dict = {} checkbox_liste = [] checkbox_group = gui.QGroupBox() checkbox_group_layout = gui.QVBoxLayout() checkbox_group.setLayout(checkbox_group_layout) top_group_layout.addWidget(checkbox_group) # Label & Checkbox builder geo_dict = {} for geo in self.geo_list: # Iterating over each object (geo = Cube, Sphere, Torus) obj_label = gui.QLabel(str(geo.name())) checkbox_group_layout.addWidget(obj_label) for channel in geo.channelList(): # Iterating over each channel (channel = Diffuse, Spec, Bump...) checkbox = gui.QCheckBox(str(channel.name())) checkbox_group_layout.addWidget(checkbox) self.checkbox_dict[checkbox] = channel # Path Layout path_layout = gui.QHBoxLayout() # Ajouter un label, bouton et text field pour le path path_label = gui.QLabel('Path:') # Label avant le lineEdit path_line_edit = gui.QLineEdit(self.path_export) # Texte sur la ligne path_line_edit.setDisabled(1) path_line_edit.setReadOnly(1) # Read Only mode, can select can't change path_pixmap = gui.QPixmap(mari.resources.path(mari.resources.ICONS) + '/ExportImages.png') icon = gui.QIcon(path_pixmap) path_button = gui.QPushButton(icon, "") path_layout.addWidget(path_label) path_layout.addWidget(path_line_edit) path_layout.addWidget(path_button) bottom_group_layout.addLayout(path_layout) # Select All & Select None Button sel_all = gui.QPushButton("Select All") sel_none = gui.QPushButton("Select None") top_group_layout.addWidget(sel_all) top_group_layout.addWidget(sel_none) sel_all.connect("clicked()", self.select_all) # Connect button to fonction sel_none.connect("clicked()", self.select_none) # Connect button to fonction # Export All & Export Button export_all = gui.QPushButton("Export All") export_selected = gui.QPushButton("Export Selected") bottom_group_layout.addWidget(export_all) bottom_group_layout.addWidget(export_selected) export_all.connect("clicked()", self.export_all_fc) # Connect button to fonction export_selected.connect("clicked()", self.export_selected_fc) # Connect button to fonction # Close button close_btn = gui.QPushButton("Close") close_layout.addWidget(close_btn) main_layout.addLayout(close_layout, stretch=1) close_btn.connect("clicked()", self.reject) # Connect button to fonction
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_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.exploration_mode_chk_box, 5, 0, 1, 2) 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_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): 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 initGUI(self): self.twiHeadersList = [] self.twiHash = {} self.setWindowTitle("Plugin Manager") # Plugin Table layout = QtGui.QVBoxLayout() self.setLayout(layout) self.pluginDirLabel = QtGui.QLabel(self.PLUGIN_DIR_LABEL_PREFIX) layout.addWidget(self.pluginDirLabel) self.panelSplit = QtGui.QSplitter() self.panelSplit.setOrientation(Qt.Qt.Vertical) layout.addWidget(self.panelSplit) pluginsGroupBox = QtGui.QGroupBox("Plugins") self.panelSplit.addWidget(pluginsGroupBox) pluginsLayout = QtGui.QVBoxLayout() pluginsGroupBox.setLayout(pluginsLayout) self.tableSplit = QtGui.QSplitter() self.tableSplit.setOrientation(Qt.Qt.Horizontal) pluginsLayout.addWidget(self.tableSplit) self.pluginTable = QtGui.QTableWidget() self.tableSplit.addWidget(self.pluginTable) self.setTableHeaders(self.pluginTable, self.PLUGIN_COLUMN_NAMES) self.pluginTable.cellClicked.connect(self.pluginTableCellClicked) self.pluginTable.cellDoubleClicked.connect( self.pluginTableCellDoubleClicked) self.finalizeTable(self.pluginTable) self.metaDataTable = QtGui.QTableWidget() self.tableSplit.addWidget(self.metaDataTable) self.setTableHeaders(self.metaDataTable, ["Key", "Value"]) self.finalizeTable(self.metaDataTable) # Action actionLayout = QtGui.QHBoxLayout() pluginsLayout.addLayout(actionLayout) reloadButton = QtGui.QPushButton("Re-evaluate") reloadButton.clicked.connect(self.reloadButtonClicked) actionLayout.addWidget(reloadButton) refreshButton = QtGui.QPushButton("Refresh") refreshButton.clicked.connect(self.refreshButtonClicked) actionLayout.addWidget(refreshButton) updateAllButton = QtGui.QPushButton("Update All") updateAllButton.clicked.connect(self.updateAllButtonClicked) actionLayout.addWidget(updateAllButton) updateSelectedButton = QtGui.QPushButton("Update Selected") updateSelectedButton.clicked.connect(self.updateSelectedButtonClicked) actionLayout.addWidget(updateSelectedButton) # Log logGroupBox = QtGui.QGroupBox("Log") self.panelSplit.addWidget(logGroupBox) logLayout = QtGui.QVBoxLayout() logGroupBox.setLayout(logLayout) self.logTable = QtGui.QTableWidget() logLayout.addWidget(self.logTable) self.setTableHeaders(self.logTable, ["Date/Time", "Title", "Text"]) self.finalizeTable(self.logTable) # Options optionsGroupBox = QtGui.QGroupBox("Options") self.panelSplit.addWidget(optionsGroupBox) optionsLayout = QtGui.QVBoxLayout() optionsGroupBox.setLayout(optionsLayout) urlLayout = QtGui.QHBoxLayout() optionsLayout.addLayout(urlLayout) urlLayout.addWidget(QtGui.QLabel("Repo List URL")) self.repoLineEdit = QtGui.QLineEdit() urlLayout.addWidget(self.repoLineEdit) mostOptionsLayout = QtGui.QHBoxLayout() optionsLayout.addLayout(mostOptionsLayout) self.quietModeCheckBox = QtGui.QCheckBox("Quiet") mostOptionsLayout.addWidget(self.quietModeCheckBox) self.offlineModeCheckBox = QtGui.QCheckBox("Offline") self.offlineModeCheckBox.stateChanged.connect( self.offlineModeCheckBoxChanged) mostOptionsLayout.addWidget(self.offlineModeCheckBox) self.overwriteSameCheckBox = QtGui.QCheckBox("Overwrite Same Version") mostOptionsLayout.addWidget(self.overwriteSameCheckBox) pluginDirButton = QtGui.QPushButton("Plugin Dir") pluginDirButton.clicked.connect(self.pluginDirButtonClicked) mostOptionsLayout.addWidget(pluginDirButton) self.clearLogButton = QtGui.QPushButton("Clear Log") self.clearLogButton.clicked.connect(self.clearLogButtonClicked) mostOptionsLayout.addWidget(self.clearLogButton) self.saveLogButton = QtGui.QPushButton("Save Log") self.saveLogButton.clicked.connect(self.saveLogButtonClicked) mostOptionsLayout.addWidget(self.saveLogButton) defaultsButton = QtGui.QPushButton("Defaults") defaultsButton.clicked.connect(self.defaultsButtonClicked) mostOptionsLayout.addWidget(defaultsButton) helpButton = QtGui.QPushButton("Help") helpButton.clicked.connect(self.helpButtonClicked) mostOptionsLayout.addWidget(helpButton) # Show self.setWindowFlags(Qt.Qt.Window) self.show() Qt.QApplication.processEvents() self.resize(self.size) return
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 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 __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)
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 _makeCheckBox(active): item = QtGui.QCheckBox() item.checked = active return item
def __init__(self): super(dlg_exportFontsInFolder, self).__init__() self.export = ExportFontsInFolder() menu = QtGui.QMenu('MyMenu') myact = QtGui.QAction('MyAction', self) menu.addAction(myact) menubar = main.menuBar() menubar.addAction(myact) layoutV = QtGui.QVBoxLayout() # Source folder self.lay_src = QtGui.QHBoxLayout() self.lbl_src = QtGui.QLabel('Source folder:') self.lbl_src.setFixedWidth(120) self.lay_src.addWidget(self.lbl_src) self.edt_srcFolder = QtGui.QLineEdit() self.edt_srcFolder.setText(self.export.srcFolder) self.edt_srcFolder.setToolTip( '<p>Finds fonts to be converted in this <b>Source folder</b>. Defaults to the same folder as the currently active font. Click ... to choose a different folder.</p>' ) self.lay_src.addWidget(self.edt_srcFolder) self.btn_pickSrcFolder = QtGui.QPushButton('...') self.btn_pickSrcFolder.setToolTip( '<p>Click to choose a different <b>Source folder</b></p>') self.btn_pickSrcFolder.clicked.connect(self.pickSrcFolder) self.lay_src.addWidget(self.btn_pickSrcFolder) layoutV.addLayout(self.lay_src) # Filtering self.lay_types = QtGui.QHBoxLayout() self.lbl_types = QtGui.QLabel('File types:') self.lbl_types.setFixedWidth(120) self.lay_types.addWidget(self.lbl_types) self.edt_types = QtGui.QLineEdit() self.edt_types.setText(" ".join(self.export.fontTypes)) self.edt_types.setToolTip( '<p>Finds fonts to be converted that match these space-separated <b>patterns</b> (case-insensitive).</p>' ) self.lay_types.addWidget(self.edt_types) self.chk_subfolders = QtGui.QCheckBox('Subfolders') self.chk_subfolders.setCheckState(QtCore.Qt.Unchecked) self.chk_subfolders.setToolTip( '<p>If <b>on</b>, finds fonts to be converted in the Source folder <b>recursively</b> (including subfolders).</p>' ) self.lay_types.addWidget(self.chk_subfolders) layoutV.addLayout(self.lay_types) # Destination folder self.lay_dest = QtGui.QHBoxLayout() self.lbl_dest = QtGui.QLabel('Destination folder:') self.lbl_dest.setFixedWidth(120) self.lay_dest.addWidget(self.lbl_dest) self.edt_destFolder = QtGui.QLineEdit() self.edt_destFolder.setText(self.export.destFolder) self.edt_destFolder.setToolTip( '<p>Exports fonts into this folder. Recreates the Source folder <b>structure</b>. If a font exports as a single file, uses the original filename as the new filename. If a font exports as multiple files, uses the original filename as a subfolder name. Click ... to choose a different folder.</p>' ) self.lay_dest.addWidget(self.edt_destFolder) self.btn_pickDestFolder = QtGui.QPushButton('...') self.btn_pickDestFolder.setToolTip( '<p>Click to choose a different <b>Destination folder</b></p>') self.btn_pickDestFolder.clicked.connect(self.pickDestFolder) self.lay_dest.addWidget(self.btn_pickDestFolder) layoutV.addLayout(self.lay_dest) # Run layout self.lay_run = QtGui.QHBoxLayout() self.lbl_format = QtGui.QLabel( '<small>Hold your pointer over the UI items for instructions</small>' ) self.lbl_format.setStyleSheet('color:darkGray;') self.lay_run.addWidget(self.lbl_format) self.lay_run.addStretch() self.btn_cancel = QtGui.QPushButton('&Cancel') self.btn_cancel.clicked.connect(self.cancel) self.lay_run.addWidget(self.btn_cancel) self.btn_run = QtGui.QPushButton('&Export Fonts As') self.btn_run.setDefault(True) self.btn_run.setFocus() self.btn_run.clicked.connect(self.run) self.btn_run.setToolTip( '<p>Click this button. In the <i>Export Font</i> dialog, choose <b>Content</b>, choose/customize the <b>Profile</b>, but <b>do not change</b> the <b>Destination</b> settings there. Then click <b>Export</b> to start the conversion.</p>' ) self.lay_run.addWidget(self.btn_run) layoutV.addLayout(self.lay_run) # - Set Widget self.setLayout(layoutV) self.setWindowTitle('%s %s' % (app_name, __version__)) self.setGeometry(300, 300, 640, 200) self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) # Always on top!! self.show()