Added round to elapsed time

Signed-off-by: Lev Rusanov <30170278+JDM170@users.noreply.github.com>
This commit is contained in:
2022-06-22 19:10:48 +07:00
parent e64f27542a
commit 2f8df1b4a4

29
main.py
View File

@@ -110,7 +110,7 @@ w11_apps = [
# "Microsoft.Paint", # Paint (W11) # "Microsoft.Paint", # Paint (W11)
"Microsoft.PowerAutomateDesktop", # (W11) "Microsoft.PowerAutomateDesktop", # (W11)
"Microsoft.Todos", # (W11) "Microsoft.Todos", # (W11)
"MicrosoftTeams", # Teams (W11) # "MicrosoftTeams", # Teams (W11)
"MicrosoftWindows.Client.WebExperience", # Виджеты (W11) "MicrosoftWindows.Client.WebExperience", # Виджеты (W11)
] ]
@@ -157,29 +157,14 @@ def main():
# Start process # Start process
time_start = time() time_start = time()
appslist = convert_applist_to_string(is_w11) appslist = convert_applist_to_string(is_w11)
wim = properties.get("wim").get("path")
mnt = properties.get("mnt").get("path")
with open(ps_script_path, mode="w") as f: # Create powershell script file with open(ps_script_path, mode="w") as f: # Create powershell script file
wim = properties.get("wim").get("path") f.write(ps_script_raw.format(appslist=appslist, wimpath=wim, mntpath=mnt, updpath=properties.get("upd").get("path")))
mnt = properties.get("mnt").get("path")
f.write(ps_script_raw.format(
appslist=appslist,
wimpath=wim,
mntpath=mnt,
updpath=properties.get("upd").get("path")
)
)
if additional_upd and exists(additional_upd): if additional_upd and exists(additional_upd):
f.write(ps_script_additional.format( f.write(ps_script_additional.format(wimpath=wim, mntpath=mnt, sec_updpath=additional_upd))
wimpath=wim,
mntpath=mnt,
sec_updpath=additional_upd
)
)
with open(bat_script_path, mode="w") as f: # Create bat script file with open(bat_script_path, mode="w") as f: # Create bat script file
f.write(bat_script_raw.format( f.write(bat_script_raw.format(mntpath=mnt, wimpath=wim))
mntpath=properties.get("mnt").get("path"),
wimpath=properties.get("wim").get("path")
)
)
# subprocess.Popen("powershell Unblock-File -Path {}".format(ps_script_path)).wait() # subprocess.Popen("powershell Unblock-File -Path {}".format(ps_script_path)).wait()
subprocess.Popen("powershell {}".format(ps_script_path)).wait() subprocess.Popen("powershell {}".format(ps_script_path)).wait()
subprocess.Popen("{}".format(bat_script_path)).wait() subprocess.Popen("{}".format(bat_script_path)).wait()
@@ -187,7 +172,7 @@ def main():
properties.get("mnt")["path"] = "" properties.get("mnt")["path"] = ""
properties.get("upd")["path"] = "" properties.get("upd")["path"] = ""
do_cleanup() do_cleanup()
print("Затраченное время:", ((time()-time_start) / 60)) print("Затраченное время:", round((time()-time_start) / 60))
if __name__ == "__main__": if __name__ == "__main__":