summaryrefslogtreecommitdiff
path: root/src/backend/update.py
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2023-04-15 13:40:05 +0100
committerV3n3RiX <venerix@koprulu.sector>2023-04-15 13:40:05 +0100
commit47acd0b822261b6b934f47b89b2276a686cc1865 (patch)
treee9e8088518f5ae5f7cc7e355927da2ce550220d9 /src/backend/update.py
parentbec61c175f88026ff9f45abcb0c66194132b8f5f (diff)
backend : improve the countdown timer, use it to kill the GUI whenever an unsupported operation is requested
Diffstat (limited to 'src/backend/update.py')
-rw-r--r--src/backend/update.py27
1 files changed, 8 insertions, 19 deletions
diff --git a/src/backend/update.py b/src/backend/update.py
index 0954334..f369c97 100644
--- a/src/backend/update.py
+++ b/src/backend/update.py
@@ -35,20 +35,15 @@ def start(gfx_ui=False):
if is_online != 1:
if gfx_ui:
- print("\nNo internet connection; Aborting!\n")
- t = 10
- while t > 0:
- mins, secs = divmod(t, 60)
- timer = '{:02d}:{:02d}'.format(mins, secs)
- print(timer, end='\r')
+ print("\n\nNo internet connection; Aborting!\n")
+ for i in range(9, 0, -1):
+ print(f"Killing application in : {i} seconds!")
time.sleep(1)
- t -= 1
- print("Time is up!")
- sys.exit()
+ sys.exit(app.exec_()) # kill GUI window
else:
print(sisyphus.getcolor.bright_red +
- "\nNo internet connection; Aborting!\n" + sisyphus.getcolor.reset)
+ "\n\nNo internet connection; Aborting!\n" + sisyphus.getcolor.reset)
sys.exit()
else:
if is_sane == 1:
@@ -64,17 +59,11 @@ def start(gfx_ui=False):
if gfx_ui:
print("\n\nInvalid configuration!")
print("Use 'sisyphus branch --help' for help\n")
- t = 10
- while t > 0:
- mins, secs = divmod(t, 60)
- timer = '{:02d}:{:02d}'.format(mins, secs)
- print(timer, end='\r')
+ for i in range(9, 0, -1):
+ print(f"Killing application in : {i} seconds!")
time.sleep(1)
- t -= 1
-
- print("Time is up!")
- sys.exit()
+ sys.exit(app.exec_()) # kill GUI window
else:
print(sisyphus.getcolor.bright_red + "\n\nInvalid configuration!" + sisyphus.getcolor.reset + sisyphus.getcolor.bright_yellow + "\nUse" +
sisyphus.getcolor.reset + " " + "'" + "sisyphus branch --help" + "'" + " " + sisyphus.getcolor.bright_yellow + "for help" + sisyphus.getcolor.reset)