mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
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:
1 parent
04ea55e21a
commit
bc3ea9c4b9
1 file changed
+10
-1
@@ -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:
|
||||
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)
|
||||
|
||||
|
||||
Reference in new issue
Block a user