This commit is contained in:
Alex committed 2026-09-24 18:42:22 +02:00
1 parent 5dc977f9dd
commit 41987f8ea8
17 files changed
+1258 -210

No files matched your search

+23 -9
View File
@@ -1,10 +1,11 @@
<#
<#
.SYNOPSIS
Déploie l'extension « Boîte à créneaux » dans Inkscape.
.DESCRIPTION
Copie box_maker.inx, box_maker.py, box_core.py et images dans un
sous-dossier dédié du répertoire des extensions utilisateur d'Inkscape
Copie box_maker.inx, box_maker.py, box_core.py, le schéma de l'onglet
« Diagram » (images\parameters_en.png) et les traductions compilées
(locale\<langue>\LC_MESSAGES\box_maker.mo) dans un sous-dossier dédié du répertoire des extensions utilisateur d'Inkscape
(Inkscape explore récursivement ce répertoire). Refuse de s'exécuter si
Inkscape est ouvert : les extensions ne sont chargées qu'au démarrage.
@@ -36,7 +37,8 @@ param(
$ErrorActionPreference = 'Stop'
$files = @('box_maker.inx', 'box_maker.py', 'box_core.py')
$files = @('box_maker.inx', 'box_maker.py', 'box_core.py', 'images\parameters_en.png')
$localeDir = 'locale'
$source = $PSScriptRoot
$destination = Join-Path $ExtensionsDir $FolderName
@@ -69,6 +71,9 @@ if ($Uninstall) {
# --- Vérification des sources ------------------------------------------------
$missing = $files | Where-Object { -not (Test-Path -LiteralPath (Join-Path $source $_)) }
if (-not (Test-Path -LiteralPath (Join-Path $source $localeDir))) {
$missing = @($missing) + "$localeDir\ (lancer : python i18n.py)"
}
if ($missing) {
Write-Error "Fichier(s) introuvable(s) dans $source : $($missing -join ', ')"
exit 1
@@ -89,20 +94,29 @@ if (-not (Test-Path -LiteralPath $destination)) {
Write-Host "Dossier créé : $destination"
}
# Images : le dossier est recréé (une image renommée ne reste pas en double)
$imagesTo = Join-Path $destination 'images'
if (Test-Path -LiteralPath $imagesTo) {
Remove-Item -LiteralPath $imagesTo -Recurse -Force
}
foreach ($file in $files) {
$from = Join-Path $source $file
$to = Join-Path $destination $file
$action = if (Test-Path -LiteralPath $to) { 'remplacé' } else { 'copié ' }
New-Item -ItemType Directory -Path (Split-Path $to) -Force | Out-Null
Copy-Item -LiteralPath $from -Destination $to -Force
Write-Host " $action $file"
}
# Schéma affiché dans l'onglet « Schéma » de la boîte de dialogue
$images = Join-Path $source 'images'
if (Test-Path -LiteralPath $images) {
Copy-Item -LiteralPath $images -Destination $destination -Recurse -Force
Write-Host " copié images\"
# Traductions : le dossier est remplacé en entier (langue retirée => supprimée)
$localeTo = Join-Path $destination $localeDir
if (Test-Path -LiteralPath $localeTo) {
Remove-Item -LiteralPath $localeTo -Recurse -Force
}
Copy-Item -LiteralPath (Join-Path $source $localeDir) -Destination $localeTo -Recurse
$languages = Get-ChildItem -LiteralPath $localeTo -Directory | ForEach-Object Name
Write-Host " copié $localeDir\ ($($languages -join ', '))"
# Le cache Python d'une version précédente peut masquer les fichiers copiés
$pycache = Join-Path $destination '__pycache__'