Actualiser setup.py
This commit is contained in:
47
setup.py
47
setup.py
@@ -67,13 +67,8 @@ def session_setup():
|
||||
# Notify the user
|
||||
if allow_force_reboot:
|
||||
if uptime_days() > boot_limit_max:
|
||||
# message_box(
|
||||
# message_box_title,
|
||||
# boot_limit_max_message_string % (convert_time_to_hours(force_reboot_timeout), convert_time_to_date(uptime_seconds(), translate=True)),
|
||||
# )
|
||||
ask_message(message_box_title, boot_limit_max_message_string % (convert_time_to_hours(force_reboot_timeout), convert_time_to_date(uptime_seconds(), translate=True)), flags=0, raise_error=False,)
|
||||
#reboot_machine(force=1, timeout=force_reboot_timeout)
|
||||
print("reboot")
|
||||
reboot_machine(force=1, timeout=force_reboot_timeout)
|
||||
return "ERROR"
|
||||
else :
|
||||
print("toto")
|
||||
@@ -107,46 +102,6 @@ def run_session_setup(package_name):
|
||||
for session_id in get_active_sessions():
|
||||
start_interactive_process("wapt-get", "--hide session-setup %s -f" % package_name, session_id=session_id) # , minimize=True
|
||||
|
||||
|
||||
# def message_box(title, text, style=0):
|
||||
# if platform.python_version_tuple()[0] == "3":
|
||||
# import importlib
|
||||
|
||||
# importlib.reload(sys)
|
||||
# else:
|
||||
# reload(sys)
|
||||
# sys.setdefaultencoding("utf-8")
|
||||
|
||||
# MB_OK = 0
|
||||
# MB_OKCANCEL = 1
|
||||
# MB_YESNOCANCEL = 3
|
||||
# MB_YESNO = 4
|
||||
# ctypes.windll.user32.MessageBoxW(0, "%s" % text, "%s" % title, style)
|
||||
# return
|
||||
|
||||
|
||||
# def message_box_ask_reboot(title, text):
|
||||
# if platform.python_version_tuple()[0] == "3":
|
||||
# import importlib
|
||||
|
||||
# importlib.reload(sys)
|
||||
# else:
|
||||
# reload(sys)
|
||||
# sys.setdefaultencoding("utf-8")
|
||||
|
||||
# ID_OK = 0
|
||||
# ID_CANCEL = 2
|
||||
# ID_ABORT = 3
|
||||
# ID_YES = 6
|
||||
# ID_NO = 7
|
||||
|
||||
# response = ctypes.windll.user32.MessageBoxW(0, "%s" % text, "%s" % title, 4)
|
||||
# if response == ID_YES:
|
||||
# reboot_machine()
|
||||
# else:
|
||||
# pass
|
||||
|
||||
|
||||
def uptime_seconds():
|
||||
return time.time() - psutil.boot_time()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user