From pykde Wed Aug 23 10:04:32 2006 From: kakada Date: Wed, 23 Aug 2006 10:04:32 +0000 To: pykde Subject: Re: [PyKDE] Re: Savefile dialog (QFileDialog.getSaveFileName). Message-Id: <44EC2830.4080008 () khmeros ! info> X-MARC-Message: https://marc.info/?l=pykde&m=115632775413926 បានសរសេរ Lukáš Lalinský: > kakada wrote: > >> your solution is detecting the filename if it exist or not, but not the >> button (Save or Cancel). >> Because if your filename isEmpty, either do you click OK nor Cancel;as >> the result, you always get "No file selected" >> > > I believe the function doesn't let you to click OK with an empty file name. > > http://doc.trolltech.com/4.1/qfiledialog.html#getOpenFileName > > "If the user presses Cancel, it returns a null string." > > It doesn't matter with getOpenFileName. The problem is with getSaveFileName http://doc.trolltech.com/4.1/qfiledialog.html#getSaveFileName "return a file name selected by the user. The file does not have to exist." if not self.fileName.isEmpty(): #save pass else: QtGui.QMessageBox.information(self,self.tr("Information") ,self.tr("Please specify the filename to save to")) Message box is always displayed if the filename is empty. da _______________________________________________ PyKDE mailing list PyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde