def _makeTerrainWizard(self): terrainWizard = QtGui.QWidget() self.cinderBlockButton = QtGui.QToolButton() self.cinderBlock2Button = QtGui.QToolButton() self.cinderBlockButton.setIcon(QtGui.QIcon(':/images/cinderblock.png')) self.cinderBlock2Button.setIcon(QtGui.QIcon(':/images/cinderblock_double.png')) self.cinderBlockButton.setIconSize(QtCore.QSize(60,60)) self.cinderBlock2Button.setIconSize(QtCore.QSize(60,60)) self.cinderBlockButton.connect('clicked()', functools.partial(self.onTerrainCinderblockSelected, self.cinderBlockButton)) self.cinderBlock2Button.connect('clicked()', functools.partial(self.onTerrainCinderblockSelected, self.cinderBlock2Button)) buttons = QtGui.QWidget() l = QtGui.QHBoxLayout(buttons) l.setMargin(0) l.addStretch() l.addWidget(self.cinderBlockButton) l.addWidget(self.cinderBlock2Button) l.addStretch() l = QtGui.QVBoxLayout(terrainWizard) l.addWidget(buttons) l.addWidget(_makeButton('double wide', functools.partial(startInteractiveLineDraw, [0.1905*2, 0.149225]))) l.addStretch() return terrainWizard
def __init__(self, title="", parent=None): super(TRCollapsibleBox, self).__init__(parent) self.toggle_button = QtGui.QToolButton() self.toggle_button.text = ' ' + title self.toggle_button.checkable = True self.toggle_button.checked = True self.toggle_button.setStyleSheet("QToolButton { border: none; font-weight: bold; color: #505050; vertical-align: middle }") self.toggle_button.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon) self.toggle_button.setArrowType(QtCore.Qt.RightArrow) self.toggle_button.setIconSize(QtCore.QSize(5,5)) self.toggle_button.clicked.connect(self.on_pressed) self.toggle_animation = QtCore.QParallelAnimationGroup(self) self.content_area = QtGui.QScrollArea() self.content_area.maximumHeight = 0 self.content_area.minimumHeight = 0 self.content_area.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) self.content_area.setFrameShape(QtGui.QFrame.NoFrame) lay = QtGui.QVBoxLayout(self) lay.setSpacing(0) lay.setContentsMargins(0, 0, 0, 0) lay.addWidget(self.toggle_button) lay.addWidget(self.content_area) self.toggle_animation.addAnimation(QtCore.QPropertyAnimation(self, b"minimumHeight")) self.toggle_animation.addAnimation(QtCore.QPropertyAnimation(self, b"maximumHeight")) self.toggle_animation.addAnimation(QtCore.QPropertyAnimation(self.content_area, b"maximumHeight"))
def _makeFirehoseWizard(self): firehoseWizard = QtGui.QWidget() segmentButton = QtGui.QToolButton() segmentButton.setIcon(QtGui.QIcon(':/images/wye.png')) segmentButton.setIconSize(QtCore.QSize(60,60)) segmentButton.connect('clicked()', self.onSegmentWye) l = QtGui.QVBoxLayout(firehoseWizard) l.addWidget(segmentButton) l.addWidget(_makeButton('segment hose nozzle', startHoseNozzleSegmentation)) l.addStretch() return firehoseWizard
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)
from PythonQt import QtCore, QtGui, example # call our new constructor of QSize size = QtCore.QSize(QtCore.QPoint(1, 2)) # call our new QPushButton constructor button = QtGui.QPushButton("sometext") # call the move slot (overload1) button.move(QtCore.QPoint(0, 0)) # call the move slot (overload2) button.move(0, 0) # call the static method print(QtGui.QWidget.mouseGrabber()) # create a CPP object via constructor yourCpp = example.YourCPPObject(2, 11.5) # call the wrapped method on CPP object print(yourCpp.doSomething(3)) # show slots available on yourCpp print(dir(yourCpp)) # destructor will be called: yourCpp = None
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 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)