Re: [PyQt] Next PyQt5 and SIP Releases

2013-08-22 Thread Dmitry Shachnev
On Mon, Aug 19, 2013 at 4:54 PM, John Donovan j...@geospark.co.uk wrote:
 It seems that the two glob searches in generate_plugin_makefile()
 (line 1180) look for libpython like this:
 /usr/lib/libpython3.3*

 Whereas on the Pi, libpython lives here:
 /usr/lib/arm-linux-gnueabihf/

This patch solves the problem here: http://paste.debian.net/28414/

MULTIARCH config var is available in Python 2.7.4+ and 3.3.1+
according to https://wiki.debian.org/Python/MultiArch#Python_code.

--
Dmitry Shachnev
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] (no subject)

2013-08-07 Thread Dmitry Shachnev

On Mon, 29 Jul 2013 22:36:17 +0100, Roger Leigh wrote:
 I've just started experimenting with Python 3.3/Qt 5.1/PyQt 5.0 on
 Debian (unstable, amd64).

 With the following trivial program, I can reproducibly observe a
 segfault when the window is closed:

Phil, any chance you can reply to this? I can reproduce this with most
of the examples (on Debian i386). It happens 1 time of ~5 for me.

--
Dmitry Shachnev


signature.asc
Description: OpenPGP digital signature
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Compiling PyQt5 on a Raspberry Pi

2013-08-05 Thread Dmitry Shachnev

This is not specific to Raspbian, but happens on all systems
where qreal == float (i.e. all ARM systems). This particular
issue happens because in qbrush.sip we have:

  typedef QVectorQPairdouble, QColor QGradientStops;

while in Qt 5.1 qreal is used instead of double:

  typedef QPairqreal, QColor QGradientStop;
  typedef QVectorQGradientStop QGradientStops;

However, this is not the only issue that makes the build fail.
In Debian, we have a patch that fixes more issues. We haven't
yet finished updating it for PyQt5, so it doesn't fully solve
the problem (any help in finalizing it is appreciated). I have
attached the current version of that patch.

--
Dmitry Shachnev
## 03_qreal_float_support.dpatch by Michael Casadevall sonicmcta...@gmail.com
--- a/configure.py
+++ b/configure.py
@@ -406,8 +406,9 @@
 out  PyQt_NoOpenGLES\\n;
 #endif
 
-if (sizeof (qreal) != sizeof (double))
+#if defined(QT_NO_FPU) || defined(QT_ARCH_ARM) || defined(QT_ARCH_WINDOWSCE)
 out  PyQt_qreal_double\\n;
+#endif
 
 return 0;
 }
--- a/sip/QtCore/qlist.sip
+++ b/sip/QtCore/qlist.sip
@@ -798,3 +798,222 @@
 return sipGetState(sipTransferObj);
 %End
 };
+
+// If we're on an architecture where qreal != double, then we need to also
+// explicately handle doubles. On architectures where qreal == double, they
+// will automaticially be cast upwards
+
+%If (!PyQt_qreal_double)
+
+// QListQPairdouble, double  is implemented as a Python list of 2-element tuples.
+%MappedType QListQPairdouble, double 
+{
+%TypeHeaderCode
+#include qlist.h
+#include qpair.h
+%End
+
+%ConvertFromTypeCode
+// Create the list.
+PyObject *l;
+
+if ((l = PyList_New(sipCpp-size())) == NULL)
+return NULL;
+
+// Set the list elements.
+for (int i = 0; i  sipCpp-size(); ++i)
+{
+const QPairdouble, double p = sipCpp-at(i);
+PyObject *pobj;
+
+if ((pobj = Py_BuildValue((char *)dd, p.first, p.second)) == NULL)
+{
+Py_DECREF(l);
+
+return NULL;
+}
+
+PyList_SET_ITEM(l, i, pobj);
+}
+
+return l;
+%End
+
+%ConvertToTypeCode
+SIP_SSIZE_T len;
+
+// Check the type if that is all that is required.
+if (sipIsErr == NULL)
+{
+if (!PySequence_Check(sipPy) || (len = PySequence_Size(sipPy))  0)
+return 0;
+
+for (SIP_SSIZE_T i = 0; i  len; ++i)
+{
+PyObject *tup = PySequence_ITEM(sipPy, i);
+
+if (!PySequence_Check(tup) || PySequence_Size(tup) != 2)
+return 0;
+}
+
+return 1;
+}
+
+QListQPairdouble, double  *ql = new QListQPairdouble, double ;
+len = PySequence_Size(sipPy);
+
+for (SIP_SSIZE_T i = 0; i  len; ++i)
+{
+PyObject *tup = PySequence_ITEM(sipPy, i);
+
+double first = PyFloat_AsDouble(PySequence_ITEM(tup, 0));
+double second = PyFloat_AsDouble(PySequence_ITEM(tup, 1));
+
+ql-append(QPairdouble, double(first, second));
+}
+
+*sipCppPtr = ql;
+
+return sipGetState(sipTransferObj);
+%End
+};
+// QListQPairdouble, TYPE  is implemented as a Python list of 2-element tuples.
+templatedouble, TYPE
+%MappedType QListQPairdouble, TYPE 
+{
+%TypeHeaderCode
+#include qlist.h
+#include qpair.h
+%End
+
+%ConvertFromTypeCode
+// Create the list.
+PyObject *l;
+
+if ((l = PyList_New(sipCpp-size())) == NULL)
+return NULL;
+
+// Set the list elements.
+for (int i = 0; i  sipCpp-size(); ++i)
+{
+const QPairdouble, TYPE p = sipCpp-at(i);
+TYPE *t = new TYPE(p.second);
+PyObject *pobj;
+
+if ((pobj = sipBuildResult(NULL, (dB), p.first, t, sipClass_TYPE, sipTransferObj)) == NULL)
+{
+Py_DECREF(l);
+delete t;
+
+return NULL;
+}
+
+PyList_SET_ITEM(l, i, pobj);
+}
+
+return l;
+%End
+
+%ConvertToTypeCode
+SIP_SSIZE_T len;
+
+// Check the type if that is all that is required.
+if (sipIsErr == NULL)
+{
+if (!PySequence_Check(sipPy) || (len = PySequence_Size(sipPy))  0)
+return 0;
+
+for (SIP_SSIZE_T i = 0; i  len; ++i)
+{
+PyObject *tup = PySequence_ITEM(sipPy, i);
+
+if (!PySequence_Check(tup) || PySequence_Size(tup) != 2)
+return 0;
+
+if (!sipCanConvertToInstance(PySequence_ITEM(tup, 1), sipClass_TYPE, SIP_NOT_NONE))
+return 0;
+}
+
+return 1;
+}
+
+QListQPairdouble, TYPE  *ql = new QListQPairdouble, TYPE ;
+len = PySequence_Size(sipPy);
+
+for (SIP_SSIZE_T i = 0; i  len; ++i)
+{
+PyObject *tup = PySequence_ITEM(sipPy, i);
+double d;
+int state;
+
+d = PyFloat_AsDouble(PySequence_ITEM(tup, 0));
+TYPE *t = reinterpret_castTYPE *(sipConvertToInstance(PySequence_ITEM(tup, 1), sipClass_TYPE, sipTransferObj, SIP_NOT_NONE, state, sipIsErr));
+
+if (*sipIsErr

[PyQt] Broken examples in PyQt5

2013-07-25 Thread Dmitry Shachnev

Two examples, namely mainwindows/menus.py and mainwindows/separations.py,
fail with AttributeError here (using PyQt 5.0 and Qt 5.0.2):

Traceback (most recent call last):
  File ./mainwindows/menus.py, line 284, in module
window = MainWindow()
  File ./mainwindows/menus.py, line 71, in __init__
vbox.setMargin(5)
AttributeError: 'QVBoxLayout' object has no attribute 'setMargin'

Traceback (most recent call last):
  File ./mainwindows/separations.py, line 484, in module
window = Viewer()
  File ./mainwindows/separations.py, line 272, in __init__
self.setCentralWidget(self.createCentralWidget())
  File ./mainwindows/separations.py, line 330, in createCentralWidget
grid.setMargin(4)
AttributeError: 'QGridLayout' object has no attribute 'setMargin'

Other examples I tested work fine. Is this a PyQt bug?

--
Dmitry Shachnev


signature.asc
Description: OpenPGP digital signature
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] PyQt5 module not found

2013-07-06 Thread Dmitry Shachnev
On Fri, Jul 5, 2013 at 10:31 PM, Shriramana Sharma samj...@gmail.com wrote:
 I had to install python3 sphinx using pip to get latest 1.2 which
 works with Py3.3.1 on Raring (Raring-installed Sphinx is not usable
 with Py3: https://bugs.launchpad.net/ubuntu/+source/sphinx/+bug/1184658).
 I hence removed the build-dep on the python3-sphinx package.

 I also manually installed python3-jinja2 and python3-pygments with py3
 sphinx requires.

Ubuntu's Sphinx has python3.3 support patches backported from
upstream, and is capable of building PyQt docs. The traceback in that
bug looks specific to pngmath extension, I will now look if I can fix
that crash.

--
Dmitry Shachnev
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] PyQt5 module not found

2013-07-05 Thread Dmitry Shachnev
On Fri, Jul 5, 2013 at 6:30 PM, Shriramana Sharma samj...@gmail.com wrote:
 Hi Scott/Dmitry -- if you have some time could I have a reply to this
 mail of last week please? Thank you!

 On Wed, Jun 26, 2013 at 8:23 PM, Shriramana Sharma samj...@gmail.com wrote:
 On Wed, Jun 26, 2013 at 6:46 PM, Dmitry Shachnev mity...@ubuntu.com wrote:
 I have packages for Saucy in ppa:mitya57/ppa, if you've already
 upgraded your sip, you can try to use them on a Raring system.

 Hi Dmitry (and Scott) and thanks for this. I've downloaded the
 packaging information and now building it myself on Raring. The
 process seems to go on fine until:

 /usr/lib/x86_64-linux-gnu/qt5/bin/moc -DSIP_PROTECTED_IS_PUBLIC
 -Dprotected=public -DQT_NO_DEBUG -DQT_PLUGIN -DQT_CORE_LIB
 -I/usr/share/qt5/mkspecs/linux-g++ -I. -I/usr/include/python3.3dm
 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include
 -I../../dbus -I/usr/include/qt5 -I/usr/include/qt5/QtCore -I.
 ../../dbus/helper.h -o moc_helper.cpp
 g++ -c -pipe -O2 -Wall -W -D_REENTRANT -fPIC -DSIP_PROTECTED_IS_PUBLIC
 -Dprotected=public -DQT_NO_DEBUG -DQT_PLUGIN -DQT_CORE_LIB
 -I/usr/share/qt5/mkspecs/linux-g++ -I. -I/usr/include/python3.3dm
 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include
 -I../../dbus -I/usr/include/qt5 -I/usr/include/qt5/QtCore -I. -o
 moc_helper.o moc_helper.cpp
 rm -f libqt.so
 g++ -Wl,-O1 -shared -o libqt.so dbus.o moc_helper.o  -ldbus-1
 -lQt5Core -lpthread
 cp -f libqt.so qt.so
 make[2]: Leaving directory
 `/mnt/sda8/samjnaa/sr/_backport/pyqt5-5.0/dbg-build-3.3/dbus'
 make[1]: Leaving directory
 `/mnt/sda8/samjnaa/sr/_backport/pyqt5-5.0/dbg-build-3.3'
 touch dbg-build-3.3/build-stamp
  fakeroot debian/rules binary
 dh_testdir
 dh_testroot
 dh_prep -a
 dh_installdirs -a

 followed by a big list of install commands but it ends in:

 mv 
 debian/python3-pyqt5-dbg/usr/lib/python3.3/dist-packages/PyQt5/QtWebKit.so \

 debian/python3-pyqt5-dbg/usr/lib/python3.3/dist-packages/PyQt5/QtWebKitWidgets.so
 \

 debian/python3-pyqt5.qtwebkit-dbg/usr/lib/python3.3/dist-packages/PyQt5
 mv: cannot stat
 ‘debian/python3-pyqt5-dbg/usr/lib/python3.3/dist-packages/PyQt5/QtWebKitWidgets.so’:
 No such file or directory
 make[1]: *** [install-arch-3.3] Error 1
 make[1]: Leaving directory `/mnt/sda8/samjnaa/sr/_backport/pyqt5-5.0'
 make: *** [install-arch] Error 2
 dpkg-buildpackage: error: fakeroot debian/rules binary gave error exit 
 status 2

 How can I fix this? Thanks!

Looks like either you didn't install all build dependencies, or some
of them are missing/incomplete on Raring.

As a work-around, you can try to comment out the WebKitWidgets-related
lines from debian/rules and debian/python3-pyqt5.qtwebkit.install.

--
Dmitry Shachnev
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Co-installing different versions of dbus.mainloop.qt

2013-06-30 Thread Dmitry Shachnev
On Sun, Jun 23, 2013 at 2:20 PM, Phil Thompson
p...@riverbankcomputing.com wrote:
 Good point. Maybe it would be more explicit to call it pyqt5 rather than
 qt5 (to avoid confusion with the PyQt4 built on Qt5 case)?

I've built PyQt5 with dbus/ directory from the latest snapshot, and now I get:

 from dbus.mainloop.pyqt5 import DBusQtMainLoop
Traceback (most recent call last):
  File stdin, line 1, in module
ImportError: dynamic module does not define init function (PyInit_pyqt5)

I think it's a bug.

--
Dmitry Shachnev
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Co-installing different versions of dbus.mainloop.qt

2013-06-30 Thread Dmitry Shachnev
On Sun, Jun 30, 2013 at 3:36 PM, Phil Thompson
p...@riverbankcomputing.com wrote:
 On Sun, 30 Jun 2013 15:21:53 +0400, Dmitry Shachnev mity...@ubuntu.com
 wrote:
 I've built PyQt5 with dbus/ directory from the latest snapshot, and now
 I
 get:

 from dbus.mainloop.pyqt5 import DBusQtMainLoop
 Traceback (most recent call last):
   File stdin, line 1, in module
 ImportError: dynamic module does not define init function (PyInit_pyqt5)

 I think it's a bug.

 Try renaming PyInit_qt to PyInit_pyqt5 in dbus.cpp.

That works, thanks!

--
Dmitry Shachnev
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] PyQt5 module not found

2013-06-26 Thread Dmitry Shachnev
On Wed, Jun 26, 2013 at 5:12 PM, Shriramana Sharma samj...@gmail.com wrote:
 @Scott: Do you perhaps have some PyQt5 packages for Raring in a PPA
 somewhere? Thanks!

I have packages for Saucy in ppa:mitya57/ppa, if you've already
upgraded your sip, you can try to use them on a Raring system.

--
Dmitry Shachnev
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Problem with Sip for Py3 on Debian/Ubuntu

2013-06-25 Thread Dmitry Shachnev
Yes, /usr/bin/sip is in python-sip-dev package. Maybe it will make
sense to move it into a separate package, but I don't see much need in
that.

--
Dmitry Shachnev

On 6/25/13, Shriramana Sharma samj...@gmail.com wrote:
 On Tue, Jun 25, 2013 at 9:09 PM, Scott Kitterman deb...@kitterman.com
 wrote:
 I'll take a look at it.

 Scott thank you very much! Please do so. RIght now I'm having to
 install python-sip-dev for developing Python3 bindings despite the
 presence of a python3-sip-dev which doesn't seem appropriate
 packaging.

 Thanks again!

 --
 Shriramana Sharma ஶ்ரீரமணஶர்மா श्रीरमणशर्मा
 ___
 PyQt mailing listPyQt@riverbankcomputing.com
 http://www.riverbankcomputing.com/mailman/listinfo/pyqt
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[PyQt] Co-installing different versions of dbus.mainloop.qt

2013-06-23 Thread Dmitry Shachnev
Hi,

It looks like versions of dbus.mainloop.qt module provided by PyQt4
and PyQt5 work only with Qt4 and Qt5, respectively. Trying to run
version from PyQt4 with a PyQt5 application, I get:

QSocketNotifier: Can only be used with threads started with QThread
QSocketNotifier: Can only be used with threads started with QThread

and connecting to singals doesn't work. Maybe it will make sense to
rename dbus.mainloop.qt to dbus.mainloop.qt5 in PyQt5? This will make
these modules co-installable, and it will be possible to use
dbus.mainloop.qt in PyQt4 apps and dbus.mainloop.qt5 in PyQt5 apps.

--
Dmitry Shachnev
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Co-installing different versions of dbus.mainloop.qt

2013-06-23 Thread Dmitry Shachnev
On Sun, Jun 23, 2013 at 2:20 PM, Phil Thompson
p...@riverbankcomputing.com wrote:
 Good point. Maybe it would be more explicit to call it pyqt5 rather than
 qt5 (to avoid confusion with the PyQt4 built on Qt5 case)?

I'm fine with that (though it seems to me that the module from PyQt4
compiled against Qt5 will be compatible with PyQt5's module).

--
Dmitry Shachnev
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt