Fixed Add new file if name was existing into tree

This commit is contained in:
svk 2018-02-24 12:22:08 +03:00
parent 5bb50aff06
commit 164317de93
5 changed files with 27 additions and 9 deletions

7
errors
View File

@ -0,0 +1,7 @@
Error in startup script: invalid command name "an""
while executing
"an""
(file "/home/svk/.projman/projman.conf" line 76)
invoked from within
"source [file join $workDir projman.conf]"
(file "/home/svk/projects/tcl/projman/projman.tcl" line 81)

View File

@ -617,3 +617,4 @@ proc FileOperation::FileDialog {tree operation} {

View File

@ -328,7 +328,9 @@ proc Quit {} {
} elseif {[regexp -nocase -all -- {set workingProject} $line match]} {
puts "set workingProject \"$activeProject\""
puts $file1 "set workingProject \"$activeProject\""
puts "Current project - $activeProject"
} else {
puts "> $line"
puts $file1 "$line"
}
}
@ -668,3 +670,4 @@ proc GetExtention {node} {

View File

@ -499,7 +499,7 @@ proc AddNewProjectIntoTree {proj} {
## ADD FILE INTO PROJECTS ##
proc AddToProj {fileName mode workingTree} {
global projDir workDir activeProject noteBook fontNormal imgDir
global projDir workDir activeProject noteBook fontNormal imgDir count
set type [string trim [file extension $fileName] {.}]
destroy .addtoproj
@ -548,6 +548,11 @@ proc AddToProj {fileName mode workingTree} {
set name [file rootname $fileName]
set ext [string range [file extension $fileName] 1 end]
set subNode "$name$dot$ext"
if {[$workingTree exists $subNode] == 1} {
puts $count
append subNode "_$count"
incr count
}
$workingTree insert end $parentNode $subNode -text $fileName \
-data [file join $dir $fileName] -open 1\
-image [Bitmap::get [file join $imgDir $img.gif]]\
@ -997,3 +1002,4 @@ proc InsertTitle {newFile type} {
close $pipe
}

View File

@ -13,6 +13,7 @@ namespace eval FileTree {
variable count
variable dblclick
}
set count 1
proc FileTree::create {nb} {
global editor
@ -46,8 +47,7 @@ proc FileTree::create {nb} {
}
proc FileTree::init { treeFile } {
global tcl_platform
variable count
global tcl_platform count
set count 0
if { $tcl_platform(platform) == "unix" } {
@ -77,7 +77,7 @@ proc FileTree::init { treeFile } {
}
proc FileTree::getdir { treeFile node path } {
variable count
global count
set lentries [glob -nocomplain [file join $path "*"]]
set lfiles {}
@ -189,7 +189,7 @@ proc FileTree::expand { treeFile but } {
}
proc FileTree::GetAllDirs {treeFiles} {
global projDir workDir fontNormal imgDir module env
global projDir workDir fontNormal imgDir module env nodeCounter
set rList ""
set rootDir $env(HOME)
if {[catch {cd $rootDir}] != 0} {
@ -198,6 +198,7 @@ proc FileTree::GetAllDirs {treeFiles} {
set rootNode [$treeFiles insert end root $rootDir -text "$rootDir" -font $fontNormal \
-data "dir_root" -open 1\
-image [Bitmap::get [file join $imgDir folder.gif]]]
incr nodeCounter
# $treeFiles insert end root $rootDir -text "$rootDir" -font $fontNormal \
# -data "dir_root" -open 0\
@ -213,7 +214,6 @@ proc FileTree::GetAllDirs {treeFiles} {
proc GetFilesSubdir {tree node dir} {
global fontNormal projDir workDir activeProject imgDir count
global backUpFileShow dotFileShow
set count 1
set rList ""
if {[catch {cd $dir}] != 0} {
return ""
@ -285,14 +285,14 @@ proc GetFilesSubdir {tree node dir} {
}
}
incr count
incr nodeCouner
}
$tree itemconfigure $node -open 1
}
## GETTING FILES FROM PROJECT DIR AND INSERT INTO TREE WIDGET ##
proc GetFiles {dir project tree} {
global fontNormal backUpFileShow dotFileShow imgDir
global fontNormal backUpFileShow dotFileShow imgDir count
set rList ""
set count 1
if {[catch {cd $dir}] != 0} {
return ""
}
@ -597,3 +597,4 @@ proc FileNotePageRaise {nb s} {
}
}