Thanks again - all is good now :-)

I have one further question, is there an elegant way to load a widget from
a UI file which you can then inherit from ?

as in:
class NewUI(uiwidget_base, uiwidget_form):
def __init__(self):
        super(NewUI, self).__init__(parent)
        self.setupUi(self)
etc.

this is what I came up with, just tested with maya2015, maya2016..
http://pastebin.com/F10CXjBu

(I do know there is QtCompat.load_ui() but I needed this functionality as
well)

seb



On Thu, Feb 2, 2017 at 4:44 AM, Marcus Ottosson <[email protected]>
wrote:

> Seconded.
>
> SIGNAL and SLOT are excluded from Qt.py as are pre-4.8 functionality.
> Better stick to the 5.0+ syntax.
>
> On 1 Feb 2017 16:51, "Justin Israel" <[email protected]> wrote:
>
>>
>>
>> On Wed, Feb 1, 2017, 10:40 PM Sebastian Schoellhammer <
>> [email protected]> wrote:
>>
>>> I set up a simple test script:
>>> http://pastebin.com/i8GJLNaY
>>>
>>> In the end this notation seemed to work for me again:
>>> *pb.clicked.connect(self.browse)*
>>>
>>> So is that the correct way?
>>>
>>
>> Wow. It didn't occur to me in your first mail, without a code example,
>> that pbBrowse was a widget and not a signal instance. This new working
>> approach is exactly what I would expect to work and would use in my own
>> approach. This is the new style signal slot connection where the signal is
>> a first class object that provides connect and disconnect methods straight
>> to callables
>>
>> Glad you got it sorted.
>>
>>
>>>
>>>
>>>
>>> On Wed, Feb 1, 2017 at 10:14 AM, Sebastian Schoellhammer <
>>> [email protected]> wrote:
>>>
>>> Hi Justin,
>>>
>>> thanks for the reply but both methods you suggest don't work for me:
>>>
>>>
>>> *self.connect(self.pbBrowse, QtCore.Signal("clicked()"), self,
>>> QtCore.Slot("browse()"))*
>>>
>>> # Error: TypeError: file D:\Tech-Art\Core\Python\Qt\wgWidgets.py line
>>> 285: 'PySide2.QtCore.QObject.connect' called with wrong argument types:
>>>   PySide2.QtCore.QObject.connect(PySide2.QtWidgets.QPushButton,
>>> PySide2.QtCore.Signal, LineEditPath, PySide2.QtCore.Slot)
>>> Supported signatures:
>>>   PySide2.QtCore.QObject.connect(PySide2.QtCore.QObject, str, callable,
>>> PySide2.QtCore.Qt.ConnectionType = Qt.AutoConnection)
>>>   PySide2.QtCore.QObject.connect(PySide2.QtCore.QObject,
>>> PySide2.QtCore.QMetaMethod, PySide2.QtCore.QObject,
>>> PySide2.QtCore.QMetaMethod, PySide2.QtCore.Qt.ConnectionType =
>>> Qt.AutoConnection)
>>>   PySide2.QtCore.QObject.connect(PySide2.QtCore.QObject, str,
>>> PySide2.QtCore.QObject, str, PySide2.QtCore.Qt.ConnectionType =
>>> Qt.AutoConnection)
>>>   PySide2.QtCore.QObject.connect(PySide2.QtCore.QObject, str, str,
>>> PySide2.QtCore.Qt.ConnectionType = Qt.AutoConnection)
>>>   PySide2.QtCore.QObject.connect(str, callable,
>>> PySide2.QtCore.Qt.ConnectionType = Qt.AutoConnection)
>>>   PySide2.QtCore.QObject.connect(str, PySide2.QtCore.QObject, str,
>>> PySide2.QtCore.Qt.ConnectionType = Qt.AutoConnection) #
>>>
>>>
>>> *self.connect(self.pbBrowse, QtCore.Signal("clicked()"), self.browse)*
>>>
>>> # Error: TypeError: file D:\Tech-Art\Core\Python\Qt\wgWidgets.py line
>>> 284: 'PySide2.QtCore.QObject.connect' called with wrong argument types:
>>>   PySide2.QtCore.QObject.connect(PySide2.QtWidgets.QPushButton,
>>> PySide2.QtCore.Signal, instancemethod)
>>> Supported signatures:
>>>   PySide2.QtCore.QObject.connect(PySide2.QtCore.QObject, str, callable,
>>> PySide2.QtCore.Qt.ConnectionType = Qt.AutoConnection)
>>>   PySide2.QtCore.QObject.connect(PySide2.QtCore.QObject,
>>> PySide2.QtCore.QMetaMethod, PySide2.QtCore.QObject,
>>> PySide2.QtCore.QMetaMethod, PySide2.QtCore.Qt.ConnectionType =
>>> Qt.AutoConnection)
>>>   PySide2.QtCore.QObject.connect(PySide2.QtCore.QObject, str,
>>> PySide2.QtCore.QObject, str, PySide2.QtCore.Qt.ConnectionType =
>>> Qt.AutoConnection)
>>>   PySide2.QtCore.QObject.connect(PySide2.QtCore.QObject, str, str,
>>> PySide2.QtCore.Qt.ConnectionType = Qt.AutoConnection)
>>>   PySide2.QtCore.QObject.connect(str, callable,
>>> PySide2.QtCore.Qt.ConnectionType = Qt.AutoConnection)
>>>   PySide2.QtCore.QObject.connect(str, PySide2.QtCore.QObject, str,
>>> PySide2.QtCore.Qt.ConnectionType = Qt.AutoConnection) #
>>>
>>>
>>> If Id do:
>>> self.connect(self.pbBrowse, QtCore.Signal("clicked()"), self.browse*()*)
>>>
>>> it runs but browse() is called right at this point....
>>>
>>> Sorry, very confused :/
>>>
>>> Thanks for any more pointers,
>>>
>>> seb
>>>
>>>
>>> On Tue, Jan 31, 2017 at 7:30 PM, Justin Israel <[email protected]>
>>> wrote:
>>>
>>>
>>>
>>> On Wed, Feb 1, 2017, 1:38 AM Sebastian Schoellhammer <
>>> [email protected]> wrote:
>>>
>>>
>>> Something I had used before all before Qt.py:
>>> self.connect(self.pbBrowse, QtCore.SIGNAL("clicked()"),
>>> QtCore.SLOT(self.browse))
>>> doesn't work because QtCore doesn't contain SIGNAL
>>>
>>> however when I try:
>>> self.connect(self.pbBrowse, QtCore.Signal("clicked()"),
>>> QtCore.Slot(self.browse))
>>> I get this error:
>>> # Error: TypeError: file D:\Tech-Art\Core\Python\Qt\wgWidgets.py line
>>> 280: Unknown signal argument type: instancemethod #
>>>
>>>
>>> That's the old signal slot connection style, which maps to the way you
>>> do it in C++
>>>
>>> http://pyqt.sourceforge.net/Docs/PyQt4/old_style_signals_slots.html
>>>
>>> There are a number of different signatures for calling it but this looks
>>> like you are using it wrong. Either you want to pass the slot method as the
>>> method itself without wrapping it in a Slot() call, or you want to pass the
>>> receiver class (self) and then the slot name :
>>>
>>> self.connect(self.pbBrowse, QtCore.Signal("clicked()"), self,
>>> QtCore.Slot("browse()"))
>>>
>>> Or
>>>
>>> self.connect(self.pbBrowse, QtCore.Signal("clicked()"), self.browse)
>>>
>>>
>>>
>>>
>>>
>>> On Wed, Jan 25, 2017 at 3:28 PM, Marcus Ottosson <[email protected]
>>> > wrote:
>>>
>>> Qt.py and safety
>>>
>>> Hi community,
>>>
>>> Today we’ve made a significant leap forwards for Qt.py and implemented a
>>> guarantee where if your program runs with Qt.py and any binding, such as
>>> PySide2, it will run in an identical fashion on any binding.
>>>
>>> This means that it will throw an error if you use any feature of any
>>> particular binding that isn’t available on another binding.
>>>
>>>
>>> What’s changed?
>>>
>>> This is possible with the current iteration of Qt.py.
>>>
>>> 1: from Qt import QtGui, QtCore2: 3: class Widget(QtGui.QWidget):4:   
>>> my_signal = QtCore.pyqtSignal(str)
>>>
>>>
>>>    - On the third line, we run into an immediate problem; QWidget is
>>>    only available via QtGui in PyQt4 and PySide(1).
>>>    - On the 4th line, we refer to a signal as pyqtSignal which would
>>>    work well on both PyQt4 and PyQt5, but fail in PySide and PySide2.
>>>    - Worst yet, these problems would not make themselves known until
>>>    you run it on each of the 4 bindings and make sure, first hand that it
>>>    works as you’d expect.
>>>
>>> With this new change, Qt.py limits the available members of each
>>> submodule into a subset of members that exist across all bindings. The
>>> result is finding out about these problems faster and being able to
>>> guarantee that if it runs on one binding, it works on all.
>>>
>>> 1: from Qt import QtGui2: 3: class Widget(QtGui.QWidget):4:   pass5:
>>> Traceback (most recent call last):
>>>   File "<stdin>", line 1, in <module>
>>> AttributeError: 'module' object has no attribute 'QWidget'
>>>
>>>
>>> It’s a breaking change
>>>
>>> As it is a breaking change, this bumps Qt.py from a 0.x.x release into a
>>> 1.x.x. This means some of your already-written software with Qt.py may need
>>> some tweaking. On the up-side, the software that would behave badly now,
>>> are those that would have already behaved badly in any of the 4 bindings.
>>> So this is your chance to smoke some of that out.
>>>
>>> We are confident in this change and direction, but are still in
>>> discussion about whether now is the right time. One of the bindings, namely
>>> PySide2, is so far behind the other bindings that it the weakest link by
>>> far, and critical submodules - such as QtOpenGL - is still missing.
>>>
>>> These are the modules supported by Qt.py with this change.
>>>
>>> __all__ = [
>>>     "QtGui",
>>>     "QtCore",
>>>     "QtWidgets",
>>>     "QtNetwork",
>>>     "QtXml",
>>>     "QtHelp",
>>>     "QtCompat"
>>> ]
>>>
>>> The second concern regards which version of this weakest link to match.
>>> As PySide2 matures, more feature will be added and Qt.py could start to
>>> grow. But Maya 2017 and others are currently fixed at version 2.0.0.
>>> Growing Qt.py beyond what Maya 2017 is capable of would limit its
>>> usefulness.
>>>
>>> For this I figure it wouldn’t be too cumbersome to implement
>>> compatibility profiles; where the end-user specifies which version of, say,
>>> the VFX Platform to provide support for.
>>>
>>> $ # For example
>>> $ export QT_BASELINE=CY2018
>>> $ python -c "from Qt import QtOpenGL"
>>>
>>>
>>> Bridging the bindings
>>>
>>> For the time being, and where you need functionality exclusive to any
>>> particular binding, such as sip in PyQt, there is still the __binding__
>>> member that allows conditional inclusion.
>>>
>>> if "PySide" in __binding__:
>>>   do_pyside_stuff()
>>>
>>> This would allow you to explicitly mark the parts of your codebase that
>>> depend on any particular binding, and to enable a bridge to your code today
>>> and your code sometime in the future when the required functionality is
>>> officially part of Qt.py.
>>>
>>>
>>> Guinea pigs unite!
>>>
>>> For now, we’d appreciate your feedback on this major change and for you
>>> to test it out for yourself. The release is still considered “alpha” and is
>>> available directly via GitHub for download or install.
>>>
>>> $ pip install git+git://github.com/mottosso/Qt.py
>>>
>>>
>>>    - Source <https://github.com/mottosso/Qt.py/blob/master/Qt.py>
>>>    - Pull request <https://github.com/mottosso/Qt.py/pull/173>
>>>    - Issue <https://github.com/mottosso/Qt.py/issues/152>
>>>
>>> Thanks to Matthew Levine for the initial feature request
>>> <https://github.com/mottosso/Qt.py/issues/152> and Fredrik Averpil for
>>> the unwavering support. :)
>>>
>>> Best,
>>> Marcus
>>> ​
>>>
>>> --
>>> 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 [email protected].
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/python_inside_maya/CAFRtmODFjo%2BzMcM0OzmnDxJ2BeTNZ%2BjN
>>> HPQVKtJoEv-w7PT%3D%2BQ%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/python_inside_maya/CAFRtmODFjo%2BzMcM0OzmnDxJ2BeTNZ%2BjNHPQVKtJoEv-w7PT%3D%2BQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>>
>>>
>>>
>>> --
>>> Sebastian Schoellhammer
>>>
>>> www.sebscorner.org
>>>
>>> --
>>> 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 [email protected].
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/python_inside_maya/CAMLepcbyCV4wdGkKVMW62dy4%3DdUJkX%
>>> 2BfnvR3ToeTGAmDW2NzvQ%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/python_inside_maya/CAMLepcbyCV4wdGkKVMW62dy4%3DdUJkX%2BfnvR3ToeTGAmDW2NzvQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>> --
>>> 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 [email protected].
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/python_inside_maya/CAPGFgA0v8HxvzVhZj2VkbgeQw%2BapGunHfZ
>>> 1G0OAc7_WSvTR%2B3Q%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0v8HxvzVhZj2VkbgeQw%2BapGunHfZ1G0OAc7_WSvTR%2B3Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>>
>>>
>>>
>>> --
>>> Sebastian Schoellhammer
>>>
>>> www.sebscorner.org
>>>
>>>
>>>
>>>
>>> --
>>> Sebastian Schoellhammer
>>>
>>> www.sebscorner.org
>>>
>>> --
>>> 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 [email protected].
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/python_inside_maya/CAMLepcbpjTTfG15yrDANXztugiqHx3OOcXL3
>>> S4p1Rq1rmqmK6g%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/python_inside_maya/CAMLepcbpjTTfG15yrDANXztugiqHx3OOcXL3S4p1Rq1rmqmK6g%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>> 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 [email protected].
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/python_inside_maya/CAPGFgA0j2ONAcLYjqGWfu1W6YjcoRBt%
>> 3DuC%2BfbXKyhB7sagws_A%40mail.gmail.com
>> <https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0j2ONAcLYjqGWfu1W6YjcoRBt%3DuC%2BfbXKyhB7sagws_A%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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 [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/python_inside_maya/CAFRtmOC%3DwoNXOqJRH-
> h3XuYEVYJrXhs38JgSGLeueu0sriUFxA%40mail.gmail.com
> <https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOC%3DwoNXOqJRH-h3XuYEVYJrXhs38JgSGLeueu0sriUFxA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Sebastian Schoellhammer

www.sebscorner.org

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAMLepcaxezMvYUZ0HXPdjzY_KMO_U_hD7FGPQQ7O8SiCFnZ8PQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to