On Thu, Apr 24, 2008 at 01:49:23AM +0200, Yoda-BZH - Tristan Charbonneau wrote: > Here is a patch to correctly set the filetype to the image we want to save. > Actually, when you want to save an image from a webcam session, it ask > you the filetype, but always show PNG Files, .png as filetype. > > Index: msncam.tcl > =================================================================== > --- msncam.tcl (révision 9757) > +++ msncam.tcl (copie de travail) > @@ -3439,8 +3439,29 @@ > > proc saveToImageStep2 { w } { > set img ${w}_img > + > + set imgFormat [ set ::${w}_saveToImageFormat ] > + switch -- $imgFormat { > + "cxgif" { > + set type { {"GIF Files" .gif} } > + } > + "cxpng" { > + set type { {"PNG Files" .png} } > + } > + "cxjpg" { > + set type { {"JPEG Files" .jpg} } > + } > + "cxtga" { > + set type { {"TGA Files" .tga} } > + } > + "cximage" - > + default { > + set type { {"All Files" *.*} } > + } > + } > > - set filename [tk_getSaveFile -filetypes {{"PNG files" .png}}] > + #set filename [tk_getSaveFile -filetypes {{"PNG files" > .png}}] > + set filename [tk_getSaveFile -filetypes $type] > if { $filename != "" } { > $img write $filename -format [set > ::${w}_saveToImageFormat] > } > > > > Good Night
Very good, well done! I don't have a lot of comments, if I wanted it to be my way, I would have done it differently, but this is just as good and doesn't require any change... If it would be done "my way", here's how I would have done it : 1 - no need for the "cximage" with the default.. 2 - for default, instead of "All Files", it would be better to do "All Image Files" and give it .jpg, .png, etc... 3 - .jpg is missing .jpeg and .JPG and .JPEG ... yeah, it's not case sensitive iirc... 4 - in gui.tcl, we use '*.jpg' instead of '.jpg', I don't know if it changes anything... 5 - "PNG files" isn't translated... it should be [trans pngfiles] ... same for the other file formats... I'm committing your patch with fixes for points 1, 2, 3, 4.. not 5 because I'm lazy :p Thanks, KaKaRoTo ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ Amsn-devel mailing list Amsn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/amsn-devel