[GRASS-SVN] r39954 - grass/branches/develbranch_6/gui/tcltk/gis.m
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Dec 9 18:04:35 EST 2009
Author: marisn
Date: 2009-12-09 18:04:34 -0500 (Wed, 09 Dec 2009)
New Revision: 39954
Modified:
grass/branches/develbranch_6/gui/tcltk/gis.m/gm.tcl
grass/branches/develbranch_6/gui/tcltk/gis.m/gmlib.tcl
grass/branches/develbranch_6/gui/tcltk/gis.m/gmtree.tcl
grass/branches/develbranch_6/gui/tcltk/gis.m/mapprint.tcl
grass/branches/develbranch_6/gui/tcltk/gis.m/maptool.tcl
grass/branches/develbranch_6/gui/tcltk/gis.m/profile.tcl
grass/branches/develbranch_6/gui/tcltk/gis.m/thematic.tcl
Log:
Remember last used directory in gis.m
Modified: grass/branches/develbranch_6/gui/tcltk/gis.m/gm.tcl
===================================================================
--- grass/branches/develbranch_6/gui/tcltk/gis.m/gm.tcl 2009-12-09 22:02:58 UTC (rev 39953)
+++ grass/branches/develbranch_6/gui/tcltk/gis.m/gm.tcl 2009-12-09 23:04:34 UTC (rev 39954)
@@ -146,7 +146,7 @@
variable selectedfont
variable encoding
global array filename ;# mon
-
+ variable last_directory ;# last save/load dir for reuse
}
@@ -271,8 +271,12 @@
Gm::cleanup}
}
+ if { [info exists env(HOME)] } {
+ set Gm::last_directory $env(HOME)
+ } else {
+ set Gm::last_directory [pwd]
+ }
-
}
Modified: grass/branches/develbranch_6/gui/tcltk/gis.m/gmlib.tcl
===================================================================
--- grass/branches/develbranch_6/gui/tcltk/gis.m/gmlib.tcl 2009-12-09 22:02:58 UTC (rev 39953)
+++ grass/branches/develbranch_6/gui/tcltk/gis.m/gmlib.tcl 2009-12-09 23:04:34 UTC (rev 39954)
@@ -86,7 +86,7 @@
[list [G_msg "All Files"] "*"] \
]
- set filename_new [tk_getOpenFile -parent $Gm::mainwindow -filetypes $types \
+ set filename_new [tk_getOpenFile -initialdir $Gm::last_directory -parent $Gm::mainwindow -filetypes $types \
-title [G_msg "Open File"] ]
if { $filename_new == "" } { return}
set filename($mon) $filename_new
@@ -115,7 +115,7 @@
[list [G_msg "DM Resource File"] [list {.dm} {.dmrc}]] \
[list [G_msg "All Files"] "*"] \
]
- set filename($mon) [tk_getSaveFile -parent $Gm::mainwindow -filetypes $types \
+ set filename($mon) [tk_getSaveFile -initialdir $Gm::last_directory -parent $Gm::mainwindow -filetypes $types \
-title [G_msg "Save File"] -defaultextension .grc]
if { $filename($mon) == "" } { return}
GmTree::save $filename($mon)
Modified: grass/branches/develbranch_6/gui/tcltk/gis.m/gmtree.tcl
===================================================================
--- grass/branches/develbranch_6/gui/tcltk/gis.m/gmtree.tcl 2009-12-09 22:02:58 UTC (rev 39953)
+++ grass/branches/develbranch_6/gui/tcltk/gis.m/gmtree.tcl 2009-12-09 23:04:34 UTC (rev 39954)
@@ -730,7 +730,9 @@
if {[catch {close $rcfile} error]} {
GmLib::errmsg $error
}
-
+ if { $fpath != "" } {
+ set Gm::last_directory [file dirname $fpath]
+ }
}
Modified: grass/branches/develbranch_6/gui/tcltk/gis.m/mapprint.tcl
===================================================================
--- grass/branches/develbranch_6/gui/tcltk/gis.m/mapprint.tcl 2009-12-09 22:02:58 UTC (rev 39953)
+++ grass/branches/develbranch_6/gui/tcltk/gis.m/mapprint.tcl 2009-12-09 23:04:34 UTC (rev 39954)
@@ -42,7 +42,7 @@
variable PVar
variable PView
variable PWid
- global array can # mon
+ global array can ;# mon
}
@@ -337,7 +337,7 @@
-state $psprint::gsstate
Entry $row.c -width 30 -textvariable psprint::pdffile -state $gsstate
Button $row.d -text [G_msg "Browse"] -command { set psprint::pdffile \
- [tk_getSaveFile -title "Output PDF file" -defaultextension ".pdf"]} \
+ [tk_getSaveFile -initialdir $Gm::last_directory -title "Output PDF file" -defaultextension ".pdf"]} \
-state $psprint::gsstate
pack $row.a $row.b $row.c $row.d -side left;
pack $row -side top -fill x -expand no -anchor n
@@ -349,7 +349,7 @@
Label $row.b -anchor w -text [G_msg "Save to EPS file "]
Entry $row.c -width 30 -textvariable psprint::epsfile
Button $row.d -text [G_msg "Browse"] -command { set psprint::epsfile \
- [ tk_getSaveFile -title "Output EPS file" -defaultextension ".eps"] }
+ [ tk_getSaveFile -initialdir $Gm::last_directory -title "Output EPS file" -defaultextension ".eps"] }
pack $row.a $row.b $row.c $row.d -side left;
pack $row -side top -fill x -expand no -anchor n
@@ -448,7 +448,7 @@
if {[catch {exec $cmd $format -sDEVICE#pdfwrite -r$res -sNOPAUSE -sOutputFile#$pdffile -dBATCH -- $tmppsfile} error]} {
GmLib::errmsg $error
}
-
+ set Gm::last_directory [file dirname $pdffile]
}
# output to eps file
@@ -458,6 +458,7 @@
} else {
$cv postscript -file "$epsfile" -rotate 1
}
+ set Gm::last_directory [file dirname $epsfile]
}
psprint::clean
Modified: grass/branches/develbranch_6/gui/tcltk/gis.m/maptool.tcl
===================================================================
--- grass/branches/develbranch_6/gui/tcltk/gis.m/maptool.tcl 2009-12-09 22:02:58 UTC (rev 39953)
+++ grass/branches/develbranch_6/gui/tcltk/gis.m/maptool.tcl 2009-12-09 23:04:34 UTC (rev 39954)
@@ -374,14 +374,8 @@
set outfile($mon) $MapCanvas::outfile($mon)
- if { [info exists env(HOME)] } {
- set dir $env(HOME)
- set path [tk_getSaveFile -initialdir $dir \
- -title "Save Mapcanvas contents to file"]
- } else {
- set path [tk_getSaveFile \
- -title "Save Mapcanvas contents to file"]
- }
+ set path [tk_getSaveFile -initialdir $Gm::last_directory \
+ -title "Save Mapcanvas contents to file" ]
set currdir [pwd]
cd $tmpdir
@@ -451,6 +445,7 @@
catch {file delete $path.ppm}
}
}
+ set Gm::last_directory [file dirname $path] ;# update last path only when user saves something
}
return
}
Modified: grass/branches/develbranch_6/gui/tcltk/gis.m/profile.tcl
===================================================================
--- grass/branches/develbranch_6/gui/tcltk/gis.m/profile.tcl 2009-12-09 22:02:58 UTC (rev 39953)
+++ grass/branches/develbranch_6/gui/tcltk/gis.m/profile.tcl 2009-12-09 23:04:34 UTC (rev 39954)
@@ -34,7 +34,7 @@
variable liney1 0.0
variable linex2 0.0
variable liney2 0.0
- variable array psegment len #
+ variable array psegment len ;#
variable elevrange 0.0
variable elevmax 0.0
variable elevmin 0.0
@@ -195,16 +195,13 @@
set types {
{{EPS} {.eps}}
}
-
- if { [info exists HOME] } {
- set dir $env(HOME)
- set path [tk_getSaveFile -filetypes $types -initialdir $dir \
+ set path [tk_getSaveFile -initialdir $Gm::last_directory -filetypes $types \
-defaultextension ".eps" -parent .profile]
- } else {
- set path [tk_getSaveFile -filetypes $types -defaultextension ".eps" -parent .profile]
- }
$pcan postscript -file "$path"
+ if { $path != "" } {
+ set Gm::last_directory [file dirname $path]
+ }
return
}
Modified: grass/branches/develbranch_6/gui/tcltk/gis.m/thematic.tcl
===================================================================
--- grass/branches/develbranch_6/gui/tcltk/gis.m/thematic.tcl 2009-12-09 22:02:58 UTC (rev 39953)
+++ grass/branches/develbranch_6/gui/tcltk/gis.m/thematic.tcl 2009-12-09 23:04:34 UTC (rev 39954)
@@ -837,15 +837,13 @@
{{EPS} {.eps}}
}
- if { [info exists HOME] } {
- set dir $env(HOME)
- set path [tk_getSaveFile -filetypes $types -initialdir $dir \
+ set path [tk_getSaveFile -initialdir $Gm::last_directory -filetypes $types \
-defaultextension ".eps"]
- } else {
- set path [tk_getSaveFile -filetypes $types -defaultextension ".eps"]
- }
$tlegcan($mon,$id) postscript -file "$path"
+ if { $path != "" } {
+ set Gm::last_directory [file dirname $path]
+ }
return
}
More information about the grass-commit
mailing list