mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
Geometry: Make import button an undo command.
This commit is contained in:
1 parent
30702cb118
commit
4d95e42d20
4 files changed
+68
-27
No files matched your search
@@ -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):
|
||||
|
||||
Reference in new issue
Block a user