[PyKDE] KDialogBase bug(?) with IconList and TreeList dialogFace

Matt T. Matt at boons.net
Tue Dec 28 19:25:35 GMT 2004



Hello all of you already back at your PCs after another Xmas:

Is it possible that I'm running in my first pykde app (the second with pyqt
though) in a nasty bug with KDialogBase?

After testing and googling for a whole day this is what I found:

Scripts terminate "unexpectedly" whenever KDialogBase is used with the
dialogFace "IconList" or "TreeList", but work fine with the dialogFace
"Tabbed".

Tested on a suse 9.2 amd64 installation updated with the latest kdebindings
from SuSE, and on a  suse 9.1 (pentium 32 bit) box using kde3.3.1 but with
the latest python kdebindings from SuSE for kde3.3.2:
kdebindings3-python-3.3.2-3.

Here's the codeline in question:

KDialogBase.__init__(self, KDialogBase.IconList, "The kdialog test app",
buttonMask, Ok)

(with buttonMask and Ok being both 0)

Changing from KDialogBase.IconList to KDialogBase.Tabbed works fine, but is
not :-( what I want :

KDialogBase.__init__(self, KDialogBase.Tabbed, "The kdialog test app",
buttonMask, Ok)

Below is a simple script to test and show the problem.

Is my code incorrect? (There is no sample for this to be found anywhere, at
least I did not find anything, despite googling for a day. I ported this code
from a working c++ app. )

If yes, how should this be coded?

Or is this a bug, and if yes, is it in all pykde or just in the SuSE
kdebindings?

Thanks for any help,
Matt
========== DialogTest script begin ============
# -*- coding: utf-8 -*-
## testing of KDialogBase with different dialogFaces
## DialogBase.IconList  KDialogBase.Tabbed  KDialogBase.Plain
KDialogBase.TreeList

import sys
from qt import *
from kdecore import *
from kdeui import *

class DialogTest(KDialogBase):
def __init__(self,parent = None, name = None, modal = 0,
fl = 0, buttonMask= 0, Ok= 0 ):

## the c++ code for KDialogBase:
##KDialogBase( int dialogFace, const QString  &caption,
##                     int buttonMask,
##                     ButtonCode defaultButton,
##                          QWidget *parent=0, const char *name=0,
##                       bool modal=true,
##                          bool separator=false,
##                          const KGuiItem &user1=KGuiItem(),
##                          const KGuiItem &user2=KGuiItem(),
##                          const KGuiItem &user3=KGuiItem() );

print "still running..."

## available as dialogFace are:
## KDialogBase.IconList  KDialogBase.Tabbed
## KDialogBase.Plain  KDialogBase.TreeList etc.

KDialogBase.__init__(self, KDialogBase.IconList, "The kdialog test
app", buttonMask, Ok)
##KDialogBase.__init__(self, KDialogBase.Tabbed, "The kdialog test
app", buttonMask, Ok)

## terminating here if using KDialogBase.IconList
## or KDialogBase.TreeList
## however working fine if using KDialogBase.Tabbed

print "this is not printing with KDialogBase.IconList",
print " and KDialogBase.TreeList"

if not name:
self.setName("DialogTest")

self.setSizeGripEnabled(1)

infoPixmap = QPixmap("info.png")

frame = self.addPage("Info", "Info about it", infoPixmap)
frameLayout =  QVBoxLayout(frame)
self.infopage =  QLabel(frame,"Infopage")
self.infopage.setText("This is the Info page which I want to see")
## using a simple QLabel instead of the real page for testing
frameLayout.addWidget(self.infopage)


frame = self.addPage("Setup", "Setup of it", infoPixmap)
frameLayout =  QVBoxLayout(frame)
self.setuppage =  QLabel(frame,"Setuppage")
self.setuppage.setText("This is the Setup page which I want to see")
## using a simple QLabel instead of the real page for testing
frameLayout.addWidget(self.setuppage)

self.clearWState(Qt.WState_Polished)

self.showPage(0)
print "finished"


def languageChange(self):
self.setCaption(self.__tr("DialogTest"))


def __tr(self,s,c = None):
return qApp.translate("DialogTest",s,c)

if __name__ == "__main__":
a = QApplication(sys.argv)
QObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()"))
w = DialogTest()
a.setMainWidget(w)
w.show()
a.exec_loop()
========== DialogTest script end ============




More information about the PyQt mailing list