Re: [PyQt] PyQt Licensing

2009-05-11 Thread Simon Edwards

Hello,

A Corsaire wrote:
> I do think that this is a
worst-case outcome for the Python community as a whole. It means that 
PyQt development won't open up and become more community driven, that we 
(and other customers) still have to worry about the 
what-if-Phil-gets-hit-by-a-bus scenario,


Is this the classic "What happens to my FOSS / closed source application 
if Riverbank disappears?" problem? (Also known as Bus Factor 1) How big 
is the concern seriously? This sounds like the same situation that KDE 
was in when Qt was QPL/GPL, incidentally.


cheers,

--
Simon Edwards | KDE-NL, Guidance tools, Guarddog Firewall
si...@simonzone.com   | http://www.simonzone.com/software/
Nijmegen, The Netherlands | "ZooTV? You made the right choice."
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] PyQt Licensing

2009-05-11 Thread Simon Edwards

Hello,

Phil Thompson wrote:

In a nutshell, the PyQt licensing will not be changed in the short term.

This is mainly a financial decision - I want to ensure that PyQt
development, and that of other software, can still be funded. For the
moment an least, making an LGPL version available would be too much of a
risk - particularly as it would be impossible to reverse such a decision if
it proved to be a mistake - but it is something that I will continually
review.


Thanks for the clarification. This is a position that I can understand 
and respect. There are at least a few people who would like to see a 
LGPL and supported SIP + PyQt, but realistically there are more like two 
options or outcomes: 1) Current situation with a supported and developed 
SIP + PyQt, or 2) LGPL SIP + PyQt but unsupported and undeveloped. I 
don't see a lot of people putting their hand up to do bindings 
development (see QtJambi). From a Free Software point of view, a support 
GPL SIP + PyQt is a lot more useful than an unsupported LGPL version. 
Closed source wise, I don't have a problem with the idea that you should 
pay for the tools that are helping you develop and make money with your 
own software.


cheers,

--
Simon Edwards | KDE-NL, Guidance tools, Guarddog Firewall
si...@simonzone.com   | http://www.simonzone.com/software/
Nijmegen, The Netherlands | "ZooTV? You made the right choice."
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Problem using pyQT4 together with py2exe

2009-05-11 Thread Frédéric
On Monday 11 May 2009, hio wrote:

> i'm in trouble with using pyQT4 and py2exe together...
> My problem is that the .exe resulting by running the script seup.py,  
> when launched works fine but
> does not load the pictures i placed in my pyQT gui code.
> No pixmaps were loaded and displayed nor images by QT resource  
> filesany ideas? where's my mistake?

You should put your icons in a resource file, compile it as a .py file, and 
import it as any other module. This way, there is no problem.

-- 
Frédéric

http://www.gbiloba.org

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


Re: [PyQt] Moving button to the right side edge of a QToolBar

2009-05-11 Thread Peter Georges

That works perfectly

Thanks!

On 12/05/09 01:02, Chris M wrote:

Try;

spacer = QWidget()
spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
toolBar.addWidget(spacer)
# Then your button to be right-aligned

Taken from http://www.ffuts.org/blog/right-aligning-a-button-in-a-qtoolbar/

2009/5/11 Peter Georges:
   

I have a QToolBar in my application and I want the last button i add to the
toolbar to be positioned to the right. What is the ideal way to do that? Is
there some sort of way I can add a 'stretching' widget to push the last
button all the way over?

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

 


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


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

Re: [PyQt] Problem using pyQT4 together with py2exe

2009-05-11 Thread Richard Smith
Have you dropped the icons into the dist directory created by py2exe?
or are you using a resource file?

cheers
Richard

On Tue, 12 May 2009 09:00:20 hio wrote:
> hi all,
> i'm in trouble with using pyQT4 and py2exe together...
> My problem is that the .exe resulting by running the script seup.py,
> when launched works fine but
> does not load the pictures i placed in my pyQT gui code.
> No pixmaps were loaded and displayed nor images by QT resource
> filesany ideas? where's my mistake?
>
> Thanks
> ___
> PyQt mailing listPyQt@riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] Problem using pyQT4 together with py2exe

2009-05-11 Thread hio

hi all,
i'm in trouble with using pyQT4 and py2exe together...
My problem is that the .exe resulting by running the script seup.py,  
when launched works fine but

does not load the pictures i placed in my pyQT gui code.
No pixmaps were loaded and displayed nor images by QT resource  
filesany ideas? where's my mistake?


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


[PyQt] possible threading/locking bug in PyQt4 snapshots

2009-05-11 Thread Darren Dale
Hello,

I have attached a short script that I think demonstrates a bug in the PyQt4
snapshots. I expect the following output on the command line:

0
1
[...]
9998

complete

The script runs as expected with PyQt4-4.4.4 on 64bit Kubuntu Jaunty
(although I have to invoke ctrl-z to exit the script. I don't know how to
improve that part, but that is not the subject of this post.)

With the most recent (20090507) snapshots installed on 64bit Gentoo, the
script does not run to completion. The script usually hangs up before
anything is printed at the command line, although occasionally the thread
gets part way through the loop before it hangs up.

Darren
from __future__ import with_statement

import copy
import sys

from PyQt4 import QtGui, QtCore


class MyData(object):

def _get_value(self):
with self._lock:
return copy.copy(self._value)
def _set_value(self, value):
with self._lock:
self._value = copy.copy(value)
value = property(_get_value, _set_value)

def __init__(self):
self._lock = QRLock()
self._value = []

def append(self, value):
with self._lock:
self._value.append(value)


class QRLock(QtCore.QMutex):

"""
"""

def __init__(self):
QtCore.QMutex.__init__(self, QtCore.QMutex.Recursive)

def __enter__(self):
self.lock()
return self

def __exit__(self, type, value, traceback):
self.unlock()


class MyThread(QtCore.QThread):

@property
def stopped(self):
with self._lock:
return self._stopped

def __init__(self, data):
QtCore.QThread.__init__(self)
self._lock = QRLock()
self._data = data
self._stopped = False

def run(self):
for i in xrange(1):
if self.stopped:
break

self._data.append(i)
self.emit(QtCore.SIGNAL('newData'), i)
self.emit(QtCore.SIGNAL('processComplete'), i)

def stop(self):
with self._lock:
self._stopped = True


class ProcessData(QtCore.QObject):

def __init__(self):
QtCore.QObject.__init__(self)
self._myData = MyData()
self._thread = MyThread(self._myData)
self.connect(self._thread, QtCore.SIGNAL('newData'), self.report)
self.connect(self._thread, QtCore.SIGNAL('processComplete'), self.cleanup)
self._thread.start()

def cleanup(self):
self._thread = None
print 'complete'

def report(self, i):
print self._myData.value[i]

app = QtCore.QCoreApplication(sys.argv)

test = ProcessData()

sys.exit(app.exec_())
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] help with qt4reactor.py?

2009-05-11 Thread Aron Bierbaum
We had this problem before and found that the key to fixing it was to
call self.deleteLater() in TwistedSocketNotifier.shutdown.

-Aron

On Sun, May 10, 2009 at 4:58 PM, Demetrius Cassidy
 wrote:
>
> qt4reactor.install() should be the first line after you create your
> QApplication instance.
>
> You might also want to use the attached qtreactor, since some of the older
> ones I've found will give out that QObject error.
>
> http://www.nabble.com/file/p23474488/qt4reactor.py qt4reactor.py
>
> markus espenhain wrote:
>>
>> On Sun, 2009-05-10 at 08:32 -0400, inhahe wrote:
>>> Hello, can someone help me with the following code:
>>>
>>> ---
>>>
>>> from PyQt4 import QtGui, QtCore
>>> import sys, qt4reactor
>>>
>>> app = QtGui.QApplication(sys.argv)
>>> mainwin = QtGui.QMainWindow()
>>> mainwin.showMaximized()
>>> qt4reactor.install(app)
>>> from twisted.internet import reactor
>>>
>>> reactor.run()
>>>
>>> ---
>>>
>>> the problem is the console window keeps displaying
>>>
>>> QObject: Do not delete object, 'unnamed', during its event handler!
>>> QObject: Do not delete object, 'unnamed', during its event handler!
>>> QObject: Do not delete object, 'unnamed', during its event handler!
>>> QObject: Do not delete object, 'unnamed', during its event handler!
>>> QObject: Do not delete object, 'unnamed', during its event handler!
>>> QObject: Do not delete object, 'unnamed', during its event handler!
>>>
>>> etc., a few times per second.  the app seems to work, but that still
>>> bothers me. i want it to be Done Right.
>>>
>>> i'm using pyqt 4.3 and python 2.5 on windows xp.
>>>
>>
>> hi
>>
>> we are using twisted and qt4reactor
>> (http://www.tarbox.org/qtreactor/index.html + twisted 8.1 + qt 4.3/4/5 +
>> python 2.5) on linux and i haven't seen such messages before - our
>> setup/run is different - maybe this helps
>>
>> ...
>>
>> from PyQt4 import QtCore, QtGui
>> app = QtGui.QApplication(sys.argv)
>> from lipy import qt4reactor
>> qt4reactor.install()
>> from twisted.internet import reactor
>>
>> # mainwin creation etc
>> # ...
>>
>> reactor.runReturn()
>> sys.exit(app.exec_())
>>
>> markus
>>
>>> ___
>>> PyQt mailing list    p...@riverbankcomputing.com
>>> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>>
>> ___
>> PyQt mailing list    p...@riverbankcomputing.com
>> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>>
>>
>
> --
> View this message in context: 
> http://www.nabble.com/help-with-qt4reactor.py--tp23469814p23474488.html
> Sent from the PyQt mailing list archive at Nabble.com.
>
> ___
> PyQt mailing list    p...@riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>

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


Re: [PyQt] Moving button to the right side edge of a QToolBar

2009-05-11 Thread Chris M
Try;

spacer = QWidget()
spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
toolBar.addWidget(spacer)
# Then your button to be right-aligned

Taken from http://www.ffuts.org/blog/right-aligning-a-button-in-a-qtoolbar/

2009/5/11 Peter Georges :
> I have a QToolBar in my application and I want the last button i add to the
> toolbar to be positioned to the right. What is the ideal way to do that? Is
> there some sort of way I can add a 'stretching' widget to push the last
> button all the way over?
>
> Cheers
> ___
> PyQt mailing list    p...@riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>

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


[PyQt] FetchMore Example - Table Edition

2009-05-11 Thread Darryl Wallace

Hello Everyone,

The last time I wrote in I had presented the FetchMore example.  I've 
extended this example to use a simple table model.  The input is a 2d 
numpy array.  I couldn't find an example with lazy table population 
anywhere, so here's what I've got.


Feel free to use it as you wish.  Hope that someone finds it useful.

Regards,
Darryl

--
__
Darryl Wallace: Project Leader
ProSensus Inc.
McMaster Innovation Park
175 Longwood Road South
Hamilton, Ontario, L8P 0A1
Canada(GMT -05:00) 


Tel:   1-905-528-9136
Fax:   1-905-546-1372

Web site:  http://www.prosensus.ca/
__

# Fetch More Example - Lazy Table Edition
# Ported to PyQt4 by Darryl Wallace, 2009 - walla...@gmail.com

import sys
from PyQt4 import QtGui, QtCore
import numpy

class LazyTableModel(QtCore.QAbstractTableModel):

def __init__(self, data, parent=None):
QtCore.QAbstractTableModel.__init__(self, parent)
self.numRows=0
self.numColumns=0
self._data=data
#__init__

def rowCount(self, parent):
"""
parent=QModelIndex
"""
return self.numRows
#rowCount

def columnCount(self, parent):
"""
parent=QModelIndex
"""
return self.numColumns
#columnCount

def data(self, index, role=QtCore.Qt.DisplayRole):
"""
index=QModelIndex
"""
if not index.isValid():
return QtCore.QVariant()

if index.row()>=self.numRows or index.row()<0 or 
index.column()>=self.numColumns or index.column()<0:
return QtCore.QVariant()

if role==QtCore.Qt.DisplayRole:
return QtCore.QVariant(self._data[index.row(), index.column()])
elif role==QtCore.Qt.BackgroundRole:
return QtCore.QVariant(QtGui.qApp.palette().base())

return QtCore.QVariant()
#data

def canFetchMore(self, index):
"""
index=QModelIndex
"""
if self.numRows0:
self.beginInsertRows(QtCore.QModelIndex(), self.numRows, 
self.numRows+rowsToFetch-1)
self.endInsertRows()
self.numRows+=rowsToFetch

remainderColumns=self._data.shape[1]-self.numColumns
columnsToFetch=min(maxFetch, remainderColumns)
if columnsToFetch>0:
self.beginInsertColumns(QtCore.QModelIndex(), self.numColumns, 
self.numColumns+columnsToFetch-1)
self.endInsertColumns()
self.numColumns+=columnsToFetch

self.emit(QtCore.SIGNAL("numberPopulated"), rowsToFetch, columnsToFetch)
#fetchMore
#LazyTableModel

class Window(QtGui.QWidget):

def __init__(self, data, parent=None):
"""
Data is any 2-d numpy array
"""
QtGui.QWidget.__init__(self, parent)

self.model = LazyTableModel(data, parent=self)

view=QtGui.QTableView()
view.setModel(self.model)

self.logViewer=QtGui.QTextBrowser()

self.logViewer.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, 
QtGui.QSizePolicy.Preferred))

self.connect(self.model, QtCore.SIGNAL("numberPopulated"), 
self.updateLog)

layout=QtGui.QGridLayout()
layout.addWidget(view, 0, 0, 1, 2)
layout.addWidget(self.logViewer, 1, 0, 1, 2)

self.setLayout(layout)

self.setWindowTitle(self.tr("Fetch More Example - Table Edition"))
self.resize(400, 600)
#__init__

def updateLog(self, rows, columns):
self.logViewer.append(self.tr("%1 rows added.  %2 columns 
added").arg(rows).arg(columns))
#updateLog
#Window

if __name__=='__main__':
qApp=QtGui.QApplication(sys.argv)
data=numpy.random.normal(size=(117, 53))
fetchMoreWindow=Window(data)
fetchMoreWindow.show()
qApp.exec_()
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt