Re: [PyQt] PyQt5.1 snapshot, Qt5.1.1, ASSERT failure in QVector

2013-10-13 Thread Phil Thompson
On Thu, 10 Oct 2013 10:27:10 +0200, Johnny Karlsson
 wrote:
> Hi! I’m experiencing a problem that might be a bug in PyQt. I've made
> a code example that demonstrates the problem:
> 
> class CommClient(QObject):
> 
>def __init__(self, parent=None):
>   QObject.__init__(self)
>   self._devicelist = ""
>   self.timer = QTimer()
>   self.timer.timeout.connect(self.test)
>   self.timer.start(2000)
> 
> def setDeviceList( self, devlist ):
> self._devicelist = devlist
> self.deviceListUpdated.emit()
> 
> def getDevicelist(self):
> return self._devicelist
> 
> deviceListUpdated = pyqtSignal()
> devicelist = pyqtProperty(str, getDevicelist,
notify=deviceListUpdated)
> 
> def test(self):
> self._devicelist = "YES"
> self.deviceListUpdated.emit()
> self.timer.stop()
> 
> app = QApplication(sys.argv)
> qmlRegisterType(CommClient, 'SDL', 1, 0, 'CommClient')
> 
> view = QQuickView()
> view.setWidth(500)
> view.setHeight(500)
> view.setTitle('CommClient')
> 
> view.setSource(QUrl('main.qml'))
> view.show()
> app.exec_()
> 
> 
> And the QML file:
> 
> import QtQuick 2.0
> import SDL 1.0
> 
> Rectangle {
> width: 400
> height: 400
> 
>Text {
>   id: myText
>   text: commClient.devicelist
>   anchors.horizontalCenter: parent.horizontalCenter
> }
> 
> CommClient {
> id: commClient
> }
> }
> 
> When the timer fires and the signal is emitted I get:
> 
> ASSERT failure in QVector::at: "index out of range", file
> ../../include/QtCore/../../src/corelib/tools/qvector.h, line 350
> 
> I'm running the latest snapshot of PyQt5.1 (
> PyQt-gpl-5.1.1-snapshot-41b8f6ca2ea4. ) and stable Qt5.1.1 built from
> source on Ubuntu 12.04.

Should be fixed in tonight's snapshot.

Thanks,
Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] SIP_READ_ONLY was not declared in this scope

2013-10-12 Thread Phil Thompson
On Wed, 9 Oct 2013 19:16:59 +0200, Filippo Cucchetto
 wrote:
> Hi,
> i'm trying to cross compile the PyQt bindings for my raspberry pi.
During
> the build process make fails with:
>
/home/filippo/Raspberry/src/PyQt-gpl-5.1.1-snapshot-41b8f6ca2ea4/sip/QtQuick/qsggeometry.sip:67:21:
> error: 'SIP_READ_ONLY' was not declared in this scope
> 
> i'm using the pyqt snapshot 41b8f6ca2ea4 and the latest sip version
> retrieved through mercurial. Any idea? i think that maybe i missed some
> kind of parameter to pass to the configure.py script.

Make sure you are picking up the latest sip.h and not the one installed on
the pi by default (which is too old).

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Missing QPageSize enum in vars(QPrinter) ?

2013-10-12 Thread Phil Thompson
On Thu, 10 Oct 2013 09:43:10 -0400, lloyd konneker 
wrote:
> This code worked in PyQt4 and Qt4 to get a dictionary of paper size
names:
> 
> paperSizeNames = {}
> print(vars(QPrinter))
> for key, value in vars(QPrinter).items():  # Python2 iteritems():
>if isinstance(value, QPrinter.PageSize):
>  print(key, value)
>  paperSizeNames[value] = key
> 
> It no longer works in PyQt5 and Qt5.0.1.  But other enum values appear 
> to be in vars(QPrinter)?  Is missing QPageSize enum a bug of omission in

> PyQt5?
> 
> This is NOT too important, since Qt 5.1 offers 
> QPrinter.supportedSizesWithNames(), which more or less does the same 
> thing (returns a map from names to QSizeF, which I suppose could be 
> mapped to QPageSize enum values i.e. encodings.)
> 
> Is there another way to get the names of Qt enum values?

In Qt5 the PageSize enum is defined in the QPagedPaintDevice class.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] PyQt5 with QtQuick 1.1

2013-10-10 Thread Phil Thompson
On Thu, 10 Oct 2013 21:19:15 +0200, Alexander Rössler
 wrote:
> Hello,
> 
> How can I use PyQt5 in combination with QtQuick 1.1? I know QtQuick 2.0
is
> better but on the BeagleBone currently no OpenGL is available so I am
> better of sticking to the raster engine of QtQuick 1.1. Where can I find
> the QtDeclarative module and the QDeclarativeView class?

Use PyQt4 (built against Qt5). PyQt5 doesn't support anything in Qt5 that
is marked as obsolete.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] module QtSvg doesn't build in, PyQt-gpl-5.1.1-snapshot-fc7b8711dba0 (lloyd konneker)

2013-10-08 Thread Phil Thompson
On Mon, 07 Oct 2013 21:03:54 -0400, lloyd konneker 
wrote:
> I determined that QtSvg is not a subtarget in the Makefile.
> 
> I will assume that is intended and that I shouldn't be using a 
> snapshot.   I will regress to the released PyQt5.1.

It should work fine. Run configure.py with the --verbose flag to see
what's happening.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] pyqt5.1 baffling exceptions: AttributeError: 'Qxxxxxx' object has no attribute 'QWidget'

2013-10-08 Thread Phil Thompson
On Tue, 08 Oct 2013 10:29:44 +1100, Stephen Gava 
wrote:
> On 07/10/13 23:36, Phil Thompson wrote:
>> Hopefully fixed in tonight's PyQt5 snapshot, or try the attached patch.
> 
> great thanls Phil, i'll try building the snapshot when it's available 
> and test that.
> 
> any wild idea how far away a point release is so i can request an 
> updated distro package?

I'll do one at the end of this week.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] PyQt5 and QQuickImageProvider

2013-10-07 Thread Phil Thompson
On Mon, 7 Oct 2013 00:09:51 +0200, Jens Persson  wrote:
> Hi, I'm trying to port an app to PyQt5 and everything has been working
> smoothly so far ... except one thing. I can't get my 
QQuickImageProvider
> to work properly:
> ---
> from PyQt5 import QtCore
> from PyQt5 import QtGui
> from PyQt5 import QtWidgets
> from PyQt5 import QtQml
> from PyQt5 import QtQuick
> 
> class ImageProviderGUI(QtCore.QObject):
> def __init__(self):
> QtCore.QObject.__init__(self)
> self.app = QtWidgets.QApplication(["ImageProvider"])
> self.view = QtQuick.QQuickView()
> self.view.setResizeMode(QtQuick.QQuickView.SizeRootObjectToView)
> self.context = self.view.rootContext()
> engine = self.context.engine()
> self.image_provider = ImageProvider()
> engine.addImageProvider("cover", self.image_provider)
> self.view.setSource(QtCore.QUrl("test.qml"))
> self.view.show()
> self.app.exec_()
> 
> class ImageProvider(QtQuick.QQuickImageProvider):
> def __init__(self):
> QtQuick.QQuickImageProvider.__init__(self,
> QtQuick.QQuickImageProvider.Pixmap)
> 
> def requestPixmap(self, id, size):
> pixmap = QtGui.QPixmap(100, 100)
> pixmap.fill(QtGui.QColor(id))
> return pixmap
> 
> ImageProviderGUI()
> ---
> import QtQuick 2.0
> 
> Image {
> source: "image://cover/red"
> }
> ---
> The code above gives an error:
> ---
> TypeError: invalid result type from ImageProvider.requestPixmap()
> file:///home/xerxes2/test.qml:4:1: QML Image: Failed to get image from
> provider: image://cover/red
> ---
> The same thing works just fine with PyQt4:
> ---
> from PyQt4 import QtCore
> from PyQt4 import QtGui
> from PyQt4 import QtDeclarative
> 
> class ImageProviderGUI(QtCore.QObject):
> def __init__(self):
> QtCore.QObject.__init__(self)
> self.app = QtGui.QApplication(["ImageProvider"])
> self.view = QtDeclarative.QDeclarativeView()
> 
>
self.view.setResizeMode(QtDeclarative.QDeclarativeView.SizeRootObjectToView)
> self.context = self.view.rootContext()
> engine = self.context.engine()
> self.image_provider = ImageProvider()
> engine.addImageProvider("cover", self.image_provider)
> self.view.setSource(QtCore.QUrl("test1.qml"))
> self.view.show()
> self.app.exec_()
> 
> class ImageProvider(QtDeclarative.QDeclarativeImageProvider):
> def __init__(self):
> QtDeclarative.QDeclarativeImageProvider.__init__(self,
> QtDeclarative.QDeclarativeImageProvider.Pixmap)
> 
> def requestPixmap(self, id, size, requestedSize):
> pixmap = QtGui.QPixmap(100, 100)
> pixmap.fill(QtGui.QColor(id))
> return pixmap
> 
> ImageProviderGUI()
> ---
> import QtQuick 1.1
> 
> Image {
> source: "image://cover/red"
> }
> ---
> Also the requestPixmap method takes one parameter less in PyQt5. So
> something is not quite right ... and I can't figure out where the bug
is?

The bug is in PyQt4. The size should be returned and not passed in as an
argument.

In your PyQt5 code change the return statement to something like...

return pixmap, QtCore.QSize(100, 100)

I probably won't fix the bug at this stage as it would break existing
code.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] pyqt5.1 baffling exceptions: AttributeError: 'Qxxxxxx' object has no attribute 'QWidget'

2013-10-07 Thread Phil Thompson
On Mon, 07 Oct 2013 11:27:56 +1100, Stephen Gava 
wrote:
> Phil, i've attached a simple test case that illustrates this problem, 
> here it is inline:
> 
> import sys
> 
> from PyQt5.QtWidgets import (QApplication,QMainWindow)
> 
> class MainWindow(QMainWindow):
>  def __init__(self):
>  super(MainWindow,self).__init__()
>  self.setWindowTitle('test case')
>  top_level_window=self.window()
>  print(top_level_window)
> 
> gui_app=QApplication(sys.argv)
> gui_main_window=MainWindow()
> gui_main_window.show()
> sys.exit(gui_app.exec_())
> 
> the result of running the above is an exception:
> 
> builtins.AttributeError: 'MainWindow' object has no attribute 'QWidget'
> 
> with the traceback stopping in my code at the line where i try to use 
> the result of self.window() (by simply printing it).
> 
> if you comment out the print(top_level_window) the code runs fine so the

> error happens when trying to _use_ the result of self.window() in any
way.
> 
> obviously MainWindow is already a top level window, so in the more 
> complex code where i'm getting these kind of errors the call to 
> QWindow.window() is ocurring in widget (sub)classes that belong to the 
> MainWindow.
> 
> as i said this error crops up in several places, but seemingly after 
> calls to either QWidget.window() or QWidget.childAt() in my code. i'm 
> hoping you find some general cause for this, but if you need it i'll try

> to also come up with a simple case where it's triggered after the 
> childAt() call.

Hopefully fixed in tonight's PyQt5 snapshot, or try the attached patch.

Thanks,
Phildiff -r fc7b8711dba0 qpy/QtCore/qpycore_qobject_helpers.cpp
--- a/qpy/QtCore/qpycore_qobject_helpers.cpp	Sat Oct 05 16:44:56 2013 +0100
+++ b/qpy/QtCore/qpycore_qobject_helpers.cpp	Mon Oct 07 13:33:22 2013 +0100
@@ -211,6 +211,7 @@
 
 SIP_BLOCK_THREADS
 
+PyTypeObject *base_pytype = sipTypeAsPyTypeObject(base);
 PyObject *mro = Py_TYPE(pySelf)->tp_mro;
 
 for (SIP_SSIZE_T i = 0; i < PyTuple_GET_SIZE(mro); ++i)
@@ -224,7 +225,10 @@
 
 if (qstrcmp(pytype->tp_name, _clname) == 0)
 {
-if (td == base)
+// The generated type definitions represent the C++ (rather than
+// Python) hierachy.  If the C++ hierachy doesn't match then the
+// super-type must be provided by a mixin.
+if (PyType_IsSubtype(base_pytype, pytype))
 *sipCpp = sipGetAddress(pySelf);
 else
 *sipCpp = sipGetMixinAddress(pySelf, td);
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] pyqt5.1 baffling exceptions: AttributeError: 'Qxxxxxx' object has no attribute 'QWidget'

2013-10-07 Thread Phil Thompson
On Mon, 07 Oct 2013 13:41:04 +0200, Vincent Vande Vyvre
 wrote:
> Le 07/10/2013 11:02, Jens Persson a écrit :
>> For me, python-2.7.3, qt-5.1.1, pyqt-5.1 and 32-bit Linux.
>>
>> On Mon, Oct 7, 2013 at 10:13 AM, Stephen Gava > > wrote:
>>
>>
>>
>> On 07/10/13 19:07, Jens Persson wrote:
>>
>> This example runs without errors for me on Python2 in Linux.
>>
>>
>> ok, i should say these errors are occurring with pyqt5,1, qt5.1
>> python 3.3 on 64bit linux.
>>
>>
>>
>> ___
>> PyQt mailing listPyQt@riverbankcomputing.com
>> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
> Works too with Python 3.2.3, Qt 5.0.2, PyQt 5.0, on 64bit Ubuntu

It's Ok I can reproduce the problem.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] PyQt4 - QChar - unicode char?

2013-10-05 Thread Phil Thompson
On Sat, 5 Oct 2013 13:10:42 -0700, David Cortesi 
wrote:
> # python 2.7
> from future import unicode_literals
> uu = u'\u2019' # no problem here but...
> qcCurlyApostrophe = QChar(uu)
> Traceback (most recent call last):
> File "", line 1, in 
> UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in
> position 0: ordinal not in range(128)
> qcCurlyApostrophe = QChar(8217) # int workaround ok
> 
> So - user error?

Yes.

> Or failure to recognize the "QChar::QChar(uchar ch)"
> overload signature?

ch is defined as an ASCII/Latin1 character.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] pyqt5.1 fails to build for qt5.01: qpyopengl_api.h:29:33: fatal error: QOpenGLVersionProfile: No such file or directory

2013-10-05 Thread Phil Thompson
On Fri, 4 Oct 2013 12:11:14 -0400,  wrote:
> My environment:
> Ubuntu 13.04
> Qt5.0.1 (as installed by Ubuntu)
> Python3.3 (as installed by Ubuntu)
> python3-dev (installed using Ubuntu Software Center)
> sip-4.15.2 (downloaded)
> PyQt-gpl-5.1 (downloaded)
> 
>>cd Down*/PyQt*
>>python3 configure.py
>>make
> yields error in the subject line
> 
>>qmake -v
> QMake version 3.0
> Using Qt version 5.0.1 in /usr/lib/i386-linux-gnu
> 
> "An Explanation of Version Numbers" in PyQt docs seems to say that pyqt
> 5.1 SHOULD at least build for Qt 5.0.1.
> 
> I will attempt to regress to PyQt5.0.1

Should be fixed in tonight's snapshot.

Thanks,
Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] pyqt5.1 QWidget.childAt() exception

2013-10-05 Thread Phil Thompson
On Fri, 04 Oct 2013 16:07:38 +1000, Stephen Gava 
wrote:
> i've found another puzzling (to me) difference in behaviour between 
> pyqt5 and pyqt4.
> 
> using pyqt4 this works without any problem:
> 
>
child_widget=self.parent_widget.childAt(self.parent_widget.mapFromGlobal(QCursor.pos()))
> 
> returning the child widget under the cursor, which i can then use in 
> subsequent operations, whether the toplevel parent window is active or
not.
> 
> using pyqt5 (pyqt 5.1 with qt 5.1 on linux x64) it works if the toplevel

> parent window is active, however if the toplevel parent window is 
> inactive, trying to use the returned reference child_widget in any way 
> throws a confusing (to me) exception, which, in the case of the widgets 
> i'm using is:
> 
> AttributeError: 'QLabel' object has no attribute 'QWidget'
> 
> can anyone shed any light on this?

Do you have a small, complete test case that demonstrates the problem?

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] pyqt5.1 segfault on QShortcut construction

2013-10-04 Thread Phil Thompson
On Fri, 04 Oct 2013 11:17:38 +1000, Stephen Gava 
wrote:
> hi there, i already tried to send a message on this, through gmane, 
> which never appeared, so apologies if they both turn up on the list. 
> hereforth let this be the canonical message on this topic (eg. ignore 
> the other one if it appears) ;) .
> 
> using pyqt4 this works without problem:
> 
>
self.shortcut_help=QShortcut(QKeySequence.HelpContents,self,self.show_help)
> 
> but using pyqy5 it segfaults (pyqt 5.1 with qt 5.1 on linux x64). why is

> that?
> 
> using pyqt5 the following _does_ work:
> 
> self.shortcut_help=QShortcut(self)
> self.shortcut_help.setKey(QKeySequence.HelpContents)
> self.shortcut_help.activated.connect(self.show_help)
> 
> fwiw the qt5 c++ docs still say that the multiple argument constructor 
> should work, but with pyqt5 it segfaults.
> 
> am i doing something wrong that somehow still worked under pyqt4?

Should be fixed in tonight's snapshot.

Thanks,
Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] ANN: PyQt v5.1 Released

2013-10-02 Thread Phil Thompson
PyQt v5.1 has been released. This fully supports Qt v5.1, including the
new QtSensors and QtSerialPort modules. Also included is a (nearly)
complete set of OpenGL v2.0 and OpenGL ES/2 bindings.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Trying to upgrade Qt4 in Linux

2013-10-01 Thread Phil Thompson
On Mon, 30 Sep 2013 16:28:48 -0700, David Cortesi 
wrote:
> In a Linux system my PyQt4 app  fails because it relies on a feature
that
> dates to Qt 4.7. This Linux system has 4.6 installed. Also the PyQt4 was
at
> 4.6.x. So I did the following:
> 
> Downloaded the Linux source of SIP, configure, make, make-install
> 
> Downloaded the Linux source of PyQt4, configure, make, make-install
> 
> Then downloaded the latest stable Qt4 from qt-project and did configure,
> make (four bloody hours!), make install.
> 
> Invoke Python, check PYQT_VERSION_STR, it is 4.10.3 but alas,
> QT_VERSION_STR is 4.6.2 still.
> 
> Went back to PyQt4 folder, did make clean; python configure-ng.py, and
note
> that it reports, "Qt v4.6.2 (Open Source) is being used."
> 
> How do I persuade PyQt4 to configure to use the newer Qt I just
installed?
> I don't see anything relevant in configure-ng --help.
> 
> I observe that  /usr/include/qt4/* exists, presumably this is the old
one;
> but the Qt4 make-install put a lot of stuff in
> /usr/local/TrollTech/Qt4.8.5/*
> 
> thanks,
> Dave Cortesi

Use the --qmake flag to specify the new qmake, probably
/usr/local/TrollTech/Qt4.8.5/bin/qmake

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] PyQt5 on Debian Wheezy for ARM

2013-09-30 Thread Phil Thompson
On Mon, 30 Sep 2013 23:10:58 +0200, Alexander Rössler
 wrote:
> Hello,
> 
> Currently I am trying to compile PyQt5 on Debian on a BeagleBone. All 
> works so far (after a few modifications...) but QtQml module does not
load.
> It gives me the following error: 
> ImportError: /usr/local/lib/python2.7/dist-packages/PyQt5/QtQml.so: 
> undefined symbol: _ZN11QQmlPrivate10createIntoI13QPyQmlObject5EEvPv
> 
> Any idea what this means? 

What it means is easy enough, why it's happening is the problem. What are
the "few modifications"?

> Btw. there was already discussion about this (Raspbian) 
> http://comments.gmane.org/gmane.comp.python.pyqt-pykde/25728
> but with no solution.

That was a different issue and, AFAIK resolved.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Custom C++ types as signal arguments

2013-09-28 Thread Phil Thompson
On Tue, 24 Sep 2013 13:24:05 + (UTC), David Boddie 
wrote:
> I'm running into problems with sip and custom signal arguments. I'm
> probably
> doing something wrong, and I'm hoping that someone might be able to put
me
> on
> the right track.
> 
> I've written a class with this definition:
> 
>   #include 
>   #include 
>   #include 
> 
>   typedef std::vector StringList;
> 
>   class Emitter : public QWidget
>   {
>   Q_OBJECT
> 
>   public:
>   Emitter(QWidget *parent = 0);
>   virtual ~Emitter();
> 
>   signals:
>   void emitStrings(StringList);
>   void emitStr(std::string, std::string);
>   void emitQString(QString);
>   };
> 
> My sip wrapper starts with a typedef for the StringList type and
> %MappedType
> implementations for std::string and StringList:

Remove this typedef...

>   typedef std::vector StringList;
> 
>   %MappedType std::string
>   {
>   %TypeHeaderCode
>   #include 
>   %End
> 
>   ...
>   };
> 
>   %MappedType StringList
>   {
>   %TypeHeaderCode
>   #include 
>   #include 
>   #include 
>   typedef std::vector StringList;
>   %End
> 
>   ...
>   };
> 
> It also has this definition for the Emitter class:
> 
>   class Emitter : public QWidget
>   {
>   %TypeHeaderCode
>   #include "Emitter.h"
>   %End
> 
>   public:
> Emitter(QWidget *parent = 0);
> virtual ~Emitter();
> 
>   signals:
> void emitStrings(StringList);
> void emitStr(std::string, std::string);
> void emitQString(QString);
>   };
> 
> This all builds correctly, but the emitStrings signal does not appear to
> work
> correctly, causing a crash when accessed in apparently any way at all.
Even
> evaluating the signal object fails.
> 
> Some elementary debugging indicates that the bound_overload member of
the
> qpycore_pyqtBoundSignal object is zero for this signal, and maybe this
> leads to
> the crash when trying to connect the signal to a slot.
> 
> I'm using PyQt 4.9.1 and sip 4.13.2. I've attached a simple project to
> demonstrate the problem.
> 
> David

SIP should probably complain about the typedef as you are effectively
providing two definitions for StringList.

Also in the current snapshot at least, you get a sensible exception.

Thanks,
Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Upcoming Release of PyQt v5.1

2013-09-28 Thread Phil Thompson
On Sat, 28 Sep 2013 12:54:08 +0200, Tomas Sobota  wrote:
> A couple of days ago I downloaded and compiled PyQt-gpl-5.1
> -snapshot-597681874226 on my Linux Mint Debian Edition box.
> 
> The file qmlscene/pluginloader.cpp failed to compile the sentence:
> QVector ucs4 = py_plugin_dir.toUcs4();
> 
> It looked like QVector was not defined, so I fixed the error including
the
> line:
> #include 
> 
> at the start of the file.After that, the file compiled fine.
> 
> Tom

Already fixed.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] Upcoming Release of PyQt v5.1

2013-09-28 Thread Phil Thompson
The current PyQt5 snapshot is a release candidate for v5.1. This
includes...

- full support for integration with QML and Quick2
- support for Qt v5.1 including the QtSensors and QtSerialPort modules
- an (almost) complete set of OpenGL 2.0 and OpenGL ES2 bindings
- support for cross-compilation.

Any last minute testing would be appreciated.

I've tested the cross-compilation support for the Raspberry Pi. I haven't
got around to looking at Android yet, and won't do for this release.
Actually building PyQt for Android shouldn't be too difficult (just setting
up a configuration file) but working out all the steps to create and
install a complete Python/Qt5/PyQt5 environment will take some
investigation. If anybody wants to have a go at this then please go ahead.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] multiple inheritance and signals problem, mixin before QObject

2013-09-14 Thread Phil Thompson
On Thu, 12 Sep 2013 10:30:06 -0400, lloyd konneker 
wrote:
> This is an update to my previous post.
> Here is an abstract of the code for easier reading:
> 
> 
> class B(object):
>def __init__(self):
>  self.a1 = A()
>  self.a1.signal1.connect(self.handler)# Fails in PyQt, succeeds 
> in PySide
> 
>def handler(self):
>  pass
> 
> 
> class A (Mixin, SubclassOfQObject):
>def __init__(self):
>  super().__init__()
> 
> class Mixin(object):
>signal1 = Signal()
>def __init__(self):
>  super().__init__()
> 
> 
> 
> Again, AFAIK this works in PySide, but not in PyQt.
> The MRO of a1, an instance of class A, is (Mixin, SubclassOfQObject, 
> QObject, object).
> And Mixin.__init__ calls super, which calls QObject.__init__ for 
> instance a1,
> so the signal instance should be bound by the time its connect method is

> called?
> 
> I found that a workaround is to eliminate the mixin:
> 
> 
> class A (SubclassOfQObject):
>signal1 = Signal()
>def __init__(self):
>  super().__init__()
> 
>... methods that were in Mixin ...
> 
> 
> I just don't understand why.  Should I submit an executable test case?

PyQt emulates the Qt behaviour - signals can only be defined in QObject
sub-classes. The error message assumes that Qt classes are always the first
super-class.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] ANN: SIP v4.15.2 Released

2013-09-14 Thread Phil Thompson
SIP v4.15.2 has been released. This is a minor functional release that
will be needed by PyQt v5.1. It also contains bug fixes needed by PyKDE4.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Coinstalling PyQt5 for Python 2 and Python 3

2013-09-13 Thread Phil Thompson
On Fri, 13 Sep 2013 21:01:02 +0200, Luca Beltrame 
wrote:
> Hello,
> 
> While packaging PyQt5 for openSUSE I noticed that there are two plugins
> that 
> are compiled which may conflict on a system that wants PyQt5 both for
> Python 2 
> and Python 3.
> 
> I'm talking about the Designer plugin and the QML plugin, in particular.
> Are 
> they Python version independent (I'm inclined on "no")? What can be done
> to 
> ensure proper coinstallation of PyQt with both Py2 and Py3?

Do the same as what you do with PyQt4 - whatever that is.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] SIP_ANYSLOT vs SIP_SLOT vs SIP_SLOT_CON()

2013-09-10 Thread Phil Thompson
On Tue, 10 Sep 2013 16:17:25 +0200, Sébastien Sablé
 wrote:
> [sorry previous email was sent before I finished it]
> 
> Hi,
> 
> I want to bind with sip a connect method which can be used with a slot
for
> which the signature will change from one call to the other.

That doesn't sound like a great design...

> The class looks a bit like that:
> 
> class Foo
> {
> Q_OBJECT
> public:
> void connect(const int eventType, QObject *receiver, const char
> *member);
> }
> 
> I have seen quite a few example in the doc or in PyQt using
SIP_RXOBJ_CON
> and SIP_SLOT_CON.
> However it seems SIP_SLOT_CON can only be used when you know the
signature
> of your signal in advance.

Correct.

> The documentation mentions also SIP_SLOT and SIP_ANYSLOT but is very
light
> on the details.
> SIP_ANYSLOT requires to write some custom code to handle conversion as
can
> be seen in the code for QShortcut.
> I could not find any example for SIP_SLOT anywhere.
> 
> What is the difference between SIP_ANYSLOT and SIP_SLOT? Which one
should I
> use? And can you provide an example when using SIP_SLOT?

SIP_SLOT just checks that the argument has been created by QtCore.SLOT(),
ie. that it is a string that begins with the magic character. Plenty of
examples in PyQt4.

SIP_ANYSLOT checks that the argument has been created by QtCore.SLOT() (in
which case it is placed in a variable called a?Name, where ? is the number
of the argument) or it is a callable (in which case it is placed in a
variable called a?Callable).

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] PyQt5 cannot import QtWebKit

2013-09-05 Thread Phil Thompson
On Thu, 5 Sep 2013 16:50:04 +0100, Joe Borġ  wrote:
> Have just (seemingly) successfully built PyQt5, but doesn't seem to have
> included WebKit:
> 
> In [1]: from PyQt5 import QtWebKit
>
---
> ImportError   Traceback (most recent call
last)
>  in ()
> > 1 from PyQt5 import QtWebKit
> 
> 
> In [3]: from PyQt5 import Qt
> Qt   QtDBus   QtGui
> QtMultimedia QtNetworkQtPrintSupport
> QtQuick  QtSvgQtWidgets
> QtCore   QtDesigner   QtHelp
> QtMultimediaWidgets  QtOpenGL QtQml
> QtSqlQtTest   QtXmlPatterns
> 
> 
> Is there a flag I missed on build?

Run configure.py with the --verbose flag to see why WebKit wasn't
detected.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] return value from QGraphicsItem::itemChange is not handled properly.

2013-09-02 Thread Phil Thompson
On Thu, 29 Aug 2013 14:58:07 +, Yann Le Hir 
wrote:
> Hi,
> 
> I'm having an issue with QGraphicsItem::itemChange.
> 
> Here is the test program :
> 
> import PyQt5.Qt  as qt
> 
> class Node( qt.QGraphicsRectItem ) :
> def __init__( self , sector ) :
> super( Node , self ).__init__( sector )
> 
> def itemChange( self , change , v ) :
> res = super( Node , self ).itemChange( change , v )
> print "itemChange return value : ",res
> return res
> 
> b = qt.QGraphicsLineItem()
> c = qt.QGraphicsLineItem()
> a = Node(b)
> print a.parentItem(),b
> a.setParentItem(c)
> print a.parentItem(), c
> 
> 
> I get this output :
> 
> 
> itemChange return value :   0x8f9f1dc>
> itemChange return value :   0x8f9f1dc>
> None 
> 
> If I remove itemChange, I get this output :
> 
> 
> 
> 
> 
> I'm using PyQt-5.0, Sip 4.14.7 and Qt 5.1.0
> I tried with PyQt-5.0.1, sip 4.15.1 and Qt 5.1.0 without change.
> 
> I digged into this, basically when setParentItem is called itemChange is
> called on this item and use the return value of itemChange to set the
> parent.
> In C itemChange returns a QVariant, which must be casted as a
> QGraphicsItem to be set as a parent.
> This took me to the Chimera::parse_py_type function. Apparently, someone
> (QT?) registers QGraphicsItem as a QMetaType, but not QGraphicsLineItem.
> 
> If I replace :
> _metatype = QMetaType::type(_name.constData());
> By :
> if(strcmp(_name.constData(),"QGraphicsLineItem*")==0)
> _metatype = QMetaType::type("QGraphicsItem*");
> else
> _metatype = QMetaType::type(_name.constData());
> 
> (I know how bad this is, but it's for demonstration purpose.)
> 
> The output of the test program is then :
> 
> 
> itemChange return value :   0x89ba1dc>
> itemChange return value :   0x89ba1dc>
> 
> 
> 
> Any ideas on how to fix this properly ?

Should be fixed in tonight's PyQt5 snapshot.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Simple patch for pylupdate4

2013-09-01 Thread Phil Thompson
On Fri, 30 Aug 2013 17:47:05 +0200, Florent Rougon 
wrote:
> Hello,
> 
> The following trivial patch to pylupdate/fetchtr.cpp (for PyQt 4.10.3)
> allows pylupdate4 to correctly process backslashes at the end of a line,
> instead of replacing such backslashes with a linefeed (ASCII 10)
> character. This is very useful in triple-quoted strings to avoid
> introducing newlines that don't exist in the original Python string.
> (this is *not* about "\n" sequences; these work fine, having an
> identical counterpart in C++ syntax)
> 
> Unfortunately, the patch only works for Python source files that have
> Unix-style line endings, but doesn't make things any worse for other
> newline styles. Ideally, Python source files would be read in some kind
> of universal newlines mode...
> 
> Could you please include it, or something similar?

Done - something similar.

Thanks,
Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Crash in frozen PyQt5 app

2013-08-30 Thread Phil Thompson
On Fri, 30 Aug 2013 15:13:29 +1200, Glenn Ramsey 
wrote:
> Hi,
> 
> When running the following test app on OSX (10.8.4, PyQt 5.1 snapshot +
Qt
> 5.1.1)
> 
>
https://github.com/pyinstaller/pyinstaller/blob/develop/tests/interactive/test_pyqt5_qml.py
> 
> I get a crash when it is frozen using PyInstaller but not when it is not
> frozen. 
> The crash occurs in QQuickView::setSource(...)
> 
> A stack trace for a very similar test app is here
> http://pastebin.com/ZhqZFPxG
> 
> Inspecting it in the debugger shows that the cause of the crash is that 
> QCoreApplication::instance() returns 0 and in the stack trace shows the
> abort 
> caused by a Q_ASSERT that I put in to check that.
> 
> Any ideas about what could be happening here?

No, but a comment on the use of "global app" in the code...

The effect of that is to impose some order on the garbage collection of
Python objects. When main() returns the local objects get garbage collected
in an arbitrary order. If that order is wrong as far as Qt is concerned
then you get undefined behaviour or a crash. Specifying "app" as a global
means that it will get garbage collected later. Personally I never use a
main() function and put the code at the module level under "if __name__ ==
'__main__'". It should only be a few lines anyway.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] PyQt 5.1 App doesn't exit after QQuickView closed

2013-08-27 Thread Phil Thompson
On Tue, 27 Aug 2013 09:26:55 +1200, Glenn Ramsey 
wrote:
> Hi,
> 
> In the following example, the application doesn't exit after the
> QQuickView 
> window is closed. Is this the correct behaviour or is it a bug? This is
> using 
> snapshot-693a95fde3fa on OSX 10.8.4 with Qt 5.1, PyQt 5.1 and macports
> python 
> built as 32 bit.
> 
> Glenn
> 
> import sys
> import os
> 
> from PyQt5 import QtCore
> from PyQt5 import QtWidgets
> from PyQt5 import QtQuick
> 
> def main():
>  app = QtWidgets.QApplication(sys.argv)
>  quickview = QtQuick.QQuickView()
>  if getattr(sys, 'frozen', None):
>  basedir = sys._MEIPASS
>  else:
>  basedir = os.path.dirname(__file__)
>  quickview.setSource(QtCore.QUrl.fromLocalFile(os.path.join(basedir,

> 'hello.qml')))
>  quickview.show()
> 
>  app.exec_()
> 
> if __name__ == "__main__":
>  main()
> 
> 
> hello.qml:
> 
> import QtQuick 2.0
> 
> Rectangle {
>  width: 360
>  height: 360
>  Text {
>  anchors.centerIn: parent
>  text: "Hello World"
>  }
>  MouseArea {
>  anchors.fill: parent
>  onClicked: {
>  Qt.quit();
>  }
>  }
> }

You need to connect up the engine's quit() signal...

quickview.engine().quit.connect(app.quit)

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] PyQt5 Support for Qt v5.1

2013-08-25 Thread Phil Thompson
For those interested, the current PyQt5 snapshot now fully supports Qt
v5.1 in all existing modules. The new modules (QtSensors and QtSerialPort)
are still to do.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] ANN: SIP v4.15.1 Released

2013-08-23 Thread Phil Thompson
SIP v4.15.1 has been released. This fixes a regression in v4.15 related to
the handling of hidden virtual methods. PyQt is unaffected.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Next PyQt5 and SIP Releases

2013-08-23 Thread Phil Thompson
On Fri, 23 Aug 2013 16:53:44 +1200, Glenn Ramsey 
wrote:
> On 18/08/13 22:32, Phil Thompson wrote:
>> The current PyQt5 and SIP snapshots are release candidates so any
testing
>> with them would be greatly appreciated.
>>
> 
> I couldn't find QWidget::createWindowContainer in 5.0.1 and it's not
> mentioned 
> in the changelog of the current snapshot.

Because that was added in Qt v5.1. See...

http://pyqt.sourceforge.net/Docs/PyQt5/introduction.html#an-explanation-of-version-numbers

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Next PyQt5 and SIP Releases

2013-08-22 Thread Phil Thompson
On Thu, 22 Aug 2013 13:39:40 +0400, Dmitry Shachnev 
wrote:
> On Mon, Aug 19, 2013 at 4:54 PM, John Donovan 
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.

Applied.

Thanks,
Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] ANN: PyQt v4.10.3 Released

2013-08-21 Thread Phil Thompson
On Wed, 21 Aug 2013 19:51:59 +0200, Detlev Offenbach
 wrote:
> Will we see a new QScintilla release in the next days as well?

No. PyQt v5.1 has priority.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] ANN: PyQt v4.10.3 Released

2013-08-21 Thread Phil Thompson
On Wed, 21 Aug 2013 19:09:47 +0200, Detlev Offenbach
 wrote:
> Hello Phil,
> 
> is the latest QScintilla snapshot compatible with these releases of
PyQt4 
> and sip?

Yes.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] ANN: PyQt v5.0.1 Released

2013-08-21 Thread Phil Thompson
PyQt v5.0.1 has been released. This is a major functional release
including full support for integrating Python with QML and Quick2. It will
build against Qt v5.1 but only supports the Qt v5.0 API.

>From the NEWS file...

- Added the QtQuick module including the ability to create Python Quick
  items from QML.
- Added the QtQml module including the ability to create Python objects
  from QML.
- Added the QtMultimediaWidgets module.
- Completed the implementation of the QtMultimedia module including
  support for cameras and radios.
- Added the remaining OpenGL classes to the QtGui module.
- Added the 'revision' keyword argument to pyqtProperty().
- Added the 'revision' and 'arguments' keyword arguments to pyqtSignal().
- Added the 'revision' keyword argument to pyqtSlot().
- Added the 'pyqt5qmlplugin' plugin for qmlscene.
- The DBus main loop module has been renamed to dbus.mainloop.pyqt5 from
  dbus.mainloop.qt.
- Added the --no-qml-plugin and --qml-plugindir options to configure.py.
- Added many QtMultimedia, QML and QtQuick related examples.
- Classes now support co-operative multi-inheritance.  (This may introduce
  incompatibilities with PyQt v5.0.)

Phil

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


[PyQt] ANN: PyQt v4.10.3 Released

2013-08-21 Thread Phil Thompson
PyQt v4.10.3 has been released.  This is a minor bug fix release.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] ANN: SIP v4.15 Released

2013-08-21 Thread Phil Thompson
SIP v4.15 has been released. This is a significant functional release and
is required by PyQt v5.0.1 and PyQt v4.10.3.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Inconsistent documentation for Factory annoctation

2013-08-18 Thread Phil Thompson
On Sun, 18 Aug 2013 01:02:30 -0500, Tyler Wade  wrote:
> Hello,
> 
> I'm somewhat confused by the documentation for the Factory annotation. 
In
> one place[1] it says that the new instance "…. is owned by C/C++."  In a
> second[2] it says the new instance "…  is owned by Python."  Could I get
> some clarification on this?
> 
> [1]
>
http://pyqt.sourceforge.net/Docs/sip4/annotations.html#function-annotation-Factory
> [2] http://pyqt.sourceforge.net/Docs/sip4/using.html#id7

The first reference is incorrect, it should be Python.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Parent child relationship: child survives parent

2013-07-12 Thread Phil Thompson
On Fri, 12 Jul 2013 09:30:46 +0200, Volker Pilipp
 wrote:
> I've got a little bit confused about ownership of objects in SIP  As
> far as I understand, if ParentObject owns ChildObject, the destruction
> of ChildObject is left to c++ i.e. the c++ destructor of ParentObject
> is expected to destruct ChildObject.  This behaviour may result in a
> seg fault if the python programmer does not make sure that ChildObject
> goes out of scope before ParentObject does. Indeed, there are many
> scenarios where this may happen accidentally.

If you are talking about QObject then you shouldn't get a segfault - you
should get a Python exception.

> That's what I would like to have:  The ChildObject keeps a reference
> on ParentObject that is released during destruction of ChildObject,
> where the Python destructor of ChildObject must  not  call the c++
> destructor of the wrapped c++ instance (this is done during
> destruction of ParentObject).

The Python destructor will not call the C++ destructor if the C++ instance
has a parent. If you think it does then provide a test case that
demonstrates it.

> I am wondering if this behavior is possible to achieve in SIP.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Fwd: Building SIP under Python 3.3

2013-07-10 Thread Phil Thompson
On Wed, 10 Jul 2013 11:39:04 +0100, Richard Mitchell
 wrote:
> Hello there, fellow SIP users and developers.
> 
> I've recently been trying to use SIP under Python 3.3. For the most part
> the current version (4.14.7) aimed at 3.1 works fine - I only had
trouble
> with the build process.
> 
> The attached patch for the configure.py script should fix the error:
> 
> ImportError: No module named 'sipconfig'
> 
> This is caused due to the way Python's import caching behaves on certain
> systems. See this Python bug for further details:
> http://bugs.python.org/issue17330
> 
> Thanks,
> Richard Mitchell

Thanks - note to self, buy a faster Mac.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] pyqt and qt 5.1

2013-07-08 Thread Phil Thompson
On Mon, 08 Jul 2013 16:59:09 +0200, Horst Hannappel 
wrote:
> Hi,
> 
> I am new to Qt and PyQt and not yet sure how things fit together. In the

> recent announcements of Qt 5.1 there were highlighted new features for 
> Qt quick 2. Is it currently possible to create an Qt application, that 
> makes use of the new  Qt quick 2 elements and combine that with PyQt 5 
> coding? Would anybody point me to a small example or a tutorial how to 
> do that?
> I did try to find an answer to that question by searching with google 
> but without good success!

Not yet. You will be able to do it with the next release (PyQt v5.0.1).
The new features of Qt v5.1 will be supported by the release after that
(PyQt v5.1).

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] make error in PyQt4 install

2013-07-07 Thread Phil Thompson
On Sun, 07 Jul 2013 12:26:18 +0200, Vincent Vande Vyvre
 wrote:
> Hi,
> 
> Installing the last PyQt4 PyQt-x11-gpl-4.10.2, the make fail with this 
> error:
> 
> ...
> rm -f libqpydbus.a
> ar cqs libqpydbus.a qpydbus_chimera_helpers.o qpydbus_post_init.o 
> qpydbuspendingreply.o qpydbusreply.o
> make[2]: quittant le répertoire « 
> /home/vincent/Téléchargements/PyQt-x11-gpl-4.10.2/qpy/QtDBus »
> make[1]: quittant le répertoire « 
> /home/vincent/Téléchargements/PyQt-x11-gpl-4.10.2/qpy »
> cd QtCore/ && make -f Makefile
> make[1]: entrant dans le répertoire « 
> /home/vincent/Téléchargements/PyQt-x11-gpl-4.10.2/QtCore »
> g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIC -DQT_WEBKIT 
> -DSIP_PROTECTED_IS_PUBLIC -Dprotected=public -DQT_NO_DEBUG -DQT_PLUGIN 
> -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-64 -I. 
> -I/usr/include/qt4/QtCore -I/usr/include/qt4 -I/usr/include/python2.7 
> -I../qpy/QtCore -I. -o sipQtCoreQTimerEvent.o sipQtCoreQTimerEvent.cpp
>
/home/vincent/Téléchargements/PyQt-x11-gpl-4.10.2/QtCore/sipQtCoreQTimerEvent.cpp:242:1:
> 
> erreur: too many initializers for ‘sipClassTypeDef {aka
_sipClassTypeDef}’
> make[1]: *** [sipQtCoreQTimerEvent.o] Erreur 1
> make[1]: quittant le répertoire « 
> /home/vincent/Téléchargements/PyQt-x11-gpl-4.10.2/QtCore »
> make: *** [sub-QtCore-make_default-ordered] Erreur 2

Some more information would be useful.

As nobody else has complained I'd suggest it is a problem with your
installation/configuration.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Duplicate symbols building PyQt5 against Qt5.1 on OS X 10.7.5

2013-07-07 Thread Phil Thompson
On Sun, 7 Jul 2013 00:13:24 -0700, Chris Knight 
wrote:
> Hello,
> 
> I had PyQt5 working with Qt5.0.2 and Python 2.7but decided to dump my
> Qt5.0.2 and install the new Qt5.1.  My environment is mac OS X 10.7.5
which
> is the latest version of Lion.  
> 
> Qt5.1 installed without issues.
> SIP installed without issues.
> 
> Running python configure.py for PyQt-gpl-5.0 failed with an error,
"Error:
> Unable to create the C++ code."  The sources were in a folder on my
desktop
> as they were last time I installed PyQt5 against Qt5.0.2 albeit without
> this error. I Googled and found that spaces  in a path have caused this
> error in the past and by moving the PyQt source directory to my user
> directory solved this issue and I was then able to run python
configure.py
> without further errors or warnings.
> 
> I ran "make clean" and then ran "make" .  I had a few warnings that
> various Qt directories could not be found similar to "warning: directory
> not found for option '-F/Users/chris/Qt//5.1.0/clang_64/qttools/lib'" it
> turns out this is a known bug with qmake, QTBUG-28336, that hadn't shown
up
> until more modularization of Qt for Qt5.1.  But long after the warnings
and
> it was starting to look like it was getting close to finishing I got a
list
> of eight duplicate symbols and the following error. 
> 
> "ld: 8 duplicate symbols for architecture x86_64
> clang: error: linker command failed with exit code 1 (use -v to see
> invocation)
> make[1]: *** [pylupdate5] Error 1
> make: *** [sub-pylupdate-make_first-ordered] Error 2""
> 
> I was able to find a work around for the warnings by creating symlinks
to
> the actual directories.  Doing this though did not solve the duplicate
> symbols problem.  
> 
> Running "make clean" and "make --silent"  results in the following,
> 
> "Makefile:1481: warning: overriding commands for target
`moc_translator.o'
> Makefile:989: warning: ignoring old commands for target
`moc_translator.o'
> duplicate symbol
> __ZN10Translator18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv
in:
> moc_translator.o
> duplicate symbol __ZNK10Translator10metaObjectEv in:
> moc_translator.o
> duplicate symbol __ZN10Translator16staticMetaObjectE in:
> moc_translator.o
> duplicate symbol __ZN10Translator11qt_metacastEPKc in:
> moc_translator.o
> duplicate symbol __ZN10Translator11qt_metacallEN11QMetaObject4CallEiPPv
in:
> moc_translator.o
> duplicate symbol __ZTV10Translator in:
> moc_translator.o
> duplicate symbol __ZTI10Translator in:
> moc_translator.o
> duplicate symbol __ZTS10Translator in:
> moc_translator.o
> ld: 8 duplicate symbols for architecture x86_64
> clang: error: linker command failed with exit code 1 (use -v to see
> invocation)
> make[1]: *** [pylupdate5] Error 1
> make: *** [sub-pylupdate-make_first-ordered] Error 2"
> 
> So there were two warnings that were probably there prior and I missed
> them among all the echoed commands and are clearly connected with the
> duplicate symbols.  What I have not been able to figure out though is
> exactly why this is happing and how to fix it.  I have not manually
edited
> any of the PyQt files and I would think "make clean" should have taken
care
> of duplicates from my prior install of PyQt5 left over in the sources
> directory.  
> 
> I'm hoping that someone with more knowledge and experience can point me
in
> the right direction for solving this.
> 
> Thank you kindly,
> ~Chris

I can't reproduce this (at least with 10.8.4). I can only suggest you make
sure you have a clean source tree.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Issue with PyQt4/5 and Qt 5.1

2013-07-07 Thread Phil Thompson
On Sat, 06 Jul 2013 15:42:21 +0200, Detlev Offenbach
 wrote:
> Hello,
> 
> today I compiled the Qt 5.1 and built the latest stable releases of
PyQt4 
> and PyQt5 against it. Now I am not able to start any QProcess. I
executed 
> the QProcess test program as contained in 
> 'qtbase/tests/auto/corelib/io/qprocess'. This shows a complete success. 
> However, if I execute the demo 'PyQt-gpl-5.0/examples/qtdemo', it
doesn't 
> work (starting assistant or any of the examples fail). What did I do
wrong?
> 
> The behavior is identical with PyQt4 and PyQt5.

It's a Qt bug - they've broken compatibility.

There will be a workaround in tonight's snapshots.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] [SIP] is there a Qt5 example for SIP?

2013-07-06 Thread Phil Thompson
On Sat, 6 Jul 2013 07:30:43 -0700, br...@stottlemyer.com wrote:
> Hi Phil,
> 
> I am trying to see if SIP will help me with a task I'm trying to solve. 
I
> started out by trying the More Complex C++ Example in the docs. 
However,
> I'm using Qt5, and the example is for Qt4.
> 
> I see the pyqtconfig is part of Qt4, but not Qt5.  No problem, except
> pyqtconfig is pretty integrated into the example, and as a beginner, I'm
> not sure how to take pyqtconfig out.
> 
> Is there a Qt5 example for SIP?

Look at the configure.py for PyQt5. A minimal build system would just be a
shell script that invoked sip then the C++ compiler then the linker. The
only thing you need to consider is to use the right -t flags to sip and
these can be found by introspecting current versions of PyQt.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] QCoreApplication.translate()

2013-07-05 Thread Phil Thompson
On Fri, 05 Jul 2013 13:46:43 +0200, pa...@paolodestefani.it wrote:
> Hi
> I'm trying to internationalize my PyQt application. Following the pyqt 
> reference guide i'm trying to use QCoreApplication.translate() instead 
> of self.tr().
> Works but only if i write the full function. But if i want to shorten 
> it in this way:
> 
> tr = QCoreApplication.translate
> 
> and then using
> 
> tr(contest, string, disambiguation)
> 
> it doesn't work ! I mean when i run pylupdate4.exe the created .ts file 
> is empty.
> If i change back using
> 
> QCoreApplication.translate(contest, string, disambiguation)
> 
> this works. The created .ts file is ok.
> 
> Why ? How can i use a short version of that function ? Is there another 
> way i can use that function ?
> 
> I look for an answer to this question using google but i found only 
> people with the same problem but no solution.
> Looks like an pylupdate4 issue.

pylupdate parses the Python source file. It can't know that you are using
a translation function with a different name.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Problems with wrapping complex types using typedefs

2013-07-05 Thread Phil Thompson
On Fri, 5 Jul 2013 17:41:21 +0800, "Casper Ti. Vector"
 wrote:
> For example, assuming all example use this header:
>> %Module test
>> %ModuleHeaderCode
>> #include "test.h"
>> %End
>> %Include types.sip // Where map, pair and vector are wrapped.
> 
> This code:
>> std::map, std::vector > Test;
> fails because sip complains:
>> sip: Test has an unsupported type - provide %GetCode and %SetCode
> 
> while this code:
>> typedef std::pair cell;
>> typedef std::vector idxx;
>> std::map Test;
> fails because the compiler complains like:
>> error: 'sipType_cell' was not declared in this scope
>> error: 'sipType_idxx' was not declared in this scope
> 
> I searched Google for `python sip typedef' and found this message:
>

> It seems that adding something like:
>> #define sipType_cell sipType_std_pair_1800_1800
>> #define sipType_idxx sipType_std_vector_2100
> to the `%ModuleHeaderCode' section make everything runs well.
> 
> However, this trick seems quite unreliable because these magic numbers
> (1800, 2100, etc.) might vary from version to version.  So is there any
> elegant way to wrap these types?
> 
> In addition, I personally think it is favourable to generate `sipType's
> for typedefs, because this can greatly simplify efforts on wrapping
> complex template types, such as those in my examples.

See...

http://pyqt.sourceforge.net/Docs/sip4/c_api.html#sipFindType

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] APPCrash on exit, Qt4 MainWindow

2013-07-03 Thread Phil Thompson
On Wed, 3 Jul 2013 06:58:56 -0700 (PDT), egus  wrote:
> Thanks for the direction Phil.
> 
> I added sip.setdestroyonexit(False) to__init__ in my MainWindow class
and
> that appears to have negated the crashing on the two apps I tried it on.
> Simply commenting that command out again caused the same apps to crash
> after
> adding it.  So it's definitely the right direction.
> 
> My limited knowledge of sip, do I risk any memory leaks or other
unexpected
> behavior by bypassing the c++ destructor call this way? Are there any
> cleanup methods/calls I should add when setting setdestroyonexit to
False?

It depends on what your application does after the interpreter exits. If
it's just a Python script (ie. not embedded in a larger application) then
the process is about to terminate anyway. This is the default behaviour of
PyQt5.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] APPCrash on exit, Qt4 MainWindow

2013-07-03 Thread Phil Thompson
On Tue, 2 Jul 2013 07:52:08 -0500, Erik  wrote:
> Python 2.7.4x32, Qt 4.8.4 (4.10.2-py27)x32 on Windows 7 64-bit OS PC's
> (multiple machines)
> 
> I'm having a reproducible APPCRASH (in QtGUI4.dll) on exit of any
> application I write that uses a QMainWindow and a menuBar, if the window
> contains > 10 other widgets.
> If I remove widgets down below the threshold (10), app closes normally.
> Whether I write it by hand or in QTDesigner, but if I include a menubar,
> blank or otherwise, App does not close properly in Windows resulting in
a
> 'close program' Windows dialog.
> 
> This happens on all 3 of my Windows 7 boxes here, but works fine in a
> instance of Windows XP on an older machine. (Same PyQt/Python versions)
> 
> An example with code would be I create a QMainWindow in QT Designer, put
12
> widgets of any combination on it. (In this example I added a menu bar in
my
> code, but works the same (crash) if I add it in QTDesigner.
> 
> 
> import sys
> from PyQt4 import QtGui
> import ui_mainwindow as UIMW
> 
> class MainWindow(QtGui.QMainWindow, UIMW.Ui_MainWindow):
> 
> def __init__(self):
> super(MainWindow, self).__init__()
> self.setupUi(self)
> 
> # MenuBar testing
> self.menubar = self.menuBar()
> menu = self.menubar.addMenu("Test")
> 
> app = QtGui.QApplication(sys.argv)
> window = MainWindow()
> window.show()
> sys.exit(app.exec_())
> 
> As long as my Ui_MainWindow has > 10 widgets + menuBar, I get:
>   Problem Event Name:APPCRASH
>   Application Name:python.exe
>   Application Version:0.0.0.0
>   Application Timestamp:51606175
>   Fault Module Name:QtGui4.dll
>   Fault Module Version:4.8.4.0
> 
> About 10% of the time, the first time I run the app, it will not crash
> until I run it again, click on some widgets, etc, and then exit.

Try experimenting with sip.setdestroyonexit().

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] [SIP] How to reasonably implement writable global variables?

2013-07-03 Thread Phil Thompson
On Wed, 3 Jul 2013 00:28:59 +0800, "Casper Ti. Vector"
 wrote:
> Hello list, I am a newcomer to SIP (only one day experience), and please
> tell me if I make a mistake.  Thanks :)
> 
> I found it quite hard to make read-write interface for (module-wide)
> global variables (other than explicitly writing C/C++ functions to get
and
> set them).  For example:
> 
> test.sip:
>> %Module test
>> %ModuleHeaderCode
>> #include "test.h"
>> %End
>> 
>> int test;
>> int get_test(void);
>> void set_test(int x);
> 
> test.h:
>> extern int test;
>> int get_test(void);
>> void set_test(int x);
> 
> test.cpp:
>> int test = 0;
>> int get_test(void) {
>>   return test;
>> }
>> void get_test(int x) {
>>   test = x;
>> }
> 
> test.py:
>> import test
>> print(test.test) # 0
>> print(test.get_test()) # 0
>> test.set_test(1)
>> print(test.test) # 0
>> print(test.get_test()) # 1
>> test.test = 2
>> print(test.test) # 2
>> print(test.get_test()) # 1
> 
> Thus `test' in python seems to be totally independently from its C++
> counterpart once it is formed.  However, if wrapped in a class, they
> would be bound together, and changes in one will affect the other.
> 
> So is there any elegant way to make global variables writable using
> the `var = val' syntax?  Any suggestions are welcome :)
> 
> P.S. I know python is object-oriented, but I think this particular
>  approach is still pratically useful in some situations (and OOP
>  itself is not a "silver bullet"), so it might not be meaningless to
>  implement this.

You can't do it. Python needs to support module level descriptors for it
to be implemented.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Installing PyQt 5 on Mac OS X (10.6.8 Snow Leopard) - Patch v3

2013-06-28 Thread Phil Thompson
On Fri, 28 Jun 2013 18:42:39 +0100, Anzir Boodoo 
wrote:
> Phil,
> On 28 Jun 2013, at 17:39, Phil Thompson wrote:
> 
>> On Fri, 28 Jun 2013 10:20:24 -0500, William Kyngesburye
>>  wrote:
>>> Though I see now what you mean by those lines in configure.py -
whatever
>>> you give for --spec will be overridden by that 'darwin' if block.  And
>> if
>>> it isn't macx-xcode it defaults to whatever Qt5 was compiled with,
>> probably
>>> clang++.
>> 
>> This patch should actually work.
> 
> Thanks... it's *still* giving the same response, except when I
> accidentally knocked something else in configure.py and generated a
syntax
> error (so at least I am editing and running the same file - phew!) - I
> wonder if something else is pointing to clang++?
> 
> When I changed
> 
>> if qt_config.QMAKE_SPEC == 'macx-xcode':
>> # This will exist (and we can't check anyway).
>> self.qmake_spec = 'macx-clang'
> 
> to
> 
>> if qt_config.QMAKE_SPEC == 'macx-xcode':
>> # This will exist (and we can't check anyway).
>> self.qmake_spec = 'macx-llvm'
> 
> 
> it didn't work either
> 
> I'm now trying to follow through what configuration.py is doing... it
> seems my default Qt is still 4.7.4, but I should be pointing PyQt 5 at
Qt
> 5. running 'qmake -query' using the Qt 5 qmake shows that
> 'QMAKE_SPEC:macx-clang' and 'QMAKE_XSPEC:macx_clang'. 
> 
> Then there is this (in configuration.py)
> 
>> # The default qmake spec.
>> if self.py_platform == 'win32':
>> if self.py_version >= 0x030300:
>> self.qmake_spec = 'win32-msvc2010'
>> elif self.py_version >= 0x020600:
>> self.qmake_spec = 'win32-msvc2008'
>> elif self.py_version >= 0x020400:
>> self.qmake_spec = 'win32-msvc.net'
>> else:
>> self.qmake_spec = 'win32-msvc'
>> else:
>> # Use the Qt default.  (We may update it for MacOS/X
later.)
>> self.qmake_spec = ''
> 
> so that's where self.qmake_spec is coming from (until it gets set to
> 'macx-clang' later on), and I'm setting opts.qmakespec through the
command
> line, which is overwriting self.qmake_spec - so that *should* work, but
> somehow doesn't ...
> 
> Maybe I should just go with Qt 4.8 and PyQt 4.8 for the moment - I've
got
> to the end of my ability to figure this out again...

I tested the patch and there was no mention of clang in any Makefile.

Maybe try with tonight's snapshot so you don't need to do any patching.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Installing PyQt 5 on Mac OS X (10.6.8 Snow Leopard) - Patch v3

2013-06-28 Thread Phil Thompson
On Fri, 28 Jun 2013 10:20:24 -0500, William Kyngesburye
 wrote:
> Though I see now what you mean by those lines in configure.py - whatever
> you give for --spec will be overridden by that 'darwin' if block.  And
if
> it isn't macx-xcode it defaults to whatever Qt5 was compiled with,
probably
> clang++.

This patch should actually work.

Ho hum...
Phildiff -r e74dbc5074d0 lib/configure.py
--- a/lib/configure.py	Fri Jun 28 16:51:28 2013 +0100
+++ b/lib/configure.py	Fri Jun 28 17:36:30 2013 +0100
@@ -473,15 +473,16 @@
 self.qsci_api_dir = os.path.join(qt_config.QT_INSTALL_DATA, 'qsci')
 self.qsci_api = os.path.isdir(self.qsci_api_dir)
 
-# The binary MacOS/X Qt installer defaults to XCode.  If this is what
-# we might have then use macx-clang.
+if opts.qmakespec is not None:
+self.qmake_spec = opts.qmakespec
+
 if sys.platform == 'darwin':
-if qt_config.QMAKE_SPEC == 'macx-xcode':
-# This will exist (and we can't check anyway).
-self.qmake_spec = 'macx-clang'
-else:
-# No need to explicitly name the default.
-self.qmake_spec = ''
+if opts.qmakespec is None:
+# The binary MacOS/X Qt installer defaults to XCode.  If this
+# is what we might have then use macx-clang.
+if qt_config.QMAKE_SPEC == 'macx-xcode':
+# This will exist (and we can't check anyway).
+self.qmake_spec = 'macx-clang'
 
 # See if it is a framework.
 if os.access(os.path.join(qt_config.QT_INSTALL_LIBS, 'QtCore.framework'), os.F_OK):
@@ -528,9 +529,6 @@
 if opts.pyuicinterpreter is not None:
 self.pyuic_interpreter = opts.pyuicinterpreter
 
-if opts.qmakespec is not None:
-self.qmake_spec = opts.qmakespec
-
 if opts.qsciapidir is not None:
 self.qsci_api_dir = opts.qsciapidir
 
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Installing PyQt 5 on Mac OS X (10.6.8 Snow Leopard)

2013-06-28 Thread Phil Thompson
On Fri, 28 Jun 2013 17:16:27 +0100, Phil Thompson
 wrote:
> On Fri, 28 Jun 2013 10:20:24 -0500, William Kyngesburye
>  wrote:
>> Though I see now what you mean by those lines in configure.py -
whatever
>> you give for --spec will be overridden by that 'darwin' if block.  And
> if
>> it isn't macx-xcode it defaults to whatever Qt5 was compiled with,
> probably
>> clang++.
> 
> The attached patch should fix it.

Sorry, that patch had slightly more in it than it should. This one is
better.

Phildiff -r e74dbc5074d0 lib/configure.py
--- a/lib/configure.py	Fri Jun 28 16:51:28 2013 +0100
+++ b/lib/configure.py	Fri Jun 28 17:12:11 2013 +0100
@@ -473,9 +473,11 @@
 self.qsci_api_dir = os.path.join(qt_config.QT_INSTALL_DATA, 'qsci')
 self.qsci_api = os.path.isdir(self.qsci_api_dir)
 
-# The binary MacOS/X Qt installer defaults to XCode.  If this is what
-# we might have then use macx-clang.
-if sys.platform == 'darwin':
+if opts.qmakespec is not None:
+self.qmake_spec = opts.qmakespec
+elif sys.platform == 'darwin':
+# The binary MacOS/X Qt installer defaults to XCode.  If this is
+# what we might have then use macx-clang.
 if qt_config.QMAKE_SPEC == 'macx-xcode':
 # This will exist (and we can't check anyway).
 self.qmake_spec = 'macx-clang'
@@ -528,9 +530,6 @@
 if opts.pyuicinterpreter is not None:
 self.pyuic_interpreter = opts.pyuicinterpreter
 
-if opts.qmakespec is not None:
-self.qmake_spec = opts.qmakespec
-
 if opts.qsciapidir is not None:
 self.qsci_api_dir = opts.qsciapidir
 
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Installing PyQt 5 on Mac OS X (10.6.8 Snow Leopard)

2013-06-28 Thread Phil Thompson
On Fri, 28 Jun 2013 10:20:24 -0500, William Kyngesburye
 wrote:
> Though I see now what you mean by those lines in configure.py - whatever
> you give for --spec will be overridden by that 'darwin' if block.  And
if
> it isn't macx-xcode it defaults to whatever Qt5 was compiled with,
probably
> clang++.

The attached patch should fix it.

Phildiff -r e74dbc5074d0 Makefile
--- a/Makefile	Fri Jun 28 16:51:28 2013 +0100
+++ b/Makefile	Fri Jun 28 17:12:11 2013 +0100
@@ -50,7 +50,7 @@
 	@SIPBIN=$(MYSIPBIN) ./build.py prepare
 
 config:
-	(cd PyQt && $(MYPYTHONBIN) configure.py --confirm-license --qmake=$(QT_QMAKE) --sip=$(MYSIPBIN) -c -j$(PARTS) --debug)
+	(cd PyQt && $(MYPYTHONBIN) configure.py --confirm-license --qmake=$(QT_QMAKE) --sip=$(MYSIPBIN) -c -j$(PARTS) --debug --spec macx-llvm)
 
 config-consolidated:
 	(cd PyQt && $(MYPYTHONBIN) configure.py --confirm-license --qmake=$(QT_QMAKE) --sip=$(MYSIPBIN) -c -j$(PARTS) --consolidate)
diff -r e74dbc5074d0 lib/configure.py
--- a/lib/configure.py	Fri Jun 28 16:51:28 2013 +0100
+++ b/lib/configure.py	Fri Jun 28 17:12:11 2013 +0100
@@ -473,9 +473,11 @@
 self.qsci_api_dir = os.path.join(qt_config.QT_INSTALL_DATA, 'qsci')
 self.qsci_api = os.path.isdir(self.qsci_api_dir)
 
-# The binary MacOS/X Qt installer defaults to XCode.  If this is what
-# we might have then use macx-clang.
-if sys.platform == 'darwin':
+if opts.qmakespec is not None:
+self.qmake_spec = opts.qmakespec
+elif sys.platform == 'darwin':
+# The binary MacOS/X Qt installer defaults to XCode.  If this is
+# what we might have then use macx-clang.
 if qt_config.QMAKE_SPEC == 'macx-xcode':
 # This will exist (and we can't check anyway).
 self.qmake_spec = 'macx-clang'
@@ -528,9 +530,6 @@
 if opts.pyuicinterpreter is not None:
 self.pyuic_interpreter = opts.pyuicinterpreter
 
-if opts.qmakespec is not None:
-self.qmake_spec = opts.qmakespec
-
 if opts.qsciapidir is not None:
 self.qsci_api_dir = opts.qsciapidir
 
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Status of QSound in PyQt5

2013-06-28 Thread Phil Thompson
On Fri, 28 Jun 2013 16:02:55 +0200, Vincent Vande Vyvre
 wrote:
> Hi,
> 
> In Qt5, the class QSound was moved from the module QtGui to the module 
> QtMultimedia.
> 
> QSound is not present in PyQt5, is it no longer supported or just missed
?

It's in the current snapshot. In fact the current snapshot fully
implements QtMultimedia and QtMultimediaWidgets. I'm just in the process of
porting the camera example (seems to work fine).

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Drawing on a QFrame

2013-06-28 Thread Phil Thompson
On Fri, 28 Jun 2013 15:35:20 +1000, Phil  wrote:
> Thank you for reading this.
> 
> I'd like to draw on a QFrame.
> 
> The following does draw a line but not on the frame, instead the line is

> drawn on the main window.
> 
> I've done this years ago with Qt and C++ but I don't remember how I did
it.
> 
> class DrawTest(QtGui.QMainWindow):
>  def __init__(self, parent=None):
>  super(DrawTest, self).__init__(parent)
>  self.ui = Ui_MainWindow()
>  self.ui.setupUi(self)
>  frame = QtGui.QFrame()
> 
>  def paintEvent(frame, event):
>  qp = QtGui.QPainter()
>  qp.begin(frame)
>  pen = QtGui.QPen(QtCore.Qt.yellow, 4)
>  qp.setPen(pen)
>  frame.drawLine(event, qp)
>  qp.end()
> 
>  def drawLine(frame, event, qp):
>  qp.drawLine(10, 10, 30, 30)

Sub-class the frame and reimplement its paintEvent(). Also make sure the
frame isn't being garbage collected (like it is above) and add it to the
GUI somewhere.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Installing PyQt 5 on Mac OS X (10.6.8 Snow Leopard)

2013-06-28 Thread Phil Thompson
On Thu, 27 Jun 2013 18:59:26 -0500, William Kyngesburye
 wrote:
> PyQt should be picking the spec from SIP (unless PyQt 5 changed that). 
> You can specify the spec when compiling SIP with the option:
> 
> -p macx-g++
> 
> if that doesn't work when compiling PyQt, try:
> 
> -p macx-llvm
> 
> It's odd though, even on OS X 10.7, I get macx-g++ as the default for
SIP.
> 
> If PyQt 5 ignores SIP for the spec, maybe there's a similar option when
> compiling PyQt 5 to set the spec.

It's --spec

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] If directive for declaring a function for different SIP versions

2013-06-26 Thread Phil Thompson
On Wed, 26 Jun 2013 16:16:41 -0400, Forest Yang 
wrote:
> Hi,
> 
>  I have one function to wrap, and want it to work with both sip 4.10 and
> 4.13,
> There is a KeywordArgs on it. It seems from 4.10 to 4.13 there are some
> changes
> from /KeywordArgs/ to /KeywordArgs="Optional"/.

But the old form should still work - it was deprecated, not removed.

> I hope I can use %if, like the following:
> 
> %if (- SIP_4_13)
> void foo(...) /KeywordArgs/;
> %End
> %if (SIP_4_13_2 -)
> void foo(..) /KeywordArgs="Optional"/;
> %End
> %MethodCode
> .
> %End.
> 
> 
> But sip complains about the syntax error at line "%MethodCode". I am
using
> sip_4_13_2.

You have to duplicate the %MethodCode in each of the %If blocks.

Phil
___
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 Phil Thompson
On Tue, 25 Jun 2013 20:46:57 +0530, Shriramana Sharma 
wrote:
> On Tue, Jun 25, 2013 at 8:19 PM, Phil Thompson
>  wrote:
>> The code generator is the same for all Python versions.
> 
> Hi thanks for this quick [as always! :-)] reply!
> 
> So then it seems to me that the packaging should be changed. Currently
> the sip4 source package (http://packages.debian.org/source/sid/sip4)
> produces these binary packages:
> 
> python-sip: runtime library
> python-sip-dbg: runtime library (debug extension)
> python-sip-dev: development files
> python-sip-doc: documentation
> python3-sip: runtime library
> python3-sip-dbg: runtime library (debug extension)
> python3-sip-dev: development files
> 
> It would seem that the common code generator should be moved to
> python-sip-dev-common and python-sip-dev and python3-sip-dev should
> both depend on it. python-sip-doc should also be moved to
> python-sip-doc-common.
> 
> Does that sound about right? If OK, I can file a Debian bug for this.

I don't care - nothing to do with me.

Phil
___
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 Phil Thompson
On Tue, 25 Jun 2013 20:16:35 +0530, Shriramana Sharma 
wrote:
> I'm trying to build PyQt5 for Py3 on Kubuntu Raring. However I got the
> error that Sip was not found:
> 
> This is the GPL version of PyQt 5.0 (licensed under the GNU General
Public
> License) for Python 3.3.1 on linux.
> ...
> Found the license file pyqt-gpl.sip.
> Error: Make sure you have a working sip on your PATH or use the --sip
> argument
> to explicitly specify a working sip.
> 
> Then I went and installed the python3-sip-dev package which is
> supposed to "contains the code generator tool and the development
> headers needed to develop Python 3 bindings with sip" (from the
> package description) but even then I get the same error.
> 
> Comparing the Python2 Sip package filelist:
> http://packages.ubuntu.com/raring/amd64/python-sip-dev/filelist with
> the Python3 Sip package filelist
> http://packages.ubuntu.com/raring/amd64/python3-sip-dev/filelist, I
> note that there is a /usr/bin/sip in the python-sip-dev package but no
> similar file in the python3-sip-dev package. Is this then a packaging
> error and should I report it as such? (Even the upstream Debian Sid
> packages have the same situation.) Or is Sip the same for both Py2 and
> Py3 in which case I should install python-sip-dev even for Py3?

The code generator is the same for all Python versions.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Installing PyQt 5 on Mac OS X (10.6.8 Snow Leopard)

2013-06-25 Thread Phil Thompson
On Tue, 25 Jun 2013 15:36:59 +0100, Anzir Boodoo 
wrote:
> Hello,
> 
> I've been trying to install PyQt 5 on Mac OS X 10.6.8, and got the
> following output (the first line being the Terminal command):
> 
>> Anzir-Boodoos-MacBook-Pro-2:PyQt-gpl-5.0 pbadmin$ python configure.py
>> --verbose
>> Querying qmake about your Qt installation...
>> An internal error occured.  Please report all the output from the
>> program,
>> including the following traceback, to supp...@riverbankcomputing.com.
>> Traceback (most recent call last):
>>   File "configure.py", line 2409, in 
>> main(sys.argv)
>>   File "configure.py", line 2366, in main
>> target_config.get_qt_configuration(opts)
>>   File "configure.py", line 484, in get_qt_configuration
>> if qt_config.QMAKE_SPEC == 'macx-xcode':
>> AttributeError: TargetQtConfiguration instance has no attribute
>> 'QMAKE_SPEC'
> 
> I had a look at configure.py, and notice the line in question seems to
be
> from here:
> 
>> # The binary MacOS/X Qt installer defaults to XCode.  If this
is
>> what
>> # we might have then use macx-clang.
>> if sys.platform == 'darwin':
>> if qt_config.QMAKE_SPEC == 'macx-xcode':
>> # This will exist (and we can't check anyway).
>> self.qmake_spec = 'macx-clang'
>> else:
>> # No need to explicitly name the default.
>> self.qmake_spec = ''
>> 
>> # See if it is a framework.
>> if os.access(os.path.join(qt_config.QT_INSTALL_LIBS,
>> 'QtCore.framework'), os.F_OK):
>> self.qt_framework = True
> 
> 
> I'm by no means a Python expert (I'm at the beginning of learning Qt,
> certainly), but qt_config.QMAKE_SPEC doesn't seem to be defined anywhere
> here (I may be completely wrong, but that appears to be where
configure.py
> is failing).
> 
> Can anyone tell me where I might have gone wrong and what I'd need to do
> to get PyQt 5 installed?

Use the --qmake flag to point to Qt5's qmake. You are probably defaulting
to Qt4's.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] PyQt5 installation

2013-06-24 Thread Phil Thompson
On Mon, 24 Jun 2013 19:09:01 +0200, Detlev Offenbach
 wrote:
> Hello,
> 
> I just installed PyQt5 from source on openSUSE and 
> noticed, that the pyuic5 executable (script) didn't get 
> installed with executable rights. Did I do anything wrong?

No, it's a Linux specific bug. I was trying to avoid a warning message
when stripping a shell script.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] ANN: PyQtChart v1.3 Released

2013-06-24 Thread Phil Thompson
PyQtChart v1.3 has been released. This supports the new features of Qt
Charts v1.3.0. See...

http://blog.qt.digia.com/blog/2013/06/19/qt-charts-1-3-0-released-2/

It can be built against PyQt4 and PyQt5.

Phil
___
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 Phil Thompson
On Sun, 23 Jun 2013 13:53:59 +0400, Dmitry Shachnev 
wrote:
> 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.

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)?

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] QRegularExpression missing from PyQt4

2013-06-23 Thread Phil Thompson
On Sun, 23 Jun 2013 10:31:23 +0200, Detlev Offenbach
 wrote:
> Hello,
> 
> I think, that the new Qt5 regular expression class 
> QRegularExpression and it's companions are missing from 
> PyQt4 (at least dir(PyQt4.QtCore) didn't show them). Can 
> these be added?

I'm not including new Qt5 things in PyQt4.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Strange observation

2013-06-21 Thread Phil Thompson
On Fri, 21 Jun 2013 18:54:15 +0200, Detlev Offenbach
 wrote:
> Hello,
> 
> there was a strange observation reported using eric5. The eric5 PySvn 
> plug-in has a dialog to ask the user for a password. This is embedded in

> code like this
> 
> cursor = QApplication.overrideCursor()
> if cursor is not None:
> QApplication.restoreOverrideCursor()
> 
> if cursor is not None:
> QApplication.setOverrideCursor(cursor)
> 
> Every now and than this code fails with
> : 
> wrapped C/C++ object of type QCursor has been deleted
> 
> What is wrong with my code?

Probably...

overrideCursor() returns a pointer to an internal copy of the cursor. This
is deleted by restoreOverrideCursor().

Before calling restoreOverrideCursor() make a copy...

cursor = QCursor(cursor)

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] QImage memory leak in 4.10.1

2013-06-21 Thread Phil Thompson
On Tue, 18 Jun 2013 19:14:35 -0400, Luke Campagnola
 wrote:
> On Fri, May 24, 2013 at 1:42 PM, Phil Thompson
> wrote:
> 
>> On Thu, 23 May 2013 16:21:26 -0400, Luke Campagnola
>>  wrote:
>> > Howdy,
>> > I am using PyQt 4.10.1 (Py2.7-qt4.8.4-x32) on windows XP. It appears
>> that
>> > on this system, QImage(sip.voidptr, int, int, format) increases the
>> > reference count to the image data object, but does not decrease the
>> > refcount after the QImage is collected. Here's an example session,
>> > where
>> I
>> > am generating a QImage from a numpy array:
>> >
>> >>>> from PyQt4 import QtGui
>> >>>> import ctypes, weakref, sys
>> >>>> import numpy as np
>> >>>> data = np.zeros((100,100,4), dtype=np.ubyte)
>> >>>> addr = ctypes.c_char.from_buffer(data,0)
>> >>>> sys.getrefcount(addr)
>> > 2
>> >>>> img = QtGui.QImage(addr, 100, 100, QtGui.QImage.Format_ARGB32)
>> >>>> sys.getrefcount(addr)   # QImage added 1 to reference count
>> > 3
>> >>>> import weakref
>> >>>> ref = weakref.ref(img)
>> >>>> del img
>> >>>> ref
>> >   # QImage was collected
>> >>>> sys.getrefcount(addr)  # but refcount is still 3
>> > 3
>> >
>> >
>> > Can anyone recommend a good way to convert from ndarray to QImage
>> > (preferrably without incurring any memory copy) ?
>>
>> Using either a sip.voidptr or a string seems to work fine for me with
>> current snapshots.
>>
> 
> Thanks, Phil. I'd like to revisit this (as well as an older, related
> question) a bit since we're still having trouble with them. I've boiled
the
> problem down a bit more and it appears entirely within sip.voidptr (or
my
> usage of sip.voidptr). First, the control, running under 4.9.3:
> 
> import sip, numpy, gc
> arr = numpy.zeros(1, dtype=numpy.ubyte)
> ptr = sip.voidptr(arr.ctypes.data)
> del arr, ptr
> gc.collect()
> 
> 
> This code runs as expected. Note that the argument to sip.voidptr is an
> integer, the memory address of the array data.
> Now the trouble, running under 4.10.2:
> 
> import sip, numpy, gc
> arr = numpy.zeros(1, dtype=numpy.ubyte)
> ptr = sip.voidptr(arr)
> del arr, ptr
> gc.collect()
> 
> 
> This code leaks the 100MB array. If I inspect with sys.getrefcount, I
see
> that the array has picked up some extra counts that were not removed
after
> the voidptr is deleted. Note also that the argument to sip.voidptr here
is
> the numpy array itself. If I try passing an integer to sip.voidptr under
> 4.10.2, I get the error "TypeError: a single integer, Capsule, CObject,
> None, buffer protocol implementor or another sip.voidptr object is
> required". Likewise, I get the same error if I pass the array directly
to
> sip.voidptr under 4.9.3.
> 
> So I have two questions about this code:
> 
> 1) Is there some way to avoid the memory leak in 4.10.2?
> 2) Can you tell me when the API change to sip.voidptr occurred?
> 
> Thanks very much! I really appreciate the effort and support you have
put
> into this project.

The attached SIP patch should fix the reference count bug.

If you still have a problem converting an int to a sip.voidptr then I need
a test that demonstrates the problem.

Phildiff -r 6e6cc6c60a36 siplib/voidptr.c
--- a/siplib/voidptr.c	Sun Jun 16 13:58:09 2013 +0100
+++ b/siplib/voidptr.c	Fri Jun 21 10:50:42 2013 +0100
@@ -986,6 +986,8 @@
 ptr = view.buf;
 size = view.len;
 rw = !view.readonly;
+
+PyBuffer_Release(&view);
 }
 #endif
 #if PY_VERSION_HEX < 0x0300
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] ANN: SIP v4.14.7 Released

2013-06-18 Thread Phil Thompson
On Tue, 18 Jun 2013 16:40:25 -0400, Scott Kitterman 
wrote:
> On Monday, June 17, 2013 10:13:32 AM Phil Thompson wrote:
>> SIP v4.14.7 has been released. This is a minor functional release but
is
>> required by PyQt v5.
> 
> It would be nice if new SIP versions that introduce a new major API
> version 
> number weren't described as a "minor functional release".  It seems to
me
> that 
> incompatible API changes are rather more than that.

They are not incompatible API changes, they are incompatible ABI changes -
an implementation detail.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Custom widgets in Qt5

2013-06-18 Thread Phil Thompson
On Tue, 18 Jun 2013 08:15:44 +0200, Vincent Vande Vyvre
 wrote:
> Le 06/06/2013 12:52, Vincent Vande Vyvre a écrit :
>> Le 05/06/2013 23:13, Phil Thompson a écrit :
>>> In PyQt5 the plugin is called libpyqt5.so. Which directory it goes in 
>>> depends on how your Qt5 installation is configured. Phil 
>> I don't know why but the Makefile was not created in 
>> .../PyQt-gpl-5.0-snapshot-cdc78cf84e0d/designer/
>>
>> So, I've re-run the configure.py and the make and make install only 
>> for the designer.
>>
>> Now the lib libpyqt5.so is in 
>> /usr/lib/Qt5.0.2/5.0.2/gcc_64/plugins/designer/ but the Designer crash 
>> at launching with any of my custom widgets and also with the 
>> geolocationwidget example provided here:
>> http://doc.qt.digia.com/qq/qq26-pyqtdesigner.html
>>
>> I've tried all my widgets separately, this is the feedback of the
command
>>

>> vincent@djoliba:~$ /usr/lib/Qt5.0.2/5.0.2/gcc_64/bin/designer
>> QMetaType::registerType: Binary compatibility break -- Size mismatch 
>> for type 'QPaintBufferCacheEntry' [1024]. Previously registered size 
>> 16, now registering size 0.
>> Abandon (core dumped)
>>

>> ...
>>
>>
> 
> Same problem with the latest release, the Designer crash at launching 
> with any custom widget.
> 
> Vincent

Mine work fine for me, without (as far as I can remember) needing any
changes. Sounds like you might have a Qt build problem.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] ANN: PyQt v5.0 Released

2013-06-17 Thread Phil Thompson
On Mon, 17 Jun 2013 08:46:45 -0700 (PDT), ruidc  wrote:
> Congrats and thanks,
> will there be windows binaries for Py2.7 coming to sourceforge?

No. Apart from wanting to limit the number of installers (and to encourage
people to move the Py3), there is an issue building ICU with MSVC 2008.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] ANN: PyQt v5.0 Released

2013-06-17 Thread Phil Thompson
PyQt v5.0 has been released. This supports Qt v5 and requires Python v2.6
or later.

Any parts of the At v5 API marked as deprecated or obsolete are not
supported.

Future versions will add support for new modules introduced with Qt v5.

Windows installers are provided for Python v3.3. Unfortunately these
cannot co-exist with the PyQt4 installers.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] ANN: PyQt v4.10.2 Released

2013-06-17 Thread Phil Thompson
PyQt v4.10.2 has been released. This is a minor bug fix release.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] ANN: PyQtChart v1.2.1 Released

2013-06-17 Thread Phil Thompson
PyQtChart v1.2.1 has been released. This adds support for PyQt v5.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] ANN: SIP v4.14.7 Released

2013-06-17 Thread Phil Thompson
SIP v4.14.7 has been released. This is a minor functional release but is
required by PyQt v5.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] PyQt5 Snapshot, build problems and their solutions, Windows, mingw

2013-06-12 Thread Phil Thompson
On Sun, 12 May 2013 22:42:23 +0200, mathias.b...@gmx.de wrote:
> Hi,
> 
> I've compiled the latest PyQt5 snaphot, on 32bit python 3.3.1 (compiled
> with mingw, using a self-made
> build script based on scons), Windows7, Qt 5.1alpha.
> 
> I've used this configuration step:
> 
> D:\_cpp_projects_\Python\Python-3.3.1\.build_release\python.exe
> configure.py --no-docstrings --confirm-license -u --spec=win32-g++
> --verbose --trace --sip="D:\_cpp_projects_\Python\Python-3.3.1\sip.exe"
> LFLAGS+="-LD:\_cpp_projects_\Python\Python-3.3.1\.build_debug
> -LD:\_cpp_projects_\Python\Python-3.3.1\.build_release" DEFINES+=_DEBUG
> 
> (It's necessary to include the release version of the python lib even in
> debug build for the designer
> plugins.)
> 
> I've run into a number of problems:
> 
> (1)
> PyQt's configure.py autoamtically assumes certain MS-compilers on the
> win32 platform, in
> TargetConfiguration.__init__():262 and following:
> 
> # The default qmake spec.
> if sys.platform == 'win32':
> if self.py_version >= 0x030300:
> #self.qmake_spec = 'win32-msvc2010'
> self.qmake_spec = 'win32-g++'
> elif self.py_version >= 0x020600:
> self.qmake_spec = 'win32-msvc2008'
> elif self.py_version >= 0x020400:
> self.qmake_spec = 'win32-msvc.net'
> else:
> self.qmake_spec = 'win32-msvc'
> else:
> # Use the Qt default.  (We may update it for MacOS/X later.)
> self.qmake_spec = ''
> 
> I had to make the marked change to get around that for my mingw-based
> python. It would be nice
> if there was an option to influence that.

I don't understand why this is needed. Using the --spec option should do
that.

> [Motivation: I must embedd the python interpreter, and I want to get
away
> from MS Visual Studio,
> because it is becoming slower with each version. Hence I'll have to
> compile python myself using
> mingw, which is non-standard.]
> 
> 
> (2)
> All makefiles attempt to build all DLLs without referring to the python
> DLL. Adding
> "-lpython33_d" to each Makefile.Debug and "-lpython33" to
Makefile.Release
> solves this.
> 
> I tried adding LFLAGS_DEBUG+="-lpython33_d" as parameter to the
configure
> script, but it had
> no effect on the makefiles.
> 
> (3)
> The final debugging versions of the DLLs get the wrong names. They all
> miss the trailing "_d".
> This way they can't be imported, unless manually renamed arcordingly.

Try tonight's snapshot.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] How to test sip version

2013-06-11 Thread Phil Thompson
On Tue, 11 Jun 2013 16:04:15 +0200, Sébastien Petitdemange
 wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> On 06/11/2013 03:31 PM, Phil Thompson wrote:
>> On Tue, 11 Jun 2013 14:42:55 +0200, Sébastien Petitdemange 
>>  wrote:
>>> -BEGIN PGP SIGNED MESSAGE- Hash: SHA1
>>> 
>>> On 06/11/2013 10:27 AM, Phil Thompson wrote:
>>>> On Tue, 11 Jun 2013 10:04:31 +0200, Sébastien Petitdemange 
>>>>  wrote:
>>>>> -BEGIN PGP SIGNED MESSAGE- Hash: SHA1
>>>>> 
>>>>> Hi list,
>>>>> 
>>>>> I need to have sip file compatible with != sip version
>>>>> (starting at
>>>> 4.10)
>>>>> What is the best way to archive that?
>>>> 
>>>> If you are talking about SIP directives, ie. you want to use
>>>> %If, and
>> you
>>>> need to support versions as old as that, then you need to
>>>> implement something yourself. You could define a %Timeline for
>>>> the SIP versions
>> and
>>>> pass the right -t argument to sip after you have detected which
>>>> version if sip you are using.
>>>> 
>>>> Starting with SIP v4.12 this is done for you.
>>>> 
>>>> Phil
>>>> 
>>> Hi Phil,
>>> 
>>> Thanks for your quick reply.
>>> 
>>> So if my sip file are compatible with directives of sip v4.12,
>>> they will stay compatible with sip version >= v4.12. Is that
>>> correct or I misunderstood?
>> 
>> That's correct, but it's true of any version - sip tries to
>> maintain backwards compatibility.
>> 
>> Phil
>> 
> 
> 
> Hi Phil,
> 
> I completely agree with you. I know that you always try to keep
> backward compatibility.
> 
> You said in the previous email:
> "Starting with SIP v4.12 this is done for you"
> 
> Apparently, I misunderstood your remark. What is done for me?

The creation of a timeline corresponding to the different SIP versions so
that you can just do...

%If (SIP_4_13_1 - SIP_4_14_2)

...see the %Timeline documentation.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] How to test sip version

2013-06-11 Thread Phil Thompson
On Tue, 11 Jun 2013 14:42:55 +0200, Sébastien Petitdemange
 wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> On 06/11/2013 10:27 AM, Phil Thompson wrote:
>> On Tue, 11 Jun 2013 10:04:31 +0200, Sébastien Petitdemange
>>  wrote:
>>> -BEGIN PGP SIGNED MESSAGE-
>>> Hash: SHA1
>>>
>>> Hi list,
>>>
>>> I need to have sip file compatible with != sip version (starting at
>> 4.10)
>>> What is the best way to archive that?
>> 
>> If you are talking about SIP directives, ie. you want to use %If, and
you
>> need to support versions as old as that, then you need to implement
>> something yourself. You could define a %Timeline for the SIP versions
and
>> pass the right -t argument to sip after you have detected which version
>> if
>> sip you are using.
>> 
>> Starting with SIP v4.12 this is done for you.
>> 
>> Phil
>> 
> Hi Phil,
> 
> Thanks for your quick reply.
> 
> So if my sip file are compatible with directives of sip v4.12, they will
> stay compatible with sip version >= v4.12.
> Is that correct or I misunderstood?

That's correct, but it's true of any version - sip tries to maintain
backwards compatibility.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] How to test sip version

2013-06-11 Thread Phil Thompson
On Tue, 11 Jun 2013 10:04:31 +0200, Sébastien Petitdemange
 wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> Hi list,
> 
> I need to have sip file compatible with != sip version (starting at
4.10)
> What is the best way to archive that?

If you are talking about SIP directives, ie. you want to use %If, and you
need to support versions as old as that, then you need to implement
something yourself. You could define a %Timeline for the SIP versions and
pass the right -t argument to sip after you have detected which version if
sip you are using.

Starting with SIP v4.12 this is done for you.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Update on PyQt5 Status

2013-06-10 Thread Phil Thompson
On Mon, 10 Jun 2013 09:22:12 +0100, Brendan Donegan
 wrote:
> On 09/06/13 08:24, Phil Thompson wrote:
>> The current PyQt5 snapshot now has a stable API - what is currently
>> implemented is what will be in v5.0.
> 
> Out of curiousity will this include the QtQml module?

No. That will be in 5.0.1 or 5.0.2.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] Update on PyQt5 Status

2013-06-09 Thread Phil Thompson
The current PyQt5 snapshot now has a stable API - what is currently
implemented is what will be in v5.0.

You will need a current SIP snapshot - which means you will have to
re-build PyQt4.

The remaining work is to resolve any outstanding platform build issues and
to do some documentation. I hope to make a release in the next two weeks.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] QTextBlockUserData forgotten in SIP 4.14.3, bug?

2013-06-08 Thread Phil Thompson
On Sat, 8 Jun 2013 18:35:56 +0200, Olivier Keshavjee
 wrote:
> Hello,
> 
> I've seen that two months ago (
> http://www.riverbankcomputing.com/pipermail/pyqt/2013-March/032458.html)
a
> bug in PyQt caused QTextBlockUserData objects to be destroyed. This was
> announced to be fixed.
> 
> Yet I still experience the same behaviour. When using the following
syntax
> highlighter:
> 
> class DummyHighlighter(QSyntaxHighlighter):
>>
>>
>>  def __init__(self, parent):
>>
>> QSyntaxHighlighter.__init__(self, parent)
>>
>>
>>  def highlightBlock(self, text):
>>
>> data = self.currentBlockUserData()
>>
>> if not data: data = DummyTextBlockUserData()
>>
>> print(data.isValid()) # AttributeError here, see below
>>
>> self.setCurrentBlockUserData(data)
>>
>>
>>
>> class DummyTextBlockUserData(QTextBlockUserData):
>>
>>
>>  def __init__(self):
>>
>> QTextBlockUserData.__init__(self)
>>
>>
>>  def isValid(self):
>>
>> return True
>>
> 
> I get the following error:
> 
> Traceback (most recent call last):
>> File "highlighter.py", line 20, in highlightBlock
>> print(data.isValid())
>> AttributeError: 'QTextBlockUserData' object has no attribute 'isValid'
>>
> 
> This is using:
> 
>- PyQt 4.10.1
>- SIP 4.14.6
>- Python 2.7.4
> 
> Is it still a bug?

Difficult to say without a short, complete example that demonstrates the
problem.

The user data is correctly owned by the QTextDocument that the highlighter
is operating on. However there may not be a reference to the document in
your application - particularly if you created the highlighter by passing a
QTextEdit to its ctor.

I'll make a change in tonight's snapshot to address that.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] PyQt / SIP from an embedded Python interpreter

2013-06-08 Thread Phil Thompson
On Fri, 7 Jun 2013 23:44:17 +0200, Johan Thelin
 wrote:
> Hi,
> 
> I've been experimenting with using PyQt and SIP from a Python
> interpreter embedded into a larger C++ application. I do this on Linux
> (Kubuntu 13.04), Qt 5 and PyQt/SIP from last Wednesday (June 5th).
> This gives me an unresolved symbol, _Py_NoneStruct, when importing
> PyQt5.QtCore. However, adding -lpython2.7 to sip and QtCore, it works.
> I guess the import statement does a dlopen, and it fails to resolve
> the symbols, despite them being linked into my host application for
> some odd reason.
> 
> So, to the point. Am I doing something wrong here? Should things just
> work? I've tried the -Wl,-E and -rdynamic, which was what Google
> indicated could help. Alas, no luck with them.

You could look at how the Designer plugin is built as that is doing
something similar.

> If I'm not doing something wrong, do you want my patches to SIP and
PyQt5?

Always happy to consider patches.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] QApplication and datetime.strptime

2013-06-05 Thread Phil Thompson
On Wed, 5 Jun 2013 22:20:46 +0200, Michka Popoff 
wrote:
> Hi
> 
> I am extracting strings containing dates from some files in a pyqt app,
> and I want to use datetime.strptime to format them.
> 
> But this won't work as Qapplication seem to alter my locales. I found
this
> topic :
> 
>
http://stackoverflow.com/questions/14684513/datetime-strptime-doesnt-work-in-pyqt4-qtgui-qwidget-inherited-class
> 
> So if I use : os.putenv("LANG", "C"), it will indeed work.
> 
> My questions are the following :
> 
> - Why does PyQt change the locales ? Is there some documentation on this
I
> could read ?

PyQt does not change the locale. Qt may be another matter.

> More "pythonic" questions, but related to the problem :
> - Is it OK to use os.putenv on all platforms ? The python documentation
> says it is not always provided. (locale.setlocale is platform
dependent).
> Setting the value directly in os.environ may causes memory leaks on some
> platforms.
> - Are there some specific problems I could have if I use the "C" option
?
> What will be the influence on the pyqt app ?
> - Is there perhaps a known alternative to datetime.strptime, where I can
> define the locale temporarily or which works with pyqt ?
> 
> Thanks in advance
> 
> Michka Popoff

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Missing QVectorD Classes

2013-06-05 Thread Phil Thompson
On Tue, 4 Jun 2013 09:57:05 -0700, "Tzucker, Jay" 
wrote:
> I am using PyQt4 under Linux (CentOS) with the following versions:
> Qt: 4.6.2
> PytQt:4.6.2
> Python:2.6.6
> 
> The QVectorD  (ex. QVector3D) classes seem to be missing.
> I imported and looked thru the classes in QtGui where I expected them,
but
> didn't see them.
> 
> Any help would be much appreciated!
> Thanks
> Jay

You need PyQt v4.7 or later.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Custom widgets in Qt5

2013-06-05 Thread Phil Thompson
On Tue, 04 Jun 2013 12:24:26 +0200, Vincent Vande Vyvre
 wrote:
> Hi,
> 
> With PyQt4 I have this folder:
> /usr/lib/x86_64-linux-gnu/qt4/plugins/designer/
> wich content the lib libpythonplugin.so and a subfolder python for my 
> custom widgets.
> 
> Now, I've just installed Qt5 and the latest snapshots of SIP and PyQt5 
> and I'm looking whee can I copy my own widgets.
> I've found a folder:
> /usr/lib/Qt5.0.2/5.0.2/gcc_64/plugins/designer
> but without the lib libpythonplugin.so, I presume this lib is needed for

> the widgets written in Python.
> 
> So, it's an other place for theses plugins or it's not already supported

> in PyQt5 ?

In PyQt5 the plugin is called libpyqt5.so. Which directory it goes in
depends on how your Qt5 installation is configured.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Bug: PyQt5.uic.loadUi() attempts to set non-existing property

2013-06-02 Thread Phil Thompson
On Sun, 2 Jun 2013 19:28:42 +0200, mathias.b...@gmx.de wrote:
> Hi,
> 
> There appears to be an error in the loading of .ui files in PyQt5.
> Please try the attached example.
> 
> Error message:
> 
> Traceback (most recent call last):
>   File "D:\eclipse.workspace\py_tests\src\uic_bug.py", line 15, in

> window = LogWindow()
>   File "D:\eclipse.workspace\py_tests\src\uic_bug.py", line 8, in
__init__
> PyQt5.uic.loadUi(os.path.join(os.path.dirname(__file__),
> 'log_window.ui'), self)
>   File
>  
"D:\_cpp_projects_\Python\Python-3.3.1\lib\site-packages\PyQt5\uic\__init__.py",
>   line 224, in loadUi
> return DynamicUILoader(package).loadUi(uifile, baseinstance,
> resource_suffix)
>   File
>  
"D:\_cpp_projects_\Python\Python-3.3.1\lib\site-packages\PyQt5\uic\Loader\loader.py",
>   line 72, in loadUi
> return self.parse(filename, resource_suffix, basedir)
>   File
>  
"D:\_cpp_projects_\Python\Python-3.3.1\lib\site-packages\PyQt5\uic\uiparser.py",
>   line 931, in parse
> actor(elem)
>   File
>  
"D:\_cpp_projects_\Python\Python-3.3.1\lib\site-packages\PyQt5\uic\uiparser.py",
>   line 756, in createUserInterface
> self.traverseWidgetTree(elem)
>   File
>  
"D:\_cpp_projects_\Python\Python-3.3.1\lib\site-packages\PyQt5\uic\uiparser.py",
>   line 734, in traverseWidgetTree
> handler(self, child)
>   File
>  
"D:\_cpp_projects_\Python\Python-3.3.1\lib\site-packages\PyQt5\uic\uiparser.py",
>   line 444, in createLayout
> self.stack.push(self.setupObject(classname, parent, elem))
>   File
>  
"D:\_cpp_projects_\Python\Python-3.3.1\lib\site-packages\PyQt5\uic\uiparser.py",
>   line 161, in setupObject
> self.wprops.setProperties(obj, branch)
>   File
>  
"D:\_cpp_projects_\Python\Python-3.3.1\lib\site-packages\PyQt5\uic\properties.py",
>   line 415, in setProperties
> getattr(widget, "set%s%s" % (ascii_upper(prop_name[0]),
> prop_name[1:]))(prop_value)
> AttributeError: 'QHBoxLayout' object has no attribute 'setMargin'
> 
> 
> The log_window.ui instantiates a QHBoxLayout, with all margins set to
the
> same value. This makes
> the uic module try to set a "margin" property, which doesn't exist.
> Setting one of the margins (for example "leftMargin") to a different
value
> works.
> 
> Best Regards,
> Mathias Born

Already fixed in current snapshots I think.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Guaranteed avoidance of C++ destructor call

2013-05-31 Thread Phil Thompson
On Thu, 30 May 2013 23:27:04 +0100 (BST), John Lee  wrote:
> On Thu, 30 May 2013, Phil Thompson wrote:
> 
>> On Thu, 30 May 2013 22:49:24 +0100 (BST), John Lee 
wrote:
>>> Hi
>>>
>>> Is it possible to guarantee that a C++ destructor of a QObject wrapped
>>> by
>>> PyQt is never called?
> [...]
>>> If I can't guarantee that from PyQt, can I write a simple sip wrapper
>>> that
>>> will achieve the same end, without copying and pasting the Qt code?
>>
>> sip.setdestroyonexit() might do what you want.
> 
> Thanks, that sounds promising.  It does trigger some followup questions:
> 
> 
> If I call sip.setdestroyonexit(False) before I construct any QProcess 
> Python instances, can ~QProcess still be called for any reason, even if
I 
> ensure that:
> 
> 1. no Qt code deletes the C++ object, and
> 
> 2. my code does not call sip.delete(), and
> 
> 3. I create a module-global reference (my module) to the wrapping 
> QtCore.QProcess Python instance which I never explicitly unbind (but for

> all I know might get unbound by some part of the PyQt/sip/Python
shutdown 
> process)?

I would be surprised if the dtor was called in those circumstances.

> Other than the usual QObject parent/child hierarchy, are there any cases

> where Qt deletes things, that might surprise me?

Possible but unlikely.

> Since setdestroyonexit affects all cleanup and not only that of
QProcess: 
> Are there other notable side effects that you or others know of that I 
> might notice / be surprised by from calling sip.setdestroyonexit(False),

> as a result of the lack of the usual cleanup associated with particular
Qt 
> classses?  In other words, what cases are known / can be guessed at
where 
> my program might start causing a leak of OS resources like temporary 
> files, or badly terminated network connections, etc?

Calling it (which PyQt5 does automatically) makes a Python application
behave like a C++ one. So, potentially, it would suffer from the same
things - which of course would be application bugs.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Guaranteed avoidance of C++ destructor call

2013-05-30 Thread Phil Thompson
On Thu, 30 May 2013 22:49:24 +0100 (BST), John Lee  wrote:
> Hi
> 
> Is it possible to guarantee that a C++ destructor of a QObject wrapped
by 
> PyQt is never called?
> 
> In C++ code, I can just avoid ever deleting the QObject, by not giving
it 
> a QObject parent, so that Qt does not manage its lifetime.  In Python 
> code, it isn't obvious to me whether Python might cause the C++ d'tor to

> be called, for example during interpreter shutdown.
> 
> The particular case I'm interested in is ~QProcess, whose destructor has

> the interesting (!) behaviour of sending the KILL signal to any child 
> process that it may have started.  I want to ensure that my program 
> doesn't ever call that destructor, so that the KILL signal is guaranteed

> not to be sent (or at least, that it is only called after the child 
> process has terminated for other reasons).  Is that possible?
> 
> If I can't guarantee that from PyQt, can I write a simple sip wrapper
that 
> will achieve the same end, without copying and pasting the Qt code?

sip.setdestroyonexit() might do what you want.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] PyQt5 and the QtQuick module

2013-05-28 Thread Phil Thompson
On Tue, 28 May 2013 16:46:16 +0100, Brendan Donegan
 wrote:
> On 28/05/13 16:44, Phil Thompson wrote:
>> On Tue, 28 May 2013 14:18:20 +0100, Brendan Donegan
>>  wrote:
>>> Hi,
>>>
>>> I'm interested in using PyQt5 to implement an application I'm working
>>> on, as I want to use the Ubuntu Touch SDK and the Qml widgets it
>>> provides. I've tried building the snapshot of PyQt5 and noticed that
the
>>> QtDeclarative module does not get built. I understand now that this is
>>> due to the QtDeclarative module having been deprecated and sort of
>>> 'renamed' as QtQuick. What I'd like to know is if support for this
>>> module will be added soon to PyQt5. If necessary I'd be willing to add
>>> the support myself with a little guidance (depending on how
complicated
>>> it is).
>> 
>> It will be added after the release of PyQt 5.0.
>> 
>> Phil
>> 
> 
> Can you confirm when that will be?

No.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] PyQt5 and the QtQuick module

2013-05-28 Thread Phil Thompson
On Tue, 28 May 2013 14:18:20 +0100, Brendan Donegan
 wrote:
> Hi,
> 
> I'm interested in using PyQt5 to implement an application I'm working
> on, as I want to use the Ubuntu Touch SDK and the Qml widgets it
> provides. I've tried building the snapshot of PyQt5 and noticed that the
> QtDeclarative module does not get built. I understand now that this is
> due to the QtDeclarative module having been deprecated and sort of
> 'renamed' as QtQuick. What I'd like to know is if support for this
> module will be added soon to PyQt5. If necessary I'd be willing to add
> the support myself with a little guidance (depending on how complicated
> it is).

It will be added after the release of PyQt 5.0.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Build error with PyQt4 4.10 on Mac 10.7.5

2013-05-24 Thread Phil Thompson
On Fri, 24 May 2013 11:49:28 -0600, Larry Shaffer 
wrote:
> Hi Phil,
> 
> On Fri, May 24, 2013 at 10:34 AM, Phil Thompson
> > wrote:
> 
>> On Tue, 21 May 2013 11:12:59 -0600, Larry Shaffer
>> 
>> wrote:
>> > Hi Phil,
>> >
>> > On Fri, Apr 12, 2013 at 4:28 AM, Phil Thompson
>> > wrote:
>> >
>> >> On Thu, 11 Apr 2013 17:21:37 -0600, Larry Shaffer
>> >> 
>> >> wrote:
>> >> > Hi,
>> >> >
>> >> > Trying to get the latest PyQt4 4.10 to build but running into this
>> >> > error
>> >> > [0].
>> >> >
>> >> > Using sip 4.14.5, Qt 4.8.4 on Mac 10.7.5 with XCode 4.5.1's
default
>> >> > compiler (from command line).
>> >> >
>> >> > [0] http://pastebin.com/as5SkZMP
>> >>
>> >> You probably have a mismatch between the sip executable being used
to
>> >> generate the code and the sip.h that the generated code #includes.
>> >>
>> >
>> > Finally got back to this. Indeed the issue was a different header
being
>> > included. I had (evidently) accidentally installed sip 4.14.0 in the
>> > Mac
>> > System path before (I usually prefix to /usr/local).
>> >
>> > However, I did notice an issue when configuring/installing PyQt4,
where
>> it
>> > did not seems to honor the configured .sip dest dir.
>> >
>> > sip build configure:
>> > python2.7 configure.py -d /Library/Python/2.7/site-packages \
>> >   -b /usr/local/bin -e /usr/local/include -v /usr/local/share/sip
>> >
>> > PyQt4 build configure:
>> > python2.7 configure.py -d /Library/Python/2.7/site-packages \
>> >   -b /usr/local/bin -n /usr/local/Qt4.8/qsci
>> >
>> > The .sip files for PyQt4 were placed in:
>> >
/System/Library/Frameworks/Python.framework/Versions/2.7/share/sip/PyQt4
>> > not:
>> > /usr/local/share/sip/PyQt4
>> >
>> > specifically adding the following to the PyQt4 build configure line
>> worked:
>> > -v /usr/local/share/sip/PyQt4
>> >
>> > This was with both configure.py and configure-ng.py. Shouldn't the
.sip
>> > dest dir be picked up from sip as a default for building PyQt4?
>>
>> Works fine for me with configure.py. It's not supposed to work with
>> configure-ng.py because it doesn't use the sipconfig.py module.
>>
> 
> Are you saying the .sip dest dir is being picked up with sip installed
in
> /usr/local (as above), then compiling PyQt4, on a Mac?

Yes.

> Thanks for the explanation about configure-ng.py. Looks like
specifically
> setting the dest dir is the best approach, regardless of configure
method
> used.
> 
> Regards,
> 
> Larry

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] QImage memory leak in 4.10.1

2013-05-24 Thread Phil Thompson
On Thu, 23 May 2013 16:21:26 -0400, Luke Campagnola
 wrote:
> Howdy,
> I am using PyQt 4.10.1 (Py2.7-qt4.8.4-x32) on windows XP. It appears
that
> on this system, QImage(sip.voidptr, int, int, format) increases the
> reference count to the image data object, but does not decrease the
> refcount after the QImage is collected. Here's an example session, where
I
> am generating a QImage from a numpy array:
> 
 from PyQt4 import QtGui
 import ctypes, weakref, sys
 import numpy as np
 data = np.zeros((100,100,4), dtype=np.ubyte)
 addr = ctypes.c_char.from_buffer(data,0)
 sys.getrefcount(addr)
> 2
 img = QtGui.QImage(addr, 100, 100, QtGui.QImage.Format_ARGB32)
 sys.getrefcount(addr)   # QImage added 1 to reference count
> 3
 import weakref
 ref = weakref.ref(img)
 del img
 ref
>   # QImage was collected
 sys.getrefcount(addr)  # but refcount is still 3
> 3
> 
> 
> Can anyone recommend a good way to convert from ndarray to QImage
> (preferrably without incurring any memory copy) ?

Using either a sip.voidptr or a string seems to work fine for me with
current snapshots.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Old style signal/slot bug on win32

2013-05-24 Thread Phil Thompson
On Thu, 23 May 2013 10:27:28 +0200, Giuseppe Corbelli
 wrote:
> Hi all
> I've found a strange bug on win32 using PyQt old style signals.
> Sometimes I get a wrong result from QObject::receivers and the signal is

> "lost". Looks like a PyQt bug cause a similar C++ example works
correctly
> both 
> on Linux and Win32.
> Sidenotes:
> * changing the signature for every new CRS instance seems to workaround
> the bug
> * not deleting (keeping a reference) every new CRS instance seems to 
> workaround the bug
> * new style signals seem to work OK
> 
> Tested on:
> Python 2.7.3 (default, Mar  5 2013, 01:19:40) [GCC 4.7.2] on linux2
> PYQT_VERSION_STR='snapshot-4.10.2-d9c6e01fe9ce'
> QtCore.QT_VERSION_STR='4.8.2'
> Linux 3.3.5 #1 SMP/32bit
> 
> Python 2.7.3 (default, Dec 18 2012, 17:53:47) [MSC v.1500 32 bit
(Intel)]
> PYQT_VERSION_STR='4.9.6'
> QT_VERSION_STR='4.8.4'
> Windows 7/32bit and XP/32bit
> 
> As programs output I expect matching emit/receive logs and 1 single
> receiver.
> Attached python and c++ examples.
> Python program uses an "nexplode.txt" logfile in append mode, while C++
> uses 
> qDebug()

They work the same as far as I can tell - though it's difficult to see as
the outputs are different.

The programs themselves are too different to be a sensible comparison.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Build error with PyQt4 4.10 on Mac 10.7.5

2013-05-24 Thread Phil Thompson
On Tue, 21 May 2013 11:12:59 -0600, Larry Shaffer 
wrote:
> Hi Phil,
> 
> On Fri, Apr 12, 2013 at 4:28 AM, Phil Thompson
> wrote:
> 
>> On Thu, 11 Apr 2013 17:21:37 -0600, Larry Shaffer
>> 
>> wrote:
>> > Hi,
>> >
>> > Trying to get the latest PyQt4 4.10 to build but running into this
>> > error
>> > [0].
>> >
>> > Using sip 4.14.5, Qt 4.8.4 on Mac 10.7.5 with XCode 4.5.1's default
>> > compiler (from command line).
>> >
>> > [0] http://pastebin.com/as5SkZMP
>>
>> You probably have a mismatch between the sip executable being used to
>> generate the code and the sip.h that the generated code #includes.
>>
> 
> Finally got back to this. Indeed the issue was a different header being
> included. I had (evidently) accidentally installed sip 4.14.0 in the Mac
> System path before (I usually prefix to /usr/local).
> 
> However, I did notice an issue when configuring/installing PyQt4, where
it
> did not seems to honor the configured .sip dest dir.
> 
> sip build configure:
> python2.7 configure.py -d /Library/Python/2.7/site-packages \
>   -b /usr/local/bin -e /usr/local/include -v /usr/local/share/sip
> 
> PyQt4 build configure:
> python2.7 configure.py -d /Library/Python/2.7/site-packages \
>   -b /usr/local/bin -n /usr/local/Qt4.8/qsci
> 
> The .sip files for PyQt4 were placed in:
> /System/Library/Frameworks/Python.framework/Versions/2.7/share/sip/PyQt4
> not:
> /usr/local/share/sip/PyQt4
> 
> specifically adding the following to the PyQt4 build configure line
worked:
> -v /usr/local/share/sip/PyQt4
> 
> This was with both configure.py and configure-ng.py. Shouldn't the .sip
> dest dir be picked up from sip as a default for building PyQt4?

Works fine for me with configure.py. It's not supposed to work with
configure-ng.py because it doesn't use the sipconfig.py module.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] [Mac] PyQt5 and Qt5.1.0 beta 1 - NameError: global name 'QApplication' is not defined

2013-05-20 Thread Phil Thompson
On Mon, 20 May 2013 20:03:16 +0100, Chris Roebuck 
wrote:
> Using osx 10.8.3 I installed Qt5.1.0 beta1 using the binary installer,
then
> built sip 4.14.7 dev snapshot and PyQt5 against Qt5.1.0 beta1
> 
> Using python3 I'm getting the following error when I try to run this
simple
> script:
> 
> #!/usr/bin/env python
> from PyQt5.QtCore import *
> from PyQt5.QtGui import *
> from PyQt5.QtWebKit import *
> from PyQt5.QtNetwork import *
> 
> QApplication.instance()
> 
> 
> 
> NameError: name 'QApplication' is not defined
> 
> Any ideas what i'm missing?

from PyQt5.QtWidgets import QApplication

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] PyQt5 QtQuick 2.0 binding

2013-05-15 Thread Phil Thompson
On Wed, 15 May 2013 15:58:52 +0200, Wojciech Daniło
 wrote:
> Hi! Is PyQt5 working with QtQuick2.0?

No. The first release of PyQt5 will be the same as PyQt4 will all the
deprecated, obsolete stuff removed.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] PyQt5 installation problem

2013-05-15 Thread Phil Thompson
On Wed, 15 May 2013 15:36:51 +0200, Wojciech Daniło
 wrote:
> Thank you, using the latest snapshot it compiled successfully - sorry
for
> not testing it myself.
> But while installation I get next error ...:
> "strip:/usr/bin/pyuic5: File format not recognized"
> 
> full error stack:
> http://pastebin.com/jT28DQmW

Which, if you look at the message, is ignored.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] PyQt5 installation problem

2013-05-15 Thread Phil Thompson
On Wed, 15 May 2013 15:05:22 +0200, Wojciech Daniło
 wrote:
> Thank you! The problem was solved, but occured next one - while
compiling I
> get:
> "qpycore_post_init.cpp:46:26: error: 'sipSetDestroyOnExit' was not
declared
> in this scope"
> 
> full error stack can be found here:  http://pastebin.com/rKxmmERd .

Make sure you are using the current SIP snapshot.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] PyQt5 installation problem

2013-05-15 Thread Phil Thompson
On Wed, 15 May 2013 14:23:35 +0200, Wojciech Daniło
 wrote:
> Hi!
> When I'm trying to install PyQt5 I get an error: Error: PyQt5 requires
Qt
> v5.0 or later.
> 
> My Qt5.0.2 installation is in my $HOME/dev/Qt5.0.2 - how can I tell the
> configure script to search for it there?

Use the --qmake flag.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] General questions on parsing large QStrings

2013-05-13 Thread Phil Thompson
On Sun, 12 May 2013 22:12:00 -0700, David Cortesi 
wrote:
> Thanks to you and Mathias for the prompt replies.
> 
>  > docstring = unicode( myEditor.toPlainText() )
>> In PyQt5 toPlainText() will return a str object for Python3 and a
unicode
>> object for Python2.
>>
> 
> And, as Mathias says, it is a copy?...
> That is not IMO a good design choice. At least if toPlainText
> returns a const QString reference, one can then use r/o QString
> methods like count(), contains(), indexOf etc, without penalty.
> Also one could provide it to a QRegExp, e.g.:
> 
> j = qre.indexIn( myEditor.toPlainText() )
> while j >= 0 :
> # ...do something with qre.cap(0)...
> j = qre.indexIn( myEditor.toPlainText() , j )
> 
> This is more or less the patther of a syntax highlighter
> as well as other possible applications -- and it
> would be a catastrophe with a large doc when every
> toPlainText call does a new memcopy.

Which is why you wouldn't do it, even in C++. You would use QTextDocument,
QSyntaxHighlighter etc.

> In short, I urge you to leave the conversion to Python str
> in the programmer's hands, e.g. via unicode() or str().
> 
> Or, find a way to support those "STL-style iterators"
> that are currently omitted...?

The behaviour you are anticipating (but not demonstrated) is a problem has
been the standard behaviour of Python3 and PyQt4 for 4 years without
anybody complaining.

If it proves that it is a real problem then I will re-introduce the
QString v1 API. As it won't be the default for any Python version, that can
be done without affect compatibility.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


  1   2   3   4   5   6   7   8   9   10   >