Re: [PyQt] PyQt examples phonon.

2010-06-29 Thread Christoph Burgmer
> On Fri Jun 25 13:20:11 BST 2010, F.A.Pinkse wrote:
> > I was looking inside the PyQt Examples source/phonon/musicplayer.pyw
> > using Eric5 on Python3
> > 
> > Eric found:
> > 
> > warning: variable declared but never used.
> > 
> > source = self.metaInformationResolver.currentSource()
> > 
> > It is in line number 185
> 
> If source isn't used, and it seems that it isn't, then that line should
> just be removed from the example.

If you do this to the MainWindow, your application will crash.
AFAIK an object is deleted once no reference is being held, so I'd be careful 
with deleting that. I might be wrong though.

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


Re: [PyQt] pythonw crash trying to run demos

2010-03-24 Thread Christoph Burgmer
Even if it seems to be a working example from the book, you might want to 
provide the source code for us. Make sure we can try to reproduce the problem.

Can you run at least another example program to show your installation is 
working?

Please also try to use text emails, not html.
Best,
-Christoph

Am Dienstag, 23. März 2010 schrieb Colin Jenkins:
> Hi,
> 
>  I have tried to google my problem but no luck - can not find archive of
>  this list to check either. 
> 
>  Apologies for basic Q.
> 
>  Bought the Summerfield rapid GUI book and Python 3.1 books.
> 
>  Using windows xp sp3.
> 
>  Just installed python 3.1.2 (windows .msi) + pyqt-py3.1-gpl4.7.2-1
>  (windows .exe).
> 
>  Started the "examples and demo" = crash in pythonw.
> 
>  The IDLE shell works OK.
> 
>  Windows restart not helped.
> 
>  Any ideas? 
> 
>  Ditto with python 2.6.5 and the corresponding pyqt binary.
> 

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


Re: [PyQt] QKeySequence.Quit missing

2010-03-07 Thread Christoph Burgmer
Am Sonntag, 7. März 2010 schrieben Sie:
> On Sat, 6 Mar 2010 18:14:06 +0100, Christoph Burgmer 
> 
> wrote:
> > It seems QKeySequence.Quit and QKeySequence.Preferences are missing from
> > enum
> > QKeySequence::StandardKey
> >
> >>>> from PyQt4.QtGui import QKeySequence
> >>>> QKeySequence.InsertLineSeparator
> >
> > 62
> >
> >>>> QKeySequence.SaveAs
> >
> > 63
> >
> >>>> QKeySequence.Preferences
> >
> > Traceback (most recent call last):
> >   File "", line 1, in 
> > AttributeError: type object 'QKeySequence' has no attribute 'Preferences'
> >
> >>>> QKeySequence.Quit
> >
> > Traceback (most recent call last):
> >   File "", line 1, in 
> > AttributeError: type object 'QKeySequence' has no attribute 'Quit'
> >
> > I'm running 4.6 on Debian.
> 
> 4.6 of what? Support was added to Qt v4.6 and PyQt v4.7.

Sorry, PyQt4.6. The Qt documentation didn't mention that these attributes 
where added lately, so I assumed they existed since Qt4.2 as mentioned for 
QKeySequence::StandardKey.

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

[PyQt] QKeySequence.Quit missing

2010-03-06 Thread Christoph Burgmer
It seems QKeySequence.Quit and QKeySequence.Preferences are missing from enum 
QKeySequence::StandardKey

>>> from PyQt4.QtGui import QKeySequence
>>> QKeySequence.InsertLineSeparator
62
>>> QKeySequence.SaveAs
63
>>> QKeySequence.Preferences
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: type object 'QKeySequence' has no attribute 'Preferences'
>>> QKeySequence.Quit
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: type object 'QKeySequence' has no attribute 'Quit'

I'm running 4.6 on Debian.

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


Re: [PyQt] Embedding VLC

2010-03-01 Thread Christoph Burgmer
Am Montag, 1. März 2010 schrieb jaybstory:
> I've heard about the phonon-vlc-backend which appears to not be available
> yet.  Is this what you are talking about?

I don't know how the current state is, but it did compile a year ago as you 
can find out if you google a bit, and commits were made recently. You might 
want to contact the developers.

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


Re: [PyQt] Embedding VLC

2010-02-28 Thread Christoph Burgmer
Am Samstag, 27. Februar 2010 schrieb jaybstory:
> I wanted to know if it is possible to embed VLC into a GUI (or to use
> QProcess to somehow open the external application inside a GUI), if so, how
> would I go about accomplishing this?

Do you know about phonon-vlc?

http://gitorious.org/phonon/phonon-vlc

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


Re: [PyQt] QTextDocument problem rendering HTML

2009-09-03 Thread Christoph Burgmer
Am Donnerstag, 3. September 2009 schrieb Gustavo A. Díaz:
> Does QTextDocument has limited support for css or html content?

http://doc.trolltech.com/4.5/richtext-html-subset.html

HTH
-Christoph

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


Re: [PyQt] Error when using Chinese characters in PyQt Designer

2009-07-27 Thread Christoph Burgmer
Am Freitag, 24. Juli 2009 schrieb ZelluX:
> Hi, all
>
> In PyQt Designer 4.5.2 I set the property 'text' of a QPushButton to some
> Chinese characters, and when I run pyuic4 to generate the coresponding .py
> file, it reports error, here is traceback:

_snip_

> It seems pyuic4 cannot handle Chinese characters correctly. Is there anyway
> to deal with unicode? Many thanks.

Can you attach an example of your .ui file?
It's "just" an encoding error and can probably be fixed if there is no code 
that explicitly asks for a str (and wouldn't accept unicode).
-Christoph
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] QVariantHash bug in PyQt 4.5.1 (+patch)

2009-07-15 Thread Christoph Burgmer
This is what I get:

$ python  
Python 2.5.4 (r254:67916, Feb 17 2009, 20:16:45)
 
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt4.QtCore import QVariant
>>> QVariant({'a': 1}).toMap()
{}
>>> QVariant({'a': 1}).type()
127

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


Re: [PyQt] best dvcs

2009-07-04 Thread Christoph Burgmer
Am Samstag, 4. Juli 2009 schrieb patx:
> I am a PyQt4 developer. I was wondering what DVCS most PyQt4 people are
> using (Mercurial, git, Bazzar)? Thanks.

Depending on your hosting you might be limited to only one choice. Googlecode 
for example only offers Mercurial next to SVN.

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


Re: [PyQt] How-to: Deploying PyQt applications on Windows and Mac OS X

2009-03-19 Thread Christoph Burgmer
Am Freitag, 20. März 2009 schrieb Giovanni Bajo:
> On 3/19/2009 2:58 PM, Damien Elmes wrote:
> > The article has a number of mistakes in it. The author could have
> > installed a mac python package and xcode and saved themselves a lot of
> > trouble getting pyqt working. They also assert that plugins are not
> > distributable when Qt in fact provides an API call to modify the
> > plugin path, allowing you to bundle the plugins and point Qt to them.
> > On that false assertion they go on to conclude that PyQt is unsuitable
> > for Mac development. It works perfectly fine in my app.
>
> And BTW why not use PyInstaller so that you have one single deploy
> instruction for all platforms? And, besides, it also handles PyQt
> plugins automagically (include them into the distribution and setup the
> Qt plugin paths accordingly).

He was looking for Mac also, but from the PyInstaller website I take:
> Mac port in development

Christoph

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


Re: [PyQt] Phonon example

2009-03-10 Thread Christoph Burgmer
> Anyone has a simple working audio player widget done using phonon?

http://techbase.kde.org/Development/Tutorials/Phonon/Introduction/Python

Dunno if this is what you're looking for.
Christoph

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

[PyQt] QWebKit as a richtext widget

2009-02-24 Thread Christoph Burgmer
My application employs several QWebView widgets to provide richtext layout and 
a webbrowser like navigation. Currently they get filled by using the setHtml() 
method, and by setting the link policy almost full control can be taken over 
this class.

Right now setting the widget's content by using setHtml() limits the 
application though, as _all_ data needs to be available before filling the 
widget. Similar to a web connection the data here arrives in single chunks as 
a database thread in the background produces the content. Storing the 
previously arrived data and repainting the widget by setHtml() each time 
additional data arrives is not an option (slow, screen blanking, scroll bar 
issue).

So I wonder if the Qt folks actually anticipated people using the class as a 
rich text widget in a non-network environment. I could try to implement the 
HTML rendering process into a local webserver implying overhead, or look for a 
different way around this, e.g. overloading the page's QNetworkAccessManager.

Any suggestions?
Christoph
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] PyQt, QWebView, SVG Rendering Problem

2009-01-24 Thread Christoph Burgmer
Am Sunday, 25. January 2009 schrieb David Boddie:
> On Sat Jan 24 04:59:26 GMT 2009, Christoph Burgmer wrote:
> > It doesn't work for me with PyQt 4.4.2. I'm using setHtml() not load().
> > I can currently not update to a newer version, so I cannot verify if that
> > is a issue in 4.4.2 solved in 4.4.3.
>
> It seems to work for me. This is what I tried:
>
> from PyQt4.QtGui import *
> from PyQt4.QtWebKit import *
> from PyQt4.QtCore import QUrl
> u = QUrl("file:///tmp/SVG_test/svg_test.xhtml")
> app = QApplication([])
> w = QWebView()
> w.setHtml(open("/tmp/SVG_test/svg_test.xhtml").read(), u)
> w.show()

Thanks for the example. The second parameter being the QUrl giving the base 
address is needed for referencing even absolut paths, something that I missed.

I thought using a .svg would be nice, removing the conversion to .png after an 
update, but now I'm stuck with getting the .svg scaled according to the size 
given. Two online proposed solutions further I am still stuck with 100%.

Anyway, nice to see that .svg is slowly making it to the browsers.

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

Re: [PyQt] PyQt, QWebView, SVG Rendering Problem

2009-01-24 Thread Christoph Burgmer
Am Saturday, 24. January 2009 schrieb David Boddie:
> On Fri Jan 23 12:47:29 GMT 2009, Atul Kulkarni wrote:
> > I have a problem of rendering SVG Images in QWebView. The SVG Images are
> > replaced with missing image icons ("?"). I am inserting a simple SVG
> > image in an XHTML document.
>
> This is a common problem with most Web browsers because SVG support is not
> as widespread as it would ideally be. Does the page appear as it should do
> in other browsers?
>
> > Can any one help me resolve this problem. I would really appreciate any
> > help or direction.
> >
> > My System and File details as follows:
> > OS - Windows XP
> > Python 2.5
> > PyQt4.4.3 with Qt4
> > Using Qt Designer 4.4.1 Open Source Edition
> > My PyQt4 plugins has imageformats with qsvg4.dll, qsvgd4.dll
>
> I don't think that Qt's support for SVG will make any difference here
> because WebKit is doing the rendering. I don't know what features WebKit
> has for embedding SVG 1.1 drawings into pages, but it seems to be able to
> display them (Qt 4.4.3, PyQt 4.4.4, Linux) if you pass the URL to the
> SVG itself to QWebView's load() method.
>
> In fact, it seems that they can also be embedded into the page. The
> following simplified XHTML markup worked for me:
>
>"-//W3C//DTD XHTML 1.0 Transitional//EN"
>   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> http://www.w3.org/1999/xhtml";
>   xmlns:svg="http://www.w3.org/2000/svg";
>   xmlns:xlink="http://www.w3.org/1999/xlink"; lang="en">
> 
>content="application/xml+xhtml; charset=UTF-8" />
>   SVG Test
> 
> 
>   I am Object showing SVG
>width="325">
>   Your Browser does not support SVG
>   
> 
> 

It doesn't work for me with PyQt 4.4.2. I'm using setHtml() not load().
I can currently not update to a newer version, so I cannot verify if that is a 
issue in 4.4.2 solved in 4.4.3.

Christoph

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

Re: [PyQt] Replace HTML characters

2009-01-21 Thread Christoph Burgmer
Am Wednesday, 21. January 2009 schrieb Sergio Jovani:
> I would like to ask if there is any Qt-way to converting HTML
> characters like "Á", "Ó" to Unicode characters ("Á",
> "Ó"). If there is not a Qt-way I would like to know if there is a
> Python module/function to doing that. I only found this:
> https://fisheye.toolserver.org/browse/~raw,r=5846/pywikipedia/trunk/pywikip
>edia/spellcheck.py (removeHTML function).

$ python   
Python 2.5.2 (r252:60911, Jan  4 2009, 17:40:26)  
[GCC 4.3.2] on linux2 
Type "help", "copyright", "credits" or "license" for more information.
>>> import htmlentitydefs
>>> print htmlentitydefs.entitydefs['Aacute'].decode('latin1')
Á
>>>

I hope that helps.

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

Re: [PyQt] Threads with PyQt. Qt's or Python's?

2009-01-19 Thread Christoph Burgmer
Am Tuesday, 20. January 2009 schrieb Giovanni Bajo:
> On 1/19/2009 4:36 PM, Christoph Burgmer wrote:
[...]
> > I am doing a
> >
> > QCoreApplication.postEvent()
> >
> > out of "run()" from a "threading.Thread" class without any problems.
>
> That's only because you are lucky. It's not something that's officially
> supported and I have spent days debugging random crashes that turned out
> being Qt accesses from threads allocated by Python.
>
> I suggest you to fix your code.

We have an unlucky situation here, Qt documents neither say that mixing 
threading libraries is ok, nor does it say it could lead to clashes.

Now guessing won't help, but I'll do it anyway:
QCoreApplication::postEvent() is "thread-safe" and thus has the highest safety 
level one could whish for in the Qt threading system. It works by adding the 
event to the event queue and returning immediatelly.
It's the main event loop that then takes over.

Now from that I would assume the only clashes could occur when fiddeling with 
the event queue. Instead of assuming some magic done in every thread I rather 
believe that synchronisation is done in the local method, postEvent(). Now 
things going wrong would mean that synchronisation there does depend on the 
threads all adhering to the same special protocol, something that IMHO is not 
needed to complete this task.

Anyway, if somebody should have a bit more indepth knowledge on that, please 
step up.

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

Re: [PyQt] Threads with PyQt. Qt's or Python's?

2009-01-19 Thread Christoph Burgmer
Am Monday, 19. January 2009 schrieben Sie:
> Le 19/1/2009, "Christoph Burgmer"  a écrit:
> >I am doing a
> >QCoreApplication.postEvent()
> >out of "run()" from a "threading.Thread" class without any problems.
>
> Under which plateform?

Linux.

I initially made a short check if their was any argument against using Python 
threads with Qt and then dediced for the Python ones as:
- learning Python threading helps you more in overall Python programming
- documentation is at hand in the usual documentation style.

Giovanni's response strikes me as it would be a serious annoyance if I had to 
change my threading model only to port my application to Windows and Mac. I 
don't even get any QPainter or other thread related warnings in my app, 
something which KDE throws out on a per minute basis.

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

Re: [PyQt] Threads with PyQt. Qt's or Python's?

2009-01-19 Thread Christoph Burgmer
Am Monday, 19. January 2009 schrieb Giovanni Bajo:
> On 1/19/2009 3:13 PM, eliben wrote:
> > I've seen various references to this issue before, but nothing to fully
> > address it as I'd expect.
> >
> > Can you comment on the pros and cons of using QThread vs Python's threads
> > with PyQt?
> >
> > I'll begin: on the surface, Python's threads make more sense because
> > they're Qt independent and can be ported between apps that don't
> > necessarily depend on Qt (for example a web version of a GUI app). The
> > Python thread API is powerful enough for all uses, it seems.
> >
> > However, there are concerns. Perhaps QThreads are more efficient? Or
> > maybe more tightly integrated with the other parts of PyQt, so it's
> > easier to use them?
>
> It's mostly the same. The main difference is that QThreads are better
> integrated with Qt (asynchrnous signals/slots, event loop, etc.). Also,
> you can't use Qt from a Python thread (you can't for instance post event
> to the main thread through QApplication.postEvent): you need a QThread
> for that to work.

I am doing a
QCoreApplication.postEvent()
out of "run()" from a "threading.Thread" class without any problems.

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

Re: [PyQt] Embedding matplotlib into PyQt

2009-01-19 Thread Christoph Burgmer
Am Monday, 19. January 2009 schrieb eliben:
> As part of my PyQt learning process, I've recoded my "embedding matplotlib
> into wxPython demo"
> (http://eli.thegreenplace.net/2008/08/01/matplotlib-with-wxpython-guis/) in
> PyQt. Here's the resulting code:

I think Anki (the flashcard program) already uses matplotlib.

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

[PyQt] Unable to directly create a QChar from unicode string

2009-01-16 Thread Christoph Burgmer
Creating a QChar from a len() == 1 unicode object fails with a TypeError:

$ python
Python 2.5.2 (r252:60911, Jan  4 2009, 17:40:26)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt4.QtCore import QChar, QString
>>> a = u'你'
>>> len(a)
1
>>> QChar(a)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: argument 1 of QChar() has an invalid type
>>> QString(QChar(QString(a).at(0))) == a
True
>>> 

I have to chose the way around using QString::at()
Is that a bug?

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

Re: [PyQt] Difficulty inheriting QEvent

2009-01-15 Thread Christoph Burgmer
Am Friday, 16. January 2009 schrieb Zac Burns:
> I'm trying to create and dispatch a custom event. If I try to inherit
> from QEvent like so:
>
> class X(qt.QEvent):
>   def __init__(self):
>   qt.QEvent.__init__(self, 1500)
>
> x = X()
>
> Then I get "# TypeError: argument 1 of QEvent() has an invalid type # "



Works for me with v4.4.2 when doing
from PyQt4 import QtCore as qt
before that.

> Or, if I omit the initialization than the object can be created.
>
> x = X()
>
> However, when I try to dispatch the event using:
>
> app.postEvent(app, x)
>
> I get "# RuntimeError: underlying C/C++ object has been deleted # "
>
> What is going on here?

Standard error when you fail to initialise your parent class like
class X(qt.QEvent):
def __init__(self):
pass

Christoph

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

Re: [PyQt] pyuic4 error for custom widgets

2009-01-15 Thread Christoph Burgmer
Am Friday, 16. January 2009 schrieb Suha Onay:
[...]
> I defined the plugins for QT Designer and used custom widgets in
> Designer to form the ui's.
> When it comes to compiling these ui files which has MCLabel widgets,
> it gives an error saying unknown baseclass 'MCSimpleLabel' .
> How should I change the plugins or widgets file not to face an error?
> The files are attached.

I reported earlier on this list that even KDE4 'custom classes' don't compile 
properly using pykdeuic4 which is built upon pyuic4.

I now run a Makefile which automatically patches the compiled output to my 
needs:
1. patch the .ui file and replace your classes with their Qt base class (or a 
placeholder) which uic knows about
2. compile with uic
3. patch the output to include the original classes and move wrong imports to 
the top of the file.

Christoph

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

Re: [PyQt] KHTMLPart mouse events

2009-01-10 Thread Christoph Burgmer
Am Saturday, 10. January 2009 schrieben Sie:
> On Friday 09 January 2009 08:50:07 am Christoph Burgmer wrote:

> > It seems that
> > khtmlMousePressEvent (khtml::MousePressEvent* event)
> > is the right place to do that, but the sip-file does not have those
> > mouse event methods, they are commented out.

[snip]

> I suspect that khtml::MousePressEvent is not a class that's exposed in
> the "public" KDE API - meaning it's declared in some file that PyKDE
> doesn't wrap. So if you got one, you couldn't do anything with it
> anyway, since it's not a wrapped class.
>
> However, there are mouse events (QMouseEvent) available in KHTMLView,
> and you can get the KHTMLView object from the part by calling it's
> view() method.

[snip]

Thanks for the answer.
I finally ported my main view from KHTMLPart to QWebView and a few lines give 
me what I want + portability to pure Qt for later.

class CharacterView(QtWebKit.QWebView):
def mousePressEvent(self, event):
QtWebKit.QWebView.mousePressEvent(self, event)
if event.button() == QtCore.Qt.MidButton:
self.emit(QtCore.SIGNAL("midButtonRelease"))

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

[PyQt] QtWebKit and WebActions

2009-01-10 Thread Christoph Burgmer
QtWebKit has some functionality embedded in WebActions[1] which can be 
accessed using
virtual void triggerAction ( WebAction action, bool checked = false )

This already allows me to copy content to the clipboard easily:

KStandardAction.copy(
lambda: self.webView.triggerPageAction(QWebPage.Copy),
self.actionCollection())

Well, this is neat but I am looking for functionality that can not be built by 
other means like "select all" and "find from beginning".

For "select all" I then tried to trigger
QWebPage.MoveToStartOfDocument ("Move the cursor to the start of the 
document."), followed by
QWebPage.SelectEndOfDocument ("Select to the end of the document.")

For find from the beginning of the document I just call 
QWebPage.MoveToStartOfDocument

But none of this works. Why? Can anybody help me out here?
The Arora project seems to not use selectAll, at least I found nothing in 
there sources. Are there other places I could check?

Christoph

[1] http://doc.trolltech.com/4.4/qwebpage.html#WebAction-enum
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[PyQt] KHTMLPart mouse events

2009-01-09 Thread Christoph Burgmer
Jim, Simon, I hope you can help me.

I am trying to track a user's MidButton mouse click to track "paste" actions.

It seems that
khtmlMousePressEvent (khtml::MousePressEvent* event)
is the right place to do that, but the sip-file does not have those mouse event 
methods, they are commented out.

Can that be changed in a later version? Is there a reason for them not being 
activated? The KHTMLPart itself does the MidButton action in these methods[1].

Christoph

[1] http://api.kde.org/4.x-api/kdelibs-apidocs/khtml/html/khtml__part_8cpp-
source.html#l06061

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

Re: [PyQt] Learning path

2009-01-09 Thread Christoph Burgmer
Am Friday, 9. January 2009 schrieb Steven Woody:
> I want to use PyQt but I don't get experience with Qt itself.  What's
> the best learning path to me?  Any suggestion will be highly
> appreciated!

From my own experience: Just go ahead with PyQt, no need to have a profound 
experience of C++ or Qt, though the latter will help of course.

You might though need C++ and (C++) Qt to prove bugs in PyQt, as reports like 
"X doesn't work with PyQt" most likely only get feedback if it includes 
"but does in Qt".

Just my humble opinion,

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

Re: [PyQt] problem with QTableView.selectionChanged

2008-10-13 Thread Christoph Burgmer
Hi,

Am Monday, 13. October 2008 schrieb Bastian Venthur:
> how can I catch a selectionChanged signal from a tableView? I tried:
>
> QtCore.QObject.connect( self.tableView,
>   QtCore.SIGNAL('selectionChanged(const QItemSelection&,
>   const QItemSelection&)'),
>   self.selection_changed)

try with a QItemSelectionModel:

fileSelectionModel = QtGui.QItemSelectionModel(itemModel, tableView)
tableView.setSelectionModel(fileSelectionModel)
self.connect(fileSelectionModel, SIGNAL(
"currentChanged(const QModelIndex &, const QModelIndex &)"),
self.cellSelected)
self.connect(fileSelectionModel, SIGNAL(
"selectionChanged(const QItemSelection &, const QItemSelection &)"),
self.updateSelection)

Hope that is what you were looking for.

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

[PyQt] Status of PyKDE4 on Windows

2008-10-02 Thread Christoph Burgmer
Today I wanted to port my application to Windows, installed Python for 
Windows, KDE libraries and PyQt for Windows only to see that currently no 
support seems to be given for getting PyKDE4 to run on Windows.

The only reference to PyKDE4 I found was the answer from Jim Bublitz on 
07.02.2008 stating that he probably wasn't going to do this. Has anything 
changed from then on?

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

Re: [PyQt] argument 1 of KDialog.setButtons() has an invalid type

2008-08-02 Thread Christoph Burgmer
Am Saturday, 2. August 2008 schrieb Benno Dielmann:
> Hi PyKDE4 - Experts,
>
> the setButtons() method of KDialog seems to be buggy - there's always an
> exception
>
> argument 1 of KDialog.setButtons() has an invalid type
>
> Argument 1 should be the KDialog instance, shouldn't it?
>
> Or am I doing something wrong? Please have a look at this example code:

[snip]

See my post "[PyQt] XORing options and result type" from last month and other 
mails in the archive.

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


Re: [PyQt] QVariant conversion toInt()

2008-07-27 Thread Christoph Burgmer
Am Sonntag, 27. Juli 2008 schrieb lj:
> Thanks for your responses. I've read and re-read the doc. But at the
> risk of being labeled as a "Language Lawyer, junior grade",
> I guess the correct way to retrieve ones "int" from a QVariant is
> something like this?
>
> from PyQt4.QtCore  import *
> from PyQt4.QtGui import *
>
> qv = QVariant(255)   # qv contains integer 255
>
> if qv.canConvert(QVariant.Int):   # if castable then
> returnedTuple = qv.toInt()# get Phil's tuple
> myValue = returnedTuple[0]# pick off the integer
> else:
> myValue = None#flag error or set default value

myValue, _ = qv.toInt()# get Phil's tuple

if you like. But in case you are unsure about the conversion you should really 
check the boolean var.

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


Fwd: Re: [PyQt] QVariant conversion toInt()

2008-07-27 Thread Christoph Burgmer
For reference again now to the list, though this has been answered already.

--  Weitergeleitete Nachricht  --

Subject: Re: [PyQt] QVariant conversion toInt()
Date: Sonntag, 27. Juli 2008
From: Christoph Burgmer <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]

Am Sonntag, 27. Juli 2008 schrieb lj:
> Given this small snip:
>
> from PyQt4.QtCore  import *
> from PyQt4.QtGui import *
>
> qv = QVariant(255)
> print qv.canConvert(QVariant.Int)  #prints True, can be converted
> x =  qv.toInt()# so attempt the conversion
> print type(x), x  #prints   (255, True)
>   # I expectedand  255
>
> I supposed that x after conversion out of the variant object qv would be
> type Int  and  print x  would  result in 255 being printed but that
> doesn't happen.
>
> I must be missing something?

The documentation on QVariant reflects the different behaviour of PyQt in this 
case [1], [2]:

(int, bool ok) toInt (self)

Chris

[1] http://doc.trolltech.com/4.4/qvariant.html
[2] http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qvariant.html

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


Re: [PyQt] PyQt and linux signals

2008-07-27 Thread Christoph Burgmer
Am Sonntag, 27. Juli 2008 schrieb Strato:

> in pyqt3 (maybe also in pyqt4), when the signal is sent, the application
> will not be immediately affected by it (in my application at least).

'My solution' works for PyQt4.

> the application have to trigger an event loop to be affected by the signal.
>
> I had to implement a QTimer that call a slot that execute the
> processEvents() method, to obtain a kind of reaction to the signal...
>
> maybe there is a better/simpler way to force the application to
> immediately react to the signal, without having the user to move the
> mouse inside the app or something else.

I don't know if I completely understand the problem, but that doesn't sound 
like anything I experienced, again with PyQt4.

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


Re: [PyQt] PyQt and linux signals

2008-07-25 Thread Christoph Burgmer
Am Freitag, 25. Juli 2008 schrieb Strato:
> is there a way for a pyqt application, to handle/detect linux signals
> send by the system, like SIGTERM, SIGUSR, etc ?

Check the attached example. This was posted already earlier here.

Chris


signal-example.py
Description: application/python
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[PyQt] KToolBarPopupAction and popup menus

2008-07-24 Thread Christoph Burgmer
API docs for KToolBarPopupAction state: 

> In contrast to KActionMenu, this action is a simple menuitem when plugged 
into a menu, and has a popup only in a toolbar.

I though receive a popup menu in my menu. PyKDE anomaly? Running RC1.

Please see the attached app.

Chris


ktoolbaroption-example.py
Description: application/python
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[PyQt] XORing options and result type

2008-07-24 Thread Christoph Burgmer
I want to raise an issue that has been raised before and which I'd like to see 
in a FAQ or some other place.

If you combine options with XOR or other logical operators the type 
information is lost and python will raise the following when given in a 
method call:

self.setupGUI(KXmlGuiWindow.Default ^ KXmlGuiWindow.StatusBar, xmlFile)
TypeError: argument 1 of KXmlGuiWindow.setupGUI() has an invalid type

I had to find old source code to get to the solution:

self.setupGUI(KXmlGuiWindow.StandardWindowOption(
KXmlGuiWindow.Default ^ KXmlGuiWindow.StatusBar), xmlFile)

I remember either Phil or Jim answering on this issue once but a quick scan 
through May - June didn't give me any result, neither did Google. Is this 
worth mentioning somewhere?

Was there an issue that wouldn't allow those methods to just accept an int 
value?

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


Re: [PyQt] Bug in KHelpMenu believed

2008-07-23 Thread Christoph Burgmer
Am Sonntag, 27. April 2008 schrieb Christoph Burgmer:
> As already pointed out in "[PyQt] Help menu and own icon" (this month)
> there seems to be a bug in the KHelpMenu bindings.
>
> Though the SIP files states:
>
> KHelpMenu (QWidget* parent /TransferThis/, const KAboutData* aboutData,
> bool showWhatsThis = 1, KActionCollection* actions = 0);
>
> No menu entry for "What's This" is shown when creating a KHelpMenu with
> this constructor.
>
> KXmlGuiWindow includes the KHelpMenu in createGUI() and in the Python
> version it does show the menu, so the erroneous behaviour seems to be
> deeper inside.

Just as a follow up:

This seems to be fixed in the subsequent versions of PyKDE for some while now.

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


Re: [PyQt] Changes in PyKDE

2008-07-10 Thread Christoph Burgmer
Hi,

Am Freitag, 11. Juli 2008 schrieb Jim Bublitz:
> As some of you may have noticed, I haven't been keeping up with PyKDE very
> well lately (again), but Simon Edwards has.  Since I'm unlikely to be able
> to do much with it for the forseeable future, we've agreed to have Simon
> take it over.
>
> The major change will probably be that up-to-date releases will come via
> KDE releases (version releases and bugfix releases), and Simon will
> probably keep you up-to-date on the where and when of those. Any project
> decisions are now up to Simon.
>
> A number of people on this list have made significant contributions to
> PyKDE over the years, and I really appreciate all of the help, criticism,
> bug reports and fixes.
>
> I'll probably still follow the list and will be happy to answer any
> questions (although I can't imagine anything that Phil or Simon won't be
> able to handle better).
>
> Thanks again to everyone who has participated in PyKDE.

I just started two apps with PyKDE this year and am happy with it. Thanks for 
your work on this.

One small question: can we now use the KDE bug tracker for fileing bugs? Not 
that there are any big ones ;)

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


[PyQt] join() can't handle a QString

2008-06-23 Thread Christoph Burgmer
QString is pretty much well integrated as much as I understand. I can 
write "print QString('foo')" or "len(QString('bar'))". It will always be cast 
to the str type (btw, why not to unicode?).

Seeing today that the following wouldn't work makes me ask if that was 
forgotten or if there is a story behing it:

>>> ''.join([QString('foobar')])
Traceback (most recent call last):
  File "", line 1, in 
TypeError: sequence item 0: expected string, QString found

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


Re: [PyQt] KAboutData() broken when using PyQt 4.4

2008-06-14 Thread Christoph Burgmer
Just to make it clear, creating the correct type doesn't help:

from PyKDE4.kdecore import KAboutData, ki18n
from PyQt4.QtCore import QByteArray
aboutData = KAboutData("", "", ki18n(""), "")
aboutData = KAboutData(QByteArray(""), QByteArray(""), ki18n(""), 
QByteArray(""))

Gives the following:

Python 2.5.2 (r252:60911, May 28 2008, 08:35:32)
[GCC 4.2.4 (Debian 4.2.4-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyKDE4.kdecore import KAboutData, ki18n
>>> from PyQt4.QtCore import QByteArray
>>> aboutData = KAboutData("", "", ki18n(""), "")
Traceback (most recent call last):
  File "", line 1, in 
TypeError: argument 1 of KAboutData() has an invalid type
>>> aboutData = KAboutData(QByteArray(""), QByteArray(""), ki18n(""), 
QByteArray(""))
Traceback (most recent call last):
  File "", line 1, in 
TypeError: argument 1 of KAboutData() has an invalid type

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


Re: [PyQt] KAboutData() broken when using PyQt 4.4

2008-06-14 Thread Christoph Burgmer
Am Samstag, 14. Juni 2008 schrieb Jim Bublitz:
> On Friday 13 June 2008 08:19, Adeodato Simó wrote:
> > * Jim Bublitz [Fri, 13 Jun 2008 07:50:31 -0700]:
> > > PyKDE3 or PyKDE4?
> >
> > Er, PyKDE4 (since I said I was using PyQt 4.4...)
>
> But you're trying to use KDE3 syntax.
>
> There is no KAboutData ctor that takes only a char string (or QString).
> Look at the PyKDE4 docs or:
>
> http://api.kde.org/4.0-api/kdelibs-apidocs/kdecore/html/classKAboutData.htm
>l
>
> There are examples in PyKDE4 that demonstrate KAboutData (in fact every
> example uses KAboutData)

Jim, I believe Adeodato knows about this.

Here's my stacktrace:

[EMAIL PROTECTED]:$ ./myapp
Traceback (most recent call last):
  File "./myapp", line 838, in 
main()
  File "./myapp", line 803, in main
license, copyright, text, homePage, bugEmail)
TypeError: argument 1 of KAboutData() has an invalid type

This code generates the problem:

def main():
appName = "myapp"
catalog = ""
programName = ki18n("myapp")
version = "0.1alpha"
description = ki18n("A simple ...")
license = KAboutData.License_GPL
copyright   = ki18n("(c) 2008 Christoph Burgmer")
text= ki18n("myapp is a simple ...")
homePage= __url__
bugEmail= "[EMAIL PROTECTED]"

aboutData = KAboutData(appName, catalog, programName, version, 
description,
license, copyright, text, homePage, bugEmail)

Does that help?
Btw, I'm using Python2.5

Chris

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


Re: [PyQt] KAboutData() broken when using PyQt 4.4

2008-06-13 Thread Christoph Burgmer
Am Freitag, 13. Juni 2008 schrieb Adeodato Simó:
> * Jim Bublitz [Fri, 13 Jun 2008 07:50:31 -0700]:
> > PyKDE3 or PyKDE4?
>
> Er, PyKDE4 (since I said I was using PyQt 4.4...)

Dunno if it helps, but I have the same problem. I guess we're using the same 
version(s) as I'm using the Debian package over here.

Chris

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


Re: [PyQt] Accented characters

2008-05-02 Thread Christoph Burgmer
Am Donnerstag, 1. Mai 2008 schrieb alteo_gange:
> Le jeudi 01 mai 2008, alteo_gange a écrit :
> > Hi,
> >
> > could you complete the next bit of code please?
> >
> > 1) File selection (the file's name is accented: ex. animé.txt)
> > file = QFileDialog.getOpenFileName(None, "Open"),".","All files (*.*))
> > 2) Print file's name in a terminal
> > ???
> >
> > It seems easy... too easy...
>
> print a.toUtf8()
> -> /home/login/animé.txt

If I'm not wrong this "trick" will only work for people who use utf8 as 
default encoding.

You may want to read about Python's way of dealing with encodings and Unicode, 
but that's off topic here.

Little hint:

_, system_encoding = locale.getdefaultlocale()

print unicode(your_string).encode(system_encoding)

Christoph

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


Re: [PyQt] Q(Core)Application.exec_() is not interruptable

2008-05-01 Thread Christoph Burgmer
Am Donnerstag, 1. Mai 2008 schrieb İsmail Dönmez:
> Following code can't be interrupted with CTRL-C :
> >>> import sys
> >>> from PyQt4.QtCore import QCoreApplication
> >>> QCoreApplication.exec_(sys.argv)

+1 on the question.

I tried a lot like using module signal to trap a Ctrl+C but nothing seems to 
work. I guess the C++ port takes away keyboard events from Python. Any help 
appreciated.

Christoph

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


[PyQt] Bug in KHelpMenu believed

2008-04-27 Thread Christoph Burgmer
As already pointed out in "[PyQt] Help menu and own icon" (this month) there 
seems to be a bug in the KHelpMenu bindings.

Though the SIP files states:

KHelpMenu (QWidget* parent /TransferThis/, const KAboutData* aboutData, bool 
showWhatsThis = 1, KActionCollection* actions = 0);

No menu entry for "What's This" is shown when creating a KHelpMenu with this 
constructor.

KXmlGuiWindow includes the KHelpMenu in createGUI() and in the Python version 
it does show the menu, so the erroneous behaviour seems to be deeper inside.

Sorry for bringing this up a second time, if somebody already is looking into 
this, but as there is no bug reporting system, this seems to be the only way 
to bring cases up to attention.

I'll append a modified KApplication derivate taken from the PyKDE4's 
tutorial which demonstrates the case.

Chris


testapp.py
Description: application/python
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[PyQt] Re: QWidget invalid layout

2008-04-17 Thread Christoph Burgmer
You wrote:
> I'm having some problems with PyQt4. I'm trying to make a QWidget window
> but when I run the generated code I get a window with all child widgets
> in the top left corner stacked onto of each other (see attached
> PyQt-4.3.3.jpg). The child widgets also does not resize.
> The form is correctly displayed in QtDesigner and the same behaviour is
> seen both under Windows (2000) an d Linux, both using Qt-4.3.

Check your command line. It sais:

QLayout: Attempting to add QLayout "" to TestApp "AtletMainWidget", which 
already has a layout

Looks like you need to take another class for your TestApp do derive from.
QWidget should work.

Hope that helps

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


[PyQt] Re: Help menu and own icon

2008-04-17 Thread Christoph Burgmer
Am Donnerstag, 17. April 2008 schrieb Christoph Burgmer:

[snip]

> I set the help menu to false before calling setupGUI() and finally add the
> help menu bar with setting icons for the "report bug" (otherwise missing)
> and "About 'app'" (otherwise 'missing icon'), adding language selection by
> giving True to the constructor (missing by default).

I was wrong with one point: "Report bug" isn't missing my default, 
it's "What's this" which can be hidden. But it should be shown by default, 
which it is currently not.

My only work around currently is to add it manualy, which isn't nice to do as 
it shows up at the end of the menu instead of being at it's default place.

Code:

whatsThis = helpMenu.action(KHelpMenu.menuWhatsThis)
helpMenu.menu().addAction(whatsThis)

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


[PyQt] Re: Help menu and own icon

2008-04-17 Thread Christoph Burgmer
Am Mittwoch, 16. April 2008 schrieb Christoph Burgmer:

[snip]

> If I do the same it adds a second help menu, and even gives me the "choose
> language" entry, but then "What is..." is missing.
> Well why all the magic when all I want is to set the app icon for the menu
> and let the app image show up in the following dialog? The latter [1]
> funnily doesn't work unless setting the menu with the above method.
>
> 1. There is no such thing like self.menuBar().getMenu() (or in Qt
> terms .menu()), so I ask myself if the above is the only way to solve my
> problem?
> 2. How to avoid 2 menus showing up then?
> 3. The app image not showing up in the "About..." dialog without the magic
> menu setting - is that a bug or a feature?
> 4. Why does KHelpMenu offer different entries compared to the XMLGuiClient
> class? (This maybe is to much for the list, but maybe someone knows.)

I played around a bit and got an answer to 2. My code now looks as follows:

# disable standard help menu
self.setHelpMenuEnabled(False)
# finally build gui
self.setupGUI()
# help menu magic, copied from pykdedocs and extended by bug icon
helpMenu = KHelpMenu(self, KCmdLineArgs.aboutData(), True)
self.menuBar().addMenu(helpMenu.menu())
self.reportBugAction = helpMenu.action(KHelpMenu.menuReportBug)
self.reportBugAction.setIcon(KIcon('tools-report-bug'))
self.aboutAction = helpMenu.action(KHelpMenu.menuAboutApp)
self.aboutAction.setIcon(self._appIcon)

I set the help menu to false before calling setupGUI() and finally add the 
help menu bar with setting icons for the "report bug" (otherwise missing) 
and "About 'app'" (otherwise 'missing icon'), adding language selection by 
giving True to the constructor (missing by default).

Questions 1, 3, 4 still remain though.

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


[PyQt] Help menu and own icon

2008-04-16 Thread Christoph Burgmer
My app kept showing the "icon-not-found" icon, so I started looking around how 
other apps handle this. pykdedocs has this following magic lines:

> helpMenu = KHelpMenu (self, aboutData, False)
> self.menuBar ().addMenu (helpMenu.menu ())
> self.aboutAction= helpMenu.action (KHelpMenu.menuAboutApp)
> self.aboutAction.setIcon (KIcon ("help-about"))
> self.aboutKDEAction = helpMenu.action (KHelpMenu.menuAboutKDE)
> actions.addAction ("about", self.aboutAction)
> actions.addAction ("aboutKDE", self.aboutKDEAction)

If I do the same it adds a second help menu, and even gives me the "choose 
language" entry, but then "What is..." is missing.
Well why all the magic when all I want is to set the app icon for the menu and 
let the app image show up in the following dialog? The latter [1] funnily 
doesn't work unless setting the menu with the above method.

1. There is no such thing like self.menuBar().getMenu() (or in Qt 
terms .menu()), so I ask myself if the above is the only way to solve my 
problem?
2. How to avoid 2 menus showing up then?
3. The app image not showing up in the "About..." dialog without the magic 
menu setting - is that a bug or a feature?
4. Why does KHelpMenu offer different entries compared to the XMLGuiClient 
class? (This maybe is to much for the list, but maybe someone knows.)

Thanks for any hints.

Chris

[1] http://www.riverbankcomputing.com/static/Docs/PyKDE4/faq.html#faq-logo
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] where to ./setup --install your ui.rc file

2008-04-15 Thread Christoph Burgmer
Yesterday I created a Debian package of my app "id3encodingconverter". Debian 
puts kde's ui.rc files under /usr/share/app/'app-name'/. So I made my python 
distutils setup.py copy the file'id3encodingconverterui.rc' 
to 'share/apps/id3encodingconverter/'. Well, I guess when not using Debian 
this behaviour will make the app miss it's ui.rc file.

I'm looking for some quick advice how to best handle this issue. Where to copy 
the file? Hardcode the path in the program's source?

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


[PyQt] Re: Setting backgroud color to a QListViewItem

2008-04-14 Thread Christoph Burgmer
> Someone can send example code to set background color to a
> QListViewItem (pyqt3)?

defaultPalette = QtGui.QPalette(element)
newPalette = QtGui.QPalette(defaultPalette)
newPalette.setColor(QtGui.QPalette.Base, Qt.green)
element.setPalette(newPalette)

This at least works for QLineEdit under KDE4.

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


[PyQt] Small error in PyKDE4 tutorial for KAction (4th program)

2008-04-12 Thread Christoph Burgmer
The kactionui.rc file given in the fourth example "KAction" in the PyKDE4 
tutorial uses a ampersand for the text string of the file menu. As & is a 
special character in XML it needs to be encoded as & which the author 
maybe already did, but then forgot to encode the & again to &

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


[PyQt] i18n() takes no unicode objects

2008-04-11 Thread Christoph Burgmer
Though it might seem unnecessary, i18n doesn't take unicode objects as input.
Though one would say English, the language which we would wrap i18n with, only 
needs ASCII, there might be occasions where other characters are needed.

Furthermore from Python 3.0 on unicode strings will be standard.

I can't find any other place for reporting this what I believe is a bug.

Cheers

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


[PyQt] QComboBox behaviour with PyQt4/PyKDE4

2008-04-08 Thread Christoph Burgmer
Hi list,

I started today with PyQt4/PyKDE4 and am experiencing some issues. I read 
about menus not being shown with the Oxygen theme, so I'll only point out the 
second problem I have.

Using one of the simple examples delivered with PyKDE4 I am trying to fill a 
QComboBox with content. It is not possible to me though, to get the list to 
drop down when trying to open it.

Beneath I add a simple model having two rows of data. I print out the count of 
rows later to verify that it took the input. Data is only shown in the 
unexpanded ComboBox if .setEditable(True) is called.

> class MainWindow (KXmlGuiWindow):
> def __init__ (self):
> KXmlGuiWindow.__init__ (self)
>
> self.comboBox = QtGui.QComboBox()
> self.comboBox.setModelColumn(1)
> self.comboBox.setObjectName("comboBox")
> self.encodingNames = {'a': 'b', '1': '2'}
> model = QtGui.QStandardItemModel(len(self.encodingNames), 2);
> for row, name in enumerate(self.encodingNames):
> model.setItem(row, 0,
> QtGui.QStandardItem(QtCore.QString(str(row
>   model.setItem(row, 1,
> QtGui.QStandardItem(QtCore.QString(name)))
>  self.comboBox.setModel(model) 
> self.setCentralWidget(self.comboBox);
> self.setupGUI()
> print self.comboBox.count()
> self.comboBox.setEditable(True)

Can somebody reproduce this problem?

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