Re: [PyQt] Collapse/expand frame

2009-08-19 Thread Alexei Puzikov
I've done some testing. The majour problem here seems to be
QVBoxLayout is sending resizeEvent (or doing something else
that sends such event) to all the children widgets that has their own Layouts.

And this causes flickering.

Anybody can figure out why?

A.

On Fri, Aug 14, 2009 at 11:50 PM, Hans-Peter Jansen wrote:
> Am Freitag, 14. August 2009 schrieb Alexei Puzikov:
>> >> Actually, you do, as soon as you'll pass over some amount of controls.
>> >>
>> >> I have the editor here that reimplements the screenshot (it's Maya,
>> >> btw) and in worst situations contains approx. 4500 controls. And I'm
>> >> still unable to remove
>> >> flickering on switch - basically, the layout refresh.
>> >>
>> >> If anybody can prototype something that works with big amount of
>> >> controls - his help would be enormous. Really.
>> >
>> > Hmm, Alexei, please don't feel offended, but presenting 4500 controls
>> > to user basically sounds like a pathologic situation, where _concepts_
>> > lost control ;-)...
>>
>> Well, it's probably Friday evening fluctuated my math a little bit -
>> so, in worst case,
>> it's 1500 controls. Which is actually pretty easy to achieve: 2
>> spacers, label, editor and slider
>> for each parameter.
>
> Ahh, okay, we're talking about 500 composite widgets then - which is where
> things start to get imaginable ;-)
>
>> > How is a user supposed to master that? Something similar to
>> > car navigation for the screen? (Take the second branch right, move
>> > mouse 200mm north, you reached your target, it's on the left side..)
>>
>> Well, that's what makes my job interesting :) Yes, it's a tough UI
>> stuff. Filtering, proper
>> grouping, good usable search, tagging, good documentation and most of
>> all - good default values :)
>>
>> > Even, if that widget, or control, if you like, is implemented in C++,
>> > as long as it is resizing itself, flickering cannot be suppressed,
>> > since it forces Qt to redraw the whole frame. I would start looking,
>> > how to get the whole thing into managable pieces. Next you may try to
>> > use a home grown layout manager, that is optimized for these cases
>> > (e.g. moves screen areas, but that's going to be tough, don't it?)
>>
>> I'm not sure. What actually bugs me is that layout engine is
>> repainting the widgets
>> that's haven't changed their geometry. Given how many layouts I have,
>> this flickers
>>
>> You think this might be overwritten?...
>
> What I had in mind was a layout manager, that's being aware of the
> situation: repaint only small screen areas (the widget, that is resizing
> itself), and copying the unchanged screen areas around, its doable but
> that's going to be a tough job, I assume.
>
> Pete
>
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] pylupdate4 error: Unbalanced parentheses in Python code

2009-08-19 Thread Paul Rouleau

This is to report what looks like an error error.

I am using PyQt 4.3 on Ubuntu Hardy Heron. This is the most recent 
version of PyQt that is packaged with Hardy.



I have this error with pylupdate:


p...@ubuntu:~/Python$ pylupdate4 buggy.py -ts buggy.ts
buggy.py: Unbalanced parentheses in Python code



The file buggy.py contains this code which is a simplified sample for 
purpose of isolating the problem:


Begin code
#!/usr/bin/python
# -*- coding: utf8 -*-

from PyQt4 import QtGui,  QtCore

#
# bugs when no blankline after the comment
#
enterSymbols = list( (92.5, 'Enter symbols...' , 12345, 'Ctrl+E',
  "Enter new symbols ",
  unicode) )
- end code

I am at lost at finding unbalanced parentheses there. The python 
interpreter doesn't find any either for I don't see an error message 
when I run the code.


On the other hand pylupdate4 doesn't report any error with this code:

 begin code
#!/usr/bin/python
# -*- coding: utf8 -*-

from PyQt4 import QtGui,  QtCore

#
# works fine when there is a blank line after the comment
#

enterSymbols = list( (92.5, 'Enter symbols...' , 12345, 'Ctrl+E',
  "Enter new symbols ",
  unicode) )
 end code


The difference between the two programs is an extra blank line between 
the comment and the assignment statement.



I have searched the archive of this mailing list for the error message 
to no avail. I verified there is nothing relevant in the Ubuntu forums 
nor in Launchpad. A Google search didn't help either.


The workaround is easy: add extra blank lines after comments when the 
next statement has parenthesis that spill over many lines. But the error 
is not reported anywhere I can think of, I felt like I should report it 
here.

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


Re: [PyQt] Re: missing sql drivers

2009-08-19 Thread Hans-Peter Jansen
Am Mittwoch, 19. August 2009 schrieb Mario Daniel Carugno:
> 2009/8/18 Mario Daniel Carugno :
> > Hi, i've installed PyQt4 (Py2.5-gpl4.4.3-1.exe) on Windows.
> >
> > The path is ok, the ODBC source is configured.
> > The application shows the GUI, but it don't find any sql driver.
> >
> > Some idea about what could be wrong ?
>
> Fixed by uninstalling everything, deleting the python25 directory, and
> reinstalling everything again... I'll never understand why this ugly
> method always works ;-)

Hey, that's by design. Being the market leader is obligating...

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


[PyQt] Where to find old PyQt binaries?

2009-08-19 Thread Daniel Naab
I have some issues that have recently surfaced in a project, which my  
best guess is caused by the PyQt 4.5.4 update.  Is there a location I  
can download old versions of the Windows Installer binaries?


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


Re: [PyQt] PyQt (QtGui.QTableWidget) problem using threads

2009-08-19 Thread Brent Villalobos
You can only do GUI operations in the main thread.  I would emit signals 
from your worker thread that are connected to operations in your main 
threads that do the actual gui manipulation.

-Brent

Ole Streicher wrote:

Hi,

When I try to update a table from another thread, my program crashes or
gives really unexpected results.

Here is some example code:
-8<--
import threading
import sys
import time

from PyQt4 import QtGui, QtCore

app = QtGui.QApplication(sys.argv)

main = QtGui.QMainWindow()
table = QtGui.QTableWidget(2, 2, main)
main.setCentralWidget(table)

class MyThread(threading.Thread):
def run(self):
time.sleep(3)
table.insertRow(2)
table.setCellWidget(2, 0, QtGui.QLabel('Hallo Welt'))

MyThread().start()


main.show()
app.exec_()
-8<--

The sleep() function just simulates some calculation.
When I start the program, it always shows warnings like 


QObject::setParent: Cannot set parent, new parent is in a different thread
QPixmap: It is not safe to use pixmaps outside the GUI thread
QObject::installEventFilter(): Cannot filter events for objects in a different 
thread.

QObject::installEventFilter(): Cannot filter events for objects in a different 
thread.
QObject::installEventFilter(): Cannot filter events for objects in a different 
thread.
QCoreApplication::sendPostedEvents: Cannot send posted events for objects in 
another thread
QCoreApplication::sendPostedEvents: Cannot send posted events for objects in 
another thread

Sometimes it shows the QLabel in an extra window which re-openes when I
try to close it. Sometimes this program crashes with the additional
printout

python: ../../src/xcb_io.c:176: process_responses: Assertion `!(req && current_request 
&& !(((long) (req->sequence) - (long) (current_request)) <= 0))' failed.
Aborted

or 


X Error: BadGC (invalid GC parameter) 13
  Major opcode: 56 (X_ChangeGC)
  Resource id:  0x2803500
table.py: Fatal IO error: client killed

What is wrong with my code and how can I add a table row and fill it
with a QWidget from another thread? I already tried to set the parent of
the QLabel to table or to main.

Qt version 4.5.0, PyQt4 version 4.4.4 (kubuntu 9.04)
Qt version 4.4.3, PyQt4 version 4.4.3 (SuSE 11.1)

Best regards

Ole

___
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] Sip iterator question

2009-08-19 Thread Sébastien Petitdemange
Hello All,

I try to create an iterator using python iterator protocol but I didn't
succeed.

The sip code look like that:

struct Data_HeaderContainer_itemIterator
{
%TypeHeaderCode
#include "data_header_iterator.h"
%End

public:
  Data_HeaderContainer_itemIterator(Data::HeaderContainer&);
  SIP_PYOBJECT next();
%MethodCode
if(sipCpp->_cur != sipCpp->_end)
{
  sipRes =
Py_BuildValue("(ss)",sipCpp->_cur->first.c_str(),sipCpp->_cur->second.c_str());
  ++(sipCpp->_cur);
}
else
 PyErr_SetString(PyExc_StopIteration,"");
%End

Data_HeaderContainer_itemIterator* __iter__();
%MethodCode
sipRes = sipCpp;
%End
};

and we I use it in python, It say that my object is not an iterator :

for k in i:
... print k
...
Traceback (most recent call last):
  File "", line 1, in 
TypeError: 'Data_HeaderContainer_itemIterator' object is not iterable

what I'm I missing?

Thanks in advance,
SEB
begin:vcard
fn;quoted-printable:S=C3=A9bastien Petitdemange
n;quoted-printable:Petitdemange;S=C3=A9bastien
email;internet:sebastien.petitdema...@esrf.fr
tel;work:1994
x-mozilla-html:TRUE
version:2.1
end:vcard

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

[PyQt] Re: missing sql drivers

2009-08-19 Thread Mario Daniel Carugno
2009/8/18 Mario Daniel Carugno :
> Hi, i've installed PyQt4 (Py2.5-gpl4.4.3-1.exe) on Windows.
> That release has sql support, and i use the ODBC driver. I know it
> works since i use this same release in another Windows machines.
> But in this particular computer, when i run the same code that works
> in the others, i get the following error:
>
>  QSqlDatabase: QODBC driver not loaded
>  QSqlDatabase: available drivers:
>  QSqlDatabase::prepare: database not open
>
> It seems that the PyQt installation has no sql drivers, but it's the
> same installation that works in the other computers. Besides i've
> checked out \Python25\Lib\site-packages\PyQt4\plugins\sqldrivers and
> there are DLLs (qsqlodbc4.dll and others).
>
> The path is ok, the ODBC source is configured.
> The application shows the GUI, but it don't find any sql driver.
>
> Some idea about what could be wrong ?
>
Fixed by uninstalling everything, deleting the python25 directory, and
reinstalling everything again... I'll never understand why this ugly
method always works ;-)

Regards

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


Re: [PyQt] Fade effect a widget on top of another widget

2009-08-19 Thread Albert Cervera i Areny
A Dimecres, 19 d'agost de 2009, David Boddie va escriure:
> On Wed Aug 19 08:46:12 BST 2009, Mailing List SVR wrote:
> > it is possible to have a short example with code?
>
> http://www.diotavelli.net/PyQtWiki/Fading Between Widgets

Thanks a lot for the example, David!

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


-- 
Albert Cervera i Areny
http://www.NaN-tic.com
Mòbil: +34 669 40 40 18
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Fade effect a widget on top of another widget

2009-08-19 Thread David Boddie
On Wed Aug 19 14:30:00 BST 2009, Hans-Peter Jansen wrote:
> Am Mittwoch, 19. August 2009 schrieb David Boddie:
> > On Wed Aug 19 08:46:12 BST 2009, Mailing List SVR wrote:
> > > it is possible to have a short example with code?
> >
> > http://www.diotavelli.net/PyQtWiki/Fading Between Widgets
>
> Awesome, David.

I have to give credit to Jason H. for suggesting the use of QWidget.render(),
otherwise I would probably have made the example much more complicated. :-)

Another interesting example of an overlay widget can be found on the Qt
Centre Wiki:

http://wiki.qtcentre.org/index.php?title=Widget_Overlay

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


Re: [PyQt] Fade effect a widget on top of another widget

2009-08-19 Thread Hans-Peter Jansen
Am Mittwoch, 19. August 2009 schrieb David Boddie:
> On Wed Aug 19 08:46:12 BST 2009, Mailing List SVR wrote:
> > it is possible to have a short example with code?
>
> http://www.diotavelli.net/PyQtWiki/Fading Between Widgets

Awesome, David.

Pete

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


Re: [PyQt] Fade effect a widget on top of another widget

2009-08-19 Thread David Boddie
On Wed Aug 19 08:46:12 BST 2009, Mailing List SVR wrote:

> it is possible to have a short example with code?

http://www.diotavelli.net/PyQtWiki/Fading Between Widgets

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


Re: [PyQt] Friend function in python

2009-08-19 Thread Mateusz Korniak
On Wednesday 19 of August 2009, abhishek gupta wrote:
> Hi ,  I want to ask if there is a way I can access the member function
> of a class from another class without instantiating that class (whose
> single instance is already running as the Main Application) . In other
> words I want to ask how we can implement the concept of friend functions in
> Python . 


It's more general python q...

http://pyref.infogami.com/staticmethod
http://pyref.infogami.com/classmethod

> Actually I am trying to implement a three level threading in my 
> application and one of the thread class needs to access the member function
> of the application class .

Be carefull what qt calls may be called fron non-qt threads ...

Regards,

-- 
Mateusz Korniak
"(...) mam brata - poważny, domator, liczykrupa, hipokryta, pobożniś,
krótko mówiąc - podpora społeczeństwa."
Nikos Kazantzakis - "Grek Zorba"
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] Friend function in python

2009-08-19 Thread abhishek gupta
Hi ,  I want to ask if there is a way I can access the member function
of a class from another class without instantiating that class (whose single
instance is already running as the Main Application) . In other words I want
to ask how we can implement the concept of friend functions in Python .
Actually I am trying to implement a three level threading in my application
and one of the thread class needs to access the member function of the
application class .

-- 
Abhishek Gupta
NIT,Durgapur
http://abhishekin.wordpress.com/
http://blog.sun.com/abhishekgupta/
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[PyQt] PyQt (QtGui.QTableWidget) problem using threads

2009-08-19 Thread Ole Streicher
Hi,

When I try to update a table from another thread, my program crashes or
gives really unexpected results.

Here is some example code:
-8<--
import threading
import sys
import time

from PyQt4 import QtGui, QtCore

app = QtGui.QApplication(sys.argv)

main = QtGui.QMainWindow()
table = QtGui.QTableWidget(2, 2, main)
main.setCentralWidget(table)

class MyThread(threading.Thread):
def run(self):
time.sleep(3)
table.insertRow(2)
table.setCellWidget(2, 0, QtGui.QLabel('Hallo Welt'))

MyThread().start()

main.show()
app.exec_()
-8<--

The sleep() function just simulates some calculation.
When I start the program, it always shows warnings like 

QObject::setParent: Cannot set parent, new parent is in a different thread
QPixmap: It is not safe to use pixmaps outside the GUI thread
QObject::installEventFilter(): Cannot filter events for objects in a different 
thread.

QObject::installEventFilter(): Cannot filter events for objects in a different 
thread.
QObject::installEventFilter(): Cannot filter events for objects in a different 
thread.
QCoreApplication::sendPostedEvents: Cannot send posted events for objects in 
another thread
QCoreApplication::sendPostedEvents: Cannot send posted events for objects in 
another thread

Sometimes it shows the QLabel in an extra window which re-openes when I
try to close it. Sometimes this program crashes with the additional
printout

python: ../../src/xcb_io.c:176: process_responses: Assertion `!(req && 
current_request && !(((long) (req->sequence) - (long) (current_request)) <= 
0))' failed.
Aborted

or 

X Error: BadGC (invalid GC parameter) 13
  Major opcode: 56 (X_ChangeGC)
  Resource id:  0x2803500
table.py: Fatal IO error: client killed

What is wrong with my code and how can I add a table row and fill it
with a QWidget from another thread? I already tried to set the parent of
the QLabel to table or to main.

Qt version 4.5.0, PyQt4 version 4.4.4 (kubuntu 9.04)
Qt version 4.4.3, PyQt4 version 4.4.3 (SuSE 11.1)

Best regards

Ole

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


Re: [PyQt] Fade effect a widget on top of another widget

2009-08-19 Thread Mailing List SVR
Thanks,

it is possible to have a short example with code?

In data martedì 18 agosto 2009 18:23:25, Jason H ha scritto:
: > 
> >> That is for a cross fade. You could always fade to empty then fade out.
> 
> > I would probably do something like that for a cross fade. The fader widget
> > appears to do a different kind of fade.
> 
> The only difference is it is a fade against a solid color. You could create 
> the Pixmap, repsecting the Palette background color. and use that for 
> intermediate fading/in/out
> 
> 
> 
>   
> ___
> 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] PySide: LGPL Qt binding

2009-08-19 Thread Ville M. Vainio
It seems there is a new Python binding for Qt around:

http://www.pyside.org/

>From what I gather, it seems to use boost::python (?), and is still at
Linux-only stage.

-- 
Ville M. Vainio
http://tinyurl.com/vainio
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] using qpainter and drawing lines on widget

2009-08-19 Thread Phil Thompson
On Wed, 19 Aug 2009 00:22:02 -0700 (PDT), vidyadhar
 wrote:
> can anyone pls give me an example or any idea on how to dray lines on a
> widget on the movment of mouse and click.
> i think i have to use a Qpainter class but dont know how to go abt it in
> pyqt.
> pls help
> thanks

As David said (yesterday?), look at the scribble.py example included with
PyQt.

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


[PyQt] using qpainter and drawing lines on widget

2009-08-19 Thread vidyadhar

can anyone pls give me an example or any idea on how to dray lines on a
widget on the movment of mouse and click.
i think i have to use a Qpainter class but dont know how to go abt it in
pyqt.
pls help
thanks
-- 
View this message in context: 
http://www.nabble.com/using-qpainter-and-drawing-lines-on-widget-tp25039063p25039063.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] missing MySQL/PostGres drivers

2009-08-19 Thread Phil Thompson
On Tue, 18 Aug 2009 16:47:57 -0700, Scott Ballard 
wrote:
> Ok, so under Windows XP 32-bit I've installed Python 2.6.2 and 
> PyQt-Py2.6-gpl-4.5.4-1.exe and the QMYSQL driver is not listed in the 
> available drivers. I've verified that I'm running 2.6 and not 2.5.
> 
> The drivers that are available are:
> QSQLITE
> QODBC3
> QODBC
> QPSQL7
> QPSQL
> 
> The qmysql4.dll is in the 
> Python26\Lib\site-packages\PyQt4\plugins\sqldrivers.
> 
> Any thoughts Phil? Is there anything special I need to do to load the 
> driver?

Do you have the MySQL client DLLs installed?

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