[Maya-Python] Qt.py - Write Qt for all bindings at once

48 views
Skip to first unread message

Marcus Ottosson

unread,
May 31, 2016, 4:36:31 PM5/31/16
to python_in...@googlegroups.com

Me and Fredrik Averpil wrote this for our GUIs and figured we’d make it general enough for most things.

Let me know what you think.

Example

$ pip install Qt.py
$ python
>>> import sys
>>> from Qt import QtWidgets
>>> app = QtWidgets.QApplication(sys.argv)
>>> button = QtWidgets.QPushButton("Hello World")
>>> button.show()
>>> app.exec_()

Example project

--
Marcus Ottosson
konstr...@gmail.com

Justin Israel

unread,
May 31, 2016, 5:19:44 PM5/31/16
to python_in...@googlegroups.com
Nice work guys!

--
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/CAFRtmOANqQ2MZiQdXGea7jmhCKK5Y%2BvTUwxuvKhMFc%2B99VR8sA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Tony Barbieri

unread,
May 31, 2016, 5:31:29 PM5/31/16
to python_in...@googlegroups.com
Yes, thank you for sharing!


For more options, visit https://groups.google.com/d/optout.



--
Tony

Justin Israel

unread,
May 31, 2016, 5:38:25 PM5/31/16
to python_in...@googlegroups.com
I just thought of something... Do you think the helper library should try and set the sip api to v2 for PyQt4, if it can? Otherwise it still wouldn't be seemless with PySide (QString, QVariant). There are circumstances I have encountered where it can't force the sip version. Specifically Maya being one of those... where someone elses library may have been imported before yours and forced it to v1.



Fredrik Averpil

unread,
May 31, 2016, 6:36:07 PM5/31/16
to python_in...@googlegroups.com

Do you think the helper library should try and set the sip api to v2 for PyQt4, if it can?

Justin, by sip API v2, do you mean this?

import sip
sip.setapi('QString', 2)

Cheers,
Fredrik

Fredrik Averpil

unread,
May 31, 2016, 6:40:57 PM5/31/16
to python_in...@googlegroups.com

That was sent prematurely…

I meant to ask if it was enough to set API to v2 only for QString and QVariant, or if all of these should be set to v2:

import sip
sip.setapi(u'QDate', 2)
sip.setapi(u'QDateTime', 2)
sip.setapi(u'QString', 2)
sip.setapi(u'QTextStream', 2)
sip.setapi(u'QTime', 2)
sip.setapi(u'QUrl', 2)
sip.setapi(u'QVariant', 2)

// Fredrik

Justin Israel

unread,
May 31, 2016, 7:23:53 PM5/31/16
to python_in...@googlegroups.com
I've really only ever set the QString and QVariant ones, and have't hit the others ones, in practice. I have a less robust version of what your Qt helper is doing, at work, which just tries to resolve importing PyQt4 vs PySide. And if it ends up being PyQt4, I also *try* to set the sip api, but it can't always succeed.
 

--
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.

Fredrik Averpil

unread,
Jun 1, 2016, 12:41:17 AM6/1/16
to python_in...@googlegroups.com
Justin, would you mind creating a feature request (as an issue) in the repo?

That way, we can move the discussion there and you can try things out and provide feedback.

// Fredrik

Justin Israel

unread,
Jun 1, 2016, 2:07:21 AM6/1/16
to python_in...@googlegroups.com

--
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.
Reply all
Reply to author
Forward
0 new messages