Re: [PyQt] PyQt/SIP snapshots

2009-03-28 Thread David Boddie
On Sunday 29 March 2009, Phil Thompson wrote:
> On Sat, 28 Mar 2009 21:16:31 +0100, David Boddie 

> >  * pyrcc4 now requires you to pass -py2 for Python 2.x code - this breaks
> >existing build environments. Is there a way that it could figure out
> >which version of Python it is running with and use that to determine
> >what kind of code to generate?
>
> I can't think of one (until pyrcc4 is re-written in Python). You only need
> to pass -py2 for Python 2.5.x and earlier.  If it was for Python 2.x then I
> would have made it the default.

Ah, I forgot that pyrcc4 is written in C++. Was it done so for performance
reasons or was there something that couldn't easily be done in Python?

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


Re: [PyQt] Implementation of the editabletreemodel example

2009-03-28 Thread Phil Thompson
On Sat, 28 Mar 2009 11:48:41 +0100, cyril Romain 
wrote:
> Hi,
> 
> Here is the PyQt implementation of the editabletreemodel itemviews
example.
> 
> The code was written from the C++ implementation, with space only inside.
> Feel free to make any necessary changes such as adjusting the header 
> (copied from simpletreemodel.py example) or removing ui_mainwindow.py 
> and editabletreemodel_rc.py generated files provided for convenience.
> 
> Feel also free to add that example in the next PyQt release.

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


Re: [PyQt] PyQt/SIP snapshots

2009-03-28 Thread Giovanni Bajo
On Sat, 28 Mar 2009 21:16:31 +0100, David Boddie 
wrote:
> On Sat Mar 28 12:57:12 GMT 2009, Phil Thompson wrote:
>> On Sat, 28 Mar 2009 13:46:48 +0100, Giovanni Bajo 
>> wrote:
>> >
>> > is this a good moment to test SIP/PyQt snapshots against Qt 4.5.0?
>>
>> Yes. I'm currently working on pyuic4 - everything else should be
>> production
>> ready.
> 
> I've found a couple of issues with PyQt-x11-gpl-4.5-snapshot-20090327
using
> Python 2.5.4:
> 
>  * pyrcc4 now requires you to pass -py2 for Python 2.x code - this breaks
>existing build environments.

Especially since existing build systems will have to go though hoops to be
compatible with older and newer pyrcc4. The older one doesn't like to be
passed the -py2 option.

> Is there a way that it could figure out
>which version of Python it is running with and use that to determine
>what kind of code to generate?

Sounds like a good idea.
-- 
Giovanni Bajo
Develer S.r.l.
http://www.develer.com
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] PyQt/SIP snapshots

2009-03-28 Thread Phil Thompson
On Sat, 28 Mar 2009 21:16:31 +0100, David Boddie 
wrote:
> On Sat Mar 28 12:57:12 GMT 2009, Phil Thompson wrote:
>> On Sat, 28 Mar 2009 13:46:48 +0100, Giovanni Bajo 
>> wrote:
>> >
>> > is this a good moment to test SIP/PyQt snapshots against Qt 4.5.0?
>>
>> Yes. I'm currently working on pyuic4 - everything else should be
>> production
>> ready.
> 
> I've found a couple of issues with PyQt-x11-gpl-4.5-snapshot-20090327
using
> Python 2.5.4:
> 
>  * pyrcc4 now requires you to pass -py2 for Python 2.x code - this breaks
>existing build environments. Is there a way that it could figure out
>which version of Python it is running with and use that to determine
>what
>kind of code to generate?

I can't think of one (until pyrcc4 is re-written in Python). You only need
to pass -py2 for Python 2.5.x and earlier.  If it was for Python 2.x then I
would have made it the default.

>  * There's a conflict between the error() signal and the error() method
in
>QNetworkReply. You can see this by obtaining the Google Suggest
example
>from the http://labs.trolltech.com/gitweb?p=GraphicsDojo repository.
>(Use "git clone git://labs.trolltech.com/GraphicsDojo" to get those
>examples or download a snapshot.)

Hmm - I need to think about that one.

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


Re: [PyQt] PyQt/SIP snapshots

2009-03-28 Thread David Boddie
On Sat Mar 28 12:57:12 GMT 2009, Phil Thompson wrote:
> On Sat, 28 Mar 2009 13:46:48 +0100, Giovanni Bajo 
> wrote:
> >
> > is this a good moment to test SIP/PyQt snapshots against Qt 4.5.0?
>
> Yes. I'm currently working on pyuic4 - everything else should be production
> ready.

I've found a couple of issues with PyQt-x11-gpl-4.5-snapshot-20090327 using
Python 2.5.4:

 * pyrcc4 now requires you to pass -py2 for Python 2.x code - this breaks
   existing build environments. Is there a way that it could figure out
   which version of Python it is running with and use that to determine what
   kind of code to generate?

 * There's a conflict between the error() signal and the error() method in
   QNetworkReply. You can see this by obtaining the Google Suggest example
   from the http://labs.trolltech.com/gitweb?p=GraphicsDojo repository.
   (Use "git clone git://labs.trolltech.com/GraphicsDojo" to get those
   examples or download a snapshot.)

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


[PyQt] Drag and drop toolbar buttons?

2009-03-28 Thread David F
Hello all,

Does anyone know of a good way to implement drag-and-drop for toolbar buttons? I
would like to be able to reorder the buttons, as well as remove and add them by
dragging to the toolbar from a list of actions.

I suppose this is a general qt question more than a pyqt one, but I thought I'd
ask here in case there was a Python solution already out there.

Thanks,
--D

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


Re: [PyQt] PyQt/SIP snapshots

2009-03-28 Thread Phil Thompson
On Sat, 28 Mar 2009 13:46:48 +0100, Giovanni Bajo 
wrote:
> Hello,
> 
> is this a good moment to test SIP/PyQt snapshots against Qt 4.5.0?

Yes. I'm currently working on pyuic4 - everything else should be production
ready.

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


[PyQt] PyQt/SIP snapshots

2009-03-28 Thread Giovanni Bajo
Hello,

is this a good moment to test SIP/PyQt snapshots against Qt 4.5.0?
-- 
Giovanni Bajo
Develer S.r.l.
http://www.develer.com


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


Re: [PyQt] Symbol not found: _sipQtConnect on Mac OSX 10.5

2009-03-28 Thread Phil Thompson
On Sat, 28 Mar 2009 13:01:53 +0900, Damien Elmes  wrote:
> Found the bug. In the project files, you are doing
> 
> CONFIG += ppc i386
> 
> as per the qmake docs, it should read
> 
> CONFIG += ppc x86
> 
> This resulted in only the PPC half of the library being built, and
> thus missing symbols when running on an Intel. I changed configure.py
> in a few places to use the correct config line, and it seems to be
> building correctly now.

Many thanks.

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


Re: [PyQt] Symbol not found: _sipQtConnect on Mac OSX 10.5

2009-03-28 Thread Phil Thompson
On Sat, 28 Mar 2009 15:51:29 +0900, Damien Elmes  wrote:
> The build was successful, and the few example programs I tested run
> fine now. However, my app seems to be dying - it looks like some
> internal data is getting clobbered somewhere. An line like:
> 
> import mymodule
> 
> results in a
> 
> TypeError: bad argument type for built-in operation
> 
> The problem seems to occur after importing about 3 modules which
> import PyQt4.QtGui. Importing modules which don't use QtGui seems to
> work fine.

I noticed that myself yesterday - should be fixed in the current SIP
snapshot.

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


[PyQt] Implementation of the editabletreemodel example

2009-03-28 Thread cyril Romain

Hi,

Here is the PyQt implementation of the editabletreemodel itemviews example.

The code was written from the C++ implementation, with space only inside.
Feel free to make any necessary changes such as adjusting the header 
(copied from simpletreemodel.py example) or removing ui_mainwindow.py 
and editabletreemodel_rc.py generated files provided for convenience.


Feel also free to add that example in the next PyQt release.

Best regards,

 Cyril

PS: if you really want the exactly the same behaviour than the C++ 
implementation, you can apply the provided patch. I think it is more 
consistent to insert "[No data]" whatever the  insertion case though.




editabletreemodel.tar.gz
Description: application/gzip
diff --git a/editabletreemodel.py b/editabletreemodel.py
index eab1af7..da98bf7 100755
--- a/editabletreemodel.py
+++ b/editabletreemodel.py
@@ -53,7 +53,7 @@ class TreeItem:
 for row in range(count):
 data = []
 for v in range(columns):
-data.append(QtCore.QVariant("[No data]"))
+data.append(QtCore.QVariant())
 item = TreeItem(data, self)
 self.childItems.insert(position, item)
 return True
@@ -62,7 +62,7 @@ class TreeItem:
 if position < 0 or position > len(self.itemData):
 return False
 for column in range(columns):
-self.itemData.insert(position, QtCore.QVariant("[No data]"))
+self.itemData.insert(position, QtCore.QVariant())
 for child in self.childItems:
 child.insertColumns(position, columns)
 return True
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[PyQt] Re: QComboBox: display an item different from the chosen one in the QListView

2009-03-28 Thread TP
TP wrote:

> So I have tried to play with a lot of methods provided by QComboBox,
> without success (for example, "currentText", "setItemText", etc.).

For those that are interested, or Qt beginners like me: by examining Qt C++
source code, I have finally found a solution: I have specialized paintEvent
in my QComboBox derived class. For example, if I want to print "toutou" in
my QComboBox, I modify the QStyleOptionComboBox in paintEvent:

def paintEvent( self, qpaintevent ):

painter = QStylePainter( self )
painter.setPen( self.palette().color( QPalette.Text ) )

# draw the combobox frame, focusrect and selected etc.
opt = QStyleOptionComboBox()
self.initStyleOption( opt )
opt.currentText = QString( "toutou" ) # HERE!!
painter.drawComplexControl( QStyle.CC_ComboBox, opt )

# draw the icon and text
painter.drawControl( QStyle.CE_ComboBoxLabel, opt)


I have just translated paintEvent from C++ to Python, and add the
line "opt.currentText = QString( "toutou" )" to modify the content of the
QComboBox once one item has been chosen by the user.

Thanks

Julien

-- 
python -c "print ''.join([chr(154 - ord(c)) for c in '*9(9&(18%.\
9&1+,\'Z4(55l4('])"

"When a distinguished but elderly scientist states that something is
possible, he is almost certainly right. When he states that something is
impossible, he is very probably wrong." (first law of AC Clarke)

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