Backup alert!

This commit is contained in:
Jeison Yehuda Amihud (Blender Dumbass) 2023-02-26 17:43:12 +00:00
parent 7368fe85cf
commit 9835108141

View file

@ -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"