Compare commits

4 Commits

Author SHA1 Message Date
svk
4f0e746128 Релиз 1-й бета версии
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 19s
2026-01-22 17:58:15 +03:00
svk
bc706ab410 Исправление ошибок 2026-01-22 17:48:59 +03:00
svk
83d70ebd3f Сделан вывод отладочной информации по запросу. Переделка кода. 2026-01-22 17:30:11 +03:00
svk
f9dbdf893d Добавлены процедуры проверки наличия параметров конфигурации, и установки значений по умолчанию в случае их отсутствия в файле конфигурации.
Добавлена новая секця и два новых парметра в конфиг, для вывода отладочной информации.
2026-01-22 16:55:17 +03:00
9 changed files with 111 additions and 32 deletions

12
debian/changelog vendored
View File

@@ -1,3 +1,12 @@
projman (2.0.0-beta1) stable; urgency=medium
* Сделан вывод отладочной информации по запросу.
* Добавлены параметры в файл конфигурации "debug" - включение или отключение отладки и "debugOut" - куда выводить информацию.
* Переделка кода.
* Добавлены процедуры проверки наличия параметров конфигурации в файле и устанвоки переменных по умолчанию.
-- svk <svk@nuk-svk.ru> Wed, 21 Jan 2026 16:44:07 +0300
projman (2.0.0-alpha24) stable; urgency=medium projman (2.0.0-alpha24) stable; urgency=medium
* Добавил фокус ввода на 'терминал' если он открыт во вкладке (при переключении вкладок). * Добавил фокус ввода на 'терминал' если он открыт во вкладке (при переключении вкладок).
@@ -32,7 +41,7 @@ projman (2.0.0-alpha21) stable; urgency=medium
projman (2.0.0-alpha20) stable; urgency=medium projman (2.0.0-alpha20) stable; urgency=medium
* Добавил вывод номера версии tcl/tl в О Программе * Добавление вывод номера версии tcl/tl в О Программе
-- Sergey Kalinin <svk@nuk-svk.ru> Mon, 03 Dec 2025 17:22:44 +0300 -- Sergey Kalinin <svk@nuk-svk.ru> Mon, 03 Dec 2025 17:22:44 +0300
@@ -458,3 +467,4 @@ projman (2.0.0-alfa0) stable; urgency=medium

View File

@@ -75,6 +75,9 @@ RB=ruby
HTM=firefox HTM=firefox
HTML=firefox HTML=firefox
LUA=lua LUA=lua
\[Debug\]
debug=false
debugOut=stdout
" "
proc Config::create {dir} { proc Config::create {dir} {
set cfgFile [open [file join $dir projman.ini] "w+"] set cfgFile [open [file join $dir projman.ini] "w+"]
@@ -131,3 +134,49 @@ proc Config::write {dir} {
ini::commit $cfgFile ini::commit $cfgFile
ini::close $cfgFile ini::close $cfgFile
} }
# Добавление перменной в список
# если отсутствует нужная секция то она будет добавлена.
proc Config::AddVariable {key value section} {
# Проверяем, существует ли уже такая переменная
if {[info exists ::cfgVariables($key)]} {
DebugPuts "The variable '$key' already exists: $::cfgVariables($key)"
return 0
}
# Добавляем в массив переменных
set ::cfgVariables($key) $value
# Добавляем в список ключей секции
if {[info exists ::cfgINIsections($section)]} {
# Проверяем, нет ли уже такого ключа в секции
if {[lsearch -exact $::cfgINIsections($section) $key] == -1} {
lappend ::cfgINIsections($section) $key
}
} else {
set ::cfgINIsections($section) [list $key]
}
DebugPuts "Config::AddVariable: The variable '$key' has been added to the array 'cfgVariables'"
return 1
}
# Проверяем наличие переменных в конфиге на основе "эталонного" списка
# и выставляем значение по умолчанию если в конфиге переменной нет
proc Config::CheckVariables {} {
set valList [split $::configDefault "\n"]
foreach item $valList {
if {[regexp -nocase -all -- {\[(\w+)\]} $item -> v1]} {
set section $v1
}
if {[regexp {^([^=]+)=(.*)$} $item -> var value]} {
if ![info exists ::cfgVariables($var)] {
DebugPuts "Error in Config::CheckVariables: variable ::cfgVariables($var) not found"
# set ::cfgVariables($var) $value
DebugPuts "Config::CheckVariables: The variable cfgVariables($var) setting to default value \"$value\""
Config::AddVariable "$var" "$value" "$section"
}
}
}
}

View File

@@ -446,8 +446,8 @@ namespace eval Editor {
# bindtags $w [list [winfo parent $w] $w Text sysAfter all] # bindtags $w [list [winfo parent $w] $w Text sysAfter all]
bindtags $w [list [winfo toplevel $w] $w Ctext sysAfter all] bindtags $w [list [winfo toplevel $w] $w Ctext sysAfter all]
catch { destroy .varhelper } catch { destroy .varhelper }
puts [bindtags $w] DebugPuts [bindtags $w]
puts [bind $w] DebugPuts [bind $w]
} }
proc VarHelper {x y w word wordType} { proc VarHelper {x y w word wordType} {
@@ -460,7 +460,7 @@ namespace eval Editor {
# set win .varhelper # set win .varhelper
# Проверяем если есть выделение то блокировать появление диалога # Проверяем если есть выделение то блокировать появление диалога
if {[$txt tag ranges sel] != ""} { if {[$txt tag ranges sel] != ""} {
puts "You have selected text [$txt tag ranges sel]" DebugPuts "You have selected text [$txt tag ranges sel]"
return return
} }
# puts "$x $y $w $word $wordType" # puts "$x $y $w $word $wordType"
@@ -1310,7 +1310,7 @@ namespace eval Editor {
} }
ttk::button $win.bBackward -state disable -image backward_20x20 -command "puts $replaceString" ttk::button $win.bBackward -state disable -image backward_20x20 -command "puts $replaceString"
ttk::button $win.bDone -image done_20x20 -state disable -command { ttk::button $win.bDone -image done_20x20 -state disable -command {
puts "$findString -> $replaceString, $regexpSet" DebugPuts "$findString -> $replaceString, $regexpSet"
} }
ttk::button $win.bDoneAll -image doneall_20x20 -command { ttk::button $win.bDoneAll -image doneall_20x20 -command {
Editor::FindReplaceText $Editor::txt "$findString" "$replaceString" $regexpSet Editor::FindReplaceText $Editor::txt "$findString" "$replaceString" $regexpSet
@@ -1395,7 +1395,7 @@ namespace eval Editor {
global cfgVariables global cfgVariables
regsub -all {\.|/|\\|\s|:} $fileFullPath "_" itemName regsub -all {\.|/|\\|\s|:} $fileFullPath "_" itemName
set itemName ".frmWork.nbEditor2.$itemName" set itemName ".frmWork.nbEditor2.$itemName"
puts "Editor::SplitEditoprV: nb item - $itemName" DebugPuts "Editor::SplitEditoprV: nb item - $itemName"
if {[winfo exists $itemName] == 1} { if {[winfo exists $itemName] == 1} {
.frmWork.nbEditor2 forget $itemName .frmWork.nbEditor2 forget $itemName
destroy $itemName destroy $itemName
@@ -1415,7 +1415,7 @@ namespace eval Editor {
# grid columnconfigure .frmWork .frmWork.nbEditor2 -weight 1 # grid columnconfigure .frmWork .frmWork.nbEditor2 -weight 1
# grid rowconfigure .frmWork .frmWork.nbEditor2 -weight 1 # grid rowconfigure .frmWork .frmWork.nbEditor2 -weight 1
.frmWork.panelNB add .frmWork.nbEditor2 -weight 0 .frmWork.panelNB add .frmWork.nbEditor2 -weight 0
puts [FileOper::Edit $fileFullPath .frmWork.nbEditor2] DebugPuts [FileOper::Edit $fileFullPath .frmWork.nbEditor2]
} }
proc GoToLineNumber {text lineNumber} { proc GoToLineNumber {text lineNumber} {
@@ -1456,7 +1456,7 @@ namespace eval Editor {
bind $win.ent <Return> { bind $win.ent <Return> {
set lineNumber [.gotoline.ent get] set lineNumber [.gotoline.ent get]
# $txt see insert $lineNumber # $txt see insert $lineNumber
puts $Editor::txt DebugPuts $Editor::txt
$Editor::txt mark set insert $lineNumber.0 $Editor::txt mark set insert $lineNumber.0
$Editor::txt see insert $Editor::txt see insert
focus $Editor::txt.t focus $Editor::txt.t
@@ -1596,7 +1596,7 @@ namespace eval Editor {
puts $fileFullPath puts $fileFullPath
} }
# puts [$w.panelTxt panes] # puts [$w.panelTxt panes]
puts "$w $fileType $nb $fileFullPath" DebugPuts "$w $fileType $nb $fileFullPath"
if [winfo exists $w.frmText2] { if [winfo exists $w.frmText2] {
$w.panelTxt forget $w.frmText2 $w.panelTxt forget $w.frmText2
destroy $w.frmText2 destroy $w.frmText2

View File

@@ -65,7 +65,7 @@ namespace eval FileOper {
catch $cmd pipe catch $cmd pipe
# puts $pipe # puts $pipe
if [regexp -nocase -- {(\w+)/([\w\-_\.]+); charset=([[:alnum:]-]+)} $pipe m fType fExt fCharset] { if [regexp -nocase -- {(\w+)/([\w\-_\.]+); charset=([[:alnum:]-]+)} $pipe m fType fExt fCharset] {
puts "$fType $fExt $fCharset" DebugPuts "$fType $fExt $fCharset"
} }
switch $opt { switch $opt {
"charset" { "charset" {
@@ -77,7 +77,7 @@ namespace eval FileOper {
# линуксовый file не всегда корректно определяет тип файла # линуксовый file не всегда корректно определяет тип файла
# используем пакет из tcl # используем пакет из tcl
lassign [::fileutil::fileType $fileFullPath] fType fBinaryType fBinaryInterp lassign [::fileutil::fileType $fileFullPath] fType fBinaryType fBinaryInterp
puts "File type is $fType, $fBinaryType, $fBinaryInterp" DebugPuts "File type is $fType, $fBinaryType, $fBinaryInterp"
set ext [string tolower [file extension $fileFullPath]] set ext [string tolower [file extension $fileFullPath]]
# Установка корректного типа для svg # Установка корректного типа для svg
@@ -99,7 +99,7 @@ namespace eval FileOper {
set fBinaryType "binary" set fBinaryType "binary"
} }
} }
puts "File type is $fType, $fBinaryType, $fBinaryInterp, $ext" DebugPuts "File type is $fType, $fBinaryType, $fBinaryInterp, $ext"
switch $fType { switch $fType {
"binary" { "binary" {
@@ -366,7 +366,7 @@ namespace eval FileOper {
} }
# puts "FileOper::Save: $nbEditorWindow" # puts "FileOper::Save: $nbEditorWindow"
set nbEditorItem [$nbEditorWindow select] set nbEditorItem [$nbEditorWindow select]
puts "Saved editor text: $nbEditorItem" DebugPuts "Saved editor text: $nbEditorItem"
if [string match "*untitled*" $nbEditorItem] { if [string match "*untitled*" $nbEditorItem] {
set filePath [tk_getSaveFile -initialdir $dirProject -filetypes $::types -parent .] set filePath [tk_getSaveFile -initialdir $dirProject -filetypes $::types -parent .]
if {$filePath eq ""} { if {$filePath eq ""} {
@@ -507,7 +507,7 @@ namespace eval FileOper {
proc Edit {fileFullPath {nbEditor .frmWork.nbEditor}} { proc Edit {fileFullPath {nbEditor .frmWork.nbEditor}} {
global tree global tree
puts "$fileFullPath" DebugPuts "$fileFullPath"
if {[file exists $fileFullPath] == 0} { if {[file exists $fileFullPath] == 0} {
return false return false
} else { } else {

View File

@@ -89,7 +89,7 @@ namespace eval NB {
Tree::SelectItem $treeItemName Tree::SelectItem $treeItemName
set txt [$w select].frmText.t set txt [$w select].frmText.t
puts "NextTab: [$w select]" DebugPuts "NextTab: [$w select]"
if {[winfo exists [$w select].frmText2] == 1} { if {[winfo exists [$w select].frmText2] == 1} {
focus -force [$w select].frmText2.frame.text.t focus -force [$w select].frmText2.frame.text.t
} else { } else {

View File

@@ -1114,11 +1114,11 @@ proc ExecutorCommandPathSetting {fileType} {
} else { } else {
set cmd "which $cfgVariables($fileType)" set cmd "which $cfgVariables($fileType)"
} }
puts "ExecutorCommandPathSetting $fileType" DebugPuts "ExecutorCommandPathSetting $fileType"
puts [catch {exec {*}$cmd} executor_path] DebugPuts [catch {exec {*}$cmd} executor_path]
puts "executor_path $executor_path" DebugPuts "executor_path $executor_path"
if {[catch {exec {*}$cmd} executor_path]} { if {[catch {exec {*}$cmd} executor_path]} {
puts "Программа $cfgVariables($fileType) для выполнения файлов $fileType не найдена в системе" DebugPuts "Программа $cfgVariables($fileType) для выполнения файлов $fileType не найдена в системе"
set cfgVariables($fileType) "" set cfgVariables($fileType) ""
return return
} }
@@ -1127,11 +1127,11 @@ proc ExecutorCommandPathSetting {fileType} {
# puts "Git найден: $first_path" # puts "Git найден: $first_path"
set cfgVariables($fileType) $first_path set cfgVariables($fileType) $first_path
puts "first_path $first_path" DebugPuts "first_path $first_path"
} }
if {[info exists cfgVariables($fileType)] == 0} { if {[info exists cfgVariables($fileType)] == 0} {
set cfgVariables($fileType) "" set cfgVariables($fileType) ""
puts $cfgVariables($fileType) DebugPuts $cfgVariables($fileType)
} }
} }
@@ -1155,3 +1155,22 @@ proc Paste {} { SendEventToLatestTxtWidget <<Paste>> }
proc Undo {} { SendEventToLatestTxtWidget <<Undo>> } proc Undo {} { SendEventToLatestTxtWidget <<Undo>> }
proc Redo {} { SendEventToLatestTxtWidget <<Redo>> } proc Redo {} { SendEventToLatestTxtWidget <<Redo>> }
# ------------ # ------------
proc DebugPuts {msg} {
global cfgVariables
if ![info exists cfgVariables(debug)] {
return 0
}
if ![info exists cfgVariables(debugOut)] {
return 0
}
if {$cfgVariables(debug) eq "true"} {
if {$cfgVariables(debugOut) eq "stdout"} {
puts "$msg"
} elseif {$cfgVariables(debugOut) ne "" } {
set logFile [open $cfgVariables(debugOut) "a+"]
puts $logFile $::configDefault
close $logFile
}
}
}

View File

@@ -106,7 +106,7 @@ namespace eval Tree {
set key [lindex [split $id "::"] 0] set key [lindex [split $id "::"] 0]
if {$values eq "" || $key eq ""} {return} if {$values eq "" || $key eq ""} {return}
puts "$key $tree $values" DebugPuts "$key $tree $values"
switch -regexp $key { switch -regexp $key {
directory { directory {
FileOper::ReadFolder $values FileOper::ReadFolder $values
@@ -114,7 +114,7 @@ namespace eval Tree {
} }
file { file {
set v [FileOper::Edit $values $nbEditor] set v [FileOper::Edit $values $nbEditor]
puts $v DebugPuts $v
if {$v eq false} { if {$v eq false} {
$tree delete $id $tree delete $id
} }

View File

@@ -9,8 +9,8 @@ exec wish8.6 "$0" -- "$@"
# Home page: https://nuk-svk.ru # Home page: https://nuk-svk.ru
###################################################### ######################################################
# Version: 2.0.0 # Version: 2.0.0
# Release: alpha24 # Release: beta1
# Build: 21012026164151 # Build: 22012026174911
###################################################### ######################################################
# определим текущую версию, релиз и т.д. # определим текущую версию, релиз и т.д.
@@ -48,7 +48,7 @@ proc PackagePresent {pkg} {
foreach item [package names] { foreach item [package names] {
# puts [string match -nocase Img $item] # puts [string match -nocase Img $item]
if {[string match -nocase Img $item] == 1} { if {[string match -nocase Img $item] == 1} {
puts "The $pkg package was found" # puts "The $pkg package was found"
return true return true
} }
} }
@@ -69,7 +69,7 @@ if { $::argc > 0 } {
foreach arg $::argv { foreach arg $::argv {
lappend opened $arg lappend opened $arg
} }
puts $opened # puts $opened
} }
@@ -97,7 +97,7 @@ source [file join $dir(lib) config.tcl]
foreach modFile [lsort [glob -nocomplain [file join $dir(lib) *.tcl]]] { foreach modFile [lsort [glob -nocomplain [file join $dir(lib) *.tcl]]] {
if {[file tail $modFile] ne "gui.tcl" && [file tail $modFile] ne "config.tcl"} { if {[file tail $modFile] ne "gui.tcl" && [file tail $modFile] ne "config.tcl"} {
source $modFile source $modFile
puts "Loading module $modFile" # puts "Loading module $modFile"
} }
} }
@@ -106,10 +106,10 @@ set dir(theme) "[file join $dir(root) theme]"
foreach modFile [lsort [glob -nocomplain [file join $dir(theme) *]]] { foreach modFile [lsort [glob -nocomplain [file join $dir(theme) *]]] {
if [file isdirectory $modFile] { if [file isdirectory $modFile] {
source $modFile/[file tail $modFile].tcl source $modFile/[file tail $modFile].tcl
puts "Loading theme $modFile.tcl" # puts "Loading theme $modFile.tcl"
} elseif {[file extension $modFile] eq ".tcl"} { } elseif {[file extension $modFile] eq ".tcl"} {
source $modFile source $modFile
puts "Loading theme $modFile" # puts "Loading theme $modFile"
} }
} }
@@ -119,13 +119,14 @@ if {[file exists [file join $dir(cfg) projman.ini]] ==0} {
Config::create $dir(cfg) Config::create $dir(cfg)
} }
Config::read $dir(cfg) Config::read $dir(cfg)
Config::CheckVariables
::msgcat::mclocale $cfgVariables(locale) ::msgcat::mclocale $cfgVariables(locale)
if [::msgcat::mcload [file join $dir(lib) msgs]] { if [::msgcat::mcload [file join $dir(lib) msgs]] {
puts "Load locale messages... OK" puts "Load locale messages... OK"
} }
puts "Setting the locale... [::msgcat::mclocale]" DebugPuts "Setting the locale... [::msgcat::mclocale]"
source [file join $dir(lib) gui.tcl] source [file join $dir(lib) gui.tcl]

View File

@@ -124,7 +124,7 @@ namespace eval ttk::theme::black {
-foreground [list selected $colors(-selectfg)] \ -foreground [list selected $colors(-selectfg)] \
-highlightbackground [list selected $colors(-lighter)] -highlightbackground [list selected $colors(-lighter)]
} }
puts [ttk::style element names] # puts [ttk::style element names]
} }
# A few tricks for Tablelist. # A few tricks for Tablelist.