Сделан вывод отладочной информации по запросу. Переделка кода.

This commit is contained in:
svk
2026-01-22 17:30:11 +03:00
parent f9dbdf893d
commit 83d70ebd3f
7 changed files with 43 additions and 35 deletions

View File

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

View File

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

View File

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

View File

@@ -1114,11 +1114,11 @@ proc ExecutorCommandPathSetting {fileType} {
} else {
set cmd "which $cfgVariables($fileType)"
}
puts "ExecutorCommandPathSetting $fileType"
puts [catch {exec {*}$cmd} executor_path]
puts "executor_path $executor_path"
DebugPuts "ExecutorCommandPathSetting $fileType"
DebugPuts [catch {exec {*}$cmd} executor_path]
DebugPuts "executor_path $executor_path"
if {[catch {exec {*}$cmd} executor_path]} {
puts "Программа $cfgVariables($fileType) для выполнения файлов $fileType не найдена в системе"
DebugPuts "Программа $cfgVariables($fileType) для выполнения файлов $fileType не найдена в системе"
set cfgVariables($fileType) ""
return
}
@@ -1127,11 +1127,11 @@ proc ExecutorCommandPathSetting {fileType} {
# puts "Git найден: $first_path"
set cfgVariables($fileType) $first_path
puts "first_path $first_path"
DebugPuts "first_path $first_path"
}
if {[info exists cfgVariables($fileType)] == 0} {
set cfgVariables($fileType) ""
puts $cfgVariables($fileType)
DebugPuts $cfgVariables($fileType)
}
}
@@ -1157,12 +1157,20 @@ proc Redo {} { SendEventToLatestTxtWidget <<Redo>> }
# ------------
proc DebugPuts {msg} {
global cfgVariables debugFlag
if ![info exists cfgVariables(debugFlag)] {
set cfgVariables(debugFlag) "true"
global cfgVariables
if ![info exists cfgVariables(debug)] {
set cfgVariables(debug) "true"
}
if {$cfgVariables(debugFlag) eq "true"} {
if ![info exists cfgVariables(debugOut)] {
set cfgVariables(debugOut) "stdout"
}
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]
if {$values eq "" || $key eq ""} {return}
puts "$key $tree $values"
DebugPuts "$key $tree $values"
switch -regexp $key {
directory {
FileOper::ReadFolder $values
@@ -114,7 +114,7 @@ namespace eval Tree {
}
file {
set v [FileOper::Edit $values $nbEditor]
puts $v
DebugPuts $v
if {$v eq false} {
$tree delete $id
}

View File

@@ -48,7 +48,7 @@ proc PackagePresent {pkg} {
foreach item [package names] {
# puts [string match -nocase Img $item]
if {[string match -nocase Img $item] == 1} {
puts "The $pkg package was found"
# puts "The $pkg package was found"
return true
}
}
@@ -69,7 +69,7 @@ if { $::argc > 0 } {
foreach arg $::argv {
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]]] {
if {[file tail $modFile] ne "gui.tcl" && [file tail $modFile] ne "config.tcl"} {
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) *]]] {
if [file isdirectory $modFile] {
source $modFile/[file tail $modFile].tcl
puts "Loading theme $modFile.tcl"
# puts "Loading theme $modFile.tcl"
} elseif {[file extension $modFile] eq ".tcl"} {
source $modFile
puts "Loading theme $modFile"
# puts "Loading theme $modFile"
}
}
@@ -126,7 +126,7 @@ Config::CheckVariables
if [::msgcat::mcload [file join $dir(lib) msgs]] {
puts "Load locale messages... OK"
}
puts "Setting the locale... [::msgcat::mclocale]"
DebugPuts "Setting the locale... [::msgcat::mclocale]"
source [file join $dir(lib) gui.tcl]

View File

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