Exemplo n.º 1
0
	def __init__(self, path, message, parent=None):
		super(BundleWidget, self).__init__(parent=parent)
		self.path = path
		self.message = message
		self.text = QtWidgets.QLabel('message')

		self.main_layout = QtWidgets.QHBoxLayout(self)
		self.btn_spool = QtWidgets.QPushButton('spool')
		self.btn_cache = QtWidgets.QPushButton('cache')
		self.btn_cancel = QtWidgets.QPushButton('cancel')

		#self.btn_add.setMaximumHeight(18)
		#self.btn_add.setMaximumWidth(55)
		#self.btn_rm.setMaximumHeight(18)
		#self.btn_rm.setMaximumWidth(55)

		self.main_layout.addWidget(self.text)
		self.main_layout.addWidget(self.btn_spool)
		self.main_layout.addWidget(self.btn_cache)
		self.main_layout.addWidget(self.btn_cancel)

		
		self.btn_spool.clicked.connect(self.onSpool)
		self.btn_cache.clicked.connect(self.onCache)
		self.btn_cancel.clicked.connect(self.onCancel)
Exemplo n.º 2
0
    def __init__(self, parent=None, close_cb=None, animationDuration=200):
        super(Animator, self).__init__(parent)

        self.animationDuration = animationDuration

        self.toggleAnimation = QtCore.QParallelAnimationGroup()
        if close_cb is not None:
            self.toggleAnimation.finished.connect(close_cb)

        self.contentArea = QtWidgets.QScrollArea(maximumHeight=0,
                                                 minimumHeight=0,
                                                 minimumWidth=500)
        self.contentArea.setStyleSheet(
            "QScrollArea { background-color: rgba(58 58, 58, 1); border: none;}"
        )
        self.contentArea.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                       QtWidgets.QSizePolicy.Fixed)

        toggleAnimation = self.toggleAnimation
        toggleAnimation.addAnimation(
            QtCore.QPropertyAnimation(self, b"minimumHeight"))
        toggleAnimation.addAnimation(
            QtCore.QPropertyAnimation(self, b"maximumHeight"))
        toggleAnimation.addAnimation(
            QtCore.QPropertyAnimation(self.contentArea, b"maximumHeight"))

        mainLayout = QtWidgets.QVBoxLayout(self)
        mainLayout.setSpacing(0)
        mainLayout.setContentsMargins(0, 0, 0, 0)
        mainLayout.addWidget(self.contentArea)
Exemplo n.º 3
0
 def initCommitWindow(self):
     self.commitBox = QtWidgets.QVBoxLayout()
     self.commitWindow = QtWidgets.QWidget()
     self.commitWindow.setMinimumHeight(400)
     self.commitWindow.setLayout(self.commitBox)
     self.commitMsg = QtWidgets.QTextEdit()
     self.commitMsg.setPlaceholderText("Enter Commit Message")
     self.commitMsg.setParent(self.commitWindow)
     self.commitBox.addWidget(self.commitMsg)
     okBtn = QtWidgets.QPushButton("Make Commit", self.commitWindow)
     okBtn.clicked.connect(self.createCommit)
     self.commitBox.addWidget(okBtn)
Exemplo n.º 4
0
    def __init__(self, label, first=True):
        super(BoxWidget, self).__init__()
        self.label = QtWidgets.QLabel(label + ":")
        self.label.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignCenter)

        if first:
            self.label.setMinimumSize(75, 20)
            self.label.setMaximumSize(75, 20)

        self.layout = QtWidgets.QHBoxLayout(self)
        self.layout.setSizeConstraint(QtWidgets.QLayout.SetMaximumSize)
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.layout.addWidget(self.label)
Exemplo n.º 5
0
	def __init__(self, data=None):
		super (ParmWindow, self).__init__()
		self.data = data
		self.parms = data["parms"]
		#self.file_name = data["file_name"]
		self.node_path = data["node_path"]
		self.node_name = data["node_name"]
		self.file_path = data["file_path"]
		self.preferences = self.populateData()

		def addCheckBox(checkbox_name):
			checkbox = QtWidgets.QCheckBox(checkbox_name)
			return checkbox

		self.save = QtWidgets.QPushButton("save")
		self.refresh = QtWidgets.QPushButton("refresh")
		self.select_all = QtWidgets.QPushButton("select_all")
		self.deselect_all = QtWidgets.QPushButton("deselect_all")
		self.onCreate()

		listBox = QtWidgets.QVBoxLayout(self)
		self.setLayout(listBox)

		scroll = QtWidgets.QScrollArea(self)
		listBox.addWidget(self.select_all)
		listBox.addWidget(self.deselect_all)
		listBox.addWidget(self.save)
		listBox.addWidget(self.refresh)
		listBox.addWidget(scroll)
		scroll.setWidgetResizable(True)
		scrollContent = QtWidgets.QWidget(scroll)

		self.scrollLayout = QtWidgets.QVBoxLayout(scrollContent)
		scrollContent.setLayout(self.scrollLayout)

		for i,(p,v) in enumerate(sorted(self.preferences.items(), key=operator.itemgetter(0)))
			#print i, p, v
			#print self.preferences[p]
		#for i, p in enumerate(self.preferences.keys()):
			self.cb = addCheckBox(p) # p.name()
			self.cb.setChecked(bool(self.preferences[p]))
			#self.cb.setChecked(bool(self.preferences.values()[i]))

			self.cb.stateChanged.connect(self.onSave)
			self.scrollLayout.addWidget(self.cb)
		scroll.setWidget(scrollContent)

		self.save.clicked.connect(self.onSave)
		self.refresh.clicked.connect(self.onRefresh)
		self.select_all.clicked.connect(self.onSelectAll)
		self.deselect_all.clicked.connect(self.onDeSelectAll)
		self.setWindowTitle(self.node_name)

		QtWidgets.QShortcut(QtGui.QKeySequence("Esc"), self, self.onClose)
Exemplo n.º 6
0
    def __init__(self, label, value=0, first=True):
        super(SliderBox, self).__init__(label, first)

        self.spinBox = QtWidgets.QSpinBox()
        self.spinBox.setButtonSymbols(QtWidgets.QAbstractSpinBox.NoButtons)
        self.spinBox.setValue(value)

        self.slider = QtWidgets.QSlider()
        self.slider.setOrientation(QtCore.Qt.Horizontal)
        self.slider.setValue(value)

        self.slider.valueChanged.connect(self.spinBox.setValue)

        self.layout.addWidget(self.spinBox)
        self.layout.addWidget(self.slider)
Exemplo n.º 7
0
 def show_error(title, text):
     msg = QtWidgets.QMessageBox()
     msg.setParent(self.parent, self.parent_flags)
     msg.setIcon(QtWidgets.QMessageBox.Critical)
     msg.setText(text)
     msg.setWindowTitle(title)
     msg.show()
Exemplo n.º 8
0
 def initLoadWindow(self):
     self.loadBox = QtWidgets.QVBoxLayout()
     self.loadWindow = QtWidgets.QWidget()
     self.loadWindow.setLayout(self.loadBox)
     self.loadWindow.setMinimumHeight(400)
     # create tree with date and message
     self.loadTree = QtWidgets.QTreeWidget()
     self.loadTree.setHeaderLabels(self.backup.getHeaders()[1:])
     self.loadBox.addWidget(self.loadTree)
     # add load button
     loadBtn = QtWidgets.QPushButton("Load Selected Backup",
                                     self.loadWindow)
     loadBtn.clicked.connect(self.loadBackup)
     self.loadBox.addWidget(loadBtn)
     # loadBtn.clicked.connect(lambda:)
     self.loadWindow.setVisible(False)
Exemplo n.º 9
0
 def initUI(self):
     self.setWindowTitle(self.title)
     self.setGeometry(self.left, self.top, self.width, self.height)
     button = QtWidgets.QPushButton("Hello", self)
     button.move(100, 70)
     button.clicked.connect(self.on_click)
     self.show()
Exemplo n.º 10
0
    def contextMenuEvent(self, event):
        """Define context menu content."""
        contextMenu = QtWidgets.QMenu(self)
        steppedAct = contextMenu.addAction("Convert to Stepped")
        linearAct = contextMenu.addAction("Convert to Linear")
        splinesAct = contextMenu.addAction("Convert to Bezier")
        contextMenu.addSeparator()
        cleanCurves = contextMenu.addAction("Clean Curves")
        contextMenu.addSeparator()
        killAllGhosts = contextMenu.addAction("Kill All Ghosts")
        action = contextMenu.exec_(QtGui.QCursor.pos())

        if action == steppedAct:
            type = "constant"
            self.convertAllKeys(type)

        if action == linearAct:
            type = "linear"
            self.convertAllKeys(type)

        if action == splinesAct:
            type = "bezier"
            self.convertAllKeys(type)

        if action == cleanCurves:
            self.cleanCurves()

        if action == killAllGhosts:
            self.killAllGhosts()
Exemplo n.º 11
0
    def __init__(self, plugin_configuration, parent):
        super(_PluginConfigurationWidget, self).__init__(parent=parent)
        self.plugin_configuration = plugin_configuration

        self.main_layout = QtWidgets.QVBoxLayout(self)
        self.main_layout.setContentsMargins(
            self.main_layout.contentsMargins().left() // 2,
            self.main_layout.contentsMargins().top() // 2,
            self.main_layout.contentsMargins().right() // 2,
            self.main_layout.contentsMargins().bottom() // 2)

        self.plugin_type = plugin_configuration.plugin_type
        if self.plugin_type == RprUsd.kPluginHybrid:
            plugin_qualities = 'Low-High Qualities'
        elif self.plugin_type == RprUsd.kPluginTahoe:
            plugin_qualities = 'Full (Legacy) Quality'
        elif self.plugin_type == RprUsd.kPluginNorthstar:
            plugin_qualities = 'Full Quality'

        self.labels_widget = QtWidgets.QWidget(self)
        self.main_layout.addWidget(self.labels_widget)

        self.labels_widget_layout = QtWidgets.QHBoxLayout(self.labels_widget)
        self.labels_widget_layout.setContentsMargins(0, 0, 0, 0)

        self.plugin_qualities_label = QtWidgets.QLabel(self.labels_widget)
        self.plugin_qualities_label.setText(plugin_qualities)
        self.labels_widget_layout.addWidget(self.plugin_qualities_label)

        self.incomplete_config_label = QtWidgets.QLabel(self.labels_widget)
        self.incomplete_config_label.setStyleSheet('color: rgb(255,204,0)')
        self.incomplete_config_label.setText('Configuration is incomplete: no devices')
        self.labels_widget_layout.addWidget(self.incomplete_config_label)
        self.incomplete_config_label.hide()

        if plugin_configuration.cpu_config.cpu_info.numThreads:
            cpu_widget = _DeviceWidget(parent=self, cpu_config=plugin_configuration.cpu_config)
            cpu_widget.on_change.connect(self.on_device_change)
            self.main_layout.addWidget(cpu_widget)

        for gpu_config in plugin_configuration.gpu_configs:
            gpu_widget = _DeviceWidget(parent=self, gpu_config=gpu_config)
            gpu_widget.on_change.connect(self.on_device_change)
            self.main_layout.addWidget(gpu_widget)

        self.is_complete = True
Exemplo n.º 12
0
    def __init__(self, scipt='lz_quick_vex', rows=4):
        super(LZ_vex_interface, self).__init__()
        #create Layout
        mainLayout = QtWidgets.QGridLayout()
        self.callbackDict = {}

        # read json
        import json
        hext = hou.expandString('$HEXT')
        self.json = json.load(open(hext + '/' + scipt + '.txt'))

        i = 0
        # fill lists
        for list_key in sorted(self.json.keys()):
            # create list widget
            new_list = QtWidgets.QListWidget()
            items = self.json[list_key]

            for key in sorted(items.keys()):
                list_item = QtWidgets.QListWidgetItem(key)

                picName = key.split(". ")[len(key.split(". ")) -
                                          1].lower().replace(":", "").replace(
                                              " ", "")
                #print picNam
                pic_path = hou.expandString(
                    '$HEXT\pic') + '\\' + picName + r".svg"
                if os.path.isfile(pic_path):
                    list_item.setIcon(QtGui.QIcon(pic_path))
                new_list.addItem(list_item)
                self.callbackDict[key] = items[key]
            new_list.doubleClicked.connect(self.doubleClickedList)

            # create label
            label = QtWidgets.QLabel(list_key)

            #fill
            layout = QtWidgets.QVBoxLayout()
            layout.addWidget(label)
            layout.addWidget(new_list)
            mainLayout.addLayout(layout, i / rows, i % rows)
            i += 1

        #set Layout
        self.setStyleSheet("background-color: hsv(0,0,45);")
        self.setLayout(mainLayout)
Exemplo n.º 13
0
 def handleLoadToggle(self):
     # add commits to tree
     commits = self.backup.getCommits()
     # if there has been a commit since last checking update list
     if (len(commits) > self.numCommits):
         for i in xrange(self.numCommits, len(commits)):
             el = QtWidgets.QTreeWidgetItem(self.loadTree, commits[i])
         self.numCommits = len(commits)
Exemplo n.º 14
0
    def __init__(self):
        super(win, self).__init__(parent=hou.ui.floatingPanels)

        loader = QtUiTools.QUiLoader()
        self.ui = loader.load(os.path.join(current_path,"win.ui"))
        main_layout = QtWidgets.QHBoxLayout()
        main_layout.addWidget(self.ui)
        self.setLayout(main_layout)
Exemplo n.º 15
0
    def __init__(self):
        super(MaterialLibraryWindow, self).__init__()

        matLibWidget = MaterialLibraryWidget(material_library)

        layout = QtWidgets.QVBoxLayout()
        layout.addWidget(matLibWidget)

        central_widget = QtWidgets.QWidget()
        central_widget.setLayout(layout)

        self.setCentralWidget(central_widget)
        self.setParent(hou.qt.mainWindow(), QtCore.Qt.Window)
        self.setWindowTitle('RPR Material Library')

        desktop_widget = QtWidgets.QDesktopWidget()
        primary_screen = desktop_widget.screen(desktop_widget.primaryScreen())
        self.resize(primary_screen.width() // 3, int(primary_screen.height() * 0.8))
Exemplo n.º 16
0
    def __init__(self):
        QtWidgets.QWidget.__init__(self)

        loader = QtUiTools.QUiLoader()
        self.ui = loader.load(os.path.join(current_path, "win.ui"))

        main_layout = QtWidgets.QHBoxLayout()
        main_layout.addWidget(self.ui)
        self.setLayout(main_layout)
Exemplo n.º 17
0
    def __init__(self, label, value=0, first=True):
        super(SpinBox, self).__init__(label, first)
        self.spinBox = QtWidgets.QSpinBox()
        self.spinBox.setButtonSymbols(QtWidgets.QAbstractSpinBox.NoButtons)
        self.spinBox.setValue(value)
        self.spinBox.setMaximumSize(50, 20)
        self.spinBox.setRange(-99999, 99999)

        self.layout.addWidget(self.spinBox)
Exemplo n.º 18
0
 def _treeItemClicked(self, index):
     items = self._libraryTreeModel.getSubItems(index)
     self._listWidget.clear()
     for item in items:
         item_text = item.name.replace('_', ' ')
         listItem = QtWidgets.QListWidgetItem(item.preview, item_text, self._listWidget)
         listItem.setToolTip(item_text)
         listItem.setSizeHint(QtCore.QSize(PREVIEW_SIZE + 10, PREVIEW_SIZE + 40))
         self._setItemHidden(listItem)
         self._listWidget.addItem(listItem)
Exemplo n.º 19
0
    def __init__(self, label, first=True):
        super(ComboBox, self).__init__(label, first)
        self.items = list()

        self.comboBox = QtWidgets.QComboBox()
        self.comboBox.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                    QtWidgets.QSizePolicy.Fixed)
        self.currentIndexChanged = self.comboBox.currentIndexChanged

        self.layout.addWidget(self.comboBox)
Exemplo n.º 20
0
    def __init__(self, configuration, show_restart_warning):
        super(_DevicesConfigurationDialog, self).__init__()

        self.configuration = configuration
        self.initial_configuration = configuration.deepcopy()

        if self.configuration.context.parent:
            self.setParent(self.configuration.context.parent, self.configuration.context.parent_flags)
        self.setSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
        self.setWindowTitle('RPR Render Devices')

        self.main_layout = QtWidgets.QVBoxLayout(self)
        self.main_layout.setSizeConstraint(QtWidgets.QLayout.SetFixedSize)

        self.plugin_configuration_widgets = list()
        for config in configuration.plugin_configurations:
            widget = _PluginConfigurationWidget(config, self)
            widget.on_change.connect(self.on_plugin_configuration_change)
            self.main_layout.addWidget(widget)
            self.plugin_configuration_widgets.append(widget)

        if show_restart_warning:
            self.restart_warning_label = QtWidgets.QLabel(self)
            self.restart_warning_label.setText('Changes will not take effect until the RPR renderer restarts.')
            self.restart_warning_label.setStyleSheet('color: rgb(255,204,0)')
            self.restart_warning_label.hide()
            self.main_layout.addWidget(self.restart_warning_label)
        else:
            self.restart_warning_label = None

        self.button_box = QtWidgets.QDialogButtonBox(self)
        self.save_button = self.button_box.addButton("Save", QtWidgets.QDialogButtonBox.AcceptRole)
        self.save_button.setEnabled(False)
        self.button_box.addButton("Cancel", QtWidgets.QDialogButtonBox.RejectRole)
        self.button_box.accepted.connect(self.on_accept)
        self.button_box.rejected.connect(self.on_reject)
        self.main_layout.addWidget(self.button_box)

        self.show()

        self.should_update_configuration = False
Exemplo n.º 21
0
 def __init__(self, parent=None):
     QtWidgets.QWidget.__init__(self, parent)
     # create composite backup controller
     self.backup = Backup()
     # init Windows
     self.initCommitWindow()
     self.initLoadWindow()
     self.setGeometry(500, 300, 400, 200)
     self.setWindowTitle('Sane Backup')
     # set layouts and add widgets
     self.numCommits = 0
     parentLayout = QtWidgets.QVBoxLayout()
     self.setLayout(parentLayout)
     # create tabs
     tabWidget = QtWidgets.QTabWidget()
     tabWidget.addTab(self.commitWindow, "Make a Commit")
     tabWidget.addTab(self.loadWindow, "Load a Backup")
     # listen for tab change
     tabWidget.currentChanged.connect(self.handleTabSelect)
     parentLayout.addWidget(tabWidget)
     self.setParent(hou.ui.mainQtWindow(), QtCore.Qt.Window)
Exemplo n.º 22
0
	def __init__(self, element, message, parent=None):
		super(SampleWindow, self).__init__(parent=parent)
		self.element = element


		self.main_layout = QtWidgets.QHBoxLayout(self)
		#for a,b in enumerate(element):
		#print e

		msg = element.evalParm("element")+'has not been cached,'
		self.textMsg = QtWidgets.QLabel(msg)

		self.btn_spool = QtWidgets.QPushButton('spool')
		self.btn_cache = QtWidgets.QPushButton('cache')
		self.btn_cancel = QtWidgets.QPushButton('cancel')

		verticalSpacer = QtWidgets.QSpacerItem(
			40, 40, QtWidgets.QSizePolicy.Minimum, 
			QtWidgets.QSizePolicy.Expanding)

		self.main_layout.addItem(verticalSpacer)
		#self.btn_add.setMaximumHeight(18)
		#self.btn_add.setMaximumWidth(55)
		#self.btn_rm.setMaximumHeight(18)
		#self.btn_rm.setMaximumWidth(55)

			#self.main_layout.addWidget(self.element)

		self.main_layout.addWidget(self.textMsg)
		self.main_layout.addWidget(self.btn_spool)
		self.main_layout.addWidget(self.btn_cache)
		self.main_layout.addWidget(self.btn_cancel)
		self.btn_spool.clicked.connect(lambda:self.onSpool(self.element))
		self.btn_cache.clicked.connect(lambda:self.onCache(self.element))
		self.btn_cancel.clicked.connect(self.onCancel)
Exemplo n.º 23
0
    def __init__(self, parent=None):
        # INITIALIZE GUI AND SET WINDOW TO ALWAYS ON TOP
        QtWidgets.QWidget.__init__(self, parent, QtCore.Qt.WindowStaysOnTopHint)
        
        # SET LAYOUTS
        vbox = QtWidgets.QVBoxLayout()
        hbox1 = QtWidgets.QHBoxLayout()        
        
        # SET WINDOW ATTRIBUTES
        self.setGeometry(500, 300, 420, 110)
        self.setWindowTitle('Convert Relative File Paths to Absolute')
        
        # CREATE WIDGETS
        self.apply_to_label = QtWidgets.QLabel("Nodes to Update:")
        self.apply_to_combo_box = QtWidgets.QComboBox(self)     
        self.update_paths_button = QtWidgets.QPushButton('Update Paths', self)
        
        # POPULATE COMBO BOX
        self.apply_to_combo_box.addItem("Selected Nodes Only")        
        self.apply_to_combo_box.addItem("All Nodes In Scene (Any Context)")          
        self.apply_to_combo_box.addItem("All Nodes In Obj Context")           
        self.apply_to_combo_box.addItem("Selected Nodes & Their Direct Children")
        self.apply_to_combo_box.addItem("Selected Nodes & All Subchildren")        
        self.apply_to_combo_box.addItem("Only Direct Children Of Selected Nodes")   
        self.apply_to_combo_box.addItem("Only All Subchildren Of Selected Nodes")           

        # CONNECT BUTTONS TO FUNCTIONS
        self.update_paths_button.clicked.connect(self.updatePaths)
        
        # ADD WIDGETS TO LAYOUT
        hbox1.addWidget(self.apply_to_label) 
        hbox1.addWidget(self.apply_to_combo_box)     
        vbox.addLayout(hbox1)
        vbox.addWidget(self.update_paths_button)
        
        # SET LAYOUT
        self.setLayout(vbox)
Exemplo n.º 24
0
def import_material():
    global material_library
    if not material_library:
        try:
            material_library = MaterialLibrary()
        except MaterialLibrary.InitError as e:
            msg = QtWidgets.QMessageBox(hou.qt.mainWindow())
            msg.setIcon(QtWidgets.QMessageBox.Critical)
            msg.setText(e.msg)
            msg.setWindowTitle("Material Library initialization failed")
            msg.show()
            return

    window = MaterialLibraryWindow()
    window.show()
Exemplo n.º 25
0
    def __init__(self, small_string, full_string, no_margins=False):
        QtWidgets.QFrame.__init__(self)
        self.smallString = small_string
        self.fullString = full_string
        self.state = False

        self.helpLabel = QtWidgets.QLabel(self.smallString)
        self.helpLabel.setWordWrap(True)
        self.helpLabel.setTextFormat(QtCore.Qt.RichText)

        self.helpExpand = QtWidgets.QPushButton("Show More")
        self.helpExpand.clicked.connect(self.expandHelp)

        help_layout = QtWidgets.QGridLayout()
        help_layout.addWidget(self.helpLabel, 0, 0, 1, 5)
        help_layout.addWidget(self.helpExpand, 1, 0, 1, 1)

        self.setLayout(help_layout)

        if no_margins:
            self.setContentsMargins(0, 0, 0, 0)
            help_layout.setContentsMargins(0, 0, 0, 0)

        self.setProperty("help_text", True)
Exemplo n.º 26
0
    def __init__(self):
        super(FullPreviewWindow, self).__init__()
        self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint)

        icon_label = QtWidgets.QLabel()
        icon_label.setAlignment(QtCore.Qt.AlignCenter)
        icon_label.setFrameShape(QtWidgets.QFrame.Box)
        icon_label.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
        icon_label.setBackgroundRole(QtGui.QPalette.Base)
        icon_label.setAttribute(QtCore.Qt.WA_TransparentForMouseEvents)
        self.setCentralWidget(icon_label)

        self.setMouseTracking(True)

        self._currentIconName = ''
        self._requiredWidget = None
Exemplo n.º 27
0
    def __init__(self, material_library):
        super(MaterialLibraryWidget, self).__init__()

        self._material_library = material_library
        self._fullPreviewWindow = FullPreviewWindow()

        script_dir = os.path.dirname(os.path.abspath(__file__))
        ui_filepath = os.path.join(script_dir, 'materialLibrary.ui')
        self._ui = QtUiTools.QUiLoader().load(ui_filepath, parentWidget=self)

        self._layout = QtWidgets.QVBoxLayout()
        self.setLayout(self._layout)
        self._layout.setContentsMargins(0, 0, 0, 0)
        self._layout.addWidget(self._ui)

        self._ui.filter.textChanged.connect(self._filterChanged)

        self._listWidget = LibraryListWidget(self)
        self._fullPreviewWindow._requiredWidget = self._listWidget
        self._ui.verticalLayout_3.insertWidget(0, self._listWidget)

        self._ui.treeView.clicked.connect(self._treeItemClicked)
        self._listWidget.clicked.connect(self._listItemClicked)
        self._listWidget.itemEntered.connect(self._listItemEntered)
        self._listWidget.viewportEntered.connect(self._listViewportEntered)
        self._listWidget.setMouseTracking(True)

        self._ui.splitter.setSizes([150, 150])

        self._libraryTreeModel = LibraryTreeModel(self)      # tree item height must not be less than line edit height
        self._ui.treeView.setModel(self._libraryTreeModel)

        for group, materials in material_library.material_groups:
            for name in materials:
                self._libraryTreeModel.addItem(['All', group, name], material_library.material_datas[name].preview)

        self._libraryTreeModel.reset()
        self._ui.treeView.setIndentation(self._ui.treeView.indentation() // 2)
        rootIndex = self._libraryTreeModel.index(0, 0, QtCore.QModelIndex())
        self._treeItemClicked(rootIndex)
        self._ui.treeView.expand(rootIndex)

        self._ui.helpButton.clicked.connect(self._helpButtonClicked)

        self._dataModel = None
        self._stateLoaded = False
Exemplo n.º 28
0
    def __init__(self, label="", include_alpha=False):
        """
__init__(self, label=\"\", include_alpha=False)

    Create and return a new ColorField object.


    label
        If set to a non-empty string then a label is added to the color
        field.

    include_alpha
        If True, then an alpha component is added to the color field.

"""
        QtWidgets.QWidget.__init__(self)

        layout = QtWidgets.QHBoxLayout()
        layout.setSpacing(hou.ui.scaledSize(2))
        layout.setContentsMargins(0, 0, 0, 0)

        self.colorSwatchButton = hou.qt.ColorSwatchButton(include_alpha)

        # Use the color swatch button's colorChanged signal as our own.
        self.colorChanged = self.colorSwatchButton.colorChanged

        self.inputField = hou.qt.InputField(hou.qt.InputField.FloatType,
                                            4 if include_alpha else 3)

        if label is not None and label != "":
            layout.addWidget(hou.qt.FieldLabel(label))

        layout.addWidget(self.colorSwatchButton)
        layout.addSpacing(hou.ui.scaledSize(5))
        layout.addWidget(self.inputField)

        # Connect color swatch button to field so their values
        # are always in-sync.
        self.colorSwatchButton.colorChanged.connect(
            self._updateFieldFromColorSwatch)
        self.inputField.valueChanged.connect(self._updateColorSwatchFromField)

        # Sync input field with color swatch.
        self._updateFieldFromColorSwatch(self.colorSwatchButton.color())

        self.setLayout(layout)
Exemplo n.º 29
0
    def chooseColor(self):
        sender = self.sender()

        self.name = sender.objectName()
        self.colorfield[self.name] = (getattr(self.ui, self.name), sender)

        qcolor = QtGui.QColor()
        qcolor.setNamedColor(self.colorfield[self.name][0].text())

        colord = QtWidgets.QColorDialog(self)
        colord.setModal(False)
        pos = self.parentwindow.mapToGlobal(
            QtCore.QPoint(self.parentwindow.width(),
                          self.parentwindow.height()))
        colord.move(
            pos.x() + 300,
            pos.y(),
        )
        c = colord.getColor(initial=qcolor,
                            parent=self,
                            options=QtWidgets.QColorDialog.DontUseNativeDialog)
        hcolor = hou.qt.fromQColor(c)

        self.colorchange_cb(hcolor[0])
Exemplo n.º 30
0
        def buildUI():

            self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
            self.setAttribute(QtCore.Qt.WA_AlwaysShowToolTips)

            # Main Layout
            mainLayout = QtWidgets.QVBoxLayout()

            # General Group
            generalGroupBox = QtWidgets.QGroupBox("General")
            generalLayout = QtWidgets.QVBoxLayout(generalGroupBox)

            # Host Layout
            hostLayout = QtWidgets.QHBoxLayout()
            self.hostLineEdit = LineEditBox("Host", u"%s" % self.defaultHost)
            self.hostCheckBox = QtWidgets.QCheckBox()
            self.hostCheckBox.setChecked(True)
            self.hostCheckBox.stateChanged.connect(
                self.hostLineEdit.setEnabled)
            hostLayout.addWidget(self.hostLineEdit)
            hostLayout.addWidget(self.hostCheckBox)

            # Port Layout
            portLayout = QtWidgets.QHBoxLayout()
            self.portSlider = SliderBox("Port")
            self.portSlider.setMinimum(0, 0)
            self.portSlider.setMaximum(9999, 15)
            self.portSlider.setValue(self.defaultPort)
            self.portSlider.connect(portUpdateUI)
            self.portCheckBox = QtWidgets.QCheckBox()
            self.portCheckBox.setChecked(True)
            self.portCheckBox.stateChanged.connect(self.portSlider.setEnabled)
            portLayout.addWidget(self.portSlider)
            portLayout.addWidget(self.portCheckBox)

            # Output Driver Layout
            outputDriverLayout = QtWidgets.QHBoxLayout()
            self.outputComboBox = ComboBox("Output")
            self.outputComboBox.addItems([i.path for i in self.outputsList])
            self.outputComboBox.currentIndexChanged.connect(outputUpdateUI)
            outputDriverLayout.addWidget(self.outputComboBox)

            # Camera Layout
            cameraLayout = QtWidgets.QHBoxLayout()
            self.cameraComboBox = ComboBox("Camera")
            self.cameraComboBox.addItems(getAllCameras(path=True))
            self.cameraComboBox.setCurrentName(self.output.cameraPath)
            cameraLayout.addWidget(self.cameraComboBox)

            # Overrides Group
            overridesGroupBox = QtWidgets.QGroupBox("Overrides")
            overridesLayout = QtWidgets.QVBoxLayout(overridesGroupBox)

            # IPR Update Layout
            IPRUpdateLayout = QtWidgets.QHBoxLayout()
            self.IPRUpdateCheckBox = CheckBox('IPR', " Auto Update")
            self.IPRUpdateCheckBox.setChecked(self.ipr.isAutoUpdateOn())
            self.IPRUpdateCheckBox.stateChanged.connect(
                lambda: self.ipr.setAutoUpdate(self.IPRUpdateCheckBox.
                                               isChecked()))
            IPRUpdateLayout.addWidget(self.IPRUpdateCheckBox)

            # Bucket Layout
            bucketLayout = QtWidgets.QHBoxLayout()
            self.bucketComboBox = ComboBox("Bucket Scan")
            self.bucketComboBox.addItems(getBucketModes())
            self.bucketComboBox.setCurrentName(self.output.bucketScanning)
            bucketLayout.addWidget(self.bucketComboBox)

            # Resolution Layout
            resolutionLayout = QtWidgets.QHBoxLayout()
            self.resolutionSlider = SliderBox("Resolution %")
            self.resolutionSlider.setMinimum(1, 1)
            self.resolutionSlider.setMaximum(200, 40)
            self.resolutionSlider.setValue(100, 20)
            self.resolutionSlider.connect(resUpdateUI)
            xres, yres = self.output.resolution[0], self.output.resolution[1]
            self.resolutionInfoLabel = QtWidgets.QLabel(
                str(xres) + 'x' + str(yres))
            self.resolutionInfoLabel.setMaximumSize(100, 20)
            self.resolutionInfoLabel.setEnabled(False)
            resolutionLayout.addWidget(self.resolutionSlider)
            resolutionLayout.addWidget(self.resolutionInfoLabel)

            # Camera AA Layout
            cameraAaLayout = QtWidgets.QHBoxLayout()
            self.cameraAaSlider = SliderBox("Camera (AA)")
            self.cameraAaSlider.setMinimum(-64, -3)
            self.cameraAaSlider.setMaximum(64, 16)
            self.cameraAaSlider.setValue(self.output.AASamples,
                                         self.output.AASamples)
            cameraAaLayout.addWidget(self.cameraAaSlider)

            # Render region layout
            renderRegionLayout = QtWidgets.QHBoxLayout()
            self.renderRegionXSpinBox = SpinBox("Region X")
            self.renderRegionYSpinBox = SpinBox("Y", 0, False)
            self.renderRegionRSpinBox = SpinBox("R", 0, False)
            self.renderRegionTSpinBox = SpinBox("T", 0, False)
            self.renderRegionRSpinBox.setValue(self.output.resolution[0])
            self.renderRegionTSpinBox.setValue(self.output.resolution[1])
            renderRegionGetNukeButton = QtWidgets.QPushButton("Get")
            renderRegionGetNukeButton.clicked.connect(self.getNukeCropNode)
            renderRegionLayout.addWidget(self.renderRegionXSpinBox)
            renderRegionLayout.addWidget(self.renderRegionYSpinBox)
            renderRegionLayout.addWidget(self.renderRegionRSpinBox)
            renderRegionLayout.addWidget(self.renderRegionTSpinBox)
            renderRegionLayout.addWidget(renderRegionGetNukeButton)

            # Overscan Layout
            overscanLayout = QtWidgets.QHBoxLayout()
            self.overscanSlider = SliderBox("Overscan")
            self.overscanSlider.setMinimum(0)
            self.overscanSlider.setMaximum(9999, 250)
            self.overscanSlider.setValue(0, 0)
            overscanLayout.addWidget(self.overscanSlider)

            # Ignore Group
            ignoresGroupBox = QtWidgets.QGroupBox("Ignore")
            ignoresGroupBox.setMaximumSize(9999, 75)

            # Ignore Layout
            ignoresLayout = QtWidgets.QVBoxLayout(ignoresGroupBox)
            ignoreLayout = QtWidgets.QHBoxLayout()
            self.motionBlurCheckBox = QtWidgets.QCheckBox(' Motion Blur')
            self.subdivsCheckBox = QtWidgets.QCheckBox(" Subdivs")
            self.displaceCheckBox = QtWidgets.QCheckBox(' Displace')
            self.bumpCheckBox = QtWidgets.QCheckBox(' Bump')
            self.sssCheckBox = QtWidgets.QCheckBox(' SSS')
            ignoreLayout.addWidget(self.motionBlurCheckBox)
            ignoreLayout.addWidget(self.subdivsCheckBox)
            ignoreLayout.addWidget(self.displaceCheckBox)
            ignoreLayout.addWidget(self.bumpCheckBox)
            ignoreLayout.addWidget(self.sssCheckBox)

            # Main Buttons Layout
            mainButtonslayout = QtWidgets.QHBoxLayout()
            startButton = QtWidgets.QPushButton("Start / Refresh")
            stopButton = QtWidgets.QPushButton("Stop")
            resetButton = QtWidgets.QPushButton("Reset")
            startButton.clicked.connect(self.startRender)
            stopButton.clicked.connect(self.stopRender)
            resetButton.clicked.connect(resetUI)
            mainButtonslayout.addWidget(startButton)
            mainButtonslayout.addWidget(stopButton)
            mainButtonslayout.addWidget(resetButton)

            # Add Layouts to Main
            generalLayout.addLayout(hostLayout)
            generalLayout.addLayout(portLayout)
            generalLayout.addLayout(outputDriverLayout)
            overridesLayout.addLayout(IPRUpdateLayout)
            overridesLayout.addLayout(cameraLayout)
            overridesLayout.addLayout(bucketLayout)
            overridesLayout.addLayout(resolutionLayout)
            overridesLayout.addLayout(cameraAaLayout)
            overridesLayout.addLayout(renderRegionLayout)
            overridesLayout.addLayout(overscanLayout)
            ignoresLayout.addLayout(ignoreLayout)

            mainLayout.addWidget(generalGroupBox)
            mainLayout.addWidget(overridesGroupBox)
            mainLayout.addWidget(ignoresGroupBox)
            mainLayout.addLayout(mainButtonslayout)

            addUICallbacks()

            return mainLayout