[Pharo-project] UITheme builder fileSave:...
Hi! I would like to use the builder to have a file selection. Here is my code: -=-=--=-=-=--=-=-=--=-=-=--=-=-=--= interactiveExportWith: imageWriterClass extension: fileExtension "Ask for a file name and a directory" | fileStream | fileStream := UITheme builder fileSave: 'Your title here' extensions: #('png') path: nil. "Very strange that I obtain a stream". fileStream ifNil: [ self inform: 'saving aborded'. ^ self ]. fileStream close. FileDirectory deleteFilePath: fileStream name. self exportWith: imageWriterClass fullname: fileStream name. -=-=--=-=-=--=-=-=--=-=-=--=-=-=--= I have no idea why fileSave:extensions:path: return a stream. If I just need a full file name ? Cheers, Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Well, that's the way it was designed, to answer a file stream to which the file contents can be added. Could be extended to support choosing file name (not file) to save to. I expect your exportWith uses #putForm:onFileNamed: whereas it could use #putForm:onStream: instead. Regards, Gary ----- Original Message ----- From: "Alexandre Bergel" <alexandre.bergel@me.com> To: "Pharo Development" <Pharo-project@lists.gforge.inria.fr> Sent: Monday, June 20, 2011 7:02 PM Subject: [Pharo-project] UITheme builder fileSave:...
Hi!
I would like to use the builder to have a file selection. Here is my code:
-=-=--=-=-=--=-=-=--=-=-=--=-=-=--= interactiveExportWith: imageWriterClass extension: fileExtension "Ask for a file name and a directory"
| fileStream | fileStream := UITheme builder fileSave: 'Your title here' extensions: #('png') path: nil.
"Very strange that I obtain a stream". fileStream ifNil: [ self inform: 'saving aborded'. ^ self ]. fileStream close. FileDirectory deleteFilePath: fileStream name. self exportWith: imageWriterClass fullname: fileStream name. -=-=--=-=-=--=-=-=--=-=-=--=-=-=--=
I have no idea why fileSave:extensions:path: return a stream. If I just need a full file name ?
Cheers, Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Well, that's the way it was designed, to answer a file stream to which the file contents can be added. Could be extended to support choosing file name (not file) to save to.
I expect your exportWith uses #putForm:onFileNamed: whereas it could use #putForm:onStream: instead.
I will change the interface indeed. Thanks Gary for your answer Cheers, Alexandre
Regards, Gary
----- Original Message ----- From: "Alexandre Bergel" <alexandre.bergel@me.com> To: "Pharo Development" <Pharo-project@lists.gforge.inria.fr> Sent: Monday, June 20, 2011 7:02 PM Subject: [Pharo-project] UITheme builder fileSave:...
Hi!
I would like to use the builder to have a file selection. Here is my code:
-=-=--=-=-=--=-=-=--=-=-=--=-=-=--= interactiveExportWith: imageWriterClass extension: fileExtension "Ask for a file name and a directory"
| fileStream | fileStream := UITheme builder fileSave: 'Your title here' extensions: #('png') path: nil.
"Very strange that I obtain a stream". fileStream ifNil: [ self inform: 'saving aborded'. ^ self ]. fileStream close. FileDirectory deleteFilePath: fileStream name. self exportWith: imageWriterClass fullname: fileStream name. -=-=--=-=-=--=-=-=--=-=-=--=-=-=--=
I have no idea why fileSave:extensions:path: return a stream. If I just need a full file name ?
Cheers, Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
participants (2)
-
Alexandre Bergel -
Gary Chambers