def wrapInHTitledItem(name, items): box = QtGui.QGroupBox(name) box.setAlignment(QtCore.Qt.AlignCenter) boxLayout = QtGui.QHBoxLayout(box) for item in items: boxLayout.addWidget(item) return box
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 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 initGUI(self): self.setWindowTitle("Watershed Splitter Hybrid Mode Widget") widgetLayout = QtGui.QVBoxLayout() self.setLayout(widgetLayout) self.markerRadiusEdit = QtGui.QLineEdit() self.baseSubObjIdEdit = QtGui.QLineEdit() self.workAreaSizeEdit = QtGui.QLineEdit() opButtonsLayout = QtGui.QHBoxLayout() widgetLayout.addLayout(opButtonsLayout) self.resetButton = QtGui.QPushButton("Reset") self.resetButton.enabled = False self.resetButton.clicked.connect(self.resetButtonClicked) opButtonsLayout.addWidget(self.resetButton) self.finishButton = QtGui.QPushButton("Finish") self.finishButton.enabled = False self.finishButton.clicked.connect(self.finishButtonClicked) opButtonsLayout.addWidget(self.finishButton) self.subObjTableGroupBox = QtGui.QGroupBox("SubObjects") subObjTableLayout = QtGui.QVBoxLayout() widgetLayout.addLayout(subObjTableLayout) self.subObjTableGroupBox.setLayout(subObjTableLayout) self.subObjTable = self.MyTableWidget(self.subObjTableDel) subObjTableWidget = QtGui.QWidget() subObjTableLayout.addWidget(subObjTableWidget) subObjTableLayout = QtGui.QVBoxLayout() subObjTableWidget.setLayout(subObjTableLayout) subObjTableLayout.addWidget(self.subObjTable) self.setTableHeaders(self.subObjTable, self.OBJECT_LIST_COLUMNS) self.finalizeTable(self.subObjTable) # Invisibles self.widgetWidthEdit = QtGui.QLineEdit() self.widgetHeightEdit = QtGui.QLineEdit() self.widgetLeftEdit = QtGui.QLineEdit() self.widgetTopEdit = QtGui.QLineEdit() self.curFont = QtGui.QFont() # Window settings self.setWindowFlags(Qt.Qt.Window) # Yes, this has to be a called separately, or else the next call works wrong self.setWindowFlags((self.windowFlags() | Qt.Qt.CustomizeWindowHint) & ~Qt.Qt.WindowCloseButtonHint) self.resize(0,0) return
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
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 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 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 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 __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 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): #set Main Window Title. self.setWindowTitle("Define New Type") self.setObjectName("xgNewTypeGUI") self.setEnabled(True) self.resize(400, 220) self.centralwidget = QtGui.QWidget() self.centralwidget.setObjectName("centralwidget") self.master_gridLayout = QtGui.QGridLayout(self.centralwidget) self.master_gridLayout.setObjectName("master_gridLayout") self.options_GroupBox = QtGui.QGroupBox("Options", self.centralwidget) self.options_GroupBox.setObjectName("options_GroupBox") self.master_gridLayout.addWidget(self.options_GroupBox, 0, 0, 1, 1) self.main_GridLayout = QtGui.QGridLayout() self.main_GridLayout.setObjectName("main_GridLayout") self.typeName_label = QtGui.QLabel("Texture Type Name: ", self.centralwidget) self.typeName_label.setObjectName("typeName_label") self.main_GridLayout.addWidget(self.typeName_label, 0, 0, 1, 1) self.ok_button = QtGui.QPushButton("OK", self.centralwidget) self.ok_button.setMinimumSize(QtCore.QSize(0, 45)) self.ok_button.setStyleSheet( "QPushButton{background-color: rgb(50, 200, 185); color: rgb(50,50,50)}" ) self.ok_button.setObjectName("ok_button") self.main_GridLayout.addWidget(self.ok_button, 8, 2, 1, 1) self.cancel_Button = QtGui.QPushButton("Cancel", self.centralwidget) self.cancel_Button.setMinimumSize(QtCore.QSize(0, 45)) self.cancel_Button.setObjectName("cancel_Button") self.main_GridLayout.addWidget(self.cancel_Button, 8, 0, 1, 1) self.nameTag_label = QtGui.QLabel("File Name Tag: ", self.centralwidget) self.nameTag_label.setObjectName("nameTag_label") self.main_GridLayout.addWidget(self.nameTag_label, 1, 0, 1, 1) self.dataType_label = QtGui.QLabel("Texture Data Type: ", self.centralwidget) self.dataType_label.setObjectName("dataType_label") self.main_GridLayout.addWidget(self.dataType_label, 5, 0, 1, 1) self.color_radioButton = QtGui.QRadioButton("Color", self.centralwidget) self.color_radioButton.setObjectName("color_radioButton") self.main_GridLayout.addWidget(self.color_radioButton, 5, 2, 1, 1) self.typeName_lineEdit = QtGui.QLineEdit(self.centralwidget) self.typeName_lineEdit.setMinimumSize(QtCore.QSize(0, 30)) self.typeName_lineEdit.setObjectName("typeName_lineEdit") self.typeName_lineEdit.setText("diffuse") self.main_GridLayout.addWidget(self.typeName_lineEdit, 0, 2, 1, 1) self.nameTag_lineEdit = QtGui.QLineEdit(self.centralwidget) self.nameTag_lineEdit.setMinimumSize(QtCore.QSize(0, 30)) self.nameTag_lineEdit.setMaximumSize(QtCore.QSize(100, 16777215)) self.nameTag_lineEdit.setObjectName("nameTag_lineEdit") self.nameTag_lineEdit.setText("col") self.main_GridLayout.addWidget(self.nameTag_lineEdit, 1, 2, 1, 1) self.noncolor_radioButton = QtGui.QRadioButton("Non-Color", self.centralwidget) self.noncolor_radioButton.setObjectName("noncolor_radioButton") self.main_GridLayout.addWidget(self.noncolor_radioButton, 6, 2, 1, 1) self.master_gridLayout.addLayout(self.main_GridLayout, 1, 0, 1, 1) self.setLayout(self.master_gridLayout)
def __init__(self): super(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()