<div dir="ltr"><div class="markdown-here-wrapper" style=""><p style="margin:1.2em 0px!important">I didn’t see how it applied to this situation, but now I see.</p>
<p style="margin:1.2em 0px!important">Changed from this..</p>
<pre style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px"><code class="hljs language-python" style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline;white-space:pre;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block!important;display:block;overflow-x:auto;padding:0.5em;color:rgb(51,51,51);background:rgb(248,248,248)"><span class="hljs-class"><span class="hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">class</span> <span class="hljs-title" style="color:rgb(153,0,0);font-weight:bold;color:rgb(68,85,136);font-weight:bold">PropertyType</span><span class="hljs-params">(QtCore.pyqtWrapperType)</span>:</span>
</code></pre>
<p style="margin:1.2em 0px!important">To this..</p>
<pre style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px"><code class="hljs language-python" style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline;white-space:pre;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block!important;display:block;overflow-x:auto;padding:0.5em;color:rgb(51,51,51);background:rgb(248,248,248)"><span class="hljs-class"><span class="hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">class</span> <span class="hljs-title" style="color:rgb(153,0,0);font-weight:bold;color:rgb(68,85,136);font-weight:bold">PropertyType</span><span class="hljs-params">(type<span class="hljs-params">(QtCore.QObject)</span>)</span>:</span>
</code></pre>
<p style="margin:1.2em 0px!important">And it worked.</p>
<p style="margin:1.2em 0px!important">Thanks Phil!</p>
<div title="MDH:PGRpdj5JIGRpZG4ndCBzZWUgaG93IGl0IGFwcGxpZWQgdG8gdGhpcyBzaXR1YXRpb24sIGJ1dCBu
b3cgSSBzZWUuPC9kaXY+PGRpdj48YnI+PC9kaXY+Q2hhbmdlZCBmcm9tIHRoaXMuLjxkaXY+PGJy
PjwvZGl2PjxkaXY+PGRpdj5gYGBweXRob248L2Rpdj48ZGl2PmNsYXNzIFByb3BlcnR5VHlwZShR
dENvcmUucHlxdFdyYXBwZXJUeXBlKTo8L2Rpdj48ZGl2PmBgYDwvZGl2PjwvZGl2PjxkaXY+PGJy
PjwvZGl2PjxkaXY+VG8gdGhpcy4uPC9kaXY+PGRpdj48YnI+PC9kaXY+PGRpdj5gYGBweXRob248
L2Rpdj48ZGl2PjxkaXY+Y2xhc3MgUHJvcGVydHlUeXBlKHR5cGUoUXRDb3JlLlFPYmplY3QpKTo8
L2Rpdj48L2Rpdj48ZGl2PmBgYDwvZGl2PjxkaXY+PGJyPjwvZGl2PjxkaXY+QW5kIGl0IHdvcmtl
ZC48L2Rpdj48ZGl2Pjxicj48L2Rpdj48ZGl2PlRoYW5rcyBQaGlsITwvZGl2Pg==" style="height:0;width:0;max-height:0;max-width:0;overflow:hidden;font-size:0em;padding:0;margin:0">​</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 9 February 2017 at 14:17, Phil Thompson <span dir="ltr"><<a href="mailto:phil@riverbankcomputing.com" target="_blank">phil@riverbankcomputing.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 9 Feb 2017, at 1:58 pm, Marcus Ottosson <<a href="mailto:konstruktion@gmail.com">konstruktion@gmail.com</a>> wrote:<br>
><br>
> Hi Phil,<br>
><br>
> Do you have any recommendations for alternatives to pyqtWrapperType when it comes to metaclasses? I was using it to dynamically add signals to a QObject.<br>
><br>
> class PropertyType(QtCore.<wbr>pyqtWrapperType):<br>
><br>
><br>
> """Metaclass for converting class attributes into pyqtProperties"""<br>
><br>
><br>
>     prefix =<br>
> "__pyqtproperty__"<br>
><br>
><br>
><br>
> def __new__(cls, name, bases, attrs):<br>
><br>
><br>
> """Convert class properties into pyqtProperties"""<br>
><br>
><br>
><br>
> for key, value in<br>
>  attrs.copy().items():<br>
><br>
> if key.startswith("__"<br>
> ):<br>
><br>
> continue<br>
><br>
><br>
>             notify = QtCore.pyqtSignal()<br>
><br>
><br>
> def set_data(key, value):<br>
><br>
><br>
> def set_data(self, value):<br>
><br>
>                     setattr(self, cls.prefix + key, value)<br>
>                     getattr(self, key +<br>
> "Changed"<br>
> ).emit()<br>
>                     self.__datachanged__.emit(<wbr>self)<br>
><br>
> return<br>
>  set_data<br>
><br>
>             attrs[key +<br>
> "Changed"<br>
> ] = notify<br>
>             attrs[key] = QtCore.pyqtProperty(<br>
>                 type(value)<br>
> if value is not None else<br>
>  QtCore.QVariant,<br>
>                 fget=<br>
> lambda self, k=key: getattr(self, cls.prefix + k, None<br>
> ),<br>
>                 fset=set_data(key, value),<br>
>                 notify=notify)<br>
><br>
><br>
> return<br>
>  super(PropertyType, cls).__new__(cls, name, bases, attrs)<br>
><br>
><br>
> class AbstractItem(QtCore.QObject):<br>
><br>
>     __metaclass__ = PropertyType<br>
>     __datachanged__ = QtCore.pyqtSignal(QtCore.<wbr>QObject)<br>
><br>
><br>
> def __str__(self):<br>
><br>
><br>
> return <a href="http://self.name" rel="noreferrer" target="_blank">self.name</a><br>
><br>
><br>
><br>
> def __repr__(self):<br>
><br>
><br>
> return "%s.%s(%r)"<br>
>  % (__name__, type(self).__name__, self.__str__())<br>
><br>
> Using type in place of pyqtWrapperType results in a:<br>
><br>
> TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases<br>
><br>
> Production code here.<br>
><br>
> Any ideas?<br>
><br>
> Thanks.<br>
<br>
</div></div>Have you tried doing what I suggest below?<br>
<span class="HOEnZb"><font color="#888888"><br>
Phil<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
> On 18 January 2017 at 22:17, Phil Thompson <<a href="mailto:phil@riverbankcomputing.com">phil@riverbankcomputing.com</a>> wrote:<br>
> On 18 Jan 2017, at 6:51 pm, Cody Scott <<a href="mailto:cody@perspexis.com">cody@perspexis.com</a>> wrote:<br>
> ><br>
> > I'm looking at this code for inspiration on testing QML and I ran into this error.<br>
> ><br>
> > <a href="https://github.com/pyblish/pyblish-qml/blob/635c82d75fa5d5e294339bf8265f05eb5ca3b5d3/pyblish_qml/models.py#L94" rel="noreferrer" target="_blank">https://github.com/pyblish/<wbr>pyblish-qml/blob/<wbr>635c82d75fa5d5e294339bf8265f05<wbr>eb5ca3b5d3/pyblish_qml/models.<wbr>py#L94</a><br>
> ><br>
> > AttributeError: module 'PyQt5.QtCore' has no attribute 'pyqtWrapperType'<br>
> ><br>
> > It doesn't appear to be available in PyQt5==5.7.1<br>
> ><br>
> > It is available in PyQt5==5.6<br>
><br>
> It was an undocumented implementation detail that was removed as part of the adoption of the limited API.<br>
><br>
> If code wants to get the meta-type used by PyQt then it should call type() on a PyQt type object.<br>
><br>
> Phil<br>
<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><font size="1"><b>Marcus Ottosson</b><br><a href="mailto:konstruktion@gmail.com" target="_blank">konstruktion@gmail.com</a></font><font size="1"><br></font></div></div>
</div>