Hi, dear SESI team !!!
Python Panel is very good addition to Houdini, but:
1. How to set main houdini widget as parent of my own widget?
2. I installed eventfilter to main widget for monitoring Qt ui behaviour. And i saw that not all events can catch.
For example, Leave event (when we go to other top level widget). I dont understand why Leave event not generated in this case
3. As I understood, Qt draw Houdini old-style UI system, and we can`t add for example QPushButton to main window. Or maybe this can changed in future releases
—
Also, I think that we need some identification method of main Houdini widget via PySide. For example, in Maya we can filter widget via objectName (QtGui.QWidget.objectName). In HDK I can get it with RE_QtWindow::mainQtWindow()
Thanks for any details about Qt…
—
PS Look at this level of PyQt\PySide intervention
http://youtu.be/Mu_tVZJYYBQ [youtu.be]
What do you think?
Best regards…
Some Qt questions
22178 24 7- Alexey Vanzhula
- Member
- 538 posts
- Joined: Dec. 2006
- Offline
- Alexey Vanzhula
- Member
- 538 posts
- Joined: Dec. 2006
- Offline
- Stalkerx777
- Member
- 183 posts
- Joined: Nov. 2008
- Offline
- rvinluan
- Staff
- 1283 posts
- Joined: July 2005
- Offline
Hello,
To attach your widget to a Python Panel you just have to ‘return’ it from the createInterface() function.
For example in the Script section of your Python Panel interface you can write:
from PySide import QtGui
def createInterface():
widget = QtGui.QLabel('Hello World!')
return widget
Also I'm not sure if you've seen this help page already:
http://www.sidefx.com/docs/houdini14.0/ref/windows/pythonpaneleditor [sidefx.com]
It contains information about creating and editing interfaces in Python Panels.
Also if you haven't already, try the Quick Start example that's available in the Python Panel by default. That might answer questions about the workflow.
There's a bug with Python Panel event filtering that we are currently working on. It should be fixed in a daily build soon.
But it sounds like you are trying to install an event filter on the root widget. This is not recommended or supported. It is best to install filters only on your custom widgets and not the main Houdini widget.
That is correct. Modifying the main window is currently not supported. This is something that we are considering for a future release.
And it sounds like a bug that the HDK currently provides you with access to the main Houdini widget. I will look into that.
Interesting. You can do something similar in Houdini by dragging parameters into the viewport and creating HUD sliders. Not as sophisticated but still pretty useful.
Cheers,
Rob
vux
1. How to set main houdini widget as parent of my own widget?
To attach your widget to a Python Panel you just have to ‘return’ it from the createInterface() function.
For example in the Script section of your Python Panel interface you can write:
from PySide import QtGui
def createInterface():
widget = QtGui.QLabel('Hello World!')
return widget
Also I'm not sure if you've seen this help page already:
http://www.sidefx.com/docs/houdini14.0/ref/windows/pythonpaneleditor [sidefx.com]
It contains information about creating and editing interfaces in Python Panels.
Also if you haven't already, try the Quick Start example that's available in the Python Panel by default. That might answer questions about the workflow.
vux
2. I installed eventfilter to main widget for monitoring Qt ui behaviour. And i saw that not all events can catch.
For example, Leave event (when we go to other top level widget). I dont understand why Leave event not generated in this case
There's a bug with Python Panel event filtering that we are currently working on. It should be fixed in a daily build soon.
But it sounds like you are trying to install an event filter on the root widget. This is not recommended or supported. It is best to install filters only on your custom widgets and not the main Houdini widget.
vux
3. As I understood, Qt draw Houdini old-style UI system, and we can`t add for example QPushButton to main window. Or maybe this can changed in future releases
That is correct. Modifying the main window is currently not supported. This is something that we are considering for a future release.
And it sounds like a bug that the HDK currently provides you with access to the main Houdini widget. I will look into that.
vux
PS Look at this level of PyQt\PySide intervention
http://youtu.be/Mu_tVZJYYBQ [youtu.be]
What do you think?
Interesting. You can do something similar in Houdini by dragging parameters into the viewport and creating HUD sliders. Not as sophisticated but still pretty useful.
Cheers,
Rob
- rvinluan
- Staff
- 1283 posts
- Joined: July 2005
- Offline
Hello,
This is a bug that we're currently looking into.
Hmm. I don't think I'm seeing this.
Which widgets look weird? Can you attach a screenshot? Or post a script example?
This is fixed in the latest H14 daily builds.
Cheers,
Rob
Stalkerx777
- QFont not working.Can't change font size on widgets. setStyleSheet not working.
This is a bug that we're currently looking into.
Stalkerx777
- Colors of widgets look weird (problem with QStyle?)
Hmm. I don't think I'm seeing this.
Which widgets look weird? Can you attach a screenshot? Or post a script example?
Stalkerx777
- dropEvent for houdini operators doesn't work.
This is fixed in the latest H14 daily builds.
Cheers,
Rob
- Stalkerx777
- Member
- 183 posts
- Joined: Nov. 2008
- Offline
rvinluan
Hello,Stalkerx777
- Colors of widgets look weird (problem with QStyle?)
Hmm. I don't think I'm seeing this.
Which widgets look weird? Can you attach a screenshot? Or post a script example?
Rob
Hello Rob, please take a look at those screenshot and simple code example. Background color is wrong, also QTextEdit is black. And QGroupBox title is invisible:
from PySide.QtGui import *
class Grp(QGroupBox):
def __init__(self, n):
super(Grp, self).__init__()
self.setTitle(“Group_%d” % n)
vl = QVBoxLayout()
vl.addWidget(QPushButton(“Button_%d” % n))
vl.addWidget(QComboBox())
vl.addWidget(QTextEdit())
self.setLayout(vl)
def createInterface():
w = QWidget()
l = QGridLayout()
for i in range(2):
for j in range(2):
l.addWidget(Grp(i*2), i, j)
w.setLayout(l)
return w
Aleksei Rusev
Sr. Graphics Tools Engineer @ Nvidia
Sr. Graphics Tools Engineer @ Nvidia
- rvinluan
- Staff
- 1283 posts
- Joined: July 2005
- Offline
- tpetrick
- Staff
- 600 posts
- Joined: May 2014
- Offline
- Alexey Vanzhula
- Member
- 538 posts
- Joined: Dec. 2006
- Offline
- tpetrick
- Staff
- 600 posts
- Joined: May 2014
- Offline
Getting the Houdini stylesheet from the QApplication instance should be safe in both PySide and C++ code. We don't currently have a method for directly querying Houdini's style sheet directly. The stylesheet is generated at runtime based on the current colour settings and a base stylesheet.
If you're working in C++, you can also use QT_Utils::applyWidgetStyleSheets(QWidget*) to apply the Houdini style sheet to a QWidget. Note that this will overwrite any style sheets currently set on the QWidget.
If you're working in C++, you can also use QT_Utils::applyWidgetStyleSheets(QWidget*) to apply the Houdini style sheet to a QWidget. Note that this will overwrite any style sheets currently set on the QWidget.
- Alexey Vanzhula
- Member
- 538 posts
- Joined: Dec. 2006
- Offline
- rvinluan
- Staff
- 1283 posts
- Joined: July 2005
- Offline
vuxQApplication instance should be safe in both PySide and C++ codeQtGui.QApplication.instance().styleSheet() retrurn empty stringQT_Utils::applyWidgetStyleSheets(QWidget*)Can`t find this method
Whoops for both items.
I fixed the QtGui.QApplication.instance().styleSheet() problem so that should start working in tomorrow's H14 build (14.0.221).
Also looking in the HDK we don't expose the QT_Utils class which is probably a good thing. You should be able to access the app stylesheet similarly in C++ like so:
QApplication::instance()->styleSheet()
But like the Python version this function call will start working in tomorrow's H14 build.
Cheers,
Rob
- Alexey Vanzhula
- Member
- 538 posts
- Joined: Dec. 2006
- Offline
- Stalkerx777
- Member
- 183 posts
- Joined: Nov. 2008
- Offline
Hello Rob,
According to journals, drag&drop was fixed, but i can't get it to work in 220 build.
from PySide.QtGui import *
class My(QWidget):
def __init__(self):
super(My, self).__init__()
self.setAcceptDrops(True)
def dropEvent(self, event):
print event
urls = event.mimeData().urls()
file = urls.toLocalFile()
event.acceptProposedAction()
def wheelEvent(self, event):
print event.delta()
event.accept()
def createInterface():
return My()
Also problem with colors from my previous post, still exists.
Thanks for your effort and quick response, you guys doing amazing job!
Alexey.
According to journals, drag&drop was fixed, but i can't get it to work in 220 build.
from PySide.QtGui import *
class My(QWidget):
def __init__(self):
super(My, self).__init__()
self.setAcceptDrops(True)
def dropEvent(self, event):
print event
urls = event.mimeData().urls()
file = urls.toLocalFile()
event.acceptProposedAction()
def wheelEvent(self, event):
print event.delta()
event.accept()
def createInterface():
return My()
Also problem with colors from my previous post, still exists.
Thanks for your effort and quick response, you guys doing amazing job!
Alexey.
Aleksei Rusev
Sr. Graphics Tools Engineer @ Nvidia
Sr. Graphics Tools Engineer @ Nvidia
- tpetrick
- Staff
- 600 posts
- Joined: May 2014
- Offline
Alexey,
Can you try adding the following method to your Python Panel script:
def dragEnterEvent(self, event):
event.acceptProposedAction()
That block of code was needed to make the example work on my machine. Also, which platform are you currently using? I'm working through some drag and drop bugs on OS X so if you're on the platform drag and drop may not work as expected.
Can you try adding the following method to your Python Panel script:
def dragEnterEvent(self, event):
event.acceptProposedAction()
That block of code was needed to make the example work on my machine. Also, which platform are you currently using? I'm working through some drag and drop bugs on OS X so if you're on the platform drag and drop may not work as expected.
- Stalkerx777
- Member
- 183 posts
- Joined: Nov. 2008
- Offline
tpetrick
Alexey,
Can you try adding the following method to your Python Panel script:
def dragEnterEvent(self, event):
event.acceptProposedAction()
That block of code was needed to make the example work on my machine. Also, which platform are you currently using? I'm working through some drag and drop bugs on OS X so if you're on the platform drag and drop may not work as expected.
Yes, it works! Although there are some problems:
1. There are drop areas in python panel, where “Drop Actions” popup occurs (occasionally)
2. How one knows what was dropped(node, parm, text)? Currently, mimeType of any drops from houdini is ‘text-plain’
I'll submit #1 as a bug.
Cheers,
Alexey.
Aleksei Rusev
Sr. Graphics Tools Engineer @ Nvidia
Sr. Graphics Tools Engineer @ Nvidia
- Alexey Vanzhula
- Member
- 538 posts
- Joined: Dec. 2006
- Offline
Good fixes! I dont know how long we have to wait its form AutoD*** )))
I consider that we still need ability to find main widget from python.
I remind that at now i get it from top level widgets and test it by windowIconText() function. If it contains something then it is MainWidget
Not so elegant but it works
Anyway you give us good Qt implementation and in some cases it more robust than in Maya !!!
Thanx !!!
I consider that we still need ability to find main widget from python.
I remind that at now i get it from top level widgets and test it by windowIconText() function. If it contains something then it is MainWidget
Not so elegant but it works
Anyway you give us good Qt implementation and in some cases it more robust than in Maya !!!
Thanx !!!
- Alexey Vanzhula
- Member
- 538 posts
- Joined: Dec. 2006
- Offline
- Alexey Vanzhula
- Member
- 538 posts
- Joined: Dec. 2006
- Offline
I have bad news. In my case, linux x64 and any of H14 builds, i can`t get my custom eventFilter to work allways.
Bug submitted…
EDIT:
I saw that this BUG reproduces when i want to catch QtCore.QEvent.KeyRelease, but not with QtCore.QEvent.KeyPress
EDIT1:
I continue to consider this problem. The problem is with key events only.
It doesn`t works allways. But, for example, with QtCore.QEvent.MouseButtonPress it works well. And it doesn't matter if i installed filter to specific widget or to QApplication instance…
Bug submitted…
EDIT:
I saw that this BUG reproduces when i want to catch QtCore.QEvent.KeyRelease, but not with QtCore.QEvent.KeyPress
EDIT1:
I continue to consider this problem. The problem is with key events only.
It doesn`t works allways. But, for example, with QtCore.QEvent.MouseButtonPress it works well. And it doesn't matter if i installed filter to specific widget or to QApplication instance…
- Alexey Vanzhula
- Member
- 538 posts
- Joined: Dec. 2006
- Offline
-
- Quick Links