Backup alert!
This commit is contained in:
parent
7368fe85cf
commit
9835108141
|
@ -2,12 +2,14 @@
|
||||||
# PYTHON 3
|
# PYTHON 3
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import time
|
||||||
import datetime
|
import datetime
|
||||||
import platform
|
import platform
|
||||||
from subprocess import *
|
from subprocess import *
|
||||||
|
|
||||||
# studio
|
# studio
|
||||||
from studio import history
|
from studio import history
|
||||||
|
from settings import talk
|
||||||
|
|
||||||
ostype = platform.system()
|
ostype = platform.system()
|
||||||
|
|
||||||
|
@ -97,6 +99,32 @@ def file_open(win, path):
|
||||||
# done to the blendfile.
|
# done to the blendfile.
|
||||||
|
|
||||||
history.record(win, path, "[Openned]")
|
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:
|
else:
|
||||||
Open(path)
|
Open(path)
|
||||||
|
@ -186,4 +214,4 @@ def get_current_blender(win):
|
||||||
|
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
return "blender"
|
return "/home/vcs/Software/blender-3.3.0-linux-x64/blender"
|
||||||
|
|
Loading…
Reference in a new issue