Search the Community
Showing results for tags 'pyside'.
-
I have a custom pyqt ui with a list widget in it. I'd like that list widget to update if the user changes context in the network view. e.g. from object to SOP to ROP (Driver) etc. I believe I can utilise the ContextEvent handler but I don't know how to initiate it. Can anyone help me out or point me to a script I can dissect? https://www.sidefx.com/docs/houdini/hom/network.html I briefly flirted with the pypanel nodepath hook but ideally I'd like to run this from a toolshelf too. https://www.sidefx.com/docs/houdini/examples/python_panels/nodepath.html
-
hi, i need some help with resizable widgets. it seems the window wont redraw the window canvas. i tried to resize the window with a event(second picture), but nothing worked. the .ui comes from QtDesigner. do i have to set some flags? is it possible at all? i appreciate your help, thx. nic.
-
As the title suggests, how do you drag and drop Qt data on to a parameter? I was able to use this example as reference. But in my case the i couldn't make the drop event register. The code i have now kinda works, but the dropped text is wierd. What's the right way to do this....could use some help! I'm attaching an example code. from PySide2.QtWidgets import * from PySide2.QtCore import * from PySide2.QtGui import * import hou class TreeWidget(QTreeView): def __init__(self): super(TreeWidget, self).__init__() self.setDragEnabled(True) # def dragEnterEvent(self, event): # print "dragEnterEvent" # event.acceptProposedAction() def mouseMoveEvent(self, event): print "MoveEvent" mimeData = QMimeData() data = (self.selectedIndexes()[0]).data() mimeData.setText(data) drag = QDrag(self) drag.setMimeData(mimeData) drag.exec_(Qt.CopyAction | Qt.MoveAction, Qt.CopyAction) # def dropEvent(self, event): # print "dropEvent" # mime_data = event.mimeData() class Example(QWidget): def __init__(self): super(Example, self).__init__() self.build_ui() def build_ui(self): self.setGeometry(300, 300, 150, 250) self.setParent(hou.qt.mainWindow(), Qt.Window) mainlayout = QVBoxLayout() self.setLayout(mainlayout) self.tree_widget = TreeWidget() self.tree_widget.setRootIsDecorated(False) self.tree_widget.setHeaderHidden(True) model = QStandardItemModel() self.tree_widget.setModel(model) mainlayout.addWidget(self.tree_widget) for i in range(10): parent_item = QStandardItem('Example_{0} \nnew_line_{0} \n '.format(i)) model.appendRow(parent_item) def dragEnterEvent(self, event): event.acceptProposedAction() # def dropEvent(self, event): # print "dropEvent 2" # str = event.mimeData().text() # event.acceptProposedAction() ex = Example() ex.show()
-
Hi guys, I'm having a simple shelf tool in Houdini: from PySide2 import QtCore, QtGui, QtWidgets class PysideTest(QtWidgets.QMainWindow): def __init__(self, parent=None): super(PysideTest, self).__init__(parent) test = QtWidgets.QWidget() self.resize(800, 800) self.setWindowTitle("This is a test") hbox = QtWidgets.QHBoxLayout() edit = QtWidgets.QLineEdit() edit.setObjectName("QLineEditCustom") print edit.styleSheet() hbox.addWidget(edit) test.setLayout(hbox) self.setCentralWidget(test) #self.setBackgroundRole(QtGui.QPalette.ColorRole.Base) self.setBackgroundRole(QtGui.QPalette.Dark) self.setAutoFillBackground(True) self.show() def run(): mainWidget = hou.qt.mainWindow() css = mainWidget.styleSheet() css_filter_str = 'QLineEdit#QLineEditCustom\n{background: rgb(255, 255, 255); color: rgb(255, 0, 255); selection-background-color: red}' css = "\n".join([css, css_filter_str]) mainWidget.setStyleSheet(css) obj = PysideTest(mainWidget) run() When I press on the shelf tool button I get my UI popping up nicely. This only works if I give the class "PysideTest" the parent "mainWidget", otherwise the UI disappears immediately after clicking on the shelf tool. Now because I'm giving it the "hou.qt.mainWindow()" as a parent, the UI inherits the CSS from its parent. In order to override the CSS on the QLineEdit for instance, I can't just simply write edit.setStyleSheet(), this is being ignored. Instead, I apparently have to grab the CSS from the mainWidget (which is a string) and append my own line using the identifier "#QLineEditCustom". This way it's possible for me to adjust the text color (in my case pink) as well as the selection background color (in my case red), however I'm unable to change the background color of the QLineEdit, which is what I actually want to do. > background: rgb(255, 255, 255) does not work > background-color: rgb(255, 255, 255) does not work either What am I missing here guys? I really like the fact that I can just inherit the CSS from Houdini, but it would be great if there was a more straight forward way of customizing it. The other question I have, what if I wanted to change the background color based on the user text input from color A to color B dynamically, how would I approach that? Thanks in advance, Manu
-
I know the icons are stored here: hicon:/SVGIcons.index? and the short form to add one to a tool or shelf would be, for example, BUTTONS_add.svg. But how can I point to one of these icons from a pyside gui? Is there a fullpath I can use?
-
Hello everyone, i´m writing a tool in Pyside and i can´t figure out how to set the color of the individual cells in a QTableView. Here is an example, which demonstrates the problem: from PySide import QtCore, QtGui import hou class cellColor(QtGui.QDialog): def __init__(self): QtGui.QDialog.__init__(self) self.resize(297, 174) self.verticalLayout = QtGui.QVBoxLayout(self) self.tableview = QtGui.QTableView(self) self.verticalLayout.addWidget(self.tableview) # without parenting the ui to houdini, i can set the cell colors self.setParent(hou.ui.mainQtWindow(), QtCore.Qt.Window) model = QtGui.QStandardItemModel() item1 = QtGui.QStandardItem("Color Red") item1.setBackground(QtGui.QColor(240,10,10)) item2 = QtGui.QStandardItem("Color Green") item2.setBackground(QtGui.QColor(10,240,10)) model.appendRow([item1,item2]) self.tableview.setModel(model) testwindow = cellColor() testwindow.show() testwindow = cellColor() testwindow.show() Is there a way to set the color of the cells, when the window is parented to Houdini? Thanks for all replies
-
In the current tool I'm building for H16, I have a UI in which I would like to have different options available to the user depending on their selection. It would be ideal if these options can change without the user having to close and relaunch the UI every time. In short, I need a way to capture a signal emitted when the user selects node(s). I looked around the HOM and didn't see anything that looks like it gets called whenever a node is selected, just queries for currently selected nodes. Does anyone know how I could trigger something in my UI whenever the user selects different nodes? Thanks! Chris
-
How to get houdini mainWindow & parent PyQt/PySide Qwidget to mainWindow in 14.0 and 15.0?? hou.ui.mainQtWindow() not working here
-
Hi guys, This has boggled my mind for a while now. I have a OTL that has a tool script attached to it (Type Properties > Tool section), that evokes a PySide interface. The problem is that when I run the tool a few times, every single time a new instance of the interface is being opened, while the old one is still alive. So I'm ending up with lots of open windows of the same tool after a while which is super annoying. How can I prevent this from happening? I want to have only one single instance running at a time, basically close the old window if the tool is run again. Here's a really simple example that we could use as a test case. (Same problem if I run it as a shelf tool) from PySide import QtGui, QtCore class Window(QtGui.QWidget): """Simple Test""" def __init__(self): super(Window, self).__init__() self.setGeometry(50, 50, 500, 300) self.setWindowTitle("test") self.home() def home(self): btn = QtGui.QPushButton("Test Button") a_label = QtGui.QLabel("Test Label") qvbox = QtGui.QVBoxLayout() qvbox.addWidget(btn) qvbox.addWidget(a_label) qvbox.insertStretch(2) self.setLayout(qvbox) def run(self): self.show() main = Window() main.run() Some where I read that using the QEventLoop might help to detect running instances with hou.ui.eventLoopCallbacks(), but after trying some stuff for a few hours, I'm at my wits end. Help here would be much appreciated Thanks!!!
-
Hi Guys, cmivfx.com just released my latest training, I know this would be very useful, the content is amazing, I'm very proud of what I did, hope you guys like it. Thank you https://vimeo.com/97522457 cmivfx.com/store/597-Houdini+Python+Character+Picker cmiVFX brings you a brand new and improved Houdini Python Character Picker using PySide, this series will bring to you the tools to tackle everything you need to know to take advantage of the amazing Qt Framework + Houdini Combo, by using the Qt Python binding PySide, you can do everything your artist can imagine. Every studio in the work requires to develop custom tools to serve project, which makes repetitive, complex tasks easier and more productive, also helps you extend the standard tools and having a great interface for it that can be made really quick and looks just like any other tool in Houdini thanks to the great python integration. So this is not just a simple tutorial, this is career building information. Short Description Get ready to polish your custom tool chops, here you’ll learn everything you need to know to take advantage of the amazing Qt Framework, that will interface throw the incredible and open source PySide Python bindings. You’ll learn how to work as you’re used to work in python and take full advantage without any restriction to both Houdini and the Qt Framework, there’s is no limit of what you can achieve and the most important part is, your animators are going to be so happy and they will work more, so let’s dive in and start creating amazing tools and making artist happy.