From 0d5832c84c5dce4b10d17fe3f04f620ac946c3aa Mon Sep 17 00:00:00 2001 From: svkalinin Date: Thu, 24 Nov 2022 13:28:11 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=B4=D0=B5=D0=BB?= =?UTF-8?q?=D0=B0=D0=BD=D0=B0=20=D0=BF=D1=80=D0=BE=D1=86=D0=B5=D0=B4=D1=83?= =?UTF-8?q?=D1=80=D0=B0=20=D0=BE=D0=BF=D1=80=D0=B5=D0=B4=D0=B5=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D0=B0=D0=BA=D1=82=D0=B8=D0=B2=D0=BD=D0=BE?= =?UTF-8?q?=D0=B3=D0=BE=20=D0=BF=D1=80=D0=BE=D0=B5=D0=BA=D1=82=D0=B0.=20?= =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=BE=20?= =?UTF-8?q?=D0=BE=D0=BF=D1=80=D0=B5=D0=B4=D0=B5=D0=BB=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D0=B2=D0=B5=D1=82=D0=BA=D0=B8=20git.=20=D0=A2=D0=B5?= =?UTF-8?q?=D0=BF=D0=B5=D1=80=D1=8C=20=D0=BC=D0=BE=D0=B6=D0=BD=D0=BE=20?= =?UTF-8?q?=D0=BD=D0=BE=D1=80=D0=BC=D0=B0=D0=BB=D1=8C=D0=BD=D0=BE=20=D1=80?= =?UTF-8?q?=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=D1=82=D1=8C=20=D0=B2=20=D0=B4?= =?UTF-8?q?=D0=B2=D1=83=D1=85=20=D0=B8=20=D0=B1=D0=BE=D0=BB=D0=B5=D0=B5=20?= =?UTF-8?q?=D0=BE=D1=82=D0=BA=D1=80=D1=8B=D1=82=D1=8B=D1=85=20=D0=BF=D1=80?= =?UTF-8?q?=D0=BE=D0=B5=D0=BA=D1=82=D0=B0=D1=85=20(=D0=BA=D0=B0=D1=82?= =?UTF-8?q?=D0=B0=D0=BB=D0=BE=D0=B3=D0=B0=D1=85/=D0=BF=D0=B0=D0=BF=D0=BA?= =?UTF-8?q?=D0=B0=D1=85)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/files.tcl | 24 ++++++++++++------------ lib/git.tcl | 3 +++ lib/menu.tcl | 3 ++- lib/procedure.tcl | 17 +++++++++++++++++ lib/tree.tcl | 14 ++++++++++++-- projman.tcl | 7 ++++--- 6 files changed, 50 insertions(+), 18 deletions(-) diff --git a/lib/files.tcl b/lib/files.tcl index ae1930a..9e9afa5 100644 --- a/lib/files.tcl +++ b/lib/files.tcl @@ -135,16 +135,16 @@ namespace eval FileOper { set dir $env(HOME) } set fullPath [tk_chooseDirectory -initialdir $dir -parent .] - set file [string range $fullPath [expr [string last "/" $fullPath]+1] end] - regsub -all "." $file "_" node - set dir [file dirname $fullPath] - # EditFile .frmBody.frmCat.noteBook.ffiles.frmTreeFiles.treeFiles $node $fullPath - # puts $fullPath - if ![info exists activeProject] { - set activeProject $fullPath - } - .frmStatus.lblGitLogo configure -image git_logo_20x20 - .frmStatus.lblGit configure -text "[::msgcat::mc "Branch"]: [Git::Branches current]" + # set file [string range $fullPath [expr [string last "/" $fullPath]+1] end] + # regsub -all "." $file "_" node + # set dir [file dirname $fullPath] + # # EditFile .frmBody.frmCat.noteBook.ffiles.frmTreeFiles.treeFiles $node $fullPath + # # puts $fullPath + # if ![info exists activeProject] { + # set activeProject $fullPath + # } + # .frmStatus.lblGitLogo configure -image git_logo_20x20 + # .frmStatus.lblGit configure -text "[::msgcat::mc "Branch"]: [Git::Branches current]" return $fullPath } @@ -172,10 +172,10 @@ namespace eval FileOper { set prevProj [$tree prev $treeItem] # puts $prevProj if {$nextProj ne ""} { - set activeProject [$tree item $nextProj -values] + SetActiveProject [$tree item $nextProj -values] puts $activeProject } elseif {$prevProj ne ""} { - set activeProject [$tree item $prevProj -values] + SetActiveProject [$tree item $prevProj -values] puts $activeProject } else { unset activeProject diff --git a/lib/git.tcl b/lib/git.tcl index 7a3539f..a53839b 100644 --- a/lib/git.tcl +++ b/lib/git.tcl @@ -94,7 +94,10 @@ namespace eval Git { set d [pwd] if {$activeProject ne ""} { cd $activeProject + } else { + return "" } + puts $activeProject lappend cmd $cfgVariables(gitCommand) lappend cmd "branch" # lappend cmd "-s" diff --git a/lib/menu.tcl b/lib/menu.tcl index 23b47c7..cd9bc25 100644 --- a/lib/menu.tcl +++ b/lib/menu.tcl @@ -29,7 +29,8 @@ proc GetFileMenu {m} { $m add command -label [::msgcat::mc "Open folder"] -accelerator "Ctrl+K" -command { set folderPath [FileOper::OpenFolderDialog] if {$folderPath != ""} { - set activeProject $folderPath + # set activeProject $folderPath + SetActiveProject $folderPath FileOper::ReadFolder $folderPath ReadFilesFromDirectory $folderPath $folderPath } diff --git a/lib/procedure.tcl b/lib/procedure.tcl index 56c2779..3b9a574 100644 --- a/lib/procedure.tcl +++ b/lib/procedure.tcl @@ -651,3 +651,20 @@ proc ShowMessage {title msg} { ok {return} } } + +proc SetActiveProject {path} { + global activeProject projman + set activeProject $path + set titleFolder [file tail $path] + wm title . "ProjMan \($projman(Version)-$projman(Release)\) - $titleFolder" + # set file [string range $fullPath [expr [string last "/" $fullPath]+1] end] + # regsub -all "." $file "_" node + # set dir [file dirname $fullPath] + # EditFile .frmBody.frmCat.noteBook.ffiles.frmTreeFiles.treeFiles $node $fullPath + # puts $fullPath + # if ![info exists activeProject] { + # set activeProject $fullPath + # } + .frmStatus.lblGitLogo configure -image git_logo_20x20 + .frmStatus.lblGit configure -text "[::msgcat::mc "Branch"]: [Git::Branches current]" +} diff --git a/lib/tree.tcl b/lib/tree.tcl index 2cf7fe8..cb94424 100644 --- a/lib/tree.tcl +++ b/lib/tree.tcl @@ -91,11 +91,11 @@ namespace eval Tree { } proc PressItem {tree} { - global nbEditor lexers editors + global nbEditor lexers editors activeProject set id [$tree selection] $tree tag remove selected $tree item $id -tags selected - + SetActiveProject [GetItemID $tree [GetUpperItem $tree $id]] set values [$tree item $id -values] set key [lindex [split $id "::"] 0] if {$values eq "" || $key eq ""} {return} @@ -144,4 +144,14 @@ namespace eval Tree { $tree selection set $treeItemName } } + + proc GetUpperItem {tree item} { + set parent [$tree parent $item] + if {$parent eq ""} { + return $item + } else { + GetUpperItem $tree $parent + } + } + } diff --git a/projman.tcl b/projman.tcl index d5bf195..0f54053 100755 --- a/projman.tcl +++ b/projman.tcl @@ -10,7 +10,7 @@ exec wish "$0" -- "$@" ###################################################### # Version: 2.0.0 # Release: alpha -# Build: 24112022115832 +# Build: 24112022132653 ###################################################### # определим текущую версию, релиз и т.д. @@ -118,7 +118,8 @@ if [info exists opened] { exit } if [file isdirectory $path] { - set activeProject $path + # set activeProject $path + SetActiveProject $path .frmStatus.lblGitLogo configure -image git_logo_20x20 .frmStatus.lblGit configure -text "[::msgcat::mc "Branch"]: [Git::Branches current]" FileOper::ReadFolder $path @@ -130,7 +131,7 @@ if [info exists opened] { } else { if {$cfgVariables(opened) ne ""} { # puts "<$cfgVariables(opened)" - set activeProject $cfgVariables(opened) + SetActiveProject $cfgVariables(opened) .frmStatus.lblGitLogo configure -image git_logo_20x20 .frmStatus.lblGit configure -text "[::msgcat::mc "Branch"]: [Git::Branches current]" FileOper::ReadFolder $cfgVariables(opened)