mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
geometry: Fix delete reach row.
This commit is contained in:
1 parent
b93b6fe62d
commit
59c4463bf7
5 files changed
+22
-35
No files matched your search
@@ -99,30 +99,18 @@ class Reach:
|
||||
self._update_profile_numbers()
|
||||
|
||||
|
||||
def delete(self, list_index: list):
|
||||
def delete(self, index: int):
|
||||
"""Delete some elements in profile list
|
||||
|
||||
Args:
|
||||
list_index: The list of element index
|
||||
index: The index to delete
|
||||
|
||||
Returns:
|
||||
Nothing.
|
||||
"""
|
||||
try:
|
||||
if list_index:
|
||||
indices = sorted(list(set(list_index)), reverse=True)
|
||||
for idx in indices:
|
||||
try:
|
||||
self._profiles.pop(idx)
|
||||
self._update_profile_numbers()
|
||||
except IndexError:
|
||||
print(f"Invalid profile index: {idx}")
|
||||
except TypeError:
|
||||
if isinstance(list_index, int):
|
||||
self._profiles.pop(list_index)
|
||||
self._update_profile_numbers()
|
||||
else:
|
||||
raise TypeError(f"{list_index} is instance of unexpected type '{type(list_index)}'")
|
||||
self._profiles.pop(index)
|
||||
self._update_profile_numbers()
|
||||
|
||||
|
||||
def get_x(self):
|
||||
return [profile.x() for profile in self.profiles]
|
||||
|
||||
Reference in new issue
Block a user