[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyKDE] Problem with messagebox
From:       "Roberto Alsina" <ralsina () kde ! org>
Date:       2005-08-02 14:50:58
Message-ID: 60228.24.232.127.13.1122995624.squirrel () linux ! netline ! com ! ar
[Download RAW message or body]


> Hi there,
>
> I am using PyKDE for a file-manager (http://onefinger.sf.net).
>
> I don't understand why this fails:
>
>                     res = QMessageBox.question(mainVBox
>                                                , _('Confirmation')
>                                                , _('Are you sure you
> want to delete ') + num + _(' files?')
>                                                , QMessageBox.Yes,
> QMessageBox.No)
>                     if res == QMessageBox.Yes:
>                         print "yes"
>                     elif res == QMessageBox.No:
>                         print "no"
>                     else:
>                         print "error"
>                         print str(res) + str(QMessageBox.Yes) +
> str(QMessageBox.No)
>
>
> The output is:
>
> error
> 034

QMessageBox.question returns an integer:

0 if you click the first button
1 for the second (if there is one)
2 for the third (if there is one)

It does *not* return what you pass in the button0/button1/button2 arguments.

For example, if you call it like you wrote, it will return 0 in Yes, 1 in No.

If you call it like this:

>                     res = QMessageBox.question(mainVBox
>                                                , _('Confirmation')
>                                                , _('Are you sure you
> want to delete ') + num + _(' files?')
>                                                , QMessageBox.No,
> QMessageBox.Yes)

It will return 1 in Yes, 0 in No.

This behaviour is exactly like the C++ version.

-- 
 ("\''/").__..-''"`-. .         Roberto Alsina
 `9_ 9  )   `-. (    ).`-._.`)  ralsina@kde.org
 (_Y_.)' ._   ) `._`.  " -.-'   KDE Developer (MFCH)
  _..`-'_..-_/ /-'_.'
(l)-'' ((i).' ((!.'             Buenos Aires - Argentina
Imminentizing the eschaton since 1971.

_______________________________________________
PyKDE mailing list    PyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic