Добавлен диалог при открытии файлов отличных от текстовых
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled

This commit is contained in:
2025-10-29 09:08:28 +03:00
parent e5b0468a44
commit 4e67dbfccf
3 changed files with 15 additions and 5 deletions

View File

@@ -47,17 +47,17 @@ 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"
switch $fType {
"binary" {
return false
return binary
}
"text" {
return text
}
"image" {
return false
return image
}
default {
return false
@@ -407,7 +407,14 @@ namespace eval FileOper {
# return text
}
"image" {
# return image
if {[tk_messageBox -message [::msgcat::mc "The file looks like a image file"] -icon question -type ok] == "Yes"} {
return
}
}
"binary" {
if {[tk_dialog .question [::msgcat::mc "Open file"] [::msgcat::mc "The file looks like a binary file. Open anyway?"] questhead 0 Yes No] == 1} {
return
}
}
false {
return

View File

@@ -65,6 +65,8 @@
::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 "File saved"
::msgcat::mcset en "Files"
::msgcat::mcset en "Find"
@@ -184,4 +186,3 @@

View File

@@ -88,6 +88,8 @@
::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 en "The file looks like a image. Support not implemented yet." "Файл выглядит как изображение. Поддержка пока не реализована."
::msgcat::mcset ru "Find" "Найти"
::msgcat::mcset ru "Found" "Найдено"
::msgcat::mcset ru "Find in files" "Найти в файлах"