Добавлена динамическая генерация меню 'Инструменты'. Теперь новые внешние инструменты доступны сразу после сохранения файла настроек tools.ini в редакторе.
This commit is contained in:
@@ -391,6 +391,12 @@ namespace eval FileOper {
|
|||||||
if {[file tail $filePath] eq "projman.ini"} {
|
if {[file tail $filePath] eq "projman.ini"} {
|
||||||
Config::read $dir(cfg)
|
Config::read $dir(cfg)
|
||||||
}
|
}
|
||||||
|
if {[file tail $filePath] eq "tools.ini"} {
|
||||||
|
Tools::Read $dir(cfg)
|
||||||
|
Tools::CheckVariables
|
||||||
|
Tools::GetMenu .popup.tools
|
||||||
|
Tools::GetMenu .frmMenu.mnuTools.m
|
||||||
|
}
|
||||||
if [string match "*untitled*" $nbEditorItem] {
|
if [string match "*untitled*" $nbEditorItem] {
|
||||||
FileOper::Close
|
FileOper::Close
|
||||||
if {$type ne "close"} {
|
if {$type ne "close"} {
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ proc Tools::Create {dir} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
proc Tools::Read {dir} {
|
proc Tools::Read {dir} {
|
||||||
|
set ::toolsVariables ""
|
||||||
set toolsFile [ini::open [file join $dir tools.ini] "r"]
|
set toolsFile [ini::open [file join $dir tools.ini] "r"]
|
||||||
foreach section [ini::sections $toolsFile] {
|
foreach section [ini::sections $toolsFile] {
|
||||||
foreach key [ini::keys $toolsFile $section] {
|
foreach key [ini::keys $toolsFile $section] {
|
||||||
@@ -104,6 +105,12 @@ proc Tools::CheckVariables {} {
|
|||||||
|
|
||||||
proc Tools::GetMenu {m} {
|
proc Tools::GetMenu {m} {
|
||||||
global cfgVariables toolsVariables
|
global cfgVariables toolsVariables
|
||||||
|
set count [$m index end]
|
||||||
|
if {$count != "none"} {
|
||||||
|
for {set i $count} {$i >= 0} {incr i -1} {
|
||||||
|
$m delete $i
|
||||||
|
}
|
||||||
|
}
|
||||||
foreach toolName [dict keys $toolsVariables] {
|
foreach toolName [dict keys $toolsVariables] {
|
||||||
dict for {key value} [dict get $toolsVariables $toolName] {
|
dict for {key value} [dict get $toolsVariables $toolName] {
|
||||||
DebugPuts "GetToolsMenu $key $value"
|
DebugPuts "GetToolsMenu $key $value"
|
||||||
|
|||||||
Reference in New Issue
Block a user