feat: added the option to select all at options at the same time
This commit is contained in:
parent
3cb35909d1
commit
ab61ff7e9b
@ -365,24 +365,30 @@ class Downloader:
|
|||||||
self.search(":".join(input_str.split(":")[1:]))
|
self.search(":".join(input_str.split(":")[1:]))
|
||||||
return False
|
return False
|
||||||
|
|
||||||
indices = []
|
def get_selected_objects(q: str):
|
||||||
for possible_index in query.split(","):
|
if q.strip().lower() == "all":
|
||||||
possible_index = possible_index.strip()
|
return list(self.current_results)
|
||||||
if possible_index == "":
|
|
||||||
continue
|
|
||||||
|
|
||||||
i = 0
|
indices = []
|
||||||
try:
|
for possible_index in q.split(","):
|
||||||
i = int(possible_index)
|
possible_index = possible_index.strip()
|
||||||
except ValueError:
|
if possible_index == "":
|
||||||
raise MKInvalidInputException(message=f"The index \"{possible_index}\" is not a number.")
|
continue
|
||||||
|
|
||||||
if i < 0 or i >= len(self.current_results):
|
i = 0
|
||||||
raise MKInvalidInputException(message=f"The index \"{i}\" is not within the bounds of 0-{len(self.current_results) - 1}.")
|
try:
|
||||||
|
i = int(possible_index)
|
||||||
|
except ValueError:
|
||||||
|
raise MKInvalidInputException(message=f"The index \"{possible_index}\" is not a number.")
|
||||||
|
|
||||||
indices.append(i)
|
if i < 0 or i >= len(self.current_results):
|
||||||
|
raise MKInvalidInputException(message=f"The index \"{i}\" is not within the bounds of 0-{len(self.current_results) - 1}.")
|
||||||
|
|
||||||
selected_objects = [self.current_results[i] for i in indices]
|
indices.append(i)
|
||||||
|
|
||||||
|
return [self.current_results[i] for i in indices]
|
||||||
|
|
||||||
|
selected_objects = get_selected_objects(query)
|
||||||
|
|
||||||
if do_merge:
|
if do_merge:
|
||||||
old_selected_objects = selected_objects
|
old_selected_objects = selected_objects
|
||||||
|
Loading…
Reference in New Issue
Block a user