Geometry: Make import button an undo command.

This commit is contained in:
Pierre-Antoine Rouby committed 2024-01-08 17:11:10 +01:00
1 parent 30702cb118
commit 4d95e42d20
4 files changed
+68 -27

No files matched your search

+8 -4
View File
@@ -487,8 +487,7 @@ class Reach(SQLSubModel):
Returns:
Nothing.
"""
list_profile = []
list_header = []
imported_profiles = []
try:
list_profile, list_header = self.read_file_st(str(file_path_name))
@@ -505,9 +504,8 @@ class Reach(SQLSubModel):
**d, reach=self, status=self._status
)
prof.import_points(profile)
self.profiles.append(prof)
self._update_profile_numbers()
imported_profiles.append(prof)
self._status.modified()
except FileNotFoundError as e:
logger.error(e)
@@ -515,6 +513,12 @@ class Reach(SQLSubModel):
except FileFormatError as e:
logger.error(e)
e.alert()
finally:
self.profiles = imported_profiles + self.profiles
self._update_profile_numbers()
return imported_profiles
@timer
def read_file_st(self, filename):