From 983510814143643b4c60a4708cc180e70628aba9 Mon Sep 17 00:00:00 2001 From: "Jeison Yehuda Amihud (Blender Dumbass)" Date: Sun, 26 Feb 2023 17:43:12 +0000 Subject: [PATCH] Backup alert! --- settings/oscalls.py | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/settings/oscalls.py b/settings/oscalls.py index abf41ed..42341c6 100644 --- a/settings/oscalls.py +++ b/settings/oscalls.py @@ -2,12 +2,14 @@ # PYTHON 3 import os +import time import datetime import platform from subprocess import * # studio from studio import history +from settings import talk ostype = platform.system() @@ -97,6 +99,32 @@ def file_open(win, path): # done to the blendfile. history.record(win, path, "[Openned]") + + # One more thing that we perhaps ought to do here is a notify the user + # if he is not running the backup creator script. Which is easily + # accesable from the main window. + + try: + with open(win.project+"/backup_data.json") as f: + backup_data = json.load(f) + except: + backup_data = {} + + backup_lastcheck = backup_data.get("lastcheck", 0) + + # If there is at least one minute delay between the last check + # and the current time. We throw a notification at the user. + # ( The backup script should check the blend-files each 30 + # seconds. But could take another 30 actually backing them up ). + + if time.time() + 60 > backup_lastcheck: + + # Blender takes time to load. So it's important to delay the + # notification a little bit. + + time.sleep(3) + + talk.alert("⚠ Backup Script Is Not Running!") else: Open(path) @@ -186,4 +214,4 @@ def get_current_blender(win): ############################################################################ - return "blender" + return "/home/vcs/Software/blender-3.3.0-linux-x64/blender"