From 83d70ebd3f341a7d0c47625aab88c5b80d6b378c Mon Sep 17 00:00:00 2001 From: svk Date: Thu, 22 Jan 2026 17:30:11 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=B4=D0=B5=D0=BB=D0=B0=D0=BD=20=D0=B2?= =?UTF-8?q?=D1=8B=D0=B2=D0=BE=D0=B4=20=D0=BE=D1=82=D0=BB=D0=B0=D0=B4=D0=BE?= =?UTF-8?q?=D1=87=D0=BD=D0=BE=D0=B9=20=D0=B8=D0=BD=D1=84=D0=BE=D1=80=D0=BC?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D0=B8=20=D0=BF=D0=BE=20=D0=B7=D0=B0=D0=BF?= =?UTF-8?q?=D1=80=D0=BE=D1=81=D1=83.=20=D0=9F=D0=B5=D1=80=D0=B5=D0=B4?= =?UTF-8?q?=D0=B5=D0=BB=D0=BA=D0=B0=20=D0=BA=D0=BE=D0=B4=D0=B0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/editor.tcl | 16 ++++++++-------- lib/files.tcl | 10 +++++----- lib/notebook.tcl | 2 +- lib/procedure.tcl | 32 ++++++++++++++++++++------------ lib/tree.tcl | 4 ++-- projman.tcl | 12 ++++++------ theme/black.tcl | 2 +- 7 files changed, 43 insertions(+), 35 deletions(-) diff --git a/lib/editor.tcl b/lib/editor.tcl index 0cd6fc1..7e585ee 100644 --- a/lib/editor.tcl +++ b/lib/editor.tcl @@ -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 { 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 diff --git a/lib/files.tcl b/lib/files.tcl index 42de62b..fe4383b 100644 --- a/lib/files.tcl +++ b/lib/files.tcl @@ -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 { diff --git a/lib/notebook.tcl b/lib/notebook.tcl index cb0c719..91cd555 100644 --- a/lib/notebook.tcl +++ b/lib/notebook.tcl @@ -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 { diff --git a/lib/procedure.tcl b/lib/procedure.tcl index 09e0828..2eabef1 100644 --- a/lib/procedure.tcl +++ b/lib/procedure.tcl @@ -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 <> } # ------------ 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"} { - puts "$msg" + 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 + } } } - diff --git a/lib/tree.tcl b/lib/tree.tcl index 2ff8bc8..920c63a 100644 --- a/lib/tree.tcl +++ b/lib/tree.tcl @@ -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 } diff --git a/projman.tcl b/projman.tcl index f8cbf79..3a9787c 100755 --- a/projman.tcl +++ b/projman.tcl @@ -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] diff --git a/theme/black.tcl b/theme/black.tcl index 89bf5ed..65955c4 100644 --- a/theme/black.tcl +++ b/theme/black.tcl @@ -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.