From 432c263cdf694c1bede0a44c0ebcc22dc7da30fd Mon Sep 17 00:00:00 2001 From: Dylan Jeannin Date: Mon, 20 Apr 2026 23:01:04 +0200 Subject: [PATCH] =?UTF-8?q?ajout=20automatique=20de=20l'extansion=20.st=20?= =?UTF-8?q?lorsque=20l'on=20ne=20le=20stipule=20pas=20manuellement=20dans?= =?UTF-8?q?=20l'export=20des=20tron=C3=A7ons?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/View/Geometry/Window.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/View/Geometry/Window.py b/src/View/Geometry/Window.py index 13f25e30..0f780035 100644 --- a/src/View/Geometry/Window.py +++ b/src/View/Geometry/Window.py @@ -20,6 +20,7 @@ import os import sys import time import pathlib +from pathlib import Path import logging from copy import deepcopy @@ -685,10 +686,18 @@ class GeometryWindow(PamhyrWindow): ) if filename != '' and filename is not None: - self._export_to_file_st(filename) + suffix = Path(filename).suffix + if suffix != "": + if suffix == ".st" or suffix == ".ST": + self._export_to_file_st(filename[:-3]) + else: + # TODO : prévenir l'utilisateur que le format n'est pas exportable + pass + else: + self._export_to_file_st(filename) def _export_to_file_st(self, filename): - with open(filename, "w+") as f: + with open(filename+".st", "w+") as f: f.write("# Exported from Pamhyr2\n") self._export_to_file_st_reach(f, self._reach)