Compare commits

1 Commits

Author SHA1 Message Date
df1d9aa36d Добавил проверку пакета Img. И поправил проверку типов изображений
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 1m23s
2025-10-31 17:30:16 +03:00
6 changed files with 69 additions and 31 deletions

9
debian/changelog vendored
View File

@@ -1,12 +1,11 @@
projman (2.0.0-alpha20) stable; urgency=medium
projman (2.0.0-alpha19) stable; urgency=medium
* Исправил сохранение и закрытие нового файла. Теперь при сохранении файл будет переоткрыт под новым именем.
* Небольшие исправления
-- Sergey Kalinin <svk@nuk-svk.ru> Fri, 31 Oct 2025 18:56:38 +0300
-- Sergey Kalinin <svk@nuk-svk.ru> Thu, 30 Oct 2025 14:47:05 +0300
projman (2.0.0-alpha19) stable; urgency=medium
* Переделал сигналы и сочетния
* Добавлен перевод фокуса ввода на прежнее окно после закрытия диалога выполнения.
* Добавлена передача сигналов для закрытия запущенного процесса
* Изменил виджет текста в окне псевдо-терминала. Добавил подстановку имени файла к командную строку по шаблону %f
@@ -395,5 +394,3 @@ projman (2.0.0-alfa0) stable; urgency=medium

0
errors Normal file
View File

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
# Проверям наличие программы в системе, если есть то добавляем опции
@@ -76,15 +106,15 @@ namespace eval FileOper {
if {$fBinaryType ne ""} {
switch $fBinaryType {
"graphic" {
if {$fBinaryInterp ne "png" && $fBinaryInterp ne "gif" && $fBinaryInterp ne "ppm" && $fBinaryInterp ne "pgm"} {
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
}
}
} else {
return image
}
}
default {
@@ -99,14 +129,15 @@ namespace eval FileOper {
return text
}
"image" {
if {$fBinaryInterp ne "png" && $fBinaryInterp ne "gif" && $fBinaryInterp ne "ppm" && $fBinaryInterp ne "pgm" && $fBinaryInterp} {
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
}
}
return image
}
}
"empty" {
@@ -279,16 +310,14 @@ namespace eval FileOper {
-icon question -type yesnocancel \
-detail [::msgcat::mc "Do you want to save it?"]]
switch $answer {
yes {Save close}
yes Save
no {}
cancel {return "cancel"}
}
}
}
if {[$nbEditor select] eq $nbItem} {
$nbEditor forget $nbItem
destroy $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
@@ -313,7 +342,7 @@ namespace eval FileOper {
NB::NextTab $nbEditor 0
}
proc Save {{type ""}} {
proc Save {} {
global nbEditor tree env activeProject dir
if [info exists activeProject] {
@@ -348,12 +377,6 @@ namespace eval FileOper {
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 {} {

View File

@@ -54,7 +54,7 @@ proc ImageBase64Encode {text} {
{"GIF" {.gif}}
{"JPEG" {.jpg}}
{"BMP" {.bmp}}
# {"SVG" {.svg}}
{"SVG" {.svg}}
{"All files" *}
}
set img [tk_getOpenFile -initialdir $env(HOME) -filetypes $types -parent .]

View File

@@ -1,6 +1,6 @@
#!/bin/sh
# Tcl ignores the next line -*- tcl -*- \
exec wish8.6 "$0" -- "$@"
exec wish9.0 "$0" -- "$@"
######################################################
# Tcl/Tk Project manager 2.0
@@ -9,8 +9,8 @@ exec wish8.6 "$0" -- "$@"
# Home page: https://nuk-svk.ru
######################################################
# Version: 2.0.0
# Release: alpha20
# Build: 31102025185656
# Release: alpha19
# Build: 30102025145246
######################################################
# определим текущую версию, релиз и т.д.
@@ -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]

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 {