For Programmers: Free Programming Magazines  


Home > Archive > PerlTk > August 2004 > getSaveFile and file extensions









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author getSaveFile and file extensions
Nath

2004-08-08, 3:56 pm

When i use getSaveFile i want to be able to do the following (any pointers
welcomed!):

select the Save As Type (to display all files of that type - with more than
1 file extension: e.g. *.fas;*.fasta;*.aa;*.nt etc)
Type the name of the file to save, without an extension, and to append a
default extension based of the currently selected Save As Type.

example.

I have 2 diferent file types:
Fasta Type: *.fas;*.fasta;*.aa;*.nt
Phylip Type: *.phy;*.phly;*.phylip

I want to save the file as a phylip type, so i select the 'Phylip Type' in
the Save As Type drop-down list. This shows me all the phylip type files
with the above extensions.
I type the name of the file i want to save: example_file_name
Click save, and the default 'Phylip Type' extension (i.e. the first
extention in the filetype list '.phy' ) is appended to the returned file
path from getSaveFile.

Thanks
Nathan




Slaven Rezic

2004-08-10, 3:57 pm

"Nath" <DON'T_SEND_ME@TRIPE_TO_MY_IN.BOX> wrote in message news:<411639d8$0$5110$afc38c87@news.ukonline.co.uk>...
> When i use getSaveFile i want to be able to do the following (any pointers
> welcomed!):
>
> select the Save As Type (to display all files of that type - with more than
> 1 file extension: e.g. *.fas;*.fasta;*.aa;*.nt etc)
> Type the name of the file to save, without an extension, and to append a
> default extension based of the currently selected Save As Type.
>
> example.
>
> I have 2 diferent file types:
> Fasta Type: *.fas;*.fasta;*.aa;*.nt
> Phylip Type: *.phy;*.phly;*.phylip
>
> I want to save the file as a phylip type, so i select the 'Phylip Type' in
> the Save As Type drop-down list. This shows me all the phylip type files
> with the above extensions.


> I type the name of the file i want to save: example_file_name
> Click save, and the default 'Phylip Type' extension (i.e. the first
> extention in the filetype list '.phy' ) is appended to the returned file
> path from getSaveFile.


Maybe subclassing Tk::FBox can help here (assuming you're on X11). In
VerifyFileName the filename is constructed by using the value of the
-defaultextension option. Now you could wrap this method and change
-defaultextension before calling the "real" method.

Regards,
Slaven
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com