From 30d055c6b00fdfa1ffb14b226f29097c2b28bcd6 Mon Sep 17 00:00:00 2001 From: yshtcn Date: Thu, 7 Sep 2023 19:54:49 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E5=A2=9E=E5=8A=A0=E4=BA=86=E6=89=93?= =?UTF-8?q?=E5=BC=80=E7=A8=8B=E5=BA=8F=E7=9B=AE=E5=BD=95=E7=9A=84=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=20-=20=E5=A2=9E=E5=8A=A0=E4=BA=86=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E5=92=8C=E4=BF=AE=E6=94=B9=E8=87=AA=E5=90=AF=E5=8A=A8=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E6=97=B6=E6=98=BE=E7=A4=BA=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- heartbeat.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/heartbeat.py b/heartbeat.py index b64bb3f..f06a3b0 100644 --- a/heartbeat.py +++ b/heartbeat.py @@ -216,12 +216,18 @@ def toggle_startup(icon, item): else: add_to_startup(program_name, sys.executable) +def open_current_dir(text): + os.startfile(current_dir) + # 创建状态栏图标和菜单 -menu_items = [item('关闭程序', quit_action)] +menu_items = [ + item('打开程序目录', open_current_dir), + item('关闭程序', quit_action) +] # 判断是否以.exe方式运行,添加相应菜单项 if is_packaged(): - menu_items.insert(0, item('添加/取消自启动', toggle_startup, checked=lambda text: is_in_startup("heartbeat"))) + menu_items.insert(0, item('添加/取消自启动', toggle_startup, checked=lambda text: is_in_startup(title))) else: menu_items.insert(0, item('Py运行不支持自启动', lambda text: None, enabled=False))