Compare commits

...

27 Commits

Author SHA1 Message Date
Sergey Kalinin
eb6b2c6f53 Новая сборка
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 17s
2025-12-03 18:06:32 +03:00
Sergey Kalinin
aa9bb03cc2 Исправил ошибку 2025-12-03 18:02:13 +03:00
Sergey Kalinin
bcc3460e06 Исправил ошибку 2025-12-03 17:59:31 +03:00
Sergey Kalinin
1385c91255 Исправления после слияния 2025-12-03 17:33:06 +03:00
Sergey Kalinin
ead8267d61 Изменения перед слиянием
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2025-12-03 17:09:42 +03:00
Sergey Kalinin
e534b27407 Добавлены настройки путей к программам для выполнения редактируемых файлов для каждого поддержимаего типа. И использование этих настроек при выполнении файла.
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2025-12-03 17:01:58 +03:00
Sergey Kalinin
45cbd7845b Добавил вывод информации о версиях tcl и tk
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2025-11-10 13:18:26 +03:00
Sergey Kalinin
b830838f8e Добавил вывод номера версии tcl/tl в О Программе
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2025-11-10 13:13:44 +03:00
Sergey Kalinin
ef87b88156 Незначительные изменения
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2025-11-10 13:00:43 +03:00
264368c61f новая сборка
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 17s
2025-10-31 19:01:41 +03:00
c38dffeeb9 Исправил сохранение и закрытие нового файла. Теперь при сохранении файл будет переоткрыт под новым именем. 2025-10-31 18:56:38 +03:00
df1d9aa36d Добавил проверку пакета Img. И поправил проверку типов изображений
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 1m23s
2025-10-31 17:30:16 +03:00
cff798a9f1 Переделал сигналы и сочетния
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 1m23s
2025-10-30 14:53:30 +03:00
64287f1a01 Небольшие исправления
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2025-10-30 14:47:05 +03:00
5e1c057bc5 Поправил changelog
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2025-10-30 13:12:49 +03:00
ab740f0be8 Добавлен перевод фокуса ввода на прежнее окно после закрытия диалога выполнения.
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2025-10-30 13:10:54 +03:00
4c6713b2d3 Добавлена передача сигналов для закрытия запущенного процесса
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2025-10-30 12:52:21 +03:00
dc5fd60c0d Исправлен changelog
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2025-10-29 21:48:31 +03:00
c3848566df Удалил линее
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2025-10-29 21:44:26 +03:00
961d597032 Изменил виджет текста в окне псевдо-терминала. Добавил подстановку имени файла к командную строку по шаблону %f 2025-10-29 21:42:34 +03:00
5d70d508cd Добавлен диалог настроек, и кнопка на панели. Для редактирования файла настроек программы
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2025-10-29 20:48:52 +03:00
8619e3e1f4 Добавил псевдо-терминал, и команды запуска файлов.
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2025-10-29 19:59:57 +03:00
8834c0954e Исправлен changelog
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2025-10-29 13:10:31 +03:00
4e67dbfccf Добавлен диалог при открытии файлов отличных от текстовых
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2025-10-29 09:08:28 +03:00
e5b0468a44 Поправил тему оформления
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2025-10-28 16:05:56 +03:00
a9ac54ce54 Новая сборка
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2025-10-27 21:01:15 +03:00
297d0f7420 Исправлена работа в windows 2025-10-27 20:59:27 +03:00
21 changed files with 909 additions and 129 deletions

4
.gitignore vendored
View File

@@ -5,4 +5,6 @@ debian/projman.substvars
debian/files
debian/projman.debhelper.log
debian/*.tmp
*.tmp
debian/errors
*.tmp
errors

View File

@@ -69,6 +69,17 @@ tcllib, tklib
![projman_global_search.png](https://nuk-svk.ru/images/projman_global_search.png)
- A pseudo-terminal for launching the edited file and other command
![projman_global_search.png](https://nuk-svk.ru/images/projman_terminal_1.png)
![projman_global_search.png](https://nuk-svk.ru/images/projman_terminal_2.png)
- Image viewer
![projman_imageviewer.png](https://nuk-svk.ru/images/projman_imageviewer.png)
## Getting source code
Download the source code https://git.nuk-svk.ru/svk/projman/
@@ -120,7 +131,6 @@ Or type "projman" into terminal, Or choose the name of the program "Projman" on
- Ctrl-N - Create new file
- Ctrl-O - Open file
- Ctrl-W - Close editor (file)
- Ctrl-K - Open folder
- Ctrl-Q - Quit from ProjMan
- Ctrl-J - Show procedures (functions) list for navigation in open editor
- Ctrl-L - Find and display files where the variable is defined, the name of which is located under the cursor in the editor
@@ -134,6 +144,10 @@ Or type "projman" into terminal, Or choose the name of the program "Projman" on
- Ctrl-G - Go to line dialog
- Ctrl-C - Copy selected text into buffer
- Ctrl-V - Paste text from buffer
- Ctrl-R - Open terminal for edited file
- Ctrl-Z - Send SIGTSTP signal
- Ctrl-D - Send SIGINT signal
- Ctrl-C - Send SIGKILL signal
- Alt-P - Show/Hide the file tree panel
- Alt-W - Delete the current word
@@ -142,6 +156,7 @@ Or type "projman" into terminal, Or choose the name of the program "Projman" on
- Alt-R - Delete current line
- Alt-Y - Copy current line into buffer
- Alt-S - Split the edited window horizontally
- Alt-K - Open folder
## Credits

5
TODO
View File

@@ -7,7 +7,7 @@
--- Ansible ---
1. Определение всех переменных в отдельный список
- внутри файла, конструкции вида:
- внутри файла, конструкции вида:
set_fact:
varName: value
set_fact varName value
@@ -18,5 +18,4 @@
- var1.yml
- var2.yml
3. Если используется роль и переменная не найдена в плэйбуке то искать в роли (не факт что требуется)
3. Если используется роль и переменная не найдена в плэйбуке

64
debian/changelog vendored
View File

@@ -1,11 +1,63 @@
projman (2.0.0-alpha18) stable; urgency=medium
projman (2.0.0-alpha21) stable; urgency=medium
* Новая сборка
* Исправил ошибку
* Добавлены настройки путей к программам для выполнения редактируемых файлов для каждого поддержимаего типа. И использование этих настроек при выполнении файла.
-- Sergey Kalinin <svk@nuk-svk.ru> Mon, 27 Oct 2025 14:48:18 +0300
-- Sergey Kalinin <svk@nuk-svk.ru> Wed, 3 Dec 2025 17:59:31 +0300
projman (2.0.0-alpha20) stable; urgency=medium
* Добавил вывод номера версии tcl/tl в О Программе
-- Sergey Kalinin <svk@nuk-svk.ru> Mon, 03 Dec 2025 17:22:44 +0300
projman (2.0.0-alpha19) stable; urgency=medium
* Исправил сохранение и закрытие нового файла. Теперь при сохранении файл будет переоткрыт под новым именем.
* Добавил проверку пакета Img. И поправил проверку типов изображений
* Переделал сигналы и сочетания
* Небольшие исправления
* Добавлен перевод фокуса ввода на прежнее окно после закрытия диалога выполнения.
* Добавлена передача сигналов для закрытия запущенного процесса
* Изменил виджет текста в окне псевдо-терминала. Добавил подстановку имени файла к командную строку по шаблону %f
* Добавлен диалог настроек
* Добавил псевдо-терминал
* Добавлен диалог при открытии файлов отличных от текстовых
* Поправил тему оформления
* Исправлена работа в windows
* Уменьшил колдичество выводимой отладочной информации
* Добавлено определение пути до git в зависимости от платформы.
* Исправлено создание файла конфигурации
* Исправлено создание файла конфигурации. Добавлены номера версий в вызов tclsh8.6 и wish8.6. Убрана зависимость на Threads.
* Исправлено чтение структуры проекта при открытии из меню 'Открыть недавнее'
* Bugfix release
* Bug fix with varhelper
* Added the "Open Recent" menu. The "recentlyEditedFolders" option in the configuration file contains a list of recently opened directories. The procedures for working with this list have also been added.
* Косметические изменения.
* Исправлены ошибки при вставке кавычек
-- Калинин Сергей Валерьевич <svk@nuk-svk.ru> Thu, 30 Jan 2025 12:19:56 +0300
projman (2.0.0-alpha19) stable; urgency=medium
* Переделал сигналы и сочетния
* Добавлен перевод фокуса ввода на прежнее окно после закрытия диалога выполнения.
* Добавлена передача сигналов для закрытия запущенного процесса
* Изменил виджет текста в окне псевдо-терминала. Добавил подстановку имени файла к командную строку по шаблону %f
* Добавлен диалог настроек
* Добавил псевдо-терминал
* Добавлен диалог при открытии файлов отличных от текстовых
* Добавлен просмотр файлов изображений (png, bmp, gif, ppm, pgm)
* Исправлена процедура опреления типа файла
* Добавлены диалоги для подтверждения открытия больших файлов, и двоичных файлов.
-- Sergey Kalinin <svk@nuk-svk.ru> Wed, 29 Oct 2025 13:10:31 +0300
projman (2.0.0-alpha18) stable; urgency=medium
* Поправил тему оформления
* Исправлена работа в windows
* Уменьшил количество выводимой отладочной информации
* Добавлено определение пути до git в зависимости от платформы.
* Исправлено создание файла конфигурации
* Добавлены номера версий в вызов tclsh8.6 и wish8.6.
@@ -375,3 +427,9 @@ projman (2.0.0-alfa0) stable; urgency=medium

View File

@@ -65,6 +65,16 @@ multilineComments=true
opened=
editedFiles=
recentFolder=
\[Executor\]
TCL=tclsh
GO=go
PY=python3
SH=bash
PL=perl
RB=ruby
HTM=firefox
HTML=firefox
LUA=lua
"
proc Config::create {dir} {
set cfgFile [open [file join $dir projman.ini] "w+"]

View File

@@ -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} {
@@ -1515,6 +1536,7 @@ namespace eval Editor {
ICO
XPM
}
# puts "$itemName"
set fr $itemName
if ![string match "*untitled*" $itemName] {
set lblText $fileFullPath
@@ -1524,6 +1546,8 @@ namespace eval Editor {
}
set fileType [string toupper [string trimleft [file extension $fileFullPath] "."]]
if {$fileType eq ""} {set fileType "Unknown"}
ExecutorCommandPathSetting $fileType
ttk::frame $fr.header
set lblName "lbl[string range $itemName [expr [string last "." $itemName] +1] end]"
@@ -1536,9 +1560,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
@@ -1556,4 +1584,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 $w
}
}

View File

@@ -9,12 +9,42 @@
namespace eval FileOper {
variable types
global packages
variable types
set ::types {
{"All files" *}
}
# Проверка поддерживаемых типов изображений
# в зависимости устновлен пакет или нет
proc SupportImageType {type} {
if {[PackagePresent Img] eq "true"} {
switch $type {
jpeg { return true }
png { return true }
gif { return true }
bmp { return true }
svg { return true }
ppm { return true }
pgm { return true }
tiff { return true }
xbm { return true }
xpm { return true }
default { return false}
}
} else {
switch $type {
png { return true }
gif { return true }
bmp { return true }
svg { return true }
ppm { return true }
pgm { return true }
default { return false}
}
}
}
proc GetFileMimeType {fileFullPath {opt ""}} {
global cfgVariables
# Проверям наличие программы в системе, если есть то добавляем опции
@@ -47,17 +77,71 @@ namespace eval FileOper {
# линуксовый file не всегда корректно определяет тип файла
# используем пакет из tcl
lassign [::fileutil::fileType $fileFullPath] fType fBinaryType fBinaryInterp
# puts "File type is $fType, $fBinaryType, $fBinaryInterp"
puts "File type is $fType, $fBinaryType, $fBinaryInterp"
set ext [string tolower [file extension $fileFullPath]]
# Установка корректного типа для svg
# Но для новых версий tcl
switch $ext {
".svg" {
set fType "binary"
set fBinaryInterp "svg"
set fBinaryType "graphic"
}
".torrent" {
set fType "binary"
set fBinaryInterp "torrent"
set fBinaryType "x-bittorrent"
}
".pdf" {
set fType "binary"
set fBinaryInterp "pdf"
set fBinaryType "binary"
}
}
puts "File type is $fType, $fBinaryType, $fBinaryInterp, $ext"
switch $fType {
"binary" {
return false
if {$fBinaryType ne ""} {
switch $fBinaryType {
"graphic" {
if {[SupportImageType $fBinaryInterp] eq "true"} {
return image
} else {
set answer [tk_messageBox -message [::msgcat::mc "The file looks like a image. Support not implemented yet."] -icon question -type ok]
switch $answer {
ok {
return false
}
}
}
}
default {
return binary
}
}
} else {
return binary
}
}
"text" {
return text
}
"image" {
return false
if {[SupportImageType $fBinaryInterp] eq "true"} {
return image
} else {
set answer [tk_messageBox -message [::msgcat::mc "The file looks like a image. Support not implemented yet."] -icon question -type ok]
switch $answer {
ok {
return false
}
}
}
}
"empty" {
return text
}
default {
return false
@@ -226,14 +310,16 @@ namespace eval FileOper {
-icon question -type yesnocancel \
-detail [::msgcat::mc "Do you want to save it?"]]
switch $answer {
yes Save
yes {Save close}
no {}
cancel {return "cancel"}
}
}
}
$nbEditor forget $nbItem
destroy $nbItem
if {[$nbEditor select] eq $nbItem} {
$nbEditor forget $nbItem
destroy $nbItem
}
set treeItem "file::[string range $nbItem [expr [string last "." $nbItem] +1] end ]"
if [$tree exists $treeItem] {
# delete all functions from tree item
@@ -258,19 +344,19 @@ namespace eval FileOper {
NB::NextTab $nbEditor 0
}
proc Save {} {
global nbEditor tree env activeProject
proc Save {{type ""}} {
global nbEditor tree env activeProject dir
if [info exists activeProject] {
set dir $activeProject
set dirProject $activeProject
} else {
set dir $env(HOME)
set dirProject $env(HOME)
}
set nbEditorItem [$nbEditor select]
# puts "Saved editor text: $nbEditorItem"
if [string match "*untitled*" $nbEditorItem] {
set filePath [tk_getSaveFile -initialdir $dir -filetypes $::types -parent .]
set filePath [tk_getSaveFile -initialdir $dirProject -filetypes $::types -parent .]
if {$filePath eq ""} {
return
}
@@ -290,6 +376,15 @@ namespace eval FileOper {
# puts "$f was saved"
close $f
ResetModifiedFlag $nbEditorItem $nbEditor
if {[file tail $filePath] eq "projman.ini"} {
Config::read $dir(cfg)
}
if [string match "*untitled*" $nbEditorItem] {
FileOper::Close
if {$type ne "close"} {
FileOper::Edit $filePath
}
}
}
proc SaveAll {} {
@@ -395,26 +490,51 @@ namespace eval FileOper {
proc Edit {fileFullPath {nbEditor .frmWork.nbEditor}} {
global tree
puts "$fileFullPath"
if {[file exists $fileFullPath] == 0} {
return false
} else {
# puts "$fileFullPath File type [::fileutil::magic::filetype $fileFullPath]"
set fileType [FileOper::GetFileMimeType $fileFullPath]
}
# puts "$fileType <<<<<<<<<<<"
switch $fileType {
"text" {
# return text
}
"image" {
# return image
}
"binary" {
set answer [tk_messageBox -message [::msgcat::mc "The file looks like a binary file. Open anyway?"] \
-icon question -type yesno]
switch $answer {
yes {}
no {return}
}
}
false {
return
}
}
# Проверяем размер файла и если он больше 1мб вывести предупреждение
# puts " File size = [file size $fileFullPath]"
if {[file size $fileFullPath] > 1000000} {
set answer [tk_messageBox -message [::msgcat::mc "The file size to big. Open anyway?"] \
-detail [GetFileAttr $fileFullPath "size"] \
-icon question -type yesno]
switch $answer {
yes {}
no {return}
}
}
set filePath [file dirname $fileFullPath]
set fileName [file tail $fileFullPath]
regsub -all {\.|/|\\|\s} $fileFullPath "_" itemName
regsub -all {\.|/|\\|\s|:} $fileFullPath "_" itemName
set itemName [string tolower $itemName]
set itemName "$nbEditor.$itemName"
set treeItemName [Tree::InsertItem $tree {} $fileFullPath "file" $fileName]
@@ -423,6 +543,11 @@ namespace eval FileOper {
if {[winfo exists $itemName] == 0} {
NB::InsertItem $nbEditor $fileFullPath "file"
if {$fileType eq "image"} {
ImageViewer $fileFullPath $itemName $itemName
return $itemName
}
Editor::Editor $fileFullPath $nbEditor $itemName
ReadFile $fileFullPath $itemName
$itemName.frmText.t highlight 1.0 end
@@ -430,6 +555,11 @@ namespace eval FileOper {
$itemName.frmText.t see 1.1
}
$nbEditor select $itemName
focus -force $itemName
if {$fileType eq "image"} {
# ImageViewer $fileFullPath $itemName $itemName
return $itemName
}
Editor::ReadStructure $itemName.frmText.t $treeItemName
GetVariablesFromFile $fileFullPath
$itemName.frmText.t.t mark set insert 1.0
@@ -437,6 +567,8 @@ namespace eval FileOper {
focus -force $itemName.frmText.t.t
.frmStatus.lblSize configure -text [GetFileAttr $fileFullPath "size"]
.frmStatus.lblEncoding configure -text [GetFileMimeType $fileFullPath "charset"]
# puts ">> $itemName"
return $itemName
}

View File

@@ -23,7 +23,7 @@ namespace eval Git {
}
if {[catch {exec {*}$cmd} git_path]} {
puts "Git не найден в системе"
set cfgVariables(gitCommand) "Git not found"
set cfgVariables(gitCommand) ""
return
}
set git_path [string trim $git_path]

View File

@@ -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
@@ -134,11 +145,15 @@ grid .frmBody.panel -row 0 -column 1 -sticky nesw
grid columnconfigure .frmBody .frmBody.panel -weight 1
grid rowconfigure .frmBody .frmBody.panel -weight 1
# Панель инстурментов
ttk::button $frmTool.btn_tree -command ToolBtnTreePress -image tree_24x24
ttk::button $frmTool.btn_search -command FileOper::FindInFiles -image search_24x24
ttk::button $frmTool.btn_git -command Git::Dialog -image git_24x24
ttk::button $frmTool.btn_settings -command Settings -image settings_24x24
pack $frmTool.btn_tree $frmTool.btn_search $frmTool.btn_git -side top -padx 1 -pady 1
pack $frmTool.btn_settings -side bottom -padx 1 -pady 10
# #label $frmTool.lbl_logo -image tcl
# pack $frmTool.btn_quit -side bottom -padx 5 -pady 5
# #pack $frmTool.lbl_logo -side bottom -padx 5 -pady 5

View File

@@ -190,5 +190,25 @@ namespace eval Highlight {} {
ctext::addHighlightClassForRegexp $txt namespaces #0093ff {->|\+\+|::}
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 namespaces #4f64ff {::}
# ctext::addHighlightClassForRegexp $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}
# ctext::addHighlightClassForRegexp $txt paths lightblue {(\s)([\w]+)(=)}
# ctext::addHighlightClassForSpecialChars $txt tags lightgreen {<>/}
# ctext::addHighlightClassForRegexp $txt tags #199100 {/.+\s}
ctext::addHighlightClassForRegexp $txt gopaths lightblue {(.+?):(\d+):(\d+):}
ctext::addHighlightClassForRegexp $txt paths lightblue {(\\|/|\.|^)((\w)|(\.)|(/)|([\.\w]))+?\s}
ctext::addHighlightClass $txt compile_errors #ff5050 {error Error ERROR invalid undefined cannot}
ctext::addHighlightClassForRegexp $txt url lightblue {\w+://\w.+\w+}
}
}

View File

@@ -1912,4 +1912,38 @@ 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==
}
image create photo settings_24x24 -data {
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAABg2lDQ1BJQ0MgcHJvZmlsZQAAKJF9
kT1Iw1AUhU9TpVIqDnYQUclQneyiIo5ahSJUCLVCqw4mL/2DJg1Jiouj4Fpw8Gex6uDirKuDqyAI
/oC4C06KLlLifUmhRYwPLu/jvHcO990HCI0K06yuWUDTbTOdTIjZ3KoYekUYw1QjiMrMMuYkKQXf
9XWPAN/v4jzL/96fq1fNWwwIiMSzzDBt4g3i6U3b4LxPHGUlWSU+Jx43qUHiR64rHr9xLros8Myo
mUnPE0eJxWIHKx3MSqZGPEUcUzWd8oWsxyrnLc5apcZaffIXRvL6yjLXqYaQxCKWIEGEghrKqMBG
nHadFAtpOk/4+Addv0QuhVxlMHIsoAoNsusH/4Pfs7UKkxNeUiQBdL84zscoENoFmnXH+T52nOYJ
EHwGrvS2v9oAZj5Jr7e12BHQtw1cXLc1ZQ+43AEGngzZlF0pSCUUCsD7GX1TDui/BcJr3txa5zh9
ADI0q9QNcHAIjBUpe93n3T2dc/v3Tmt+P5frcrXBnzRwAAAABmJLR0QA/wD/AP+gvaeTAAAACXBI
WXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH6QodESQY6jzHvgAAABl0RVh0Q29tbWVudABDcmVhdGVk
IHdpdGggR0lNUFeBDhcAAAHySURBVEjHrZZPSFVREMZ/iomaBm1SApFHIEoL+6e7ROHTFkEbaWNb
95YgSFiLyECIoJXtIkEXZqSrIoYwQiEScVOCguQylCzKpyFBm3PjvcO5f8L3wV3cufPNnHNmvjO3
jAwws06gxTN/lTSfxq0gGx4BFz3bAVCdRizPmOBswFZlZg1HTmBm9UBVzOczafwyL9groAGYAJ4D
bcDDwPFE+AKMADPAdWAAaATOSfpdlMDM+oDZAvJPoC7jEf4CagveRySN/0tgZtXAKtBMabAH5CRt
RzUYyhj80D1pOA48KCzyQArhE9AlqVJSJXAeeJvC6TezY1GCXmAtxnEd6JD0LjJIWnWchRjOFtAj
6bDcETaAS8DLgPNdSXnfKOkPMBzw/wC0S1oq0oEL8jpAWIw7A0nLAfOypO3/UfKJBBGG+AdBJZtZ
DhgMEK4mJL8WsN0ws8tFSnYimwRqAoQfQJukLW/1jcB7oClmF7ckPYkSbAK5hJXmXV9HNWoH7gCn
U9R9KrquR4GpBOca4L57smJM0n7UptNuu6XCOvDY76KbntMC8C1DsDzwxrPdlrTv62AFuOeu6lZJ
3W5MPksIPgdckHTF1XAMeCrpRXAexPT6yYSddEj6eKSJJmk3IcFGqWby51AbSvpeqr+KPjcKC7GT
hfgXbteIc85F7RUAAAAASUVORK5CYII=
}

View File

@@ -1,8 +1,9 @@
proc ImageViewer {f w node} {
global factor cfgVariables
set factor($node) 1.0
ttk::frame $w.f
pack $w.f -side left -fill both -expand true
canvas $w.f.c -xscrollcommand "$w.f.x set" -yscrollcommand "$w.y set"
canvas $w.f.c -xscrollcommand "$w.f.x set" -yscrollcommand "$w.y set" -bg $cfgVariables(backGround)
ttk::scrollbar $w.f.x -ori hori -command "$w.f.c xview"
ttk::scrollbar $w.y -ori vert -command "$w.f.c yview"
@@ -20,15 +21,15 @@ proc ImageViewer {f w node} {
}
proc openImg {fn w node} {
global im1
global im1 factor
set im1 [image create photo -file $fn]
#scale $w
scale $w $factor($node) $node
list [file size $fn] bytes, [image width $im1]x[image height $im1]
$w create image 1 1 -image $im1 -anchor nw -tag img
}
proc scale {w {n 1} node} {
global im1 im2 factor noteBook tab_label
global im1 im2 factor tab_label
set factor($node) [expr {$factor($node) * $n}]
$w delete img
catch {image delete $im2}
@@ -41,7 +42,8 @@ proc scale {w {n 1} node} {
$im2 copy $im1 -subsample $f $f
}
$w create image 1 1 -image $im2 -anchor nw -tag img
$noteBook itemconfigure $node -text "$tab_label (size x$factor($node))"
set noteBook [file extension $node]
# $noteBook itemconfigure $node -text "(size x$factor($node))"
$w config -scrollregion [$w bbox all]
}
@@ -52,6 +54,7 @@ proc ImageBase64Encode {text} {
{"GIF" {.gif}}
{"JPEG" {.jpg}}
{"BMP" {.bmp}}
{"SVG" {.svg}}
{"All files" *}
}
set img [tk_getOpenFile -initialdir $env(HOME) -filetypes $types -parent .]
@@ -65,5 +68,3 @@ proc ImageBase64Encode {text} {
$text insert [Position] "image create photo $name -data {\n$data\n}"
}
}

View File

@@ -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
@@ -76,7 +76,8 @@ proc GetEditMenu {m} {
$m add separator
$m add command -label [::msgcat::mc "Insert image"] -accelerator "Ctrl+I"\
-command ImageBase64Encode
$m add separator
$m add command -label [::msgcat::mc "Settings"] -command Settings
}
proc GetViewMenu {m} {

View File

@@ -59,12 +59,16 @@
::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?"
::msgcat::mcset en "File modify"
::msgcat::mcset en "File was modifyed. Close?"
::msgcat::mcset en "File was modifyed. Save?"
::msgcat::mcset en "The file looks like a binary file. Open anyway?"
::msgcat::mcset en "The file looks like a image. Support not implemented yet."
::msgcat::mcset en "The file size to big. Open anyway?"
::msgcat::mcset en "File saved"
::msgcat::mcset en "Files"
::msgcat::mcset en "Find"
@@ -182,6 +186,3 @@

View File

@@ -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" "Выход"
@@ -88,6 +89,9 @@
::msgcat::mcset ru "File was modifyed" "Файл был изменен"
::msgcat::mcset ru "File modify" "Файл изменен"
::msgcat::mcset ru "File saved" "Файл сохранен"
::msgcat::mcset ru "The file looks like a binary file. Open anyway?" "Файл похож на двоичный. Открыть все равно?"
::msgcat::mcset ru "The file looks like a image. Support not implemented yet." "Файл выглядит как изображение. Поддержка пока не реализована."
::msgcat::mcset ru "The file size to big. Open anyway?" "Файл большого размера. Открыть все равно?"
::msgcat::mcset ru "Find" "Найти"
::msgcat::mcset ru "Found" "Найдено"
::msgcat::mcset ru "Find in files" "Найти в файлах"
@@ -196,7 +200,7 @@
::msgcat::mcset ru "Select directory" "Выбор директории"
::msgcat::mcset ru "Selected directory" "Директория"
::msgcat::mcset ru "Selection color" "Цвет выделения"
::msgcat::mcset ru "Settings" "Установки"
::msgcat::mcset ru "Settings" "Настройки"
::msgcat::mcset ru "Statusbar" "Строка статуса"
::msgcat::mcset ru "Show backup files" "Показывать временные файлы"
::msgcat::mcset ru "Show the Menu" "Показывать меню"

View File

@@ -13,7 +13,9 @@ namespace eval NB {
proc InsertItem {nb item type} {
switch $type {
file {
regsub -all {\.|/|\\|\s} $item "_" itemName
set item [string tolower $item]
regsub -all {\.|/|\\|\s|:} $item "_" itemName
# puts "$item -> $itemName"
if [winfo exists $nb.$itemName] {
set fm $nb.$itemName
} else {

View File

@@ -254,11 +254,13 @@ proc FindImage {ext} {
namespace eval Help {
proc About {} {
global projman
global projman tcl_version tk_version
set msg "Tcl/Tk project Manager\n\n"
append msg "Version: " $projman(Version) "\n" \
"Release: " $projman(Release) "\n" \
"Build: " $projman(Build) "\n\n" \
"Build: " $projman(Build) "\n" \
"Tcl Version: " $tcl_version "\n" \
"Tk Version: " $tk_version "\n\n" \
"Author: " $projman(Author) "\n" \
"Home page: " $projman(Homepage)
# foreach name [array names projman] {
@@ -714,3 +716,411 @@ 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}
}
}
# Процедура для проверки, находится ли редактирование в последней строке
proc IsLastLine {widget} {
set current_line [lindex [split [$widget index insert] .] 0]
set last_line [lindex [split [$widget index end-1c] .] 0]
return [expr {$current_line == $last_line}]
}
# Процедура для проверки выделения в последней строке
proc IsSelectionInLastLine {widget} {
if {![$widget tag ranges sel]} {
return 0
}
set last_line [lindex [split [$widget index end-1c] .] 0]
set sel_start_line [lindex [split [$widget index sel.first] .] 0]
set sel_end_line [lindex [split [$widget index sel.last] .] 0]
return [expr {$sel_start_line == $last_line && $sel_end_line == $last_line}]
}
# Процедура-обертка для проверки последней строки
proc CheckLastLineAndRun {txt w filePath} {
# Проверяем, находится ли курсор в последней строке
set current_line [lindex [split [$txt index insert] .] 0]
set last_line [lindex [split [$txt index end-1c] .] 0]
if {$current_line == $last_line} {
# Разрешаем выполнение в последней строке
$txt insert insert "\n"
Run $w $filePath
} else {
# Запрещаем в других строках
bell
$txt mark set insert end
}
}
## MAKE PROJ PROCEDURE (RUNNING PROJECT) ##
proc Execute {filePath w activeEditor} {
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
# create array with file names #
frame $w.frame -borderwidth 2 -relief ridge -background $cfgVariables(backGround)
pack $w.frame -side top -fill both -expand true
set txt $w.frame.text
ctext $txt -yscrollcommand "$w.frame.yscroll set" -linemap 0 \
-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 "$txt yview" -background $cfgVariables(backGround)
Highlight::ExecuteColorized $txt
pack $txt -side left -fill both -expand true
pack $w.frame.yscroll -side left -fill y
bind $txt <Return> [list Run $w $filePath]
bind $txt <Control-r> [list CloseExecuteDialog $w $activeEditor]
bind $txt <Control-Cyrillic_er> [list CloseExecuteDialog $w $activeEditor]
# focus -force $w.frmBtn.btnOk
# $noteBook raise $node
# insert debug data into text widget #
$txt tag configure bold -font $cfgVariables(fontBold)
$txt tag configure error -font $cfgVariables(fontBold) -foreground red
$txt tag add bold 0.0 0.end
$txt 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 "======================================================================================\n"
# Added executor from config
set fileType [string toupper [string trimleft [file extension $filePath] "."]]
if {[info exists cfgVariables($fileType)] != 0 && $cfgVariables($fileType) ne ""} {
$w.frame.text insert end "$cfgVariables($fileType) %f"
}
unset fileType
# $w.frame.text insert end [string toupper [string trimleft [file extension $filePath] "."]]
# $w.frame.text insert end cfgVariables($fileType)
$w.frame.text tag add bold $lineNum.0 $lineNum.end
Highlight::ExecuteColorized $w.frame.text
# focus -force $w.frame.text
# Привязки событий для защиты от редактирования
# bind $txt <KeyPress> {
# if {![IsLastLine %W]} {
# break
# }
# }
# bind $txt <KeyPress-Return> {
# # Разрешаем Enter только в последней строке
# if {![IsLastLine %W]} {
# break
# } else {
# list Run $w $filePath
# }
# }
# bind $txt <KeyPress-Return> [list CheckLastLineAndRun $txt $w $filePath]
#
# bind $txt <BackSpace> {
# if {[%W tag ranges sel] ne ""} {
# if {![IsSelectionInLastLine %W]} {
# break
# }
# } else {
# if {![IsLastLine %W]} {
# break
# }
# }
# }
# bind $txt <Delete> {
# if {[%W tag ranges sel] ne ""} {
# if {![IsSelectionInLastLine %W]} {
# break
# }
# } else {
# if {![IsLastLine %W]} {
# break
# }
# }
# }
# # Защита от вставки
# bind $txt <<Paste>> {
# if {[%W tag ranges sel] ne ""} {
# if {![IsSelectionInLastLine %W]} {
# break
# }
# } else {
# if {![IsLastLine %W]} {
# break
# }
# }
# }
# # Защита от вырезания
# bind $txt <<Cut>> {
# if {[%W tag ranges sel] ne ""} {
# if {![IsSelectionInLastLine %W]} {
# break
# }
# } else {
# break
# }
# }
focus -force $w.frame.text.t
}
proc CloseExecuteDialog {w activeEditor} {
destroy $w
focus $activeEditor.frmText.t.t
}
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]
# Заменяем знак %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 processPID [pid $pipe]
bind $w.frame.text <Control-c> [list SendSignal $processPID "SIGINT"]
bind $w.frame.text <Control-z> [list SendSignal $processPID "SIGTSTP"]
bind $w.frame.text <Control-d> [list SendSignal $processPID "SIGKILL"]
# 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 {
# Highlight::ExecuteColorized $widget
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"
}
Highlight::ExecuteColorized $widget
# close $f
} else {
# Highlight::ExecuteColorized $widget
$widget insert "end-4l linestart" "[read $file]"
}
while {[gets $f line]>=0} {
Highlight::ExecuteColorized $widget
$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
}
# Функция для отправки сигнала процессу
proc SendSignal {pid signal} {
global tcl_platform
if {$tcl_platform(platform) eq "unix"} {
# На Unix-системах
switch -- $signal {
"SIGINT" { exec kill -INT $pid } ; # Ctrl+C
"SIGTERM" { exec kill -TERM $pid } ; # Завершение
"SIGTSTP" { exec kill -TSTP $pid } ; # Ctrl+Z (приостановка)
"SIGKILL" { exec kill -KILL $pid } ; # Принудительное завершение
}
} else {
# На Windows
switch -- $signal {
"SIGINT" - "SIGTERM" {
# Используем taskkill для завершения
catch {exec taskkill /PID $pid /T}
}
"SIGKILL" {
# Принудительное завершение на Windows
catch {exec taskkill /PID $pid /T /F}
}
}
}
}
# Правка файла настроек
proc Settings {} {
global dir
FileOper::Edit [file join $dir(cfg) projman.ini]
# Config::read $dir(cfg)
}
# Определяем пути до программ для запуска исходников
proc ExecutorCommandPathSetting {fileType} {
global cfgVariables tcl_platform
# puts $cfgVariables($fileType)
if {[info exists cfgVariables($fileType)] == 1 && $cfgVariables($fileType) ne ""} {
if {$tcl_platform(platform) eq "windows"} {
set cmd "where $cfgVariables($fileType)"
} else {
set cmd "which $cfgVariables($fileType)"
}
puts "ExecutorCommandPathSetting $fileType"
puts [catch {exec {*}$cmd} executor_path]
puts "executor_path $executor_path"
if {[catch {exec {*}$cmd} executor_path]} {
puts "Программа $cfgVariables($fileType) для выполнения файлов $fileType не найдена в системе"
set cfgVariables($fileType) ""
return
}
set full_path [string trim $executor_path]
set first_path [lindex [split $executor_path "\n"] 0]
# puts "Git найден: $first_path"
set cfgVariables($fileType) $first_path
puts "first_path $first_path"
}
if {[info exists cfgVariables($fileType)] == 0} {
set cfgVariables($fileType) ""
puts $cfgVariables($fileType)
}
}

View File

@@ -18,7 +18,8 @@ namespace eval Tree {
# puts "$tree $parent $item $type $text"
switch $type {
file {
regsub -all {\.|/|\\|\s} $item "_" subNode
regsub -all {\.|/|\\|\s|:} $item "_" subNode
set subNode [string tolower $subNode]
# puts "Inserted tree node: $subNode"
set fileExt [string trimleft [file extension $text] "."]
#set fileName [string trimleft [file extension $text] "."]
@@ -41,7 +42,8 @@ namespace eval Tree {
}
}
directory {
regsub -all {\.|/|\\|\s} $item "_" subNode
regsub -all {\.|/|\\|\s|:} $item "_" subNode
set subNode [string tolower $subNode]
# puts $subNode
if {[string match {*debian*} [string tolower [file tail $item]]]} {
set image [::FindImage debian]
@@ -104,7 +106,7 @@ namespace eval Tree {
set key [lindex [split $id "::"] 0]
if {$values eq "" || $key eq ""} {return}
# puts "$key $tree $values"
puts "$key $tree $values"
switch -regexp $key {
directory {
FileOper::ReadFolder $values
@@ -112,6 +114,7 @@ namespace eval Tree {
}
file {
set v [FileOper::Edit $values $nbEditor]
puts $v
if {$v eq false} {
$tree delete $id
}

View File

@@ -9,8 +9,8 @@ exec wish8.6 "$0" -- "$@"
# Home page: https://nuk-svk.ru
######################################################
# Version: 2.0.0
# Release: alpha18
# Build: 27102025193106
# Release: alpha21
# Build: 03122025180445
######################################################
# определим текущую версию, релиз и т.д.
@@ -43,6 +43,24 @@ package require fileutil
# package require Thread
package require fileutil::magic::filetype
# Определим установлен ли пакет Img для расширенной поддержки изображений
proc PackagePresent {pkg} {
# puts $pkg
foreach item [package names] {
# puts [string match -nocase Img $item]
if {[string match -nocase Img $item] == 1} {
puts "The $pkg package was found"
return true
}
}
}
if {[PackagePresent "Img"] eq "true"} {
package require Img
} else {
puts "Img not present"
}
# Устанавливаем текущий каталог
set dir(root) [pwd]
set dir(doc) [file join $dir(root) doc]
@@ -149,4 +167,3 @@ if [info exists opened] {
}
}
}

View File

@@ -6,8 +6,8 @@
#
# $Id: black.tcl,v 1.2 2009/10/25 19:21:30 oberdorfer Exp $
package require Tk 8.4; # minimum version for Tile
package require tile 0.8; # depends upon tile
package require Tk; # minimum version for Tile
package require tile; # depends upon tile
namespace eval ttk {
@@ -39,6 +39,7 @@ namespace eval ttk::theme::black {
-lightest "#ffffff"
-selectbg "#4a6984"
-selectfg "#ffffff"
-font "#c8c8c8"
}
if {[info commands ::ttk::style] ne ""} {
set styleCmd ttk::style
@@ -46,77 +47,83 @@ namespace eval ttk::theme::black {
set styleCmd style
}
$styleCmd theme create black -parent clam -settings {
$styleCmd theme create black -parent clam -settings {
# -----------------------------------------------------------------
# Theme defaults
#
$styleCmd configure "." \
-background $colors(-frame) \
-foreground white \
-bordercolor $colors(-darkest) \
-darkcolor $colors(-dark) \
-lightcolor $colors(-lighter) \
-troughcolor $colors(-darker) \
-selectbackground $colors(-selectbg) \
-selectforeground $colors(-selectfg) \
-selectborderwidth 0 \
-font "{Droid Sans Mono} 9" \
;
# -----------------------------------------------------------------
# Theme defaults
#
$styleCmd configure "." \
-background $colors(-frame) \
-foreground white \
-bordercolor $colors(-darkest) \
-darkcolor $colors(-dark) \
-lightcolor $colors(-lighter) \
-troughcolor $colors(-darker) \
-selectbackground $colors(-selectbg) \
-selectforeground $colors(-selectfg) \
-selectborderwidth 0 \
-font "{Droid Sans Mono} 9" \
;
$styleCmd map "." \
-background [list disabled $colors(-frame) \
active $colors(-lighter)] \
-foreground [list disabled $colors(-disabledfg)] \
-selectbackground [list !focus $colors(-darkest)] \
-selectforeground [list !focus white] \
;
# ttk widgets.
$styleCmd configure TButton \
-width -8 -padding {5 1} -relief link
$styleCmd configure TMenubutton \
-relief flat -arrowsize 0
$styleCmd configure TCheckbutton \
-indicatorbackground $colors(-lighter) -indicatormargin {1 1 4 1}
$styleCmd configure TRadiobutton \
-indicatorbackground $colors(-lighter) -indicatormargin {1 1 4 1}
$styleCmd configure TEntry \
-fieldbackground gray20 -foreground $colors(-font) \
-padding {2 0} -border -1
$styleCmd configure TCombobox \
-fieldbackground white -foreground $colors(-font)\
-padding {2 0}
$styleCmd configure TSpinbox \
-fieldbackground white -foreground $colors(-font) \
-padding {2 0}
$styleCmd configure TNotebook \
-border -1
$styleCmd configure TNotebook.Tab \
-padding {6 2 6 2} \
-border -1
$styleCmd map TNotebook.Tab -background [list \
selected $colors(-lighter)]
# tk widgets.
$styleCmd map Menu \
-background [list active $colors(-dark)] \
-foreground [list disabled $colors(-lightest)] \
$styleCmd configure TreeCtrl \
-background gray30 -itembackground {gray60 gray50} \
-itemfill white -itemaccentfill yellow -border -1
$styleCmd map Treeview\
-background [list selected $colors(-lighter)] \
-foreground [list selected $colors(-selectfg)]
# -background [list selected $colors(-selectbg)] \
$styleCmd configure Treeview -fieldbackground gray25
$styleCmd map "." \
-background [list disabled $colors(-frame) \
active $colors(-lighter)] \
-foreground [list disabled $colors(-disabledfg)] \
-selectbackground [list !focus $colors(-darkest)] \
-selectforeground [list !focus white] \
;
# ttk widgets.
$styleCmd configure TButton \
-width -8 -padding {5 1} -relief link
$styleCmd configure TMenubutton\
-relief flat -arrowsize 0
$styleCmd configure TCheckbutton \
-indicatorbackground $colors(-lighter) -indicatormargin {1 1 4 1}
$styleCmd configure TRadiobutton \
-indicatorbackground $colors(-lighter) -indicatormargin {1 1 4 1}
$styleCmd configure TEntry \
-fieldbackground gray20 -foreground black \
-padding {2 0} -border -1
$styleCmd configure TCombobox \
-fieldbackground white -foreground black \
-padding {2 0}
$styleCmd configure TSpinbox \
-fieldbackground white -foreground black \
-padding {2 0}
$styleCmd configure TNotebook \
-border -1
$styleCmd configure TNotebook.Tab \
-padding {6 2 6 2} \
-border -1
$styleCmd map TNotebook.Tab -background [list \
selected $colors(-lighter)]
# tk widgets.
$styleCmd map Menu \
-background [list active $colors(-lighter)] \
-foreground [list disabled $colors(-disabledfg)]
$styleCmd configure TreeCtrl \
-background gray30 -itembackground {gray60 gray50} \
-itemfill white -itemaccentfill yellow -border -1
$styleCmd map Treeview\
-background [list selected $colors(-lighter)] \
-foreground [list selected $colors(-selectfg)]
# -background [list selected $colors(-selectbg)] \
$styleCmd configure Treeview -fieldbackground gray25
}
$styleCmd map Canvas \
-background [list selected $colors(-lighter)] \
-foreground [list selected $colors(-selectfg)] \
-highlightbackground [list selected $colors(-lighter)]
}
puts [ttk::style element names]
}

View File

@@ -1365,5 +1365,3 @@ proc make-regexp::make-regexp {words} {
set regexp
}
#==============================================================================================