diff --git a/scanning.ipynb b/scanning.ipynb index 4209d7b..1ffcd81 100644 --- a/scanning.ipynb +++ b/scanning.ipynb @@ -211,9 +211,9 @@ "outputs": [ { "data": { - "text/plain": "'2115507066'" + "text/plain": "'1992141906'" }, - "execution_count": 129, + "execution_count": 130, "metadata": {}, "output_type": "execute_result" } @@ -231,11 +231,11 @@ "metadata": { "collapsed": false, "ExecuteTime": { - "end_time": "2024-01-21T08:59:27.857633500Z", - "start_time": "2024-01-21T08:59:27.836633400Z" + "end_time": "2024-01-21T09:42:09.654427500Z", + "start_time": "2024-01-21T09:42:09.644608500Z" } }, - "execution_count": 129 + "execution_count": 130 }, { "cell_type": "code", diff --git a/src/main.py b/src/main.py index 1190da9..8688720 100644 --- a/src/main.py +++ b/src/main.py @@ -147,11 +147,15 @@ def toggle(): global timer if not toggle_var.get(): if connect_discord(RPC): + stop_variable.clear() timer = RepeatedTimer(interval, update, stop_variable=stop_variable) toggle_var.set(True) + menu.insert(0, item('Disable' if not is_CN else '禁用', toggle)) else: stop_update() toggle_var.set(False) + menu.insert(0, item('Enable' if not is_CN else '启用', toggle)) + icon.menu = menu def about(): @@ -170,10 +174,9 @@ def show_window(icon, item): def hide_window(): + global icon root.withdraw() image = Image.open(get_res_path("app_logo.png")) - menu = [item('Show' if not is_CN else '显示主窗口', show_window), - item('Quit' if not is_CN else '退出', quit_app)] if toggle_var.get(): menu.insert(0, item('Disable' if not is_CN else '禁用', toggle)) else: @@ -369,6 +372,9 @@ def stop_update(): RPC.clear(pid=pid) +menu = [item('Show' if not is_CN else '显示主窗口', show_window, default=True), + item('Quit' if not is_CN else '退出', quit_app)] + root = Tk() root.title('Netease Cloud Music Discord RPC') root.resizable(False, False) @@ -400,6 +406,5 @@ def stop_update(): root.after_idle(startup) root.mainloop() -# TODO: delay before first update -# TODO: disable then enable dont work, just disable work -# TODO: tray icon menu dont update after enable/disable +# TODO: delay before first update - unable to reproduce reliably +# TODO: RuntimeError: Event loop is closed error when re-enabling, doesnt affect functionality though