From 0bc021cbe8607358e0decb121d312b05d896433c Mon Sep 17 00:00:00 2001 From: misyaguziya Date: Mon, 9 Oct 2023 13:49:22 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=8D[Update]=20Model=20:=20restart?= =?UTF-8?q?=E5=87=A6=E7=90=86=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.bat | 2 +- main.py | 1 + model.py | 8 ++++++++ restart.bat | 4 ++++ 4 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 restart.bat diff --git a/build.bat b/build.bat index 8b50ff9c..9c7d54fe 100644 --- a/build.bat +++ b/build.bat @@ -1 +1 @@ -pyinstaller --onedir --onefile --windowed --clean --icon="./img/vrct_logo_mark_black.ico" --add-data "./img;img/" --add-data "./locales;locales/" --add-data "./update.bat;./" --name VRCT --exclude-module numpy --exclude-module pandas --exclude-module matplotlib --exclude-module PyQt5 main.py \ No newline at end of file +pyinstaller --onedir --onefile --windowed --clean --icon="./img/vrct_logo_mark_black.ico" --add-data "./img;img/" --add-data "./locales;locales/" --add-data "./update.bat;./" --add-data "./restart.bat;./" --name VRCT --exclude-module numpy --exclude-module pandas --exclude-module matplotlib --exclude-module PyQt5 main.py \ No newline at end of file diff --git a/main.py b/main.py index c35708d2..db2bdcbc 100644 --- a/main.py +++ b/main.py @@ -13,6 +13,7 @@ def callbackUpdateSoftware(): def callbackRestartSoftware(): print("callbackRestartSoftware") # model.updateSoftware(restart=True) + model.reStartSoftware() # func transcription send message def sendMicMessage(message): diff --git a/model.py b/model.py index 9a3871d0..2b3eaf80 100644 --- a/model.py +++ b/model.py @@ -256,6 +256,14 @@ class Model: command = [os_path.join(program_directory, batch_name), program_name, temporary_name, str(restart)] Popen(command) + @staticmethod + def reStartSoftware(): + program_name = 'VRCT.exe' + batch_name = 'restart.bat' + program_directory = os_path.dirname(__file__) + command = [os_path.join(program_directory, batch_name), program_name] + Popen(command) + @staticmethod def getListInputHost(): return [host for host in getInputDevices().keys()] diff --git a/restart.bat b/restart.bat new file mode 100644 index 00000000..fc305a6e --- /dev/null +++ b/restart.bat @@ -0,0 +1,4 @@ +@echo off + +taskkill /im %1 /F +START "" %1 \ No newline at end of file