Skip to content

Commit a12917c

Browse files
committed
Add update action
1 parent 4e6b80d commit a12917c

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

code.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -950,6 +950,7 @@ def select_application(index: int|tuple) -> None:
950950
actions=list(filter(lambda x: x, [
951951
("Cancel", deselect_application),
952952
("Remove", toggle_application),
953+
("Update", update_application),
953954
("Open", open_application) if not is_screensaver else None,
954955
])),
955956
)
@@ -985,6 +986,27 @@ def toggle_application(full_name: str = None) -> bool:
985986

986987
return result
987988

989+
def update_application(full_name: str = None) -> bool:
990+
global selected_application, current_page
991+
if full_name is None:
992+
if selected_application is None:
993+
return False
994+
full_name = selected_application
995+
repo_owner, repo_name = selected_application.split("/")
996+
997+
result = False
998+
if is_application_installed(repo_name):
999+
if remove_application(full_name):
1000+
result = download_application(full_name)
1001+
else:
1002+
log("Unable to locate application")
1003+
1004+
# hide dialog and update installed state
1005+
deselect_application()
1006+
refresh_page()
1007+
1008+
return result
1009+
9881010
# item selection
9891011

9901012
selected_item = None

0 commit comments

Comments
 (0)