Переделана процедура определения активного проекта. Исправлено определение ветки git.
Теперь можно нормально работать в двух и более открытых проектах (каталогах/папках)
This commit is contained in:
parent
f8c268294a
commit
0d5832c84c
|
@ -135,16 +135,16 @@ namespace eval FileOper {
|
||||||
set dir $env(HOME)
|
set dir $env(HOME)
|
||||||
}
|
}
|
||||||
set fullPath [tk_chooseDirectory -initialdir $dir -parent .]
|
set fullPath [tk_chooseDirectory -initialdir $dir -parent .]
|
||||||
set file [string range $fullPath [expr [string last "/" $fullPath]+1] end]
|
# set file [string range $fullPath [expr [string last "/" $fullPath]+1] end]
|
||||||
regsub -all "." $file "_" node
|
# regsub -all "." $file "_" node
|
||||||
set dir [file dirname $fullPath]
|
# set dir [file dirname $fullPath]
|
||||||
# EditFile .frmBody.frmCat.noteBook.ffiles.frmTreeFiles.treeFiles $node $fullPath
|
# # EditFile .frmBody.frmCat.noteBook.ffiles.frmTreeFiles.treeFiles $node $fullPath
|
||||||
# puts $fullPath
|
# # puts $fullPath
|
||||||
if ![info exists activeProject] {
|
# if ![info exists activeProject] {
|
||||||
set activeProject $fullPath
|
# set activeProject $fullPath
|
||||||
}
|
# }
|
||||||
.frmStatus.lblGitLogo configure -image git_logo_20x20
|
# .frmStatus.lblGitLogo configure -image git_logo_20x20
|
||||||
.frmStatus.lblGit configure -text "[::msgcat::mc "Branch"]: [Git::Branches current]"
|
# .frmStatus.lblGit configure -text "[::msgcat::mc "Branch"]: [Git::Branches current]"
|
||||||
return $fullPath
|
return $fullPath
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,10 +172,10 @@ namespace eval FileOper {
|
||||||
set prevProj [$tree prev $treeItem]
|
set prevProj [$tree prev $treeItem]
|
||||||
# puts $prevProj
|
# puts $prevProj
|
||||||
if {$nextProj ne ""} {
|
if {$nextProj ne ""} {
|
||||||
set activeProject [$tree item $nextProj -values]
|
SetActiveProject [$tree item $nextProj -values]
|
||||||
puts $activeProject
|
puts $activeProject
|
||||||
} elseif {$prevProj ne ""} {
|
} elseif {$prevProj ne ""} {
|
||||||
set activeProject [$tree item $prevProj -values]
|
SetActiveProject [$tree item $prevProj -values]
|
||||||
puts $activeProject
|
puts $activeProject
|
||||||
} else {
|
} else {
|
||||||
unset activeProject
|
unset activeProject
|
||||||
|
|
|
@ -94,7 +94,10 @@ namespace eval Git {
|
||||||
set d [pwd]
|
set d [pwd]
|
||||||
if {$activeProject ne ""} {
|
if {$activeProject ne ""} {
|
||||||
cd $activeProject
|
cd $activeProject
|
||||||
|
} else {
|
||||||
|
return ""
|
||||||
}
|
}
|
||||||
|
puts $activeProject
|
||||||
lappend cmd $cfgVariables(gitCommand)
|
lappend cmd $cfgVariables(gitCommand)
|
||||||
lappend cmd "branch"
|
lappend cmd "branch"
|
||||||
# lappend cmd "-s"
|
# lappend cmd "-s"
|
||||||
|
|
|
@ -29,7 +29,8 @@ proc GetFileMenu {m} {
|
||||||
$m add command -label [::msgcat::mc "Open folder"] -accelerator "Ctrl+K" -command {
|
$m add command -label [::msgcat::mc "Open folder"] -accelerator "Ctrl+K" -command {
|
||||||
set folderPath [FileOper::OpenFolderDialog]
|
set folderPath [FileOper::OpenFolderDialog]
|
||||||
if {$folderPath != ""} {
|
if {$folderPath != ""} {
|
||||||
set activeProject $folderPath
|
# set activeProject $folderPath
|
||||||
|
SetActiveProject $folderPath
|
||||||
FileOper::ReadFolder $folderPath
|
FileOper::ReadFolder $folderPath
|
||||||
ReadFilesFromDirectory $folderPath $folderPath
|
ReadFilesFromDirectory $folderPath $folderPath
|
||||||
}
|
}
|
||||||
|
|
|
@ -651,3 +651,20 @@ proc ShowMessage {title msg} {
|
||||||
ok {return}
|
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]"
|
||||||
|
}
|
||||||
|
|
14
lib/tree.tcl
14
lib/tree.tcl
|
@ -91,11 +91,11 @@ namespace eval Tree {
|
||||||
}
|
}
|
||||||
|
|
||||||
proc PressItem {tree} {
|
proc PressItem {tree} {
|
||||||
global nbEditor lexers editors
|
global nbEditor lexers editors activeProject
|
||||||
set id [$tree selection]
|
set id [$tree selection]
|
||||||
$tree tag remove selected
|
$tree tag remove selected
|
||||||
$tree item $id -tags selected
|
$tree item $id -tags selected
|
||||||
|
SetActiveProject [GetItemID $tree [GetUpperItem $tree $id]]
|
||||||
set values [$tree item $id -values]
|
set values [$tree item $id -values]
|
||||||
set key [lindex [split $id "::"] 0]
|
set key [lindex [split $id "::"] 0]
|
||||||
if {$values eq "" || $key eq ""} {return}
|
if {$values eq "" || $key eq ""} {return}
|
||||||
|
@ -144,4 +144,14 @@ namespace eval Tree {
|
||||||
$tree selection set $treeItemName
|
$tree selection set $treeItemName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
proc GetUpperItem {tree item} {
|
||||||
|
set parent [$tree parent $item]
|
||||||
|
if {$parent eq ""} {
|
||||||
|
return $item
|
||||||
|
} else {
|
||||||
|
GetUpperItem $tree $parent
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ exec wish "$0" -- "$@"
|
||||||
######################################################
|
######################################################
|
||||||
# Version: 2.0.0
|
# Version: 2.0.0
|
||||||
# Release: alpha
|
# Release: alpha
|
||||||
# Build: 24112022115832
|
# Build: 24112022132653
|
||||||
######################################################
|
######################################################
|
||||||
|
|
||||||
# определим текущую версию, релиз и т.д.
|
# определим текущую версию, релиз и т.д.
|
||||||
|
@ -118,7 +118,8 @@ if [info exists opened] {
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
if [file isdirectory $path] {
|
if [file isdirectory $path] {
|
||||||
set activeProject $path
|
# set activeProject $path
|
||||||
|
SetActiveProject $path
|
||||||
.frmStatus.lblGitLogo configure -image git_logo_20x20
|
.frmStatus.lblGitLogo configure -image git_logo_20x20
|
||||||
.frmStatus.lblGit configure -text "[::msgcat::mc "Branch"]: [Git::Branches current]"
|
.frmStatus.lblGit configure -text "[::msgcat::mc "Branch"]: [Git::Branches current]"
|
||||||
FileOper::ReadFolder $path
|
FileOper::ReadFolder $path
|
||||||
|
@ -130,7 +131,7 @@ if [info exists opened] {
|
||||||
} else {
|
} else {
|
||||||
if {$cfgVariables(opened) ne ""} {
|
if {$cfgVariables(opened) ne ""} {
|
||||||
# puts "<$cfgVariables(opened)"
|
# puts "<$cfgVariables(opened)"
|
||||||
set activeProject $cfgVariables(opened)
|
SetActiveProject $cfgVariables(opened)
|
||||||
.frmStatus.lblGitLogo configure -image git_logo_20x20
|
.frmStatus.lblGitLogo configure -image git_logo_20x20
|
||||||
.frmStatus.lblGit configure -text "[::msgcat::mc "Branch"]: [Git::Branches current]"
|
.frmStatus.lblGit configure -text "[::msgcat::mc "Branch"]: [Git::Branches current]"
|
||||||
FileOper::ReadFolder $cfgVariables(opened)
|
FileOper::ReadFolder $cfgVariables(opened)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user