[PyQt] PyQt4 and Qt5

2012-12-21 Thread Detlev Offenbach
Hello Phil,

will you eventually provide Windows installers including Qt5 as well? If you 
will, will it be possible to install them in parallel, i.e. have PyQt4 with 
Qt4 and Qt5 available at the same time?

Regards,
Detlev
-- 
Detlev Offenbach
det...@die-offenbachs.de___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[PyQt] Issue with latest PyQt4 snapshot and Qt 5.0.0

2012-12-21 Thread Detlev Offenbach
Hello,

I built and installed Qt 5.0.0 myself on my openSUSE 12.2 machine. Everything 
compiled and installed fine. However, when I tried to configure the latest 
PyQt4 
snapshot with a command like

~/py3qt50env/bin/python configure.py -b ~/py3qt50env/bin/ -v ~/py3qt50env/sip -
c -j8

I am getting an error

Determining the layout of your Qt installation...
Error: Unable to find the qmake configuration file
/usr/local/Qt-5.0.0/mkspecs/default/qmake.conf. Use the QMAKESPEC environment
variable to specify the correct platform.

I checked the Qt5 installation and indeed, there is no default directory. How 
can I tell configure.py which mkspec to use (other than through QMAKESPEC)?

Regards,
Detlev
-- 
Detlev Offenbach
det...@die-offenbachs.de___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[PyQt] Another issue with latest PyQt4 snapshot and Qt5

2012-12-21 Thread Detlev Offenbach
Hello,

here is the next issue I faced. Having resolved the before reported issue 
temporarily I tried to compile. However, the linking stage failed. Here is the 
output.

g++ -c -m64 -pipe -fPIC -O2 -Wall -W -D_REENTRANT -DNDEBUG -
DQT_DISABLE_DEPRECATED_BEFORE=0x040900 -DSIP_PROTECTED_IS_PUBLIC -
Dprotected=public -DQT_NO_DEBUG -DQT_MULTIMEDIA_LIB -DQT_GUI_LIB -DQT_CORE_LIB 
-I. -I/usr/include/python3.2mu -I/usr/local/Qt-5.0.0/mkspecs/default -
I/usr/local/Qt-5.0.0/include/QtMultimedia -I/usr/local/Qt-5.0.0/include/QtGui 
-I/usr/local/Qt-5.0.0/include/QtWidgets -
I/usr/local/Qt-5.0.0/include/QtPrintSupport -
I/usr/local/Qt-5.0.0/include/QtCore -I/usr/local/Qt-5.0.0/include -o 
sipQtMultimediapart6.o sipQtMultimediapart6.cpp
g++ -shared  -Wl,-O1 -Wl,-rpath,/usr/local/Qt-5.0.0/lib -Wl,--version-
script=QtMultimedia.exp -o QtMultimedia.so sipQtMultimediapart0.o 
sipQtMultimediapart1.o sipQtMultimediapart2.o sipQtMultimediapart3.o 
sipQtMultimediapart4.o sipQtMultimediapart5.o sipQtMultimediapart6.o -
L/usr/local/Qt-5.0.0/lib -L/usr/X11R6/lib64 -lQtMultimedia -lQtGui -lQtWidgets 
-lQtPrintSupport -lQtCore -lXext -lX11 -lm -lpthread
/usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld: 
cannot find -lQtWidgets
/usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld: 
cannot find -lQtPrintSupport

That is correct because the installed Qt5 libraries are called
libQt5Widgets.so
libQt5PrintSupport.so
and so on.

Regards,
Detlev
-- 
Detlev Offenbach
det...@die-offenbachs.de___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] PyQt4 and Qt5

2012-12-21 Thread Phil Thompson
On Fri, 21 Dec 2012 11:04:33 +0100, Detlev Offenbach
det...@die-offenbachs.de wrote:
 Hello Phil,
 
 will you eventually provide Windows installers including Qt5 as well?

Yes, but probably only for Python 2.7 and 3.3.

 If
 you 
 will, will it be possible to install them in parallel, i.e. have PyQt4
 with 
 Qt4 and Qt5 available at the same time?

No.

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


Re: [PyQt] Multithreading and plotting

2012-12-21 Thread David Hoese

Hey Fabien,

See comments below and the bottom for my final changes. Please CC me in 
replies.


On 12/21/12 5:06 AM, lafont.fab...@gmail.com wrote:

Hello everyone,

I'm trying to plot live datas using matplotlib and PyQt. I need a
multithreaded program beacause I use time.sleep and it freeze completely
the app during that moment. I've tried that but it crash immediatly:

Do you get a seg. fault or some other error? I'm pretty sure I've helped 
you with this type of Qt application before, but I'll see what I can 
clear up.

from PyQt4 import QtCore, QtGui

import time

import sys

from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as
FigureCanvas

from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg as
NavigationToolbar

from matplotlib.figure import Figure

# Subclassing QThread

# http://doc.qt.nokia.com/latest/qthread.html

class Graph(FigureCanvas):

def __init__(self,parent):

self.fig = Figure()

self.ax = self.fig.add_subplot(111)

FigureCanvas.__init__(self, self.fig)

self.R1 = []

self.l_R1, = self.ax.plot([], self.R1,-o)

self.fig.canvas.draw()

FigureCanvas.updateGeometry(self)

class ApplicationWindow(QtGui.QMainWindow):

Example main window

def __init__(self):

QtGui.QMainWindow.__init__(self)

self.main_widget = QtGui.QWidget(self)

vbl = QtGui.QGridLayout(self.main_widget)

qmc = Graph(self.main_widget)

vbl.addWidget(qmc,0,0,1,11)

self.setCentralWidget(self.main_widget)
First, a small thing, I'm not sure if this matters but I've always 
created layouts by doing:


   vbl = QtGui.QGridLayout()
   # addWidget
   self.main_widget.setLayout(vbl)

I got this pattern from the documentation:
http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qwidget.html#setLayout 



class AThread(QtCore.QThread):

def run(self):

count = 0

while count  5:

time.sleep(1)

print Increasing

count += 1

aw.l_R1.set_data(count, count)
I don't approve of subclassing the run method of QThread, but what you 
have should work a little bit for now.  I really don't approve of using 
a global in another thread affinity and I highly doubt this will work 
correctly.  You should be using Qt signals to communicate between 
threads, but using signals you may have to get a little more complex 
with how you are using QThreads to free up the event loops.


You are also calling aw.l_R1 which does not exist.  You need to have a 
way to access the graph.  As a quick hack I just set the graph to 
self.qmc and then in the run method I did aw.qmc.l_R1.set_data(count, 
count).  You will also want to update the limits to show the new data 
as it comes in or set it to a certain range from the start. You will 
need to redraw the canvas every time you update it.  You will likely run 
into problems in the future if you draw in a different thread from the 
GUI thread, but for some reason it works in your example.


I'm not sure if this was intended, but since you are not saving the 
previous count you are only plotting points not a line. One way to do 
this is if you want to keep the last N records (lets say N=200) then you 
can plot originally self.ax.plot(numpy.arange(200), numpy.zeros(200)) 
and then update the y-data only like this aw.qmc.set_ydata(length 200 
array of previous counts).


def usingQThread():

app = QtCore.QCoreApplication([])

thread = AThread()

thread.finished.connect(app.exit)

thread.start()

sys.exit(app.exec_())
I'm really confused at this point.  How have you been calling this 
module? As python test.py? You are creating 2 QApplications, which 
isn't the easiest to follow.  You should create 1 application, then make 
the window, then make the threads.


Another big thing is that when you run 
thread.finished.connect(app.exit) you are connecting the end of the 
thread to the app closing.  Do you want the Application to completely 
close when the thread finishes (as you have it which I've never done so 
not sure if this will cause problems in more complex applications) or do 
you want the thread to stop, leaving the window open? The application 
would then close when the last window is closed.


if __name__ == __main__:

#

  qApp = QtGui.QApplication(sys.argv)

aw = ApplicationWindow()

aw.showMaximized()

usingQThread()

sys.exit(qApp.exec_())

I removed usingQThread method and moved that logic to the if statement 
so it now looks like this:


   if __name__ == __main__:
qApp = QtGui.QApplication([ ])
aw = ApplicationWindow()
aw.showMaximized()
thread = AThread()
thread.finished.connect(qApp.exit)
thread.start()
sys.exit(qApp.exec_())


I also added a self.qmc = qmc in the ApplicationWindow and forced the 
y-limits in the Graph.__init__ method using the following:


   self.ax.set_xlim(-1, 6)
   self.ax.set_ylim(-1, 6)

Then in the run method the last 2 lines in the while loop now say:

 aw.qmc.l_R1.set_data(count, count)
 aw.qmc.draw()


This got it running for me, although it had the plotting points 

Re: [PyQt] PyQt Digest, Vol 101, Issue 21

2012-12-21 Thread Patrick Moran
:

 CGErrorBreakpoint
-- next part --
An HTML attachment was scrubbed...
URL:
http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20121220/dc692
bdd/attachment-0001.html

--

Message: 3
Date: Thu, 20 Dec 2012 17:32:23 +0100
From: Fabien Lafont lafont.fab...@gmail.com
To: pyqt@riverbankcomputing.com pyqt@riverbankcomputing.com
Subject: [PyQt]  Multithreading and plotting
Message-ID:
CAC9H_chunLCx2Mju8oAH=pph2a5g7q7v_upayzpqpfgengu...@mail.gmail.com
Content-Type: text/plain; charset=iso-8859-1

Hello everyone,

I'm trying to plot live datas using matplotlib and PyQt. I need a
multithreaded program beacause I use time.sleep and it freeze completely the
app during that moment. I've tried that but it crash immediatly:


from PyQt4 import QtCore, QtGui

import time

import sys

from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as
FigureCanvas

from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg as
NavigationToolbar

from matplotlib.figure import Figure

# Subclassing QThread

# http://doc.qt.nokia.com/latest/qthread.html

class Graph(FigureCanvas):

def __init__(self,parent):

self.fig = Figure()

self.ax = self.fig.add_subplot(111)

FigureCanvas.__init__(self, self.fig)

self.R1 = []

self.l_R1, = self.ax.plot([], self.R1,-o)

self.fig.canvas.draw()

FigureCanvas.updateGeometry(self)

class ApplicationWindow(QtGui.QMainWindow):

Example main window

def __init__(self):

QtGui.QMainWindow.__init__(self)

self.main_widget = QtGui.QWidget(self)

vbl = QtGui.QGridLayout(self.main_widget)

qmc = Graph(self.main_widget)

vbl.addWidget(qmc,0,0,1,11)

self.setCentralWidget(self.main_widget)

class AThread(QtCore.QThread):

def run(self):

count = 0

while count  5:

time.sleep(1)

print Increasing

count += 1

aw.l_R1.set_data(count, count)

def usingQThread():

app = QtCore.QCoreApplication([])

thread = AThread()

thread.finished.connect(app.exit)

thread.start()

sys.exit(app.exec_())

if __name__ == __main__:

#

 qApp = QtGui.QApplication(sys.argv)

aw = ApplicationWindow()

aw.showMaximized()

usingQThread()

sys.exit(qApp.exec_())


Could you explain me why? The aim is to use one thread to acquire the data
and another to refresh the graph.


Thanks!


Fabien
-- next part --
An HTML attachment was scrubbed...
URL:
http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20121220/db252
1fa/attachment-0001.html

--

Message: 4
Date: Fri, 21 Dec 2012 11:04:33 +0100
From: Detlev Offenbach det...@die-offenbachs.de
To: pyqt@riverbankcomputing.com
Subject: [PyQt] PyQt4 and Qt5
Message-ID: 2755190.YHLBfl5yGU@saturn
Content-Type: text/plain; charset=us-ascii

Hello Phil,

will you eventually provide Windows installers including Qt5 as well? If you
will, will it be possible to install them in parallel, i.e. have PyQt4 with
Qt4 and Qt5 available at the same time?

Regards,
Detlev
--
Detlev Offenbach
det...@die-offenbachs.de
-- next part --
An HTML attachment was scrubbed...
URL:
http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20121221/c55e2
94f/attachment-0001.html

--

Message: 5
Date: Fri, 21 Dec 2012 12:01:08 +0100
From: Detlev Offenbach det...@die-offenbachs.de
To: pyqt@riverbankcomputing.com
Subject: [PyQt] Issue with latest PyQt4 snapshot and Qt 5.0.0
Message-ID: 2812146.BFkD31vffh@saturn
Content-Type: text/plain; charset=us-ascii

Hello,

I built and installed Qt 5.0.0 myself on my openSUSE 12.2 machine.
Everything compiled and installed fine. However, when I tried to configure
the latest PyQt4 snapshot with a command like

~/py3qt50env/bin/python configure.py -b ~/py3qt50env/bin/ -v
~/py3qt50env/sip - c -j8

I am getting an error

Determining the layout of your Qt installation...
Error: Unable to find the qmake configuration file
/usr/local/Qt-5.0.0/mkspecs/default/qmake.conf. Use the QMAKESPEC
environment variable to specify the correct platform.

I checked the Qt5 installation and indeed, there is no default directory.
How can I tell configure.py which mkspec to use (other than through
QMAKESPEC)?

Regards,
Detlev
--
Detlev Offenbach
det...@die-offenbachs.de
-- next part --
An HTML attachment was scrubbed...
URL:
http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20121221/8780d
124/attachment-0001.html

--

Message: 6
Date: Fri, 21 Dec 2012 12:09:03 +0100
From: Detlev Offenbach det...@die-offenbachs.de
To: pyqt@riverbankcomputing.com
Subject: [PyQt] Another issue with latest PyQt4 snapshot and Qt5
Message-ID: 3630416.fgq1txFdtm@saturn
Content-Type: text/plain; charset=us-ascii

Hello,

here is the next issue I faced. Having resolved the before reported issue
temporarily I tried to compile. However, the linking stage failed. Here is
the output.

g++ -c -m64 -pipe -fPIC -O2 -Wall -W -D_REENTRANT -DNDEBUG -
DQT_DISABLE_DEPRECATED_BEFORE=0x040900

[PyQt] newbie installing under OpenBSD

2012-12-21 Thread Alan Corey
I'm trying to install PyQt-x11-gpl-4.9.6 from a freshly downloaded
tarball.  I have sip-4.14.2 installed, Python 2.7.1p9 from OpenBSD
ports,
qt4-4.7.3p0 also from OpenBSD ports.

Following the directions in the README, when I do:
python2.7 configure.py --verbose
where I extracted in /usr/src/misc/pyqt4/PyQt-x11-gpl-4.9.6
I get messages like:
qtdirs.cpp:1:28: error: QCoreApplication: No such file or directory
qtdirs.cpp:2:17: error: QFile: No such file or directory
qtdirs.cpp:3:24: error: QLibraryInfo: No such file or directory
qtdirs.cpp:4:23: error: QTextStream: No such file or directory
qtdirs.cpp: In function 'int main(int, char**)':
qtdirs.cpp:16: error: 'QCoreApplication' was not declared in this scope

And a whole bunch more.  If this were C I'd say I need to use a -I to
include a path because all these files it isn't finding are in
/usr/local/include/X11/qt4/QtCore.  There aren't any spaces in the
path, and I tried
setenv PYTHONPATH /usr/local/include/X11/qt4/QtCore but it didn't help.

I also tried putting a -I/usr/local/include/X11/qt4/QtCore in the
INCPATH in the Makefile.

I don't know much of anything about Python or QT, I'm just trying to
get the qt-gui in gnuradio working.  I think I'm missing something
pretty basic but Googling didn't help much.

Thanks for any help,

  Alan, ab1jx

-- 
Credit is the root of all evil.  - AB1JX
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt