Re: [PyQt] connectSlotsByName and signals emitted by dialogs?

2008-08-08 Thread Matti Airas
On to, 2008-08-07 at 16:50 +0100, Phil Thompson wrote:

 connectSlotsByName() (according to the documentation) connects the children
 of its argument, and not the argument (ie. the dialog) itself.
 
 It does sound like a limitation, but unless there is a bug in the
 documentation, it is the intended behaviour.

OK, so true. Apparently I had too strong assumptions regarding its
behaviour. Thanks for the tip.

ma.


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


Re: [PyQt] Strange shadowing of hex() function by PyQt4.QtCore

2008-08-08 Thread Mark Summerfield
On 2008-08-08, Boris Barbour wrote:
 Hi,

 Importing PyQt4.QtCore seems to alter or shadow the builtin hex()
 function. I'm afraid I haven't tracked things down further - I just
 learnt the hard way to import instead of from import *. However,
 I'm not sure the clash is intended, so I'm reporting it.

 Best regards,

 Boris
[snip]

It is unfortunate that doing * imports on PyQt4 brings in some objects
which don't begin with q or Q. Here's a solution for hex shown as an
IDLE session:

 hex(123)
'0x7b'
 from PyQt4.QtCore import *
 hex(123)

Traceback (most recent call last):
File pyshell#3, line 1, in module
hex(123)
TypeError: argument 1 of hex() has an invalid type
 __builtins__.hex(123)
'0x7b'
 # restore built-in hex
 hex = __builtins__.hex
 hex(123) 
'0x7b'

In Python 3 you'll be able to do import builtins and use
builtins.hex(). But I'm hoping that in PyQt4 for Python 3, the * imports
will only import objects that begin with q or Q, forcing the handful of
objects that don't meet this criterion to either be imported explicitly
or accessed fully qualified. [Any comment on this, Phil?]

-- 
Mark Summerfield, Qtrac Ltd, www.qtrac.eu
C++, Python, Qt, PyQt - training and consultancy
Rapid GUI Programming with Python and Qt - ISBN 0132354187

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


Re: [PyQt] simple newb question

2008-08-08 Thread Phil Thompson
On Thu, 07 Aug 2008 21:04:14 -0400, Neal Becker [EMAIL PROTECTED]
wrote:
 import sys
 from PyQt4.QtCore import *
 from PyQt4.QtGui import *
 
 app = QApplication (sys.argv)
 ret = QMessageBox.question (None, My App, You have mail)
 print ret
 
 Why doesn't this display any icon?  The docs say that I should see an
 icon, varying with whether I used '.question', or '.warning', etc.

Works for me.

Phil

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


Re: [PyQt] Strange shadowing of hex() function by PyQt4.QtCore

2008-08-08 Thread Phil Thompson
On Fri, 8 Aug 2008 08:02:55 +0100, Mark Summerfield [EMAIL PROTECTED] wrote:
 On 2008-08-08, Boris Barbour wrote:
 Hi,

 Importing PyQt4.QtCore seems to alter or shadow the builtin hex()
 function. I'm afraid I haven't tracked things down further - I just
 learnt the hard way to import instead of from import *. However,
 I'm not sure the clash is intended, so I'm reporting it.

 Best regards,

 Boris
 [snip]
 
 It is unfortunate that doing * imports on PyQt4 brings in some objects
 which don't begin with q or Q. Here's a solution for hex shown as an
 IDLE session:
 
  hex(123)
 '0x7b'
  from PyQt4.QtCore import *
  hex(123)
 
 Traceback (most recent call last):
 File pyshell#3, line 1, in module
   hex(123)
 TypeError: argument 1 of hex() has an invalid type
  __builtins__.hex(123)
 '0x7b'
  # restore built-in hex
  hex = __builtins__.hex
  hex(123) 
 '0x7b'
 
 In Python 3 you'll be able to do import builtins and use
 builtins.hex(). But I'm hoping that in PyQt4 for Python 3, the * imports
 will only import objects that begin with q or Q, forcing the handful of
 objects that don't meet this criterion to either be imported explicitly
 or accessed fully qualified. [Any comment on this, Phil?]

I'm not going to treat specific names differently as it's not a PyQt
problem.

Don't use import * - ever, in any Python code.

Phil

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


[PyQt] Some PyQt tutorial screencasts

2008-08-08 Thread Kushal Das
Hi all,

I am trying to create some PyQt tutorials for newbies. You can find them 
here[1], download links are coming soon. 
Comments are welcome :)

[1] http://tv.dgplug.org/devel-inside.html

Kushal
-- 
Fedora Ambassador, India
http://kushaldas.in
http://dgplug.org (Linux User Group of Durgapur)

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


[PyQt] newbie questions...

2008-08-08 Thread Chris Withers

Hey All,

Apologies for the newbie questions, I'm still trying to decide what gui 
toolkit I want to use and so would like to give Qt4 a go. Everything I 
do is in python, so that leads me to PyQt4 ;-)


I'm currently doing entirely open soruce development on Windows. 
However, I wouldn't like to rule out developing some commercial apps 
later. What's the licensing position on this? This, from the Trolltech 
website was more than a little weird:



The Commercial License does not allow you to incorporate code developed 
with the Open Source Editions of Trolltech software into a proprietary 
project



That seems weird to put it politely. I would have thought they both had 
the same interfaces?


Anyway, some questions:

- where do I get the Qt Designer from?

- how come PyQt4 isn't on PyPI? (Nowadays I'm used to just specifying 
packages as egg requirements in a buildout.cfg 
(http://buildout.zope.org/) but I guess I can't do that with PyQt4?)


thanks for any help!

Chris :-)

--
Simplistix - Content Management, Zope  Python Consulting
   - http://www.simplistix.co.uk
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] newbie questions...

2008-08-08 Thread Phil Thompson
On Fri, 08 Aug 2008 10:16:53 +0100, Chris Withers [EMAIL PROTECTED]
wrote:
 Hey All,
 
 Apologies for the newbie questions, I'm still trying to decide what gui 
 toolkit I want to use and so would like to give Qt4 a go. Everything I 
 do is in python, so that leads me to PyQt4 ;-)
 
 I'm currently doing entirely open soruce development on Windows. 
 However, I wouldn't like to rule out developing some commercial apps 
 later. What's the licensing position on this? This, from the Trolltech 
 website was more than a little weird:
 
 
 The Commercial License does not allow you to incorporate code developed 
 with the Open Source Editions of Trolltech software into a proprietary 
 project
 
 
 That seems weird to put it politely. I would have thought they both had 
 the same interfaces?

It's not a technical limitation. It is to prevent people developing a
commercial product with the GPL version and then switching to the
commercial version at the last minute. The PyQt commercial license has the
same restriction. In reality we would be open to discussion (usually
involving backdating the purchase of the commercial licenses).

 Anyway, some questions:
 
 - where do I get the Qt Designer from?

It's part of Qt.

 - how come PyQt4 isn't on PyPI? (Nowadays I'm used to just specifying 
 packages as egg requirements in a buildout.cfg 
 (http://buildout.zope.org/) but I guess I can't do that with PyQt4?)

PyPI is a PIA to use when you are not using eggs.

Phil

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


Re: [PyQt] newbie questions...

2008-08-08 Thread Andreas Pakulat
On 08.08.08 10:16:53, Chris Withers wrote:
 Hey All,

 Apologies for the newbie questions, I'm still trying to decide what gui  
 toolkit I want to use and so would like to give Qt4 a go. Everything I  
 do is in python, so that leads me to PyQt4 ;-)

 I'm currently doing entirely open soruce development on Windows.  
 However, I wouldn't like to rule out developing some commercial apps  
 later. What's the licensing position on this? This, from the Trolltech  
 website was more than a little weird:

 
 The Commercial License does not allow you to incorporate code developed  
 with the Open Source Editions of Trolltech software into a proprietary  
 project
 

 That seems weird to put it politely. I would have thought they both had  
 the same interfaces?

Its not a technical, but a legal limitation. That is you're not allowed
to make money off any code you've developed with the open-source version
of Qt (or PyQt for that matter).

 Anyway, some questions:

 - where do I get the Qt Designer from?

From Qt: www.trolltech.com

 - how come PyQt4 isn't on PyPI? (Nowadays I'm used to just specifying  
 packages as egg requirements in a buildout.cfg  
 (http://buildout.zope.org/) but I guess I can't do that with PyQt4?)

Because so far there's little interest in that I think, plus PyQt4
doesn't use distutils/setuptools and hence one would need to change the
buildsystem first probably.

Andreas

-- 
Try to relax and enjoy the crisis.
-- Ashleigh Brilliant
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] Re: simple newb question

2008-08-08 Thread Neal Becker
Phil Thompson wrote:

 On Thu, 07 Aug 2008 21:04:14 -0400, Neal Becker [EMAIL PROTECTED]
 wrote:
 import sys
 from PyQt4.QtCore import *
 from PyQt4.QtGui import *
 
 app = QApplication (sys.argv)
 ret = QMessageBox.question (None, My App, You have mail)
 print ret
 
 Why doesn't this display any icon?  The docs say that I should see an
 icon, varying with whether I used '.question', or '.warning', etc.
 
 Works for me.
 
 Phil

Not for me: Fedora F9 qt-4.4.0-16.fc9.x86_64 PyQt4-4.4.2-2.fc9.x86_64

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


Re: [PyQt] Strange shadowing of hex() function by PyQt4.QtCore

2008-08-08 Thread İsmail Dönmez
On Fri, Aug 8, 2008 at 10:02, Mark Summerfield [EMAIL PROTECTED] wrote:
 On 2008-08-08, Boris Barbour wrote:
 Hi,

 Importing PyQt4.QtCore seems to alter or shadow the builtin hex()
 function. I'm afraid I haven't tracked things down further - I just
 learnt the hard way to import instead of from import *. However,
 I'm not sure the clash is intended, so I'm reporting it.

 Best regards,

 Boris
 [snip]

 It is unfortunate that doing * imports on PyQt4 brings in some objects
 which don't begin with q or Q. Here's a solution for hex shown as an
 IDLE session:

 hex(123)
'0x7b'
 from PyQt4.QtCore import *
 hex(123)

Traceback (most recent call last):
File pyshell#3, line 1, in module
hex(123)
TypeError: argument 1 of hex() has an invalid type
 __builtins__.hex(123)
'0x7b'
 # restore built-in hex
 hex = __builtins__.hex
 hex(123)
'0x7b'

This also bite me many times when I was doing a fast hack using from
PyQt4.QtCore import *. Shadowing stdlib functions is evil.

Regards,
ismail

-- 
Programmer Excuse #11: I figured I didn't need to test because it was
obviously correct.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] PyQt shadowing virtual slots?

2008-08-08 Thread Arve Knudsen
I encountered a strange problem when wrapping a custom QDialog
subclass. This subclass implements accept and connects it to
QDialogButtonBox::accepted, but this would not get invoked and I could
not for the life of me understand why. Eventually I discovered that
the reason was that I did not declare accept among the class' methods
in the SIP wrapper. Why is it that C++ reimplementations of slots are
hidden if they are not also wrapped in the SIP equivalent?? See
attached demo (test.py is the main script).

Arve


testdialog.tar
Description: Unix tar archive
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] PyQt shadowing virtual slots?

2008-08-08 Thread Phil Thompson
On Fri, 8 Aug 2008 16:25:06 +0200, Arve Knudsen [EMAIL PROTECTED]
wrote:
 I encountered a strange problem when wrapping a custom QDialog
 subclass. This subclass implements accept and connects it to
 QDialogButtonBox::accepted, but this would not get invoked and I could
 not for the life of me understand why. Eventually I discovered that
 the reason was that I did not declare accept among the class' methods
 in the SIP wrapper. Why is it that C++ reimplementations of slots are
 hidden if they are not also wrapped in the SIP equivalent?? See
 attached demo (test.py is the main script).

In order to void recursive calls to virtuals the generated code explicitly
specifies the scope, so if it doesn't know about it it can't call it.

Phil

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


Re: [PyQt] using a Macro to define %MappedType

2008-08-08 Thread Phil Thompson
On Fri, 08 Aug 2008 17:36:04 +0100, Damien Fagnou
[EMAIL PROTECTED] wrote:
 Hi ,
 
 we have hierachy of object binded with boost that need to be able to be 
 passed to a qt class bound with sip
 class myWidget : public QGLWidget
 {
   void setMyObject( boost::shared_ptrMyClassA A );
   void setMyOtherObject( boost::shared_ptrMyClassB B );
   void setMyLastObject( boost::shared_ptrMyClassC C );
 }
 
 in my myWidget.sip
 
 I have
 
 %Include MyClassA.sip
 
 where classA.sip is
 %MappedType MyClassAPtr
 {
 %TypeHeaderCode  

 #include 
 boost/python/extract.hpp   
 #include MyClassA.sip
 using namespace boost::python;   
 %End
 
 %ConvertToTypeCode
..
boost::python::extractMyClassAPtr convert( sipPy );
.
return 0;%End
 
 %ConvertFromTypeCode
return  boost::python::object(sipCpp).ptr();
 %End
 }
 
 this is working fine , but I have many , many classes , ideally I would 
 like to be able to right a template or macro
 so I could just do
 
 MY_CONVERT( MyClassAPtr )
 MY_CONVERT( MyClassBPtr )
 MY_CONVERT( MyClassEPtr )
 
 before the code of my widget . is there something like %Macro file value 
 .. or something of that type ?

No.

 I guess I could write scripts to generate those *.sip file from the 
 template before hand .

Or look at a macro package like m4.

Phil

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


[PyQt] Installation problem on OSX

2008-08-08 Thread Pim Schellart
Hello everyone,

I am new to the list so please correct me if I ask my question in the wrong way.

Recently I installed the latest version of Qt (4.4.1) and the latest
version of PqQt4 (4.4.2).
My python installation is from the scisoft package (ESO software
bundle) version 2.5.1.
Installation of PqQt4 was done using a simple:

sudo python configure.py
(seemed to be necessary because without the sudo it complained about:
IOError: [Errno 13] Permission denied: 'qtdirs.pro')

followed by:
sudo make
sudo make install

This seemed to work.
But if I run the following from within python:

 import sys
 from PyQt4.QtGui import *

I get the following error:

Traceback (most recent call last):
 File stdin, line 1, in module
ImportError: 
dlopen(/scisoft/i386/library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/PyQt4/QtGui.so,
2): Library not loaded: QtGui.framework/Versions/4/QtGui
 Referenced from:
/scisoft/i386/library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/PyQt4/QtGui.so
 Reason: image not found

At first I thought it might be the `library' with lower case because
according to find my installation is located at:

/scisoft/i386/Packages/Python-2.5.1/Python.framework/Versions/2.5/lib/python2.5/site-packages/PyQt4

/scisoft/i386/Packages/Python-2.5.1/Python.framework/Versions/2.5/share/sip/PyQt4

/scisoft/i386/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/PyQt4/

So I tried changing `library' to `Library' in pyqtconfig.py and
Makefile (after configure.py) but this did not solve the problem.

Does anyone have a clue what is going wrong?

Kind regards,

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


[PyQt] ANN: new snapshot of the Django plugin released

2008-08-08 Thread Detlev Offenbach
Hi,

this is to inform you about the immediate availability of a new snapshot of 
the enhanced Django plugins. This snapshots adds support for these Django 
actions from within eric4.

  -- show difference of settings (diffsettings)
  -- cleanup the database (cleanup)
  -- validate all models (validate)
  -- print admin-index template snippet (adminindex)
  -- start an interactive Python shell for a Django project (shell)
  -- create the tables for the SQL caching backend (createcachetable)
  -- introspect the database (inspectdb)
  -- flush the database (flush)
  -- reset an application's database tables (reset)
  -- start a database client console (dbshell)
  -- show CREATE TABLE SQL statements (sql)
  -- show CREATE INDEX SQL statements (sqlindexes)
  -- show CREATE TABLE, custom SQL and CREATE INDEX SQL statements (sqlall)
  -- show custom SQL statements (sqlcustom)
  -- show DROP TABLE SQL statements (sqlclear)
  -- show statements to flush the database (sqlflush)
  -- show statements to reset application(s) (sqlreset)
  -- show statements to reset sequences (sqlsequencereset)

Get it via the Plugin Repository dialog of eric4 or from the eric4 web site.

Regards,
Detlev
-- 
Detlev Offenbach
[EMAIL PROTECTED]
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] Strange bug in PyQt

2008-08-08 Thread Roberto Alsina
I don't know how to explain it, si I have to use pictures.

Here's how my app looks when things go bad:

http://flickr.com/photos/ralsina/2744179213/

Here's the good:

http://flickr.com/photos/ralsina/2744178603/

What's the difference in the code? This:

In the good version, I create the star icon for each item:

  item1.setIcon(QtGui.QIcon(':/star.svg'))

In the bad version, I created a global:

star=QtGui.QIcon(':/star.svg')

And used it instead:

  item1.setIcon(star)

I had the same thing happen to another app before and never figured out why it 
happened.

I am using 

qt 4.4.0
pyqt 4.4.2
python 2.5.2

On Linux.

Any ideas?


-- 
 (\''/).__..-''`-. . Roberto Alsina
 `9_ 9  )   `-. ().`-._.`)  KDE Developer (MFCH)
 (_Y_.)' ._   ) `._`.   -.-'  http://lateral.netmanagers.com.ar 
  _..`-'_..-_/ /-'_.' The 6,855th most popular site of Slovenia   
(l)-'' ((i).' ((!.'   according to alexa.com (27/5/2007) 

Debugging is twice as hard as writing the code in the first place. 
Therefore, if you write the code as cleverly as possible, you are, 
by definition, not smart enough to debug it. --Brian W. Kernighan

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


Re: [PyQt] Strange bug in PyQt

2008-08-08 Thread Andreas Pakulat
On 08.08.08 16:36:35, Roberto Alsina wrote:
 I don't know how to explain it, si I have to use pictures.

Are you talking about the cut-off menu items? Or what? Which parts of
the pictures should we look into/

 In the good version, I create the star icon for each item:
 
   item1.setIcon(QtGui.QIcon(':/star.svg'))
 
 In the bad version, I created a global:
 
 star=QtGui.QIcon(':/star.svg')
 
 And used it instead:
 
   item1.setIcon(star)

Note that the icon here might vanish as soon as the function is left, so
your items might have invalid icons - unless they do a deep-copy of the
given item.

Andreas

-- 
You're a card which will have to be dealt with.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Problems with Sonnet Highlighter

2008-08-08 Thread Simon Edwards

Hi,

Albert Cervera i Areny wrote:
I wanted to give Sonnet Highlighter a try and I find that it simply doesn't 
work for me (debian unstable packages), it gives:


Traceback (most recent call last):
  File test-sonnet.py, line 10, in module
Sonnet.Highlighter( edit )
TypeError: argument 1 of Highlighter() has an invalid type


[EMAIL PROTECTED] ~/devel/pykde4]$ python test-sonnet.py
Fatal error: you need to have a KComponentData object before
you do anything that requires it! Examples of this are config
objects, standard directories or translations.

This is on KDE 4.1. Your example code should use KApplication instead of 
just QApplication. What version of everything are you using?


cheers,

--
Simon Edwards | KDE-NL, Guidance tools, Guarddog Firewall
[EMAIL PROTECTED]   | 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] Strange bug in PyQt

2008-08-08 Thread Roberto Alsina
On Friday 08 August 2008 18:43:12 Andreas Pakulat wrote:
 On 08.08.08 16:36:35, Roberto Alsina wrote:
  I don't know how to explain it, si I have to use pictures.

 Are you talking about the cut-off menu items? Or what? Which parts of
 the pictures should we look into/

Cutoff menu items, varying font sizes, the Search label, even the left 
qtreeview's header is weird.

Loos like font metrics were all cray.

  In the good version, I create the star icon for each item:
 
item1.setIcon(QtGui.QIcon(':/star.svg'))
 
  In the bad version, I created a global:
 
  star=QtGui.QIcon(':/star.svg')
 
  And used it instead:
 
item1.setIcon(star)

 Note that the icon here might vanish as soon as the function is left, so
 your items might have invalid icons - unless they do a deep-copy of the
 given item.

It's in the module's scope so it shouldn't be deleted while the module is 
imported. Also since the icon is diplayed I'm assuming it's not deleted.

-- 
 (\''/).__..-''`-. . Roberto Alsina
 `9_ 9  )   `-. ().`-._.`)  KDE Developer (MFCH)
 (_Y_.)' ._   ) `._`.   -.-'  http://lateral.netmanagers.com.ar 
  _..`-'_..-_/ /-'_.' The 6,855th most popular site of Slovenia   
(l)-'' ((i).' ((!.'   according to alexa.com (27/5/2007) 

Debugging is twice as hard as writing the code in the first place. 
Therefore, if you write the code as cleverly as possible, you are, 
by definition, not smart enough to debug it. --Brian W. Kernighan

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


[PyQt] ANN: PyQt v4.4.3 and SIP v4.7.7 Released

2008-08-08 Thread Phil Thompson
PyQt v4.4.3 and SIP v4.7.7 have been released and are available from the
usual places.

These are mainly bug-fix releases - see the NEWS files for the details, or
the Changelogs for the detailed details.

The Windows GPL installer has also been updated.

Phil

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