Revision: 44715 http://brlcad.svn.sourceforge.net/brlcad/?rev=44715&view=rev Author: starseeker Date: 2011-05-31 16:08:17 +0000 (Tue, 31 May 2011)
Log Message: ----------- Reviewed and applied patch from Brandon Hinesley (one of our 2011 GSoC students) that replaces MGED's g2asc saving dialog with the proper use of tk_getSaveFile. Modified Paths: -------------- brlcad/trunk/src/tclscripts/mged/g2asc.tcl Modified: brlcad/trunk/src/tclscripts/mged/g2asc.tcl =================================================================== --- brlcad/trunk/src/tclscripts/mged/g2asc.tcl 2011-05-31 13:19:27 UTC (rev 44714) +++ brlcad/trunk/src/tclscripts/mged/g2asc.tcl 2011-05-31 16:08:17 UTC (rev 44715) @@ -40,37 +40,22 @@ set top .$id.ascii catch { destroy $top } + # get the name of the ascii database to save set db_name [_mged_opendb] - set default_name [file rootname $db_name].asc - set ret [cad_input_dialog $top $mged_gui($id,screen) "Save as Ascii"\ - "Enter ascii filename:" ascii_filename\ - $default_name 0 {{ summary "Enter a filename to indicate where -to put the acsii converted database."}} OK Cancel] + set default_name [file tail [file rootname $db_name]].asc + set ftypes {{{Ascii Database} {.asc}} {{All Files} {*}}} + set filename [tk_getSaveFile -parent .$id -filetypes $ftypes \ + -initialdir $mged_gui(databaseDir) \ + -initialfile $default_name \ + -title "Extract Ascii Database"] + if { $filename != "" } { + # save the current directory for subsequent file saves + set mged_gui(databaseDir) [ file dirname $filename ] - if { $ascii_filename != "" } { - if { $ret == 0 } { - if [file exists $ascii_filename] { - set result [cad_dialog $::tk::Priv(cad_dialog) $mged_gui($id,screen)\ - "Overwrite $ascii_filename?"\ - "Overwrite $ascii_filename?"\ - "" 0 OK Cancel] - - if { $result } { - return - } - } - - set g2asc [file join [bu_brlcad_root "bin"] g2asc] - catch {exec $g2asc $db_name $ascii_filename} msg - } - } else { - if { $ret == 0 } { - cad_dialog $::tk::Priv(cad_dialog) $mged_gui($id,screen)\ - "No file name specified!"\ - "No file name specified!"\ - "" 0 OK - } + # convert binary database to ascii + set g2asc [bu_brlcad_root "bin/g2asc"] + catch {exec $g2asc $db_name $filename} msg } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Data protection magic? Nope - It's vRanger. Get your free trial download today. http://p.sf.net/sfu/quest-sfdev2dev _______________________________________________ BRL-CAD Source Commits mailing list brlcad-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/brlcad-commits