mirror of https://gitlab.com/pamhyr/pamhyr2
ajout automatique de l'extansion .st lorsque l'on ne le stipule pas manuellement dans l'export des tronçons
parent
c2d28b0110
commit
432c263cdf
|
|
@ -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:
|
||||||
|
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)
|
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)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue