Изменил виджет текста в окне псевдо-терминала. Добавил подстановку имени файла к командную строку по шаблону %f

This commit is contained in:
2025-10-29 21:42:34 +03:00
parent 5d70d508cd
commit 961d597032
6 changed files with 43 additions and 74 deletions

7
debian/changelog vendored
View File

@@ -1,3 +1,9 @@
projman (2.0.0-alpha19) stable; urgency=medium
* Добавлен диалог настроек
-- Sergey Kalinin <svk@nuk-svk.ru> Wed, 29 Oct 2025 20:48:52 +0300
projman (2.0.0-alpha19) stable; urgency=medium projman (2.0.0-alpha19) stable; urgency=medium
* Добавил псевдо-терминал * Добавил псевдо-терминал
@@ -385,3 +391,4 @@ projman (2.0.0-alfa0) stable; urgency=medium

0
errors Normal file
View File

View File

@@ -190,5 +190,19 @@ namespace eval Highlight {} {
ctext::addHighlightClassForRegexp $txt namespaces #0093ff {->|\+\+|::} ctext::addHighlightClassForRegexp $txt namespaces #0093ff {->|\+\+|::}
ctext::addHighlightClass $txt bool #3e803b {null false true} ctext::addHighlightClass $txt bool #3e803b {null false true}
} }
proc ExecuteColorized {txt} {
ctext::addHighlightClassForRegexp $txt flags orange {\s-[a-zA-Z]+}
ctext::addHighlightClass $txt stackControl #19a2a6 [info commands]
ctext::addHighlightClass $txt widgets #9d468d [list canvas ctext button entry label text labelframe frame toplevel scrollbar checkbutton canvas listbox menu menubar menubutton radiobutton scale entry message tk_chooseDir tk_getSaveFile tk_getOpenFile tk_chooseColor tk_optionMenu ttk::button ttk::checkbutton ttk::combobox ttk::entry ttk::frame ttk::intro ttk::label ttk::labelframe ttk::menubutton ttk::treeview ttk::notebook ttk::panedwindow ttk::progressbar ttk::radiobutton ttk::scale ttk::scrollbar ttk::separator ttk::sizegrip ttk::spinbox ]
ctext::addHighlightClassWithOnlyCharStart $txt vars #4471ca "\$"
ctext::addHighlightClass $txt variable_funcs gold {set global variable unset}
ctext::addHighlightClassForSpecialChars $txt brackets green {[]{}()}
ctext::addHighlightClassForRegexp $txt paths lightblue {\.[a-zA-Z0-9\_\-]+}
ctext::addHighlightClassForRegexp $txt namespaces #4f64ff {::}
ctext::addHighlightClassForSpecialChars $txt qoute #b84a0c {"'`}
ctext::addHighlightClassForRegexp $txt colors #68ceff {(#)(\w)+?(\s|$)}
ctext::addHighlightClassForRegexp $txt comments #666666 {(^|;)\s*(#)[^\n\r]*}
ctext::addHighlightClass $txt bool #3e803b {null false true}
}
} }

View File

@@ -841,65 +841,22 @@ proc Execute {filePath w} {
FileOper::Save FileOper::Save
set file $filePath set file $filePath
set action run set action run
# if {$action == "compile"} {
# if {$t == "proj"} {
# set prog [file join $projDirName $projFileName.java]
# } elseif {$t == "file"} {
# set node [$tree selection get]
# set fullPath [$tree itemcget $node -data]
# set dir [file dirname $fullPath]
# set file [file tail $fullPath]
# set prog $fullPath
# }
# } elseif {$action == "run"} {
# if {$t == "proj"} {
# set prog [file join $projDirName $projFileName]
# } elseif {$t == "file"} {
# set node [$tree selection get]
# set fullPath [$tree itemcget $node -data]
# set dir [file dirname $fullPath]
# set file [file tail $fullPath]
# set prog $fullPath
# }
# }
# set node "debug"
# if {[$noteBook index $node] != -1} {
# $noteBook delete debug
# }
# set w [$noteBook insert end $node -text [::msgcat::mc "Running project"]]
# create array with file names # # create array with file names #
frame $w.frame -borderwidth 2 -relief ridge -background $cfgVariables(backGround) frame $w.frame -borderwidth 2 -relief ridge -background $cfgVariables(backGround)
pack $w.frame -side top -fill both -expand true pack $w.frame -side top -fill both -expand true
text $w.frame.text -yscrollcommand "$w.frame.yscroll set" \ ctext $w.frame.text -yscrollcommand "$w.frame.yscroll set" \
-bg $cfgVariables(backGround) -fg $cfgVariables(foreground) \ -bg $cfgVariables(backGround) -fg $cfgVariables(foreground) \
-relief sunken -wrap word -highlightthickness 0 -font $cfgVariables(font)\ -relief sunken -wrap word -highlightthickness 0 -font $cfgVariables(font)\
-selectborderwidth 0 -selectbackground $cfgVariables(selectbg) -width 10 -height 10 -selectborderwidth 0 -selectbackground $cfgVariables(selectbg) -width 10 -height 10
scrollbar $w.frame.yscroll -relief sunken -borderwidth {1} -width {10} -takefocus 0 \ scrollbar $w.frame.yscroll -relief sunken -borderwidth {1} -width {10} -takefocus 0 \
-command "$w.frame.text yview" -background $cfgVariables(backGround) -command "$w.frame.text yview" -background $cfgVariables(backGround)
Highlight::ExecuteColorized $w.frame.text
pack $w.frame.text -side left -fill both -expand true pack $w.frame.text -side left -fill both -expand true
pack $w.frame.yscroll -side left -fill y pack $w.frame.yscroll -side left -fill y
# frame $w.frmBtn -borderwidth 2 -relief ridge -bg $cfgVariables(backGround)
# pack $w.frmBtn -side top -fill x
# button $w.frmBtn.btnOk -text [::msgcat::mc "Close"] -borderwidth {1} \
# -bg $cfgVariables(backGround) -fg $cfgVariables(backGround) -command {
# $noteBook delete debug
# $noteBook raise [$noteBook page end]
# return 0
# }
# pack $w.frmBtn.btnOk -pady 2
# key bindings #
# bind $w.frmBtn.btnOk <Escape> {
# $noteBook delete debug
# $noteBook raise [$noteBook page end]
# # return 0
# }
bind $w.frame.text <Return> [list Run $w $filePath] bind $w.frame.text <Return> [list Run $w $filePath]
bind $w.frame.text <Control-r> [list destroy $w] bind $w.frame.text <Control-r> [list destroy $w]
bind $w.frame.text <Control-Cyrillic_er> [list destroy $w] bind $w.frame.text <Control-Cyrillic_er> [list destroy $w]
@@ -909,34 +866,15 @@ proc Execute {filePath w} {
$w.frame.text tag configure bold -font $cfgVariables(fontBold) $w.frame.text tag configure bold -font $cfgVariables(fontBold)
$w.frame.text tag configure error -font $cfgVariables(fontBold) -foreground red $w.frame.text tag configure error -font $cfgVariables(fontBold) -foreground red
$w.frame.text tag add bold 0.0 0.end $w.frame.text tag add bold 0.0 0.end
# if {$action == "compile"} {
# $w.frame.text insert end "[::msgcat::mc "Compile project"] - $activeProject\n"
# $w.frame.text insert end "[::msgcat::mc "Compile"] - $prog\n\n"
# } elseif {$action == "run"} {
# $w.frame.text insert end "[::msgcat::mc "Running project"] - $activeProject\n"
# $w.frame.text insert end "[::msgcat::mc "Run"] - $prog\n\n"
# }
$w.frame.text insert end "[::msgcat::mc "Enter command for execute file"] $filePath >\n" $w.frame.text insert end "[::msgcat::mc "Enter command for execute file"] $filePath >\n"
set pos [$w.frame.text index insert] set pos [$w.frame.text index insert]
set lineNum [lindex [split $pos "."] 0] set lineNum [lindex [split $pos "."] 0]
$w.frame.text insert 0.0 "^^^^^^^^^^^^^^^^^^^^^ [::msgcat::mc "Programm output"] ^^^^^^^^^^^^^^^^^\n" $w.frame.text insert 0.0 "======================================================================================\n"
$w.frame.text tag add bold $lineNum.0 $lineNum.end $w.frame.text tag add bold $lineNum.0 $lineNum.end
focus -force $w.frame.text Highlight::ExecuteColorized $w.frame.text
# open and manipulate executed program chanel # # focus -force $w.frame.text
# cd $projDirName focus -force $w.frame.text.t
# if {$action == "compile"} {
# set cmdCompile ""
# CompileOption "$projCompiler $prog"
# vwait cmdCompile
# puts "string - $projCompiler $prog" ;# debug info
# set pipe [open "|$cmdCompile 2> [file join $projDirName errors]" "r"]
# set f [open [file join $projDirName errors] "r"]
# } elseif {$action == "run"} {
# set pipe [open "|$command $filePath" "r"]
# set f [open [file join $projDirName errors] "r"]
# }
} }
proc Run {w filePath} { proc Run {w filePath} {
@@ -947,7 +885,13 @@ proc Run {w filePath} {
set startIndex [$w.frame.text index "end-1l linestart"] set startIndex [$w.frame.text index "end-1l linestart"]
set command [$w.frame.text get $startIndex $endIndex end] set command [$w.frame.text get $startIndex $endIndex end]
set pipe [open "|$command $filePath 2> [file join [file dirname $filePath] errors]" "r"] # Заменяем знак %f на имя текущего файла
regsub -all "%f" $command "$filePath" fullCommand
$w.frame.text replace $startIndex $endIndex $fullCommand
# $w.frame.text insert "end-4l linestart"
cd [file dirname $filePath]
set pipe [open "|$fullCommand 2> [file join [file dirname $filePath] errors]" "r"]
set f [open [file join [file dirname $filePath] errors] "r"] set f [open [file join [file dirname $filePath] errors] "r"]
# set pipe [open "|$command $filePath" "r"] # set pipe [open "|$command $filePath" "r"]
@@ -965,18 +909,22 @@ proc DebugInfo {widget file f} {
puts $msg puts $msg
$widget insert "end-4l linestart" "[::msgcat::mc "Program failed"]: $msg\n"; $widget insert "end-4l linestart" "[::msgcat::mc "Program failed"]: $msg\n";
} else { } else {
Highlight::ExecuteColorized $widget
puts $msg puts $msg
$widget see "end-1l lineend" $widget see "end-1l lineend"
$widget delete "end-1l lineend" end $widget delete "end-1l lineend" end
# $widget insert end "\n-------------------------------------------------\n" # $widget insert end "\n-------------------------------------------------\n"
# $widget insert end "[::msgcat::mc "Program finished successfully"]\n" # $widget insert end "[::msgcat::mc "Program finished successfully"]\n"
} }
Highlight::ExecuteColorized $widget
} else { } else {
Highlight::ExecuteColorized $widget
$widget insert "end-4l linestart" [read $file] $widget insert "end-4l linestart" [read $file]
} }
while {[gets $f line]>=0} { while {[gets $f line]>=0} {
Highlight::ExecuteColorized $widget
$widget insert "end-4l linestart" "$line\n" $widget insert "end-4l linestart" "$line\n"
puts $line # puts $line
} }
# close $f # close $f
$widget see end $widget see end

View File

@@ -10,7 +10,7 @@ exec wish8.6 "$0" -- "$@"
###################################################### ######################################################
# Version: 2.0.0 # Version: 2.0.0
# Release: alpha19 # Release: alpha19
# Build: 29102025200405 # Build: 29102025204917
###################################################### ######################################################
# определим текущую версию, релиз и т.д. # определим текущую версию, релиз и т.д.

0
theme/2> Normal file
View File