From 164317de93f00a38854bd2322d6e7186cb8290db Mon Sep 17 00:00:00 2001 From: svk Date: Sat, 24 Feb 2018 12:22:08 +0300 Subject: [PATCH] Fixed Add new file if name was existing into tree --- errors | 7 +++++++ lib/filedialog.tcl | 1 + lib/procedure.tcl | 3 +++ lib/projects.tcl | 8 +++++++- lib/tree.tcl | 17 +++++++++-------- 5 files changed, 27 insertions(+), 9 deletions(-) diff --git a/errors b/errors index e69de29..59d9add 100644 --- a/errors +++ b/errors @@ -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) diff --git a/lib/filedialog.tcl b/lib/filedialog.tcl index 0550160..3afeb74 100644 --- a/lib/filedialog.tcl +++ b/lib/filedialog.tcl @@ -617,3 +617,4 @@ proc FileOperation::FileDialog {tree operation} { + diff --git a/lib/procedure.tcl b/lib/procedure.tcl index 40e028a..e6526b5 100644 --- a/lib/procedure.tcl +++ b/lib/procedure.tcl @@ -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} { + diff --git a/lib/projects.tcl b/lib/projects.tcl index ac3ba3d..8f93a8e 100644 --- a/lib/projects.tcl +++ b/lib/projects.tcl @@ -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 } + diff --git a/lib/tree.tcl b/lib/tree.tcl index 6af2f39..7d12df9 100644 --- a/lib/tree.tcl +++ b/lib/tree.tcl @@ -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 "" @@ -252,7 +252,7 @@ proc GetFilesSubdir {tree node dir} { } } } - incr count + incr count } } foreach file [lsort [glob -nocomplain *]] { @@ -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} { } } +