Добавил псевдо-терминал, и команды запуска файлов.
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
This commit is contained in:
@@ -786,8 +786,11 @@ namespace eval Editor {
|
||||
bind $txt <Control-eacute> Quit
|
||||
bind $txt <Control-igrave> "Editor::SelectionPaste $txt"
|
||||
bind $txt <Control-v> "Editor::SelectionPaste $txt"
|
||||
bind $txt <Control-Cyrillic_em> "Editor::SelectionPaste $txt"
|
||||
bind $txt <Control-l> "SearchVariable $txt; break"
|
||||
bind $txt <Control-Cyrillic_de> "SearchVariable $txt; break"
|
||||
bind $txt <Control-i> "ImageBase64Encode $txt"
|
||||
bind $txt <Control-Cyrillic_sha> "ImageBase64Encode $txt"
|
||||
bind $txt <Control-bracketleft> "Editor::InsertTabular $txt"
|
||||
bind $txt <Control-bracketright> "Editor::DeleteTabular $txt"
|
||||
bind $txt <Control-comma> "Editor::Comment $txt $fileType"
|
||||
@@ -797,25 +800,35 @@ namespace eval Editor {
|
||||
bind $txt <ButtonRelease-1> "Editor::SearchBrackets $txt"
|
||||
bind $txt <Button-1><ButtonRelease-1> "Editor::SelectionHighlight $txt"
|
||||
bind $txt <<Modified>> "SetModifiedFlag $w $nb"
|
||||
bind $txt <Control-i> ImageBase64Encode
|
||||
bind $txt <Control-u> "Editor::SearchBrackets %W"
|
||||
bind $txt <Control-Cyrillic_ghe> "Editor::SearchBrackets %W"
|
||||
bind $txt <Control-J> "catch {Editor::GoToFunction $txt}"
|
||||
bind $txt <Control-j> "catch {Editor::GoToFunction $txt}; break"
|
||||
bind $txt <Control-Cyrillic_o> "catch {Editor::GoToFunction $txt}; break"
|
||||
bind $txt <Alt-w> "$txt delete {insert wordstart} {insert wordend}"
|
||||
bind $txt <Alt-odiaeresis> "$txt delete {insert wordstart} {insert wordend}"
|
||||
bind $txt <Alt-Cyrillic_tse> "$txt delete {insert wordstart} {insert wordend}"
|
||||
bind $txt <Alt-r> "$txt delete {insert linestart} {insert lineend + 1char}"
|
||||
bind $txt <Alt-ecircumflex> "$txt delete {insert linestart} {insert lineend + 1char}"
|
||||
bind $txt <Alt-Cyrillic_er> "$txt delete {insert linestart} {insert lineend + 1char}"
|
||||
bind $txt <Alt-b> "$txt delete {insert linestart} insert"
|
||||
bind $txt <Alt-Cyrillic_i> "$txt delete {insert linestart} insert"
|
||||
bind $txt <Alt-e> "$txt delete insert {insert lineend}"
|
||||
bind $txt <Alt-Cyrillic_u> "$txt delete insert {insert lineend}"
|
||||
bind $txt <Alt-s> "Editor::SplitEditorH $w $fileType"
|
||||
bind $txt <Alt-ucircumflex> "Editor::SplitEditorH $w $fileType"
|
||||
bind $txt <Alt-Cyrillic_hardsign> "Editor::SplitEditorH $w $fileType"
|
||||
bind $txt <Alt-y> "Editor::TextCopy $txt"
|
||||
bind $txt <Alt-Cyrillic_en> "Editor::TextCopy $txt"
|
||||
bind $txt <Control-g> "Editor::GoToLineNumberDialog $txt"
|
||||
bind $txt <Control-Cyrillic_pe> "Editor::GoToLineNumberDialog $txt"
|
||||
bind $txt <Control-agrave> "Editor::FindDialog $w"
|
||||
bind $txt <Control-f> "Editor::FindDialog $txt"
|
||||
bind $txt <Control-Cyrillic_a> "Editor::FindDialog $txt"
|
||||
bind $txt <Control-F> "Editor::FindDialog $txt"
|
||||
bind $txt <Control-odiaeresis> FileOper::Close
|
||||
bind $txt <Control-w> FileOper::Close
|
||||
bind $txt <Control-Cyrillic_tse> FileOper::Close
|
||||
bind $txt <Control-o> {
|
||||
set filePath [FileOper::OpenDialog]
|
||||
if {$filePath != ""} {
|
||||
@@ -830,6 +843,16 @@ namespace eval Editor {
|
||||
}
|
||||
break
|
||||
}
|
||||
bind $txt <Control-Cyrillic_shcha> {
|
||||
set filePath [FileOper::OpenDialog]
|
||||
if {$filePath != ""} {
|
||||
FileOper::Edit $filePath
|
||||
}
|
||||
break
|
||||
}
|
||||
bind $txt <Control-r> "Editor::SplitEditorForExecute $w $fileType $nb "
|
||||
bind $txt <Control-Cyrillic_ka> "Editor::SplitEditorForExecute $w $fileType $nb "
|
||||
|
||||
# bind $txt.t <KeyRelease> "Editor::ReleaseKey %K $txt.t $fileType"
|
||||
# bind $txt.t <KeyPress> "Editor::PressKey %K $txt.t"
|
||||
# bind $txt <KeyRelease> "Editor::Key %k %K"
|
||||
@@ -939,7 +962,7 @@ namespace eval Editor {
|
||||
# set fileName untitled-$untitledNumber
|
||||
set fileFullPath untitled-$untitledNumber
|
||||
#puts [Tree::InsertItem $tree {} $fileFullPath "file" $fileName]
|
||||
set nbEditorItem [NB::InsertItem $nbEditor $fileFullPath "file"]
|
||||
set nbEditorItem [NB::InsertItem $nbEditor $fileFullPath "file"]
|
||||
# puts "$nbEditorItem, $nbEditor"
|
||||
Editor $fileFullPath $nbEditor $nbEditorItem
|
||||
SetModifiedFlag $nbEditorItem $nbEditor
|
||||
@@ -1367,7 +1390,7 @@ namespace eval Editor {
|
||||
|
||||
proc SplitEditorV {fileFullPath} {
|
||||
global cfgVariables
|
||||
regsub -all {\.|/|\\|\s} $fileFullPath "_" itemName
|
||||
regsub -all {\.|/|\\|\s|:} $fileFullPath "_" itemName
|
||||
set itemName ".frmWork.nbEditor2.$itemName"
|
||||
# puts $itemName
|
||||
if {[winfo exists $itemName] == 1} {
|
||||
@@ -1390,8 +1413,6 @@ namespace eval Editor {
|
||||
# grid rowconfigure .frmWork .frmWork.nbEditor2 -weight 1
|
||||
.frmWork.panelNB add .frmWork.nbEditor2 -weight 0
|
||||
puts [FileOper::Edit $fileFullPath .frmWork.nbEditor2]
|
||||
|
||||
|
||||
}
|
||||
|
||||
proc GoToLineNumber {text lineNumber} {
|
||||
@@ -1537,9 +1558,13 @@ namespace eval Editor {
|
||||
-command "Editor::SplitEditorH $fr $fileType $nb"
|
||||
ttk::button $fr.header.$btnSplitV -image split_vertical_11x11 \
|
||||
-command "Editor::SplitEditorV $fileFullPath"
|
||||
|
||||
set btnSplitExecute "btnSplitExec[string range $itemName [expr [string last "." $itemName] +1] end]"
|
||||
ttk::button $fr.header.$btnSplitExecute -image execute_11x11 \
|
||||
-command "Editor::SplitEditorForExecute $fr $fileType $nb $fileFullPath"
|
||||
# pack $fr.$btnSplitH $fr.$btnSplitV -side right -anchor e
|
||||
pack $fr.header.$lblName -side left -expand true -fill x
|
||||
pack $fr.header.$btnSplitV $fr.header.$btnSplitH -side right
|
||||
pack $fr.header.$btnSplitV $fr.header.$btnSplitH $fr.header.$btnSplitExecute -side right
|
||||
|
||||
pack $fr.header -side top -fill x
|
||||
|
||||
@@ -1557,4 +1582,27 @@ namespace eval Editor {
|
||||
|
||||
return $fr
|
||||
}
|
||||
|
||||
proc SplitEditorForExecute {w fileType nb {fileFullPath ""}} {
|
||||
global cfgVariables tree
|
||||
if {$fileFullPath eq ""} {
|
||||
set treeItem "file::[string range $w [expr [string last "." $w] +1] end ]"
|
||||
set fileFullPath [Tree::GetItemID $tree $treeItem]
|
||||
puts $fileFullPath
|
||||
}
|
||||
# puts [$w.panelTxt panes]
|
||||
puts "$w $fileType $nb $fileFullPath"
|
||||
if [winfo exists $w.frmText2] {
|
||||
$w.panelTxt forget $w.frmText2
|
||||
destroy $w.frmText2
|
||||
focus -force $w.frmText.t.t
|
||||
return
|
||||
}
|
||||
|
||||
set frmText [ttk::frame $w.frmText2 -border 1]
|
||||
$w.panelTxt add $frmText -weight 1
|
||||
# focus -force $frmText.t.t
|
||||
Execute $fileFullPath $frmText
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
15
lib/gui.tcl
15
lib/gui.tcl
@@ -23,12 +23,14 @@ wm overrideredirect . 0
|
||||
|
||||
bind . <Control-q> Quit
|
||||
bind . <Control-Q> Quit
|
||||
bind . <Control-Cyrillic_shorti> Quit
|
||||
bind . <Control-eacute> Quit
|
||||
bind . <Insert> Add
|
||||
bind . <Delete> Del
|
||||
bind . <F1> ShowHelpDialog
|
||||
bind . <Control-n> Editor::New
|
||||
bind . <Control-N> Editor::New
|
||||
bind . <Control-Cyrillic_te> Editor::New
|
||||
bind . <Control-o> {
|
||||
set filePath [FileOper::OpenDialog]
|
||||
if {$filePath != ""} {
|
||||
@@ -41,21 +43,30 @@ bind . <Control-O> {
|
||||
FileOper::Edit $filePath
|
||||
}
|
||||
}
|
||||
bind . <Control-k> {
|
||||
bind . <Alt-k> {
|
||||
set folderPath [FileOper::OpenFolderDialog]
|
||||
if {$folderPath != ""} {
|
||||
FileOper::ReadFolder $folderPath
|
||||
}
|
||||
}
|
||||
bind . <Control-K> {
|
||||
bind . <Alt-K> {
|
||||
set folderPath [FileOper::OpenFolderDialog]
|
||||
if {$folderPath != ""} {
|
||||
FileOper::ReadFolder $folderPath
|
||||
}
|
||||
}
|
||||
bind . <Alt-Cyrillic_el> {
|
||||
set folderPath [FileOper::OpenFolderDialog]
|
||||
if {$folderPath != ""} {
|
||||
FileOper::ReadFolder $folderPath
|
||||
}
|
||||
}
|
||||
|
||||
bind . <Control-s> {FileOper::Save}
|
||||
bind . <Control-S> {FileOper::Save}
|
||||
bind . <Control-Cyrillic_hardsign> {FileOper::Save}
|
||||
bind . <Alt-p> {ViewFilesTree true}
|
||||
bind . <Alt-Cyrillic_ze> {ViewFilesTree true}
|
||||
bind . <Button-3> {catch [PopupMenu %X %Y]}
|
||||
|
||||
#ttk::style configure TPanedwindow -background blue
|
||||
|
||||
@@ -1912,4 +1912,19 @@ image create photo j2_16x12 -data {
|
||||
waYDtkPwRhMJCQAAcy6XQBVVAwTH2sGQ25vNaAwYtjCvkcjhE5Ysd1Cwe/gmifh0nQMAwBvJ5H54
|
||||
5nEG7+28M9SARyoW37c7A72MxzFpr/Dd1sUKRxpZbJg7joMDAwDgDzlS9ta5m7mUAAAAAElFTkSu
|
||||
QmCC
|
||||
}
|
||||
}
|
||||
image create photo execute_11x11 -data {
|
||||
iVBORw0KGgoAAAANSUhEUgAAAAsAAAALCAYAAACprHcmAAABg2lDQ1BJQ0MgcHJvZmlsZQAAKJF9
|
||||
kT1Iw1AUhU9TpVIqDnYQUclQneyiIo5ahSJUCLVCqw4mL/2DJg1Jiouj4Fpw8Gex6uDirKuDqyAI
|
||||
/oC4C06KLlLifUmhRYwPLu/jvHcO990HCI0K06yuWUDTbTOdTIjZ3KoYekUYw1QjiMrMMuYkKQXf
|
||||
9XWPAN/v4jzL/96fq1fNWwwIiMSzzDBt4g3i6U3b4LxPHGUlWSU+Jx43qUHiR64rHr9xLros8Myo
|
||||
mUnPE0eJxWIHKx3MSqZGPEUcUzWd8oWsxyrnLc5apcZaffIXRvL6yjLXqYaQxCKWIEGEghrKqMBG
|
||||
nHadFAtpOk/4+Addv0QuhVxlMHIsoAoNsusH/4Pfs7UKkxNeUiQBdL84zscoENoFmnXH+T52nOYJ
|
||||
EHwGrvS2v9oAZj5Jr7e12BHQtw1cXLc1ZQ+43AEGngzZlF0pSCUUCsD7GX1TDui/BcJr3txa5zh9
|
||||
ADI0q9QNcHAIjBUpe93n3T2dc/v3Tmt+P5frcrXBnzRwAAAABmJLR0QA/wD/AP+gvaeTAAAACXBI
|
||||
WXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH6QodCiMdxWTpZwAAABl0RVh0Q29tbWVudABDcmVhdGVk
|
||||
IHdpdGggR0lNUFeBDhcAAABHSURBVBjTjY/BDQAwCAKNUzleux1b2Y+PxgiRJ7kjalYBkADSRLwX
|
||||
SvCpZIKzlUlwdWMXJFw5Kzgi7mr5A/XyBI4wA9kzFHrskxvBNKQinAAAAABJRU5ErkJggg==
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ proc GetFileMenu {m} {
|
||||
|
||||
$m add separator
|
||||
|
||||
$m add command -label [::msgcat::mc "Open folder"] -accelerator "Ctrl+K" -command {
|
||||
$m add command -label [::msgcat::mc "Open folder"] -accelerator "Alt+K" -command {
|
||||
set folderPath [FileOper::OpenFolderDialog]
|
||||
if {$folderPath != ""} {
|
||||
# set activeProject $folderPath
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
::msgcat::mcset en "Editor font bold"
|
||||
::msgcat::mcset en "Error open URL"
|
||||
::msgcat::mcset en "Editor settings"
|
||||
::msgcat::mcset en "Enter command for execute file"
|
||||
::msgcat::mcset en "Exit"
|
||||
::msgcat::mcset en "File"
|
||||
::msgcat::mcset en "File already exists. Overwrite?"
|
||||
@@ -185,4 +186,3 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -77,6 +77,7 @@
|
||||
::msgcat::mcset ru "Editor settings" "Настройки редактора"
|
||||
::msgcat::mcset ru "Editor helpers" "Подсказки при вводе"
|
||||
::msgcat::mcset ru "Encode" "Перекодировка"
|
||||
::msgcat::mcset ru "Enter command for execute file" "Введите команду для запуска текущего файла"
|
||||
::msgcat::mcset ru "Authorisation required" "Требуется авторизация"
|
||||
::msgcat::mcset ru "Error open URL" "Ошибка открытия URL"
|
||||
::msgcat::mcset ru "Exit" "Выход"
|
||||
|
||||
@@ -714,3 +714,272 @@ proc AddRecentEditedFolder {path} {
|
||||
}
|
||||
.frmMenu.mnuFile.m.openRecent add command -label $path -command [list OpenRecentProject $path]
|
||||
}
|
||||
|
||||
# ================== OLD ====================
|
||||
proc launchBrowser {url} {
|
||||
global tcl_platform
|
||||
if {$tcl_platform(platform) eq "windows"} {
|
||||
set command [list {*}[auto_execok start] {}]
|
||||
if {[file isdirectory $url]} {
|
||||
set url [file nativename [file join $url .]]
|
||||
}
|
||||
} elseif {$tcl_platform(os) eq "Darwin"} {
|
||||
set command [list open]
|
||||
} else {
|
||||
set command [list xdg-open]
|
||||
}
|
||||
exec {*}$command $url &
|
||||
}
|
||||
## EXEC EXTERNAL BROWSER AND GOTO URL ##
|
||||
proc GoToURL {url} {
|
||||
global env tcl_platform
|
||||
if {$tcl_platform(platform) == "windows"} {
|
||||
set pipe [open "|iexplore $url" "r"]
|
||||
} elseif {$tcl_platform(platform) == "mac"} {
|
||||
set pipe [open "|iexplore $url" "r"]
|
||||
} elseif {$tcl_platform(platform) == "unix"} {
|
||||
#$env(BROWSER)
|
||||
#set pipe [open "|$env(BROWSER) $url" "r"]
|
||||
launchBrowser $url
|
||||
return
|
||||
}
|
||||
fileevent $pipe readable
|
||||
fconfigure $pipe -buffering none -blocking no
|
||||
}
|
||||
## MAKING TAR ARCHIVE ##
|
||||
proc MakeTGZ {} {
|
||||
global activeProject tgzDir tgzNamed workDir projDir env tcl_platform
|
||||
if {$activeProject == ""} {
|
||||
set answer [tk_messageBox\
|
||||
-message [::msgcat::mc "Not found active project"]\
|
||||
-type ok -icon warning\
|
||||
-title [::msgcat::mc "Warning"]]
|
||||
case $answer {
|
||||
ok {return 0}
|
||||
}
|
||||
}
|
||||
FileDialog tree save_all
|
||||
set file [open [file join $workDir $activeProject.proj] r]
|
||||
while {[gets $file line]>=0} {
|
||||
scan $line "%s" keyWord
|
||||
set string [string range $line [string first "\"" $line] [string last "\"" $line]]
|
||||
set string [string trim $string "\""]
|
||||
if {$keyWord == "ProjectDirName"} {
|
||||
set dir "$string"
|
||||
}
|
||||
if {$keyWord == "ProjectVersion"} {
|
||||
set version "$string"
|
||||
}
|
||||
if {$keyWord == "ProjectRelease"} {
|
||||
set release "$string"
|
||||
}
|
||||
}
|
||||
close $file
|
||||
set res [split $tgzNamed "-"]
|
||||
set name [lindex $res 0]
|
||||
set ver [lindex $res 1]
|
||||
set rel [lindex $res 2]
|
||||
if {$name == "projectName"} {
|
||||
set name $activeProject
|
||||
}
|
||||
if {$ver == "version"} {
|
||||
append name "-$version"
|
||||
}
|
||||
if {$rel == "release"} {
|
||||
append name "-$release"
|
||||
}
|
||||
# multiplatform featuring #
|
||||
if {$tcl_platform(platform) == "windows"} {
|
||||
append name ".zip"
|
||||
} elseif {$tcl_platform(platform) == "mac"} {
|
||||
append name ".zip"
|
||||
} elseif {$tcl_platform(platform) == "unix"} {
|
||||
append name ".tar.gz"
|
||||
}
|
||||
catch {cd $projDir} res
|
||||
if {[file exists [file join $tgzDir $name]] == 1} {
|
||||
set answer [tk_messageBox\
|
||||
-message "[::msgcat::mc "File already exists. Overwrite?"] \"$name\" ?"\
|
||||
-type yesno -icon question -default yes\
|
||||
-title [::msgcat::mc "Question"]]
|
||||
case $answer {
|
||||
yes {file delete [file join $tgzDir $name]}
|
||||
no {return 0}
|
||||
}
|
||||
}
|
||||
# multiplatform featuring #
|
||||
if {$tcl_platform(platform) == "windows"} {
|
||||
catch [exec pkzip -r -p [file join $tgzDir $name] [file join $activeProject *]] err
|
||||
} elseif {$tcl_platform(platform) == "mac"} {
|
||||
catch [exec zip -c [file join $tgzDir $name] $activeProject] err
|
||||
} elseif {$tcl_platform(platform) == "unix"} {
|
||||
catch [exec tar -czvf [file join $tgzDir $name] $activeProject] err
|
||||
}
|
||||
# message dialog #
|
||||
set msg "[::msgcat::mc "Archive created in"] [file join $tgzDir $name]"
|
||||
set icon info
|
||||
set answer [tk_messageBox\
|
||||
-message "$msg"\
|
||||
-type ok -icon $icon]
|
||||
case $answer {
|
||||
ok {return 0}
|
||||
}
|
||||
}
|
||||
|
||||
## MAKE PROJ PROCEDURE (RUNNING PROJECT) ##
|
||||
proc Execute {filePath w} {
|
||||
global activeProject cfgVariables
|
||||
if {$activeProject == ""} {
|
||||
set answer [tk_messageBox\
|
||||
-message "[::msgcat::mc "Not found active project"]"\
|
||||
-type ok -icon warning\
|
||||
-title [::msgcat::mc "Warning"]]
|
||||
case $answer {
|
||||
ok {return 0}
|
||||
}
|
||||
}
|
||||
FileOper::Save
|
||||
set file $filePath
|
||||
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 #
|
||||
frame $w.frame -borderwidth 2 -relief ridge -background $cfgVariables(backGround)
|
||||
pack $w.frame -side top -fill both -expand true
|
||||
|
||||
|
||||
text $w.frame.text -yscrollcommand "$w.frame.yscroll set" \
|
||||
-bg $cfgVariables(backGround) -fg $cfgVariables(foreground) \
|
||||
-relief sunken -wrap word -highlightthickness 0 -font $cfgVariables(font)\
|
||||
-selectborderwidth 0 -selectbackground $cfgVariables(selectbg) -width 10 -height 10
|
||||
scrollbar $w.frame.yscroll -relief sunken -borderwidth {1} -width {10} -takefocus 0 \
|
||||
-command "$w.frame.text yview" -background $cfgVariables(backGround)
|
||||
|
||||
pack $w.frame.text -side left -fill both -expand true
|
||||
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 <Control-r> [list destroy $w]
|
||||
bind $w.frame.text <Control-Cyrillic_er> [list destroy $w]
|
||||
# focus -force $w.frmBtn.btnOk
|
||||
# $noteBook raise $node
|
||||
# insert debug data into text widget #
|
||||
$w.frame.text tag configure bold -font $cfgVariables(fontBold)
|
||||
$w.frame.text tag configure error -font $cfgVariables(fontBold) -foreground red
|
||||
$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"
|
||||
set pos [$w.frame.text index insert]
|
||||
set lineNum [lindex [split $pos "."] 0]
|
||||
$w.frame.text insert 0.0 "^^^^^^^^^^^^^^^^^^^^^ [::msgcat::mc "Programm output"] ^^^^^^^^^^^^^^^^^\n"
|
||||
$w.frame.text tag add bold $lineNum.0 $lineNum.end
|
||||
focus -force $w.frame.text
|
||||
# open and manipulate executed program chanel #
|
||||
# cd $projDirName
|
||||
# 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} {
|
||||
# Получаем индекс конца последней строки
|
||||
set endIndex [$w.frame.text index "end-1c"]; # или "end-1l lineend"
|
||||
|
||||
# Получаем индекс начала последней строки
|
||||
set startIndex [$w.frame.text index "end-1l linestart"]
|
||||
|
||||
set command [$w.frame.text get $startIndex $endIndex end]
|
||||
set pipe [open "|$command $filePath 2> [file join [file dirname $filePath] errors]" "r"]
|
||||
set f [open [file join [file dirname $filePath] errors] "r"]
|
||||
|
||||
# set pipe [open "|$command $filePath" "r"]
|
||||
# set f [open [file join ~ tmp errors] "r"]
|
||||
fileevent $pipe readable [list DebugInfo $w.frame.text $pipe $f]
|
||||
fconfigure $pipe -buffering none -blocking no
|
||||
}
|
||||
|
||||
## INSERT DEBUG INFORMATION INTO TEXT WIDGET ##
|
||||
proc DebugInfo {widget file f} {
|
||||
$widget configure -state normal
|
||||
if {[eof $file]} {
|
||||
catch [close $file] msg
|
||||
if {$msg != ""} {
|
||||
puts $msg
|
||||
$widget insert "end-4l linestart" "[::msgcat::mc "Program failed"]: $msg\n";
|
||||
} else {
|
||||
puts $msg
|
||||
$widget see "end-1l lineend"
|
||||
$widget delete "end-1l lineend" end
|
||||
# $widget insert end "\n-------------------------------------------------\n"
|
||||
# $widget insert end "[::msgcat::mc "Program finished successfully"]\n"
|
||||
}
|
||||
} else {
|
||||
$widget insert "end-4l linestart" [read $file]
|
||||
}
|
||||
while {[gets $f line]>=0} {
|
||||
$widget insert "end-4l linestart" "$line\n"
|
||||
puts $line
|
||||
}
|
||||
# close $f
|
||||
$widget see end
|
||||
$widget tag add error 0.0 0.end
|
||||
# $widget configure -state disabled
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user