Difference PyQt4/PySide in "Tutorial : PyQt4 UI Development for maya by Justin Israel"

268 views
Skip to first unread message

Jean Noval

unread,
Apr 16, 2015, 11:28:52 AM4/16/15
to python_in...@googlegroups.com
Hello Justin Israel,

I'm watching your videos series "Tutorial : PyQt4 UI Development for maya" but I'm working with PySide rather than PyQt.
So I made so changes in your files as shown below :

#Difference between PyQt4 and PySide in maya

#Import differences
from PyQt4 import QtCore, QtGui
from PySide import QtCore, QtGui

import sip
import shiboken

#Difference between sip and shiboken
mainWin
= sip.wrapinstance(long(ptr), QtCore.QObject)
mainWin
= shiboken.wrapInstance(long(ptr), QtGui.QWidget)

name
= mui.MQtUtil.fullName(long(sip.unwrapinstance(win)))
name
= mui.MQtUtil.fullName(long(shiboken.getCppPointer(win)[0]))




In Chapter 06 you are showing channelBox.py
And when I show it with the showChannelBox() class method it works fine I have a empty UI with the same height and size,
But then, when I select an object I only see the object's name (top left)  and Visibility under it. I don't see the others attribute.

Do you why the UI is not diplaying correctly ?

Jean Noval

unread,
Apr 16, 2015, 11:34:37 AM4/16/15
to python_in...@googlegroups.com

I made some screenshots, UI with selection, then UI without selection :

Justin Israel

unread,
Apr 16, 2015, 6:41:22 PM4/16/15
to python_in...@googlegroups.com

Hi

That's a good question. I can try and look into this tonight, unless someone else beats me to it :-)


Justin




On Fri, 17 Apr 2015 3:34 AM Jean Noval <jean...@gmail.com> wrote:

I made some screenshots, UI with selection, then UI without selection :

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/1553ad8a-9512-4951-9738-2b478c83eb68%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jean Noval

unread,
Apr 17, 2015, 3:54:46 AM4/17/15
to python_in...@googlegroups.com
Thanks Justin, I am looking forward to your response !
By the way I'm using Maya 2014

Justin Israel

unread,
Apr 17, 2015, 5:58:30 PM4/17/15
to python_in...@googlegroups.com
Hey there,

I found the reason it was showing up strangely under PySide. It is because the code was using a now deprecated method, on QTableWidgetItem. In the "showAttributes()" method, you need to change this line:
item.setBackgroundColor(QtGui.QColor(40,40,40))
to
item.setBackground(QtGui.QBrush(QtGui.QColor(40,40,40)))
It was still valid in PyQt4, but in PySide has been changed. For me, I got a warning printing out in the Script Editor. Basically the loop would crash while setting up the attributes, so you ended up with a partially constructed channel box.

Justin



On Fri, Apr 17, 2015 at 7:54 PM Jean Noval <jean...@gmail.com> wrote:
Thanks Justin, I am looking forward to your response !
By the way I'm using Maya 2014

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.

Panupat Chongstitwattana

unread,
Apr 17, 2015, 10:36:03 PM4/17/15
to python_in...@googlegroups.com
Hi

How do you make a code block Justin?

I would like to throw in what I found updating my script to PySide in the flowlayout. The example that comes with PySide itself was using some deprecated method too. The setMargin

if parent is not None:
self.setMargin(margin)

The new one is setContentsMargins which takes 4 arguments for margin of each side. Just my quick silly fix.

if parent is not None:
self.setContentsMargins(margin, margin, margin, margin)

the margin() method is deprecated too, so need to change this.

2 * self.margin()
to this
2 * self.getContentsMargins()[0]

Justin Israel

unread,
Apr 18, 2015, 12:37:39 AM4/18/15
to python_in...@googlegroups.com
On Sat, Apr 18, 2015 at 2:36 PM Panupat Chongstitwattana <panu...@gmail.com> wrote:
Hi

How do you make a code block Justin?

You mean the email-formatted code blocks? A few of us are using that Markdown-Here browser plugin:

You just mark up a block with 

```[optional lang]  
code code code
```

And hit the button :-)

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.

Panupat Chongstitwattana

unread,
Apr 18, 2015, 12:46:52 AM4/18/15
to python_in...@googlegroups.com
Awesome thank you :D Going to play with that now.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.

Jean Noval

unread,
Apr 18, 2015, 6:45:35 AM4/18/15
to python_in...@googlegroups.com
Thanks for the answer !

Is there a list with the differences between PyQt4 PySide somewhere on the internet ?

I'm still learning PySide so it could be useful for me.

Justin Israel

unread,
Apr 18, 2015, 3:37:38 PM4/18/15
to python_in...@googlegroups.com

http://pyqt.sourceforge.net/Docs/PyQt4/new_style_signals_slots.html

https://wiki.qt.io/Differences_Between_PySide_and_PyQt

This specific case was more of it being a now deprecated function used back when it wasn't deprecated.


--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/94e6f160-356b-438a-aab0-7c760cd36b27%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages