បានសរសេរ 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    [email protected]
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde

Reply via email to