[PyKDE] QFileDialog problems

Hans-Peter Jansen hpj at urpla.net
Wed Sep 20 22:15:48 BST 2006


Am Mittwoch, 20. September 2006 22:24 schrieb Dave S:
> OK I am a bit stuck. I am trying to use QFileDialog to allow users to
> select where they want to save a file to, by default the Desktop
>
>
>             desktop = self.config.get('dbase','desktop')
>             file_selector = QFileDialog(desktop, "dBase Files
> (*.adb)", self.parent, '', True)
>             file_selector.setSelection(self.gsr_name + '.adb')
>             file_selector.setCaption('dBase Backup')

Try s.th. like:
	      okButton = file_selector.child("OK", "QPushButton")
	      if okButton:
		  okButton.setText("Save")

>             file_selector.exec_loop()
>             print file_selector.selectedFiles()
>
> (1) When I select the 'OK' button the dialog does not close ! I
> expected it to close and return the selection - thats a problem

See the mode property..

> (2) Is it possible to change the 'OK' to a 'save' button or is it
> fixed as 'OK' ?
>
> (2) When I select 'cancel' the dialog does close and I get a ...
> <qt.QStringList object at 0xb61733ac>
> Which I am struggling to turn into a straight Python list.

Ever tried to iterate over the list?

for item in ..

Hth,
Pete




More information about the PyQt mailing list