[PyQt] [Announce] EuroPython 2010 (17-24 July)

2010-03-19 Thread David Boddie
I thought this announcement might be relevant to some of the readers of
this list. Apologies to those of you who have already seen it elsewhere.

David


EuroPython 2010 - 17th to 24th July 2010


EuroPython is a conference for the Python programming language community, 
including the Django, Zope and Plone communities. It is aimed at everyone in 
the Python community, of all skill levels, both users and programmers.

Last year's conference was the largest open source conference in the UK and 
one of the largest community organised software conferences in Europe.

This year EuroPython will be held from the 17th to 24th July in Birmingham, 
UK. It will include over 100 talks, tutorials, sprints and social events.

Registration


Registration is open now at:

http://www.europython.eu/registration/

For the best registration rates, book as soon as you can! The normal Early 
Bird rate will apply until 10th May.

Talks, Activities and Events


Do you have something you wish to present at EuroPython? You want to give a 
talk, run a tutorial or sprint?

Go to http://www.europython.eu/talks/cfp/ for information and advice!
Go to http://wiki.europython.eu/Sprints to plan a sprint!

Help Us Out
---

EuroPython is run by volunteers, like you! We could use a hand, and any 
contribution is welcome.

Go to http://wiki.europython.eu/Helping to join us!
Go to http://www.europython.eu/contact/ to contact us directly!

Sponsors


Sponsoring EuroPython is a unique opportunity to affiliate with this 
prestigious conference and to reach a large number of Python users from 
computing professionals to academics, from entrepreneurs to motivated and 
well-educated job seekers.

http://www.europython.eu/sponsors/

Spread the Word
---

We are a community-run not-for-profit conference. Please help to spread the 
word by distributing this announcement to colleagues, project mailing lists, 
friends, your blog, Web site, and through your social networking connections. 
Take a look at our publicity resources:

http://wiki.europython.eu/Publicity

General Information
---

For more information about the conference, please visit the official site:

http://www.europython.eu/

Looking forward to see you!

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


[PyQt] Connecting to base class signals in subclass

2010-03-19 Thread Demetrius Cassidy

I am not sure if this is the intended behavior, but if I subclass a QWidget
instance, and then try to connect to one of those signals in my subclass, I
get a TypeError:

>>> class MyLabel(QtGui.QLabel):
... def __init__(self):
... self.linkActivated.connect(self._lnkActivated)
...
... def _lnkActivated(self, link):
... pass
...
>>> l = MyLabel()
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 3, in __init__
TypeError: pyqtSignal must be bound to a QObject, not 'MyLabel'
>>>

Why can't I connect to my base class's signals in my subclass? 
-- 
View this message in context: 
http://old.nabble.com/Connecting-to-base-class-signals-in-subclass-tp27951038p27951038.html
Sent from the PyQt mailing list archive at Nabble.com.

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


Re: [PyQt] QSqlDatabase connection parameters

2010-03-19 Thread Scott Frankel


On Mar 19, 2010, at 2:27 PM, Russell Valentine wrote:

So if you did the exact same statements your program is doing with  
psql

to the remote server, they take a similar time as the local?


No, the statements to the remote server take 20x longer!
2.5 (remote) vs. 0.12 (local) seconds.



You say similar dataset,


Identical.  I created a new database locally and on the remote server,  
then imported the same schema and test data sql files to both.




just wondering if maybe the remote was missing
a index or hasn't been vacuumed in a while. Can you do a vacuum  
yourself

just to double check?


I follow the same steps for my local db and the remote server:
- dropdb
- createdb
- import schema.sql
- import testData.sql
- launch app ...

Furthermore, monitoring usage on the remote machine shows minuscule  
load during my app's launch and operations.


I'm going to switch gears and look into multi-threading my data model  
loads and select() statements.


Thanks for the suggestions!  Much appreciated.
Scott







Russell Valentine

On 03/19/10 15:29, Scott Frankel wrote:


On Mar 19, 2010, at 12:24 PM, Russell Valentine wrote:


Perhaps time each part to see what exactly is taking up the time?



Thanks for the suggestion.  I was hoping to find a global parameter
(buffer_size, or similar) that could be tweaked to improve overall
performance.

My app loads a dozen QSqlRelationalTableModel objects, in addition to
various support data.  Remotely, each table model requires roughly  
2 to

3 seconds to load.  Locally, each requires 0.12 seconds to load!

I'm already printing timing statements to help with my optimization
efforts to date.  Complete output is long.  Here are some highlights:

#---

# remote data launch
#---

2010-03-19 12:56:02.580540 Application launch

2010-03-19 12:56:05.538501 connecting...
2010-03-19 12:56:06.564915 database connection opened
[ ~1 second to open the connection ]

2010-03-19 12:56:11.091056 loading application support data...
2010-03-19 12:56:16.912604 user data loaded...
[ ~6 seconds to load QSqlRelationalTableModel objects, using  
unfiltered

select() methods ]

...
2010-03-19 12:56:24.943313 form 3/12 set
2010-03-19 12:56:27.320105 form 4/12 set
...
[ ~2.5 seconds for each of 12 forms to load additional data model
objects and set widgets accordingly ]

2010-03-19 12:56:45.861150 ready...
[ ~43 seconds to launch ]



#---

# local data launch
#---

2010-03-19 13:13:02.606677 Application launch
...
2010-03-19 13:13:05.733303 form 3/12 set
2010-03-19 13:13:05.854210 form 4/12 set
[ ~0.12 seconds for each of 12 forms to load additional data model
objects and set widgets accordingly ]
...
2010-03-19 13:13:06.710319 ready...
[ ~4 seconds to launch, start to finish ]




One
way to do so is below:

t=time.time()
dostuff()
print "dostuff() time = "+str(time.time()-t)+" s"

Is it really the initial connection that takes a long time to get,  
or is

it something else on that remote machine. work_mem has nothing to do
with making a connection for example.

On 03/19/10 14:06, Scott Frankel wrote:


Hi all,

Would anyone have any suggestions for improving QSqlDatabase PSQL
connection performance?


The Qt docs refer to PSQL connection options and demonstrate the
"requiressl=1" example.  Are there other options that can be  
set?  (eg:
the docs' PostgreSQL "options" bullet point)  Google searches are  
coming

up short.

I note that my local postgresql.conf file has a "work_mem"  
statement.
(Usage:  work_mem = 1MB)  That could be germane, but including  
the term

in my setConnectOptions() method (as part of a semi-colon separated
list) yields PSQL errors.

I've optimized my working code further.  Running from a local  
data set,
launch times are down to 4 seconds.  Running from an identical  
data set

hosted remotely, my application launches in 40+ seconds!

Thanks in advance!
Scott



On Mar 16, 2010, at 9:09 PM, Scott Frankel wrote:



Hi all,

Is there a buffer size or similar optimization parameter that  
can be
set for QSqlDatabase PSQL connections?  The docs refer to  
PostgreSQL

"options" without specifying what they may be.

I have a PG database cluster of about 7MB, spread over a couple  
dozen
tables.  Locally, it takes about 6 seconds to launch my app,  
loading

the model data into my forms.

When I pull an identical data-set from a remote location, my
application launch time increases to over 60 seconds.  Yet  
resource

utilization on the remote server is miniscule.

For comparison, I'm able to download the results of a 21MB SELECT
statement in less than 8 seconds via cmd-line psql.  That's  
orders of

magnitude more data in an order of magnitude less time!

I'm cre

Re: [PyQt] QSqlDatabase connection parameters

2010-03-19 Thread Russell Valentine
So if you did the exact same statements your program is doing with psql
to the remote server, they take a similar time as the local?

You say similar dataset, just wondering if maybe the remote was missing
a index or hasn't been vacuumed in a while. Can you do a vacuum yourself
just to double check?


Russell Valentine

On 03/19/10 15:29, Scott Frankel wrote:
> 
> On Mar 19, 2010, at 12:24 PM, Russell Valentine wrote:
> 
>> Perhaps time each part to see what exactly is taking up the time?
> 
> 
> Thanks for the suggestion.  I was hoping to find a global parameter
> (buffer_size, or similar) that could be tweaked to improve overall
> performance.
> 
> My app loads a dozen QSqlRelationalTableModel objects, in addition to
> various support data.  Remotely, each table model requires roughly 2 to
> 3 seconds to load.  Locally, each requires 0.12 seconds to load!
> 
> I'm already printing timing statements to help with my optimization
> efforts to date.  Complete output is long.  Here are some highlights:
> 
> #---
> 
> # remote data launch
> #---
> 
> 2010-03-19 12:56:02.580540 Application launch
> 
> 2010-03-19 12:56:05.538501 connecting...
> 2010-03-19 12:56:06.564915 database connection opened
> [ ~1 second to open the connection ]
> 
> 2010-03-19 12:56:11.091056 loading application support data...
> 2010-03-19 12:56:16.912604 user data loaded...
> [ ~6 seconds to load QSqlRelationalTableModel objects, using unfiltered
> select() methods ]
> 
> ...
> 2010-03-19 12:56:24.943313 form 3/12 set
> 2010-03-19 12:56:27.320105 form 4/12 set
> ...
> [ ~2.5 seconds for each of 12 forms to load additional data model
> objects and set widgets accordingly ]
> 
> 2010-03-19 12:56:45.861150 ready...
> [ ~43 seconds to launch ]
> 
> 
> 
> #---
> 
> # local data launch
> #---
> 
> 2010-03-19 13:13:02.606677 Application launch
> ...
> 2010-03-19 13:13:05.733303 form 3/12 set
> 2010-03-19 13:13:05.854210 form 4/12 set
> [ ~0.12 seconds for each of 12 forms to load additional data model
> objects and set widgets accordingly ]
> ...
> 2010-03-19 13:13:06.710319 ready...
> [ ~4 seconds to launch, start to finish ]
> 
> 
> 
>> One
>> way to do so is below:
>>
>> t=time.time()
>> dostuff()
>> print "dostuff() time = "+str(time.time()-t)+" s"
>>
>> Is it really the initial connection that takes a long time to get, or is
>> it something else on that remote machine. work_mem has nothing to do
>> with making a connection for example.
>>
>> On 03/19/10 14:06, Scott Frankel wrote:
>>>
>>> Hi all,
>>>
>>> Would anyone have any suggestions for improving QSqlDatabase PSQL
>>> connection performance?
>>>
>>>
>>> The Qt docs refer to PSQL connection options and demonstrate the
>>> "requiressl=1" example.  Are there other options that can be set?  (eg:
>>> the docs' PostgreSQL "options" bullet point)  Google searches are coming
>>> up short.
>>>
>>> I note that my local postgresql.conf file has a "work_mem" statement.
>>> (Usage:  work_mem = 1MB)  That could be germane, but including the term
>>> in my setConnectOptions() method (as part of a semi-colon separated
>>> list) yields PSQL errors.
>>>
>>> I've optimized my working code further.  Running from a local data set,
>>> launch times are down to 4 seconds.  Running from an identical data set
>>> hosted remotely, my application launches in 40+ seconds!
>>>
>>> Thanks in advance!
>>> Scott
>>>
>>>
>>>
>>> On Mar 16, 2010, at 9:09 PM, Scott Frankel wrote:
>>>

 Hi all,

 Is there a buffer size or similar optimization parameter that can be
 set for QSqlDatabase PSQL connections?  The docs refer to PostgreSQL
 "options" without specifying what they may be.

 I have a PG database cluster of about 7MB, spread over a couple dozen
 tables.  Locally, it takes about 6 seconds to launch my app, loading
 the model data into my forms.

 When I pull an identical data-set from a remote location, my
 application launch time increases to over 60 seconds.  Yet resource
 utilization on the remote server is miniscule.

 For comparison, I'm able to download the results of a 21MB SELECT
 statement in less than 8 seconds via cmd-line psql.  That's orders of
 magnitude more data in an order of magnitude less time!

 I'm creating my db connection as follows.  (Sample code attached also.)

db = QtSql.QSqlDatabase.addDatabase("QPSQL")
db.setDatabaseName("fubar")
db.setHostName("localhost")
db.setUserName("admin")
db.setPassword("abc123")


 Thanks in advance!
 Scott


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

Re: [PyQt] PyQt 4.7 / Qt 4.6.1 QSortFilterProxyModel subclass not emitting signals

2010-03-19 Thread Giacomo Lacava
On Fri, Mar 19, 2010 at 11:47 AM, Giacomo Lacava  wrote:
> It seems like subclasses of QSortFilterProxyModel will not emit
> inherited signals. Tested with PyQt 4.7 / Qt 4.6.1 on Windows XP.

Same happening on Linux with the same PyQt/Qt combination.

Adding the pyqtSlot decorator doesn't make any difference.
Connecting via signal-object or classic QObject.connect doesn't make
any difference.
Using the native object rather than a subclass also doesn't seem to
make any difference.

Looks like a bug to me...?

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


Re: [PyQt] Delete a Laytou

2010-03-19 Thread starglider develop
Hi Nick,
I'm trying to make it work without luck, is there any python example?
The example that is in *Rapid GUI Programming With Python and Qt* is only
for stackedwidgets.

Thank you.


On 19 March 2010 10:38, Nick Gaens  wrote:

> Take a look at a QStackedLayout.. You can add multiple widgets, each having
> their own layout, to it and set it as the central widget of your mainwindow.
> There's no need for deleting a layout and set a new one, since you alternate
> between the added widgets / layouts.
>
> Check out http://doc.trolltech.com/4.3/qstackedlayout.html#details to see
> a short example..
>
> On Thu, Mar 18, 2010 at 11:39 PM, starglider develop <
> starglider@gmail.com> wrote:
>
>> Hi,
>> I have a QMainWindow with a main Vertical Layout and  3 HLayouts and
>> several Widgets in every layout,
>> but the program needs to remove all the layouts to create another one with
>> a widget.
>> How can I remove the original layouts? I was unable to find an answer in
>> the internet.
>>
>> Thank you in advance for your help.
>>
>> Regards
>>
>> ___
>> PyQt mailing listPyQt@riverbankcomputing.com
>> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>>
>
>
>
> --
> Nick Gaens
>
> ___
> 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] QSqlDatabase connection parameters

2010-03-19 Thread Scott Frankel


On Mar 19, 2010, at 12:59 PM, Matt Newell wrote:


On Friday 19 March 2010 12:06:12 Scott Frankel wrote:

Hi all,

Would anyone have any suggestions for improving QSqlDatabase PSQL
connection performance?


The Qt docs refer to PSQL connection options and demonstrate the
"requiressl=1" example.  Are there other options that can be set?
(eg:  the docs' PostgreSQL "options" bullet point)  Google searches
are coming up short.

I note that my local postgresql.conf file has a "work_mem" statement.
(Usage:  work_mem = 1MB)  That could be germane, but including the
term in my setConnectOptions() method (as part of a semi-colon
separated list) yields PSQL errors.

I've optimized my working code further.  Running from a local data
set, launch times are down to 4 seconds.  Running from an identical
data set hosted remotely, my application launches in 40+ seconds!

Thanks in advance!
Scott

I always disable prepared connection inside the qsqlpsql driver,  
just add a

return false; line after the PreparedQueries case statement in the
hasFeatures function(that's all from memory, names may be off).   
This will

only help if you are using QSqlQuery.prepare, which i use for the api
convenience, not because i actually want prepared queries.  This  
will reduce
the roundtrip count and could make a difference if roundtrip time is  
an

issue.


I use prepared statements sparingly and only for inserts back to the db.


On the server you should enable logging of queries that take over a  
certain
amount of time.  This will help you narrow down places where you  
need indexes

or better designed queries.


Good idea.


Also it's possible to use multiple connection each from it's own  
thread.  I
haven't done this in pyqt alone, but have done this quite a lot in c+ 
+/qt

apps.


My initial forays into multithreading yielded warnings about pixmaps  
when I attempted to thread form construction as a whole.  I'll look  
into threading just the data load portions.



Other than that just reducing the total number of queries, which can  
be done

by more intelligent/complex queries, or by stored procedures.


Yes.  Most of my recent effort has been replacing queries with data  
model operations.



The qsqlpsql driver is a fairly thin wrapper around psql so I don't  
really
think there is a lot of performance gains to be had by changing any  
settings.


Thanks for the info!




Matt












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


Re: [PyQt] QSqlDatabase connection parameters

2010-03-19 Thread Scott Frankel


On Mar 19, 2010, at 12:24 PM, Russell Valentine wrote:


Perhaps time each part to see what exactly is taking up the time?



Thanks for the suggestion.  I was hoping to find a global parameter  
(buffer_size, or similar) that could be tweaked to improve overall  
performance.


My app loads a dozen QSqlRelationalTableModel objects, in addition to  
various support data.  Remotely, each table model requires roughly 2  
to 3 seconds to load.  Locally, each requires 0.12 seconds to load!


I'm already printing timing statements to help with my optimization  
efforts to date.  Complete output is long.  Here are some highlights:


#---
# remote data launch
#---
2010-03-19 12:56:02.580540 Application launch

2010-03-19 12:56:05.538501 connecting...
2010-03-19 12:56:06.564915 database connection opened
[ ~1 second to open the connection ]

2010-03-19 12:56:11.091056 loading application support data...
2010-03-19 12:56:16.912604 user data loaded...
[ ~6 seconds to load QSqlRelationalTableModel objects, using  
unfiltered select() methods ]


...
2010-03-19 12:56:24.943313 form 3/12 set
2010-03-19 12:56:27.320105 form 4/12 set
...
[ ~2.5 seconds for each of 12 forms to load additional data model  
objects and set widgets accordingly ]


2010-03-19 12:56:45.861150 ready...
[ ~43 seconds to launch ]



#---
# local data launch
#---
2010-03-19 13:13:02.606677 Application launch
...
2010-03-19 13:13:05.733303 form 3/12 set
2010-03-19 13:13:05.854210 form 4/12 set
[ ~0.12 seconds for each of 12 forms to load additional data model  
objects and set widgets accordingly ]

...
2010-03-19 13:13:06.710319 ready...
[ ~4 seconds to launch, start to finish ]




One
way to do so is below:

t=time.time()
dostuff()
print "dostuff() time = "+str(time.time()-t)+" s"

Is it really the initial connection that takes a long time to get,  
or is

it something else on that remote machine. work_mem has nothing to do
with making a connection for example.

On 03/19/10 14:06, Scott Frankel wrote:


Hi all,

Would anyone have any suggestions for improving QSqlDatabase PSQL
connection performance?


The Qt docs refer to PSQL connection options and demonstrate the
"requiressl=1" example.  Are there other options that can be set?   
(eg:
the docs' PostgreSQL "options" bullet point)  Google searches are  
coming

up short.

I note that my local postgresql.conf file has a "work_mem" statement.
(Usage:  work_mem = 1MB)  That could be germane, but including the  
term

in my setConnectOptions() method (as part of a semi-colon separated
list) yields PSQL errors.

I've optimized my working code further.  Running from a local data  
set,
launch times are down to 4 seconds.  Running from an identical data  
set

hosted remotely, my application launches in 40+ seconds!

Thanks in advance!
Scott



On Mar 16, 2010, at 9:09 PM, Scott Frankel wrote:



Hi all,

Is there a buffer size or similar optimization parameter that can be
set for QSqlDatabase PSQL connections?  The docs refer to PostgreSQL
"options" without specifying what they may be.

I have a PG database cluster of about 7MB, spread over a couple  
dozen

tables.  Locally, it takes about 6 seconds to launch my app, loading
the model data into my forms.

When I pull an identical data-set from a remote location, my
application launch time increases to over 60 seconds.  Yet resource
utilization on the remote server is miniscule.

For comparison, I'm able to download the results of a 21MB SELECT
statement in less than 8 seconds via cmd-line psql.  That's orders  
of

magnitude more data in an order of magnitude less time!

I'm creating my db connection as follows.  (Sample code attached  
also.)


   db = QtSql.QSqlDatabase.addDatabase("QPSQL")
   db.setDatabaseName("fubar")
   db.setHostName("localhost")
   db.setUserName("admin")
   db.setPassword("abc123")


Thanks in advance!
Scott





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









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





Scott Frankel
President
Circle-S Studios

510-339-7477 (o)
510-332-2990 (c)

www.circlesfx.com
www.sequoyaworkflow.com










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

[PyQt] pyqt and dbus

2010-03-19 Thread Kobus Wolvaardt
Hi,

I have found an oddity with dbus and pyqt. A message of type string longer
than 120k sent over dbus will work, but the eventloop from where it was sent
will go crazy with cpu usage at 100% after that. This does not happen with
the glib eventloop and python, and it also doesn't happen with the qt c++
dbus eventloop. Any idea what can be causing this. I also saw the c++ qt
eventloop fail on large messages (might have been a coding issue) but the
pyqt one succeeds. Is this onpurpose, could it be related?

I have seen this issue on 4.5.x and 4.6.2 QT, with the latest pyqt paired
with 4.6.2.

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

Re: [PyQt] QSqlDatabase connection parameters

2010-03-19 Thread Matt Newell
On Friday 19 March 2010 12:06:12 Scott Frankel wrote:
> Hi all,
>
> Would anyone have any suggestions for improving QSqlDatabase PSQL
> connection performance?
>
>
> The Qt docs refer to PSQL connection options and demonstrate the
> "requiressl=1" example.  Are there other options that can be set?
> (eg:  the docs' PostgreSQL "options" bullet point)  Google searches
> are coming up short.
>
> I note that my local postgresql.conf file has a "work_mem" statement.
> (Usage:  work_mem = 1MB)  That could be germane, but including the
> term in my setConnectOptions() method (as part of a semi-colon
> separated list) yields PSQL errors.
>
> I've optimized my working code further.  Running from a local data
> set, launch times are down to 4 seconds.  Running from an identical
> data set hosted remotely, my application launches in 40+ seconds!
>
> Thanks in advance!
> Scott
>
I always disable prepared connection inside the qsqlpsql driver, just add a 
return false; line after the PreparedQueries case statement in the 
hasFeatures function(that's all from memory, names may be off).  This will 
only help if you are using QSqlQuery.prepare, which i use for the api 
convenience, not because i actually want prepared queries.  This will reduce 
the roundtrip count and could make a difference if roundtrip time is an 
issue.

On the server you should enable logging of queries that take over a certain 
amount of time.  This will help you narrow down places where you need indexes 
or better designed queries.

Also it's possible to use multiple connection each from it's own thread.  I 
haven't done this in pyqt alone, but have done this quite a lot in c++/qt 
apps.

Other than that just reducing the total number of queries, which can be done 
by more intelligent/complex queries, or by stored procedures.

The qsqlpsql driver is a fairly thin wrapper around psql so I don't really 
think there is a lot of performance gains to be had by changing any settings.

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


Re: [PyQt] QSqlDatabase connection parameters

2010-03-19 Thread Russell Valentine
Perhaps time each part to see what exactly is taking up the time? One
way to do so is below:

t=time.time()
dostuff()
print "dostuff() time = "+str(time.time()-t)+" s"

Is it really the initial connection that takes a long time to get, or is
it something else on that remote machine. work_mem has nothing to do
with making a connection for example.

On 03/19/10 14:06, Scott Frankel wrote:
> 
> Hi all,
> 
> Would anyone have any suggestions for improving QSqlDatabase PSQL
> connection performance?
> 
> 
> The Qt docs refer to PSQL connection options and demonstrate the
> "requiressl=1" example.  Are there other options that can be set?  (eg: 
> the docs' PostgreSQL "options" bullet point)  Google searches are coming
> up short.
> 
> I note that my local postgresql.conf file has a "work_mem" statement. 
> (Usage:  work_mem = 1MB)  That could be germane, but including the term
> in my setConnectOptions() method (as part of a semi-colon separated
> list) yields PSQL errors.
> 
> I've optimized my working code further.  Running from a local data set,
> launch times are down to 4 seconds.  Running from an identical data set
> hosted remotely, my application launches in 40+ seconds!
> 
> Thanks in advance!
> Scott
> 
> 
> 
> On Mar 16, 2010, at 9:09 PM, Scott Frankel wrote:
> 
>>
>> Hi all,
>>
>> Is there a buffer size or similar optimization parameter that can be
>> set for QSqlDatabase PSQL connections?  The docs refer to PostgreSQL
>> "options" without specifying what they may be.
>>
>> I have a PG database cluster of about 7MB, spread over a couple dozen
>> tables.  Locally, it takes about 6 seconds to launch my app, loading
>> the model data into my forms.
>>
>> When I pull an identical data-set from a remote location, my
>> application launch time increases to over 60 seconds.  Yet resource
>> utilization on the remote server is miniscule.
>>
>> For comparison, I'm able to download the results of a 21MB SELECT
>> statement in less than 8 seconds via cmd-line psql.  That's orders of
>> magnitude more data in an order of magnitude less time!
>>
>> I'm creating my db connection as follows.  (Sample code attached also.)
>>
>> db = QtSql.QSqlDatabase.addDatabase("QPSQL")
>> db.setDatabaseName("fubar")
>> db.setHostName("localhost")
>> db.setUserName("admin")
>> db.setPassword("abc123")
>>
>>
>> Thanks in advance!
>> Scott
>>
>>
>> 
>>
>>
>> ___
>> 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] QSqlDatabase connection parameters

2010-03-19 Thread Scott Frankel


Hi all,

Would anyone have any suggestions for improving QSqlDatabase PSQL  
connection performance?



The Qt docs refer to PSQL connection options and demonstrate the  
"requiressl=1" example.  Are there other options that can be set?   
(eg:  the docs' PostgreSQL "options" bullet point)  Google searches  
are coming up short.


I note that my local postgresql.conf file has a "work_mem" statement.   
(Usage:  work_mem = 1MB)  That could be germane, but including the  
term in my setConnectOptions() method (as part of a semi-colon  
separated list) yields PSQL errors.


I've optimized my working code further.  Running from a local data  
set, launch times are down to 4 seconds.  Running from an identical  
data set hosted remotely, my application launches in 40+ seconds!


Thanks in advance!
Scott



On Mar 16, 2010, at 9:09 PM, Scott Frankel wrote:



Hi all,

Is there a buffer size or similar optimization parameter that can be  
set for QSqlDatabase PSQL connections?  The docs refer to PostgreSQL  
"options" without specifying what they may be.


I have a PG database cluster of about 7MB, spread over a couple  
dozen tables.  Locally, it takes about 6 seconds to launch my app,  
loading the model data into my forms.


When I pull an identical data-set from a remote location, my  
application launch time increases to over 60 seconds.  Yet resource  
utilization on the remote server is miniscule.


For comparison, I'm able to download the results of a 21MB SELECT  
statement in less than 8 seconds via cmd-line psql.  That's orders  
of magnitude more data in an order of magnitude less time!


I'm creating my db connection as follows.  (Sample code attached  
also.)


db = QtSql.QSqlDatabase.addDatabase("QPSQL")
db.setDatabaseName("fubar")
db.setHostName("localhost")
db.setUserName("admin")
db.setPassword("abc123")


Thanks in advance!
Scott





___
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 connecting to QDialog exec_ method

2010-03-19 Thread Phil Thompson
On Fri, 19 Mar 2010 11:54:36 +, Stuart McNicholas
 wrote:
> I have a very simple program:
> 
> from PyQt4 import QtGui, QtCore
> import sys
> 
> class Win(QtGui.QWidget):
>SaveFiles = QtCore.pyqtSignal()
>def __init__(self,parent=None):
>  QtGui.QWidget.__init__(self,parent)
>  self.fileDialog = QtGui.QDialog()
>  self.SaveFiles.connect(self.fileDialog.exec_)
>  self.SaveFiles.emit()
> 
> app = QtGui.QApplication(sys.argv)
> 
> win = Win()
> win.show()
> win.raise_()
> 
> sys.exit(app.exec_())
> 
> which produces the error:
> 
> Traceback (most recent call last):
>File "jif.py", line 23, in 
>  win = Win()
>File "jif.py", line 18, in __init__
>  self.SaveFiles.connect(self.fileDialog.exec_)
> TypeError: 'exec_()' has no overload that is compatible with
'SaveFiles()'
> 
> This is with PyQt 4.7.2. The problem is not apparent in 4.7.
> 
> If I subclass QDialog, the problem persists, but I can workaround by 
> defining my own exec_ method.

Yuck - the problem is that it's using the Python method name (exec_) rather
than the C++ method name (exec) to look up the slot.

Attached is a patch that will fix it - looks like there will be a v4.7.3
fairly soon.

Phildiff -r 9528814bc9bd qpy/QtCore/qpycore_pyqtboundsignal.cpp
--- a/qpy/QtCore/qpycore_pyqtboundsignal.cppWed Mar 17 18:26:22 2010 +
+++ b/qpy/QtCore/qpycore_pyqtboundsignal.cppFri Mar 19 12:52:03 2010 +
@@ -561,6 +561,13 @@
 {
 rx_self = PyCFunction_GET_SELF(slot_obj);
 rx_name = ((PyCFunctionObject *)slot_obj)->m_ml->ml_name;
+
+// We actually want the C++ name which may (in theory) be completely
+// different.  However this will cope with the exec_ case which is
+// probably good enough.
+if (rx_name.endsWith('_'))
+rx_name.chop(1);
+
 need_qt_slot = true;
 }
 else
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[PyQt] problem connecting to QDialog exec_ method

2010-03-19 Thread Stuart McNicholas

I have a very simple program:

from PyQt4 import QtGui, QtCore
import sys

class Win(QtGui.QWidget):
  SaveFiles = QtCore.pyqtSignal()
  def __init__(self,parent=None):
QtGui.QWidget.__init__(self,parent)
self.fileDialog = QtGui.QDialog()
self.SaveFiles.connect(self.fileDialog.exec_)
self.SaveFiles.emit()

app = QtGui.QApplication(sys.argv)

win = Win()
win.show()
win.raise_()

sys.exit(app.exec_())

which produces the error:

Traceback (most recent call last):
  File "jif.py", line 23, in 
win = Win()
  File "jif.py", line 18, in __init__
self.SaveFiles.connect(self.fileDialog.exec_)
TypeError: 'exec_()' has no overload that is compatible with 'SaveFiles()'

This is with PyQt 4.7.2. The problem is not apparent in 4.7.

If I subclass QDialog, the problem persists, but I can workaround by 
defining my own exec_ method.


Best Wishes,
Stuart McNicholas
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] PyQt 4.7 / Qt 4.6.1 QSortFilterProxyModel subclass not emitting signals

2010-03-19 Thread Giacomo Lacava
It seems like subclasses of QSortFilterProxyModel will not emit
inherited signals. Tested with PyQt 4.7 / Qt 4.6.1 on Windows XP. I
couldn't find any related entry in Qt bugtracker, so I guess it's
PyQt's fault (unless I've done something wrong).

Here's a simple testcase (expects a ui.py file with a MainWindow with
one pushButton and one listView ).

import sys
from PyQt4 import QtCore, QtGui
from PyQt4.QtCore import Qt, SIGNAL, QVariant
from ui import *

class MyModel(QtCore.QAbstractTableModel):
def __init__(self):
super(QtCore.QAbstractTableModel,self).__init__()

def rowCount(self,index=QtCore.QModelIndex()):
return 3

def columnCount(self,index=QtCore.QModelIndex()):
return 3

def data(self,index=QtCore.QModelIndex(),role=Qt.DisplayRole):
if index.row() < 0 or index.row() > self.rowCount() or \
index.column() < 0 or index.column() > self.columnCount():
return QtCore.QVariant()

if role == Qt.DisplayRole:
if index.row() == 1:
return QVariant("Something")
else:
return QVariant("Else")

class MyProxyModel(QtGui.QSortFilterProxyModel):
def __init__(self, sourceModel):
super(QtGui.QSortFilterProxyModel,self).__init__()
self.setSourceModel(sourceModel)
self.setFilterKeyColumn(0)

@QtCore.pyqtSlot('QString')
def setFilterFixedString(self, *args):
QtGui.QSortFilterProxyModel.setFilterFixedString(self,"Something")


class MyMain(Ui_MainWindow):
def __init__(self):
super(Ui_MainWindow,self).__init__()
self.window = QtGui.QMainWindow()
self.setupUi(self.window)

self.model = MyModel()
self.proxyModel = MyProxyModel(self.model)

self.listView.setModel(self.proxyModel)
self.listView.setModelColumn(0)


self.listView.connect(self.pushButton,SIGNAL("clicked()"),self.proxyModel.setFilterFixedString)
self.proxyModel.layoutChanged.connect(self.trigger)
self.window.show()

def trigger(self,*args):
print "triggered"

if __name__ == '__main__':

app = QtGui.QApplication(sys.argv)
tm = MyMain()
sys.exit(app.exec_())

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


Re: [PyQt] Again, problems with garbage collection

2010-03-19 Thread Martin Teichmann
Hi List, Hi Phil,

>> I just upgraded to PyQt4 4.7.2 (with Python 2.6.4 on Windows XP)
>> and the following little script crashes with "unterlying C/C++ object
>> has been deleted"
>>
>> I guess that's a bug.
>
> Why? It works as I would expect.

Oops. I didn't realize that that's a excpected behaviour. I was under the
impression that Qt shouldn't "own" objects and delete them, so that
this runtime error was always indicator of a bug (or an indicator that
someone forgot to call the parent's __init__, maybe the error message
should actually read "underlying C/C++ object has been deleted or not
yet created", anyhow, that's not the current problem)

Unfortunately, this leads to the somewhat annoying behaviour that
signals are still sent to C++-dead but python-alive objects. That's
especially annoying when the python object ought to be dead already,
just had not been collected yet, as illustrated in the following
example. Note how gc.collect makes a difference, a situation that
better should not happen as garbage collection happens at random intervals...

Greetings

Martin

And here the example:

-- snip -
from PyQt4.QtCore import QObject, SIGNAL, QCoreApplication
import gc

# following two lines not important
from sys import argv
app = QCoreApplication(argv)

class A(QObject):
def __init__(self, p=None):
QObject.__init__(self, p)

def g(self):
self.emit(SIGNAL("sig"))

def k(self):
self.emit(SIGNAL("kill"))

def f(self):
try:
print self.children() # only to test if C++ object is still alive
except RuntimeError:
print "hey, caught runtime error!"

def kill(self):
self.setParent(None)

a = A()
b = A(a)
c = A(b)

b.connect(a, SIGNAL("sig"), c.f)
b.connect(a, SIGNAL("kill"), b.kill)

a.g() # deliver signal to c, all fine
c.v = c # create cycle to prevent immediate collection
b = None
c = None
a.k() # now c ceases existence in the C++ world
print "here"
a.g() # signal is still delivered
print "now collect"
gc.collect()
a.g() # signal no more delivered, python object has died
 snip -
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Delete a Laytou

2010-03-19 Thread Nick Gaens
Take a look at a QStackedLayout.. You can add multiple widgets, each having
their own layout, to it and set it as the central widget of your mainwindow.
There's no need for deleting a layout and set a new one, since you alternate
between the added widgets / layouts.

Check out http://doc.trolltech.com/4.3/qstackedlayout.html#details to see a
short example..

On Thu, Mar 18, 2010 at 11:39 PM, starglider develop <
starglider@gmail.com> wrote:

> Hi,
> I have a QMainWindow with a main Vertical Layout and  3 HLayouts and
> several Widgets in every layout,
> but the program needs to remove all the layouts to create another one with
> a widget.
> How can I remove the original layouts? I was unable to find an answer in
> the internet.
>
> Thank you in advance for your help.
>
> Regards
>
> ___
> PyQt mailing listPyQt@riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>



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

[PyQt] Link failure when compiling with --debug on Mac

2010-03-19 Thread Stuart McNicholas

Dear All,

I tried configuring with --debug on OS X 10.6 with sip 4.10.1/PyQt 
4.7.2, Qt 4.6.2 (built from source)


The linker tries to pull in -framework QtCore_debug. This does not 
exist. -lQtCore_debug could possibly work with libtool, I guess?



g++ -headerpad_max_install_names -bundle -undefined dynamic_lookup -arch 
i386 -o QtCore.so sipQtCorecmodule.o 
sipQtCoreQList0600QPair0100QByteArray0100QByteArray.o 
sipQtCoreQList0600QPair0100QString0100QString.o 
sipQtCoreQSet0101QAbstractState.o sipQtCoreQList0100QUrl.o 
sipQtCoreQList0101QAbstractAnimation.o 
sipQtCoreQList0101QAbstractState.o sipQtCoreQHash18000100QByteArray.o 
sipQtCoreQMap18000100QVariant.o sipQtCoreQList0100QByteArray.o 
sipQtCoreQVector0100QXmlStreamNotationDeclaration.o 
sipQtCoreQVector0100QXmlStreamNamespaceDeclaration.o 
sipQtCoreQVector0100QXmlStreamEntityDeclaration.o 
sipQtCoreQMap0100QString0100QVariant.o sipQtCoreQList0100QVariant.o 
sipQtCoreQHash0100QString0100QVariant.o 
sipQtCoreQVector0600QPair24000100QVariant.o sipQtCoreQList0101QObject.o 
sipQtCoreQList0100QModelIndex.o sipQtCoreQList0100QFileInfo.o 
sipQtCoreQXmlStreamWriter.o sipQtCoreQXmlStreamReader.o 
sipQtCoreQXmlStreamEntityResolver.o 
sipQtCoreQXmlStreamEntityDeclaration.o 
sipQtCoreQXmlStreamNotationDeclaration.o 
sipQtCoreQXmlStreamNamespaceDeclaration.o 
sipQtCoreQXmlStreamAttributes.o sipQtCoreQXmlStreamAttribute.o 
sipQtCoreQWaitCondition.o sipQtCoreQVector2400.o sipQtCoreQVector1900.o 
sipQtCoreQVariant_5.o sipQtCoreQVariant_4.o sipQtCoreQUuid.o 
sipQtCoreQUrlFormattingOptions.o sipQtCoreQUrl.o sipQtCoreQTranslator.o 
sipQtCoreQTimer.o sipQtCoreQTimeLine.o sipQtCoreQThreadPool.o 
sipQtCoreQThread.o sipQtCoreQTextStreamManipulator.o 
sipQtCoreQTextStreamNumberFlags.o sipQtCoreQTextStream.o 
sipQtCoreQTextDecoder.o sipQtCoreQTextEncoder.o 
sipQtCoreQTextCodecConverterState.o sipQtCoreQTextCodecConversionFlags.o 
sipQtCoreQTextCodec.o sipQtCoreQTextBoundaryFinderBoundaryReasons.o 
sipQtCoreQTextBoundaryFinder.o sipQtCoreQTemporaryFile.o 
sipQtCoreQSystemSemaphore.o sipQtCoreQStringMatcher_0.o 
sipQtCoreQStringList_0.o sipQtCoreQStringList_1.o 
sipQtCoreQStringRef_0.o sipQtCoreQStringRef_1.o 
sipQtCoreQLatin1String_0.o sipQtCoreQStringSectionFlags_0.o 
sipQtCoreQString_0.o sipQtCoreQString_1.o 
sipQtCoreQStateMachineWrappedEvent.o sipQtCoreQStateMachineSignalEvent.o 
sipQtCoreQStateMachine.o sipQtCoreQState.o sipQtCoreQSocketNotifier.o 
sipQtCoreQSizeF.o sipQtCoreQSize.o sipQtCoreQSignalTransition.o 
sipQtCoreQSignalMapper.o sipQtCoreQSharedMemory.o sipQtCoreQSettings.o 
sipQtCoreQSequentialAnimationGroup.o sipQtCoreQSemaphore.o 
sipQtCoreQRunnable.o sipQtCoreQResource.o sipQtCoreQRegExp.o 
sipQtCoreQRectF.o sipQtCoreQRect.o sipQtCoreQWriteLocker.o 
sipQtCoreQReadLocker.o sipQtCoreQReadWriteLock.o 
sipQtCoreQPropertyAnimation.o sipQtCoreQVariantAnimation.o 
sipQtCoreQProcessEnvironment.o sipQtCoreQProcess.o sipQtCoreQPointF.o 
sipQtCoreQPoint.o sipQtCoreQPluginLoader.o sipQtCoreQPauseAnimation.o 
sipQtCoreQParallelAnimationGroup.o sipQtCoreQPair18001800.o 
sipQtCoreQGenericReturnArgument.o sipQtCoreQGenericArgument.o 
sipQtCoreQMetaObject.o sipQtCoreQObjectCleanupHandler.o 
sipQtCoreQWidget.o sipQtCoreQMutexLocker.o sipQtCoreQMutex.o 
sipQtCoreQMimeData.o sipQtCoreQMetaType.o sipQtCoreQMetaClassInfo.o 
sipQtCoreQMetaProperty.o sipQtCoreQMetaEnum.o sipQtCoreQMetaMethod.o 
sipQtCoreQMargins.o sipQtCoreQList0100QLocaleCountry.o 
sipQtCoreQSystemLocale.o sipQtCoreQLocaleNumberOptions.o 
sipQtCoreQLocale.o sipQtCoreQList2400.o sipQtCoreQList1800.o 
sipQtCoreQList0600QPair24002400.o sipQtCoreQList0600QPair18001800.o 
sipQtCoreQLineF.o sipQtCoreQLine.o sipQtCoreQLibraryInfo.o 
sipQtCoreQLibraryLoadHints.o sipQtCoreQLibrary.o 
sipQtCoreQIODeviceOpenMode.o sipQtCoreQHistoryState.o 
sipQtCoreQFSFileEngine.o sipQtCoreQFinalState.o 
sipQtCoreQFileSystemWatcher.o sipQtCoreQFileInfo.o 
sipQtCoreQFilePermissions.o sipQtCoreQFile.o sipQtCoreQEventTransition.o 
sipQtCoreQEventLoopProcessEventsFlags.o sipQtCoreQEventLoop.o 
sipQtCoreQEasingCurve.o sipQtCoreQDirIteratorIteratorFlags.o 
sipQtCoreQDirIterator.o sipQtCoreQDirSortFlags.o sipQtCoreQDirFilters.o 
sipQtCoreQDir.o sipQtCoreQDateTime.o sipQtCoreQTime.o sipQtCoreQDate.o 
sipQtCoreQDataStream.o sipQtCoreQCryptographicHash.o 
sipQtCoreQDynamicPropertyChangeEvent.o sipQtCoreQChildEvent.o 
sipQtCoreQTimerEvent.o sipQtCoreQEvent.o sipQtCoreQCoreApplication.o 
sipQtCoreQChar_0.o sipQtCoreQChar_1.o sipQtCoreQLatin1Char_0.o 
sipQtCoreQByteArrayMatcher.o sipQtCoreQByteArray.o sipQtCoreQBuffer.o 
sipQtCoreQIODevice.o sipQtCoreQBitArray.o sipQtCoreQBasicTimer.o 
sipQtCoreQAnimationGroup.o sipQtCoreQAbstractTransition.o 
sipQtCoreQAbstractState.o sipQtCoreQAbstractListModel.o 
sipQtCoreQAbstractTableModel.o sipQtCoreQAbstractItemModel.o 
sipQtCoreQPersistentModelIndex.o sipQtCoreQModelIndex.o 
sipQtCoreQAbstractFileEngineIterator.o 
sipQtCoreQAbstractFileEngineHandler.o 
sipQtCoreQAbstractFileEngineFileFlags.o sipQtCoreQAbstract