Skip to content

Commit

Permalink
将相关功能合并到generate_time(tag)中
Browse files Browse the repository at this point in the history
  • Loading branch information
Suisuroru committed Sep 21, 2024
1 parent a40fafe commit ad237e1
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions Suya_Downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,22 +66,26 @@ def get_admin():
print("运行目录:", current_working_dir)


def generate_current_time(tag):
def generate_time(tag):
from datetime import datetime
# 使用strftime方法将当前时间格式化为指定的格式
if tag == 0:
export_time = datetime.now().strftime("%Y_%m_%d_%H_%M_%S")
else:
elif tag == 1:
export_time = datetime.now().strftime("%Y/%m/%d|%H:%M:%S")
elif tag == 2:
export_time = time()
else:
export_time = "Unknown request"
return export_time


def export_system_info(msg_box):
import psutil
import platform
# 输出系统信息到文本框
msg_box.insert(tk.END, f"Report Export Time: {generate_current_time(1)}\n")
msg_box.insert(tk.END, f"Unix timestamp: {time()}\n")
msg_box.insert(tk.END, f"Report Export Time: {generate_time(1)}\n")
msg_box.insert(tk.END, f"Unix timestamp: {generate_time(2)}\n")
msg_box.insert(tk.END, f"Running Directory: {current_working_dir}\n")
msg_box.insert(tk.END, f"Suya Downloader Version: {Suya_Downloader_Version}")
if Dev_Version != "":
Expand Down Expand Up @@ -228,7 +232,7 @@ def dupe_crash_report(error_message=None):

# 输出系统信息并写入文件
export_system_info(msg_box)
file_name = generate_current_time(0) + "_CrashReport"
file_name = generate_time(0) + "_CrashReport"
file_path = write_to_file(msg_box, file_name)
open_directory(file_path)

Expand Down Expand Up @@ -520,7 +524,7 @@ def show_ui():

def on_export_button_click():
try:
file_name = generate_current_time(0) + "_InfoExport"
file_name = generate_time(0) + "_InfoExport"
file_path = write_to_file(system_info_box, file_name) # 返回文件的完整路径
msgbox.showinfo(get_text("export_information"),
get_text("export_information_success") + f"{file_path}")
Expand Down

0 comments on commit ad237e1

Please sign in to comment.