ajout automatique de l'extansion .st lorsque l'on ne le stipule pas manuellement dans l'export des tronçons

This commit is contained in:
Dylan Jeannin committed 2026-04-28 11:06:57 +02:00
1 parent 04ea55e21a
commit bc3ea9c4b9
1 file changed
+11 -2
+11 -2
View File
@@ -20,6 +20,7 @@ import os
import sys import sys
import time import time
import pathlib import pathlib
from pathlib import Path
import logging import logging
from copy import deepcopy from copy import deepcopy
@@ -685,10 +686,18 @@ class GeometryWindow(PamhyrWindow):
) )
if filename != '' and filename is not None: 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): 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") f.write("# Exported from Pamhyr2\n")
self._export_to_file_st_reach(f, self._reach) self._export_to_file_st_reach(f, self._reach)