Re: [PyQt] Porting PyQt GUI between platforms.

2010-08-06 Thread Algis Kabaila
On Thursday 05 August 2010 14:36:17 Raoul Snyman wrote:
> 
> And once again, you need to run this on a real Windows box. WINE *might*
> work, but PyInstaller tracks various Windows dependencies that might not be
> in WINE. You cannot build Windows packages on Linux.

Raoul,

This is valuable advice.  My first experiment with Windows on VM failed. The 
same example worked fine under real box with Windows.  A detail to watch: I 
had to disable Fire Wall.

A nice reference to this PyInstaller on window:
http://bytes.com/topic/python/insights/579554-simple-guide-using-pyinstaller

Thank you for sharing your knowledge!

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


[PyQt] enums and hand written code

2010-08-06 Thread Clinton Stimpson
Hi,

I've got some hand written code using the SIP API to integrate PyQt with other 
C++ classes wrapped with another tool.

I've got things generally working, but I'm not quite sure how to handle enums, 
such as Qt::AutoConnection.

When I call api->api_convert_to_type(...) it asserts.  I can do a 
sipTypeIsEnum(...) to check beforehand, but I don't see in the docs how to get 
the value out.

Also, the docs should be updated to show how to get the sip api if its a 
PyCapsule.

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


Re: [PyQt] Segmentation faults

2010-08-06 Thread Luke Campagnola
On Fri, Aug 6, 2010 at 10:53, Mailing List SVR wrote:

> Il giorno gio, 05/08/2010 alle 03.10 -0400, Luke Campagnola ha scritto:
> > $ python
> > >>> from PyQt4.QtGui import *
> > >>> a = QApplication([])
> > >>> s = QSpinBox()
> > >>> l = s.lineEdit()
> > >>> del s
> > >>> l.text()
> > Segmentation fault
>
> PySide is more forgiving and raise the following error:
>
> RuntimeError: Internal C++ object already deleted.
>


Thanks, I'll have to look into this. I had not heard of PySide before.

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

Re: [PyQt] Segmentation faults

2010-08-06 Thread Mailing List SVR
Il giorno gio, 05/08/2010 alle 03.10 -0400, Luke Campagnola ha scritto: 
> I believe I have run into a class of bugs in PyQt4. I originally found
> that QSpinBox.lineEdit() returns a QLineEdit instance which does not
> maintain its reference count properly after the original QSpinBox is
> deleted. Thus it is possible to either 1) have uncollectable LineEdits
> lingering in memory, or 2) crash the program by accessing the LineEdit
> (see example below). 
> 
> 
> The same bug also applies to:
>  - QAbstractSpinBox.lineEdit
>  - QComboBox.lineEdit, 
>  - QAbstractScrollArea.horizontalScrollBar
>  - QAbstractScrollArea.verticalScrollBar
>  - QTreeView.header
>  - QSplitter.handle
> 
> 
> .. and likely many others. In the best case, this bug causes minor
> memory leaks that few people are likely to notice. In the worst case,
> it causes crashes which are very difficult to debug if you don't have
> easy access to debugging symbols (ie using windows binaries). 
> 
> 
> $ python
> >>> from PyQt4.QtGui import *
> >>> a = QApplication([])
> >>> s = QSpinBox()
> >>> l = s.lineEdit()
> >>> del s
> >>> l.text()
> Segmentation fault

PySide is more forgiving and raise the following error:

RuntimeError: Internal C++ object already deleted.

> ___
> 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] pyuic4 problem

2010-08-06 Thread David Quinn
> Other than that, I don't know anything about pyqt to say if there's anything 
> wrong in your ui code, but it sounds like there may just be a syntax problem 
> there.
>

Sorry for the deluge of list traffic - yes it turned out to be a
syntax error. Thanks for all the advice.

On Fri, Aug 6, 2010 at 10:25 AM, William Kyngesburye
 wrote:
> On Aug 6, 2010, at 8:55 AM, David Quinn wrote:
>
>> I don't understand what this means. Should I just delete all my python
>> files from the frameworks folder, and reinstall everything (a new
>> python install, etc)?
>>
> Delete/Reinstall /System/Frameworks/Python.framework - definitely not (last 
> resort), that would mean reinstalling the whole system, and I doubt pyqt 
> corrupted the system python.  Clearing out those sip/pyqt files in there as I 
> mentioned, yes.  In fact, a clean system python doesn't have a 
> "site-packages" folder (that's what /Library/Python is for) so you can delete 
> that folder.
>
> /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages
>
> Certainly trashing sip/pyqt files in /library/Python and rebuilding might 
> help.
>
> Other than that, I don't know anything about pyqt to say if there's anything 
> wrong in your ui code, but it sounds like there may just be a syntax problem 
> there.
>
>>
>>
>> On Thu, Aug 5, 2010 at 10:45 PM, William Kyngesburye
>>  wrote:
>>>
>>> On Aug 5, 2010, at 9:18 PM, David Quinn wrote:
>>>
 Thanks for the advice, William.

 I followed the instructions for installation (though I could not find
 all the files to delete).
>>>
>>> It's possible some files may be in /usr/bin and /usr/include.  (which files 
>>> did you not find?)
>>>
 I now received the following error message:

 david$ pyuic4
 Traceback (most recent call last):
  File "/Library/Python/2.6/site-packages/PyQt4/uic/pyuic.py", line 4,
 in 
    from PyQt4 import QtCore
 ImportError: dlopen(/Library/Python/2.6/site-packages/PyQt4/QtCore.so,
 2): Symbol not found: _sipQtConnect
  Referenced from: /Library/Python/2.6/site-packages/PyQt4/QtCore.so
  Expected in: flat namespace
 in /Library/Python/2.6/site-packages/PyQt4/QtCore.so

>>>
>>> Just to make sure - rebuild *both* sip and pyqt, with clean source would 
>>> help.  And Qt Cocoa is a must (not the Carbon version) for 64bit.  If your 
>>> using Carbon, don't add --arch=x86_64 for SIP, and use the --use-arch=i386 
>>> option for PyQt.
>
>
> -
> William Kyngesburye 
> http://www.kyngchaos.com/
>
> "We are at war with them. Neither in hatred nor revenge and with no 
> particular pleasure I shall kill every ___ I can until the war is over. That 
> is my duty."
>
> "Don't you even hate 'em?"
>
> "What good would it do if I did? If all the many millions of people of the 
> allied nations devoted an entire year exclusively to hating the  it 
> wouldn't kill one ___ nor shorten the war one day."
>
>  "And it might give 'em all stomach ulcers."
>
> - Tarzan, on war
>
>
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] pyuic4 problem

2010-08-06 Thread William Kyngesburye
On Aug 6, 2010, at 8:55 AM, David Quinn wrote:

> I don't understand what this means. Should I just delete all my python
> files from the frameworks folder, and reinstall everything (a new
> python install, etc)?
> 
Delete/Reinstall /System/Frameworks/Python.framework - definitely not (last 
resort), that would mean reinstalling the whole system, and I doubt pyqt 
corrupted the system python.  Clearing out those sip/pyqt files in there as I 
mentioned, yes.  In fact, a clean system python doesn't have a "site-packages" 
folder (that's what /Library/Python is for) so you can delete that folder.

/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages

Certainly trashing sip/pyqt files in /library/Python and rebuilding might help.

Other than that, I don't know anything about pyqt to say if there's anything 
wrong in your ui code, but it sounds like there may just be a syntax problem 
there.

> 
> 
> On Thu, Aug 5, 2010 at 10:45 PM, William Kyngesburye
>  wrote:
>> 
>> On Aug 5, 2010, at 9:18 PM, David Quinn wrote:
>> 
>>> Thanks for the advice, William.
>>> 
>>> I followed the instructions for installation (though I could not find
>>> all the files to delete).
>> 
>> It's possible some files may be in /usr/bin and /usr/include.  (which files 
>> did you not find?)
>> 
>>> I now received the following error message:
>>> 
>>> david$ pyuic4
>>> Traceback (most recent call last):
>>>  File "/Library/Python/2.6/site-packages/PyQt4/uic/pyuic.py", line 4,
>>> in 
>>>from PyQt4 import QtCore
>>> ImportError: dlopen(/Library/Python/2.6/site-packages/PyQt4/QtCore.so,
>>> 2): Symbol not found: _sipQtConnect
>>>  Referenced from: /Library/Python/2.6/site-packages/PyQt4/QtCore.so
>>>  Expected in: flat namespace
>>> in /Library/Python/2.6/site-packages/PyQt4/QtCore.so
>>> 
>> 
>> Just to make sure - rebuild *both* sip and pyqt, with clean source would 
>> help.  And Qt Cocoa is a must (not the Carbon version) for 64bit.  If your 
>> using Carbon, don't add --arch=x86_64 for SIP, and use the --use-arch=i386 
>> option for PyQt.


-
William Kyngesburye 
http://www.kyngchaos.com/

"We are at war with them. Neither in hatred nor revenge and with no particular 
pleasure I shall kill every ___ I can until the war is over. That is my duty."

"Don't you even hate 'em?"

"What good would it do if I did? If all the many millions of people of the 
allied nations devoted an entire year exclusively to hating the  it 
wouldn't kill one ___ nor shorten the war one day."

 "And it might give 'em all stomach ulcers."

- Tarzan, on war

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


Re: [PyQt] pyuic4 problem

2010-08-06 Thread David Quinn
I downloaded a new version of PyQt and SIP and reinstalled. PyQt4
appeared to be installed properly, as was pyuic4. However when I ran
the following command:

david$ pyuic4 -d window.ui > window.py

I go this error message:

Traceback (most recent call last):
  File "/Library/Python/2.6/site-packages/PyQt4/uic/port_v2/invoke.py",
line 12, in invoke
exit_status = driver.invoke()
  File "/Library/Python/2.6/site-packages/PyQt4/uic/driver.py", line
37, in invoke
self._generate()
  File "/Library/Python/2.6/site-packages/PyQt4/uic/driver.py", line
63, in _generate
self._opts.pyqt3_wrapper)
  File "/Library/Python/2.6/site-packages/PyQt4/uic/__init__.py", line
128, in compileUi
winfo = compiler.UICompiler().compileUi(uifile, pyfile)
  File "/Library/Python/2.6/site-packages/PyQt4/uic/Compiler/compiler.py",
line 66, in compileUi
w = self.parse(input_stream)
  File "/Library/Python/2.6/site-packages/PyQt4/uic/uiparser.py", line
834, in parse
document = parse(filename)
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xml/etree/ElementTree.py",
line 862, in parse
tree.parse(source, parser)
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xml/etree/ElementTree.py",
line 586, in parse
parser.feed(data)
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xml/etree/ElementTree.py",
line 1245, in feed
self._parser.Parse(data, 0)
ExpatError: mismatched tag: line 63, column 4

I don't understand what this means. Should I just delete all my python
files from the frameworks folder, and reinstall everything (a new
python install, etc)?



On Thu, Aug 5, 2010 at 10:45 PM, William Kyngesburye
 wrote:
>
> On Aug 5, 2010, at 9:18 PM, David Quinn wrote:
>
>> Thanks for the advice, William.
>>
>> I followed the instructions for installation (though I could not find
>> all the files to delete).
>
> It's possible some files may be in /usr/bin and /usr/include.  (which files 
> did you not find?)
>
>> I now received the following error message:
>>
>> david$ pyuic4
>> Traceback (most recent call last):
>>  File "/Library/Python/2.6/site-packages/PyQt4/uic/pyuic.py", line 4,
>> in 
>>    from PyQt4 import QtCore
>> ImportError: dlopen(/Library/Python/2.6/site-packages/PyQt4/QtCore.so,
>> 2): Symbol not found: _sipQtConnect
>>  Referenced from: /Library/Python/2.6/site-packages/PyQt4/QtCore.so
>>  Expected in: flat namespace
>> in /Library/Python/2.6/site-packages/PyQt4/QtCore.so
>>
>
> Just to make sure - rebuild *both* sip and pyqt, with clean source would 
> help.  And Qt Cocoa is a must (not the Carbon version) for 64bit.  If your 
> using Carbon, don't add --arch=x86_64 for SIP, and use the --use-arch=i386 
> option for PyQt.
>
> ... I didn't want to comment, but I also notice your use of Fink.  Are you 
> running the system python or from Fink?
>
> My compile instructions should build both 32 abd 64bit SIP and PyQt, so it 
> shouldn't matter if you somehow run Python 32bit instead of the default 
> 64bit.  Check the binaries to make sure:
>
>  file /Library/Python/2.6/site-packages/PyQt4/QtCore.so
>  file /Library/Python/2.6/site-packages/sip.so
>
>> My .bash_profile looks like this:
>>
>> # Setting PATH for MacPython 2.6
>> # The orginal version is saved in .bash_profile.pysave
>> PATH="/System/Library/Frameworks/Python.framework/Versions/2.6/bin:${PATH}"
>> export PATH
>>
> No need if you use the /usr/local and /Library/Python install locations.
>
>
> P.S.  I also noticed your "qgis_scratch".  Are your developing a plugin for 
> Qgis?  I make the "official" Qgis binaries which include a bundled Qt/PyQt, 
> and if there is something that I could do with the distribution to help, let 
> me know (like adding the sip/pyqt executables and includes).  I didn't think 
> about that possibility. Though I do purposely strip out the Qt includes to 
> save space.
>
> ... h 
>
> -
> William Kyngesburye 
> http://www.kyngchaos.com/
>
> [Trillian]  What are you supposed to do WITH a maniacally depressed robot?
>
> [Marvin]  You think you have problems?  What are you supposed to do if you 
> ARE a maniacally depressed robot?  No, don't try and answer, I'm 50,000 times 
> more intelligent than you and even I don't know the answer...
>
> - HitchHiker's Guide to the Galaxy
>
>
>
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] could this be a PyQt problem or it is Qt behavior change?

2010-08-06 Thread Linos

Hello,
i have a QTableView with a QSortFilterProxyModel using a QSqlQueryModel 
as
source, in Qt 4.5 i execute after the query has populated the data of the table
resizeColumnsToContents() or resizeColumnToContent(int) and it get adjusted to
the column contents but in Qt 4.6 if i have not reimplemented the sizeHint 
method in

the delegate and i use the default QStyledItemDelegate.sizeHint method the col
get not resized correctly, you can see an example here:

http://img819.imageshack.us/img819/804/examplet.png

I have printed to console the output of the sizehint of the delegate for the
first visible col "SERIE" and row 0 and i get QSize(31, 15) in QT 4.6 and
QSize(31, 16) in QT 4.5 but when i print the size of the section from the
horizontal QHeaderView after the resize of the col i get 73 in Qt 4.6 and 46 in
Qt 4.5, this col it is ever of three chars in all the rows of the model, the 
same
three chars, so i don't understand why happens this difference, can anyone help
me with this? Thanks.

Regards,
Miguel Angel.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt