From fc8b8ac5eec8304c748cef68d7ef397e82396fbe Mon Sep 17 00:00:00 2001 From: misyaguziya Date: Wed, 25 Oct 2023 22:45:28 +0900 Subject: [PATCH 01/16] =?UTF-8?q?=F0=9F=91=8D[Update]=20Model=20:=20Add=20?= =?UTF-8?q?Installer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.py | 15 +++++- installer/Install.nsi | 108 ++++++++++++++++++++++++++++++++++++++++ installer/Uninstall.nsi | 14 ++++++ model.py | 4 +- 4 files changed, 138 insertions(+), 3 deletions(-) create mode 100644 installer/Install.nsi create mode 100644 installer/Uninstall.nsi diff --git a/config.py b/config.py index afd25f43..cf2c91bf 100644 --- a/config.py +++ b/config.py @@ -1,6 +1,8 @@ import sys import inspect from os import path as os_path +from os import getenv as os_getenv +from os import makedirs as os_makedirs from json import load as json_load from json import dump as json_dump import tkinter as tk @@ -39,10 +41,18 @@ class Config: def VERSION(self): return self._VERSION + @property + def LOCAL_PATH(self): + return self._LOCAL_PATH + @property def PATH_CONFIG(self): return self._PATH_CONFIG + @property + def PATH_LOGS(self): + return self._PATH_LOGS + @property def GITHUB_URL(self): return self._GITHUB_URL @@ -520,7 +530,10 @@ class Config: def init_config(self): # Read Only self._VERSION = "2.0.0" - self._PATH_CONFIG = os_path.join(os_path.dirname(sys.argv[0]), "config.json") + self._LOCAL_PATH = os_path.join(os_getenv('LOCALAPPDATA'), "VRCT") + self._PATH_CONFIG = os_path.join(self._LOCAL_PATH, "config.json") + self._PATH_LOGS = os_path.join(self._LOCAL_PATH, "logs") + os_makedirs(self._LOCAL_PATH, exist_ok=True) self._GITHUB_URL = "https://api.github.com/repos/misyaguziya/VRCT/releases/latest" self._BOOTH_URL = "https://misyaguziya.booth.pm/" self._DOCUMENTS_URL = "https://mzsoftware.notion.site/VRCT-Documents-be79b7a165f64442ad8f326d86c22246" diff --git a/installer/Install.nsi b/installer/Install.nsi new file mode 100644 index 00000000..f32b7b0f --- /dev/null +++ b/installer/Install.nsi @@ -0,0 +1,108 @@ +# Modern UI +!include MUI2.nsh +# nsDialogs +!include nsDialogs.nsh +# LogicLib +!include LogicLib.nsh + +# アプリケーション名 +Name "VRCT Setup" +# 作成されるインストーラ +OutFile "VRCT_Setup.exe" + +RequestExecutionLevel admin +ShowInstDetails show + +# 圧縮メソッド +SetCompressor lzma +# インストールされるディレクトリ +InstallDir "$PROGRAMFILES\VRCT" +# XPマニフェスト +XPStyle on +# ページ +!insertmacro MUI_PAGE_WELCOME +!insertmacro MUI_PAGE_DIRECTORY +Page custom OptionPage OptionPageLeave +!insertmacro MUI_PAGE_INSTFILES +!insertmacro MUI_PAGE_FINISH +# アンインストーラ ページ +!insertmacro MUI_UNPAGE_WELCOME +!insertmacro MUI_UNPAGE_CONFIRM +!insertmacro MUI_UNPAGE_INSTFILES +!insertmacro MUI_UNPAGE_FINISH +# 日本語UI +!insertmacro MUI_LANGUAGE "Japanese" +# インターフェース 設定 +!define MUI_ABORTWARNING +# 変数 +Var Checkbox_InstallDocs +Var Dialog_Options +Var InstallDocs +Var Label_DescriptionOptions + +# 初期化時コールバック +Function .onInit + # オプション値を初期化します。 + StrCpy $InstallDocs ${BST_CHECKED} +FunctionEnd + +# オプション ページ +Function OptionPage + # nsDialogsを作成します。 + nsDialogs::Create 1018 + # 作成されたnsDialogsを変数に代入します。 + Pop $Dialog_Options + + ${If} $Dialog_Options == error + # ダイアログの作成に失敗した場合には終了します。 + Abort + ${EndIf} + + # ラベルを作成します。 + ${NSD_CreateLabel} 0 0 100% 12u "オプションを選択してください。" + # ラベルを変数に代入します。 + Pop $Label_DescriptionOptions + + ${NSD_CreateCheckbox} 0 13u 100% 12u "ドキュメントをインストールする(&D)" + Pop $Checkbox_InstallDocs + + ${If} $InstallDocs == ${BST_CHECKED} + # チェックが入力済の場合、チェックボックスにチェックを入れます。 + ${NSD_Check} $Checkbox_InstallDocs + ${EndIf} + nsDialogs::Show +FunctionEnd + +# オプション ページ退出コールバック +Function OptionPageLeave + ${NSD_GetState} $Checkbox_InstallDocs $InstallDocs +FunctionEnd + +# デフォルト セクション +Section + # 出力先を指定します。 + SetOutPath "$INSTDIR" + # インストールされるファイル + File "..\dist\VRCT.exe" + + ${If} $InstallDocs == ${BST_CHECKED} + # ドキュメントをインストールする場合 + # 出力先を指定します。 + SetOutPath "$INSTDIR\docs" + # インストールされるファイル + File "..\dist\README.txt" + ${EndIf} + + # アンインストーラを出力 + WriteUninstaller "$INSTDIR\Uninstall.exe" + # スタート メニューにショートカットを登録 + CreateDirectory "$SMPROGRAMS\VRCT" + SetOutPath "$INSTDIR" + CreateShortcut "$SMPROGRAMS\VRCT\VRCT.lnk" "$INSTDIR\VRCT.exe" "" + # レジストリに登録 + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VRCT" "DisplayName" "VRCT" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VRCT" "UninstallString" '"$INSTDIR\Uninstall.exe"' +SectionEnd + +# アンインストーラ +!include Uninstall.nsi diff --git a/installer/Uninstall.nsi b/installer/Uninstall.nsi new file mode 100644 index 00000000..4187f6c5 --- /dev/null +++ b/installer/Uninstall.nsi @@ -0,0 +1,14 @@ +# 繧「繝ウ繧、繝ウ繧ケ繝医シ繝ゥ +Section "Uninstall" + # 繧「繝ウ繧、繝ウ繧ケ繝医シ繝ゥ繧貞炎髯、 + Delete "$INSTDIR\Uninstall.exe" + # 繝輔ぃ繧、繝ォ繧貞炎髯、 + Delete "$INSTDIR\VRCT.exe" + # 繝繧」繝ャ繧ッ繝医Μ繧貞炎髯、 + RMDir /r "$INSTDIR" + # 繧ケ繧ソ繝シ繝 繝。繝九Η繝シ縺九i蜑企勁 + Delete "$SMPROGRAMS\VRCT\VRCT.lnk" + RMDir "$SMPROGRAMS\VRCT" + # 繝ャ繧ク繧ケ繝医Μ 繧ュ繝シ繧貞炎髯、 + DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VRCT" +SectionEnd \ No newline at end of file diff --git a/model.py b/model.py index 51a881dd..1be1ce9f 100644 --- a/model.py +++ b/model.py @@ -91,10 +91,10 @@ class Model: return result def startLogger(self): - os_makedirs(os_path.join(os_path.dirname(sys.argv[0]), "logs"), exist_ok=True) + os_makedirs(config.PATH_LOGS, exist_ok=True) logger = getLogger() logger.setLevel(INFO) - file_name = os_path.join(os_path.dirname(sys.argv[0]), "logs", f"{datetime.now().strftime('%Y-%m-%d_%H-%M-%S')}.log") + file_name = os_path.join(config.PATH_LOGS, f"{datetime.now().strftime('%Y-%m-%d_%H-%M-%S')}.log") file_handler = FileHandler(file_name, encoding="utf-8", delay=True) formatter = Formatter("[%(asctime)s] %(message)s") file_handler.setFormatter(formatter) From ad3a8f38ae591734036f61090ea259725e8b3388 Mon Sep 17 00:00:00 2001 From: misyaguziya Date: Thu, 26 Oct 2023 03:52:12 +0900 Subject: [PATCH 02/16] =?UTF-8?q?=F0=9F=91=8D[Update]=20Model=20:=20update?= =?UTF-8?q?=20installer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.bat | 2 +- installer/Install.nsi | 21 ++++++++++++++++++++- installer/Uninstall.nsi | 6 ++++-- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/build.bat b/build.bat index 6dcbbf71..7b723572 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 "./batch;batch/" --name VRCT --exclude-module numpy --exclude-module pandas --exclude-module matplotlib --exclude-module PyQt5 main.py \ No newline at end of file +pyinstaller --windowed --clean --icon="./img/vrct_logo_mark_black.ico" --add-data "./img;img/" --add-data "./locales;locales/" --add-data "./batch;batch/" --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/installer/Install.nsi b/installer/Install.nsi index f32b7b0f..6221b3a5 100644 --- a/installer/Install.nsi +++ b/installer/Install.nsi @@ -5,6 +5,7 @@ # LogicLib !include LogicLib.nsh +Unicode True # アプリケーション名 Name "VRCT Setup" # 作成されるインストーラ @@ -36,14 +37,17 @@ Page custom OptionPage OptionPageLeave !define MUI_ABORTWARNING # 変数 Var Checkbox_InstallDocs +Var Checkbox_InstallShortcut Var Dialog_Options Var InstallDocs +Var InstallShortcut Var Label_DescriptionOptions # 初期化時コールバック Function .onInit # オプション値を初期化します。 StrCpy $InstallDocs ${BST_CHECKED} + StrCpy $InstallShortcut ${BST_CHECKED} FunctionEnd # オプション ページ @@ -66,16 +70,24 @@ Function OptionPage ${NSD_CreateCheckbox} 0 13u 100% 12u "ドキュメントをインストールする(&D)" Pop $Checkbox_InstallDocs + ${NSD_CreateCheckbox} 0 26u 100% 12u "デスクトップにショートカットを作成(&D)" + Pop $Checkbox_InstallShortcut + ${If} $InstallDocs == ${BST_CHECKED} # チェックが入力済の場合、チェックボックスにチェックを入れます。 ${NSD_Check} $Checkbox_InstallDocs ${EndIf} + ${If} $InstallShortcut == ${BST_CHECKED} + # チェックが入力済の場合、チェックボックスにチェックを入れます。 + ${NSD_Check} $Checkbox_InstallShortcut + ${EndIf} nsDialogs::Show FunctionEnd # オプション ページ退出コールバック Function OptionPageLeave ${NSD_GetState} $Checkbox_InstallDocs $InstallDocs + ${NSD_GetState} $Checkbox_InstallShortcut $InstallShortcut FunctionEnd # デフォルト セクション @@ -83,7 +95,7 @@ Section # 出力先を指定します。 SetOutPath "$INSTDIR" # インストールされるファイル - File "..\dist\VRCT.exe" + File /r "..\dist\VRCT\" ${If} $InstallDocs == ${BST_CHECKED} # ドキュメントをインストールする場合 @@ -95,6 +107,12 @@ Section # アンインストーラを出力 WriteUninstaller "$INSTDIR\Uninstall.exe" + + ${If} $InstallDocs == ${BST_CHECKED} + # デスクトップにショートカットを作成 + CreateShortCut "$DESKTOP\VRCT.lnk" "$INSTDIR\VRCT.exe" + ${EndIf} + # スタート メニューにショートカットを登録 CreateDirectory "$SMPROGRAMS\VRCT" SetOutPath "$INSTDIR" @@ -102,6 +120,7 @@ Section # レジストリに登録 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VRCT" "DisplayName" "VRCT" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VRCT" "UninstallString" '"$INSTDIR\Uninstall.exe"' + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VRCT" "DisplayIcon" '"$INSTDIR\_internal\img\vrct_logo_mark_black.ico"' SectionEnd # アンインストーラ diff --git a/installer/Uninstall.nsi b/installer/Uninstall.nsi index 4187f6c5..f44b7ac7 100644 --- a/installer/Uninstall.nsi +++ b/installer/Uninstall.nsi @@ -1,14 +1,16 @@ # 繧「繝ウ繧、繝ウ繧ケ繝医シ繝ゥ Section "Uninstall" # 繧「繝ウ繧、繝ウ繧ケ繝医シ繝ゥ繧貞炎髯、 - Delete "$INSTDIR\Uninstall.exe" + # Delete "$INSTDIR\Uninstall.exe" # 繝輔ぃ繧、繝ォ繧貞炎髯、 - Delete "$INSTDIR\VRCT.exe" + # Delete "$INSTDIR\VRCT.exe" # 繝繧」繝ャ繧ッ繝医Μ繧貞炎髯、 RMDir /r "$INSTDIR" # 繧ケ繧ソ繝シ繝 繝。繝九Η繝シ縺九i蜑企勁 Delete "$SMPROGRAMS\VRCT\VRCT.lnk" RMDir "$SMPROGRAMS\VRCT" + # 繝繧ケ繧ッ繝医ャ繝 繧キ繝ァ繝シ繝医き繝繝医r蜑企勁 + Delete "$DESKTOP\VRCT.lnk" # 繝ャ繧ク繧ケ繝医Μ 繧ュ繝シ繧貞炎髯、 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VRCT" SectionEnd \ No newline at end of file From 85f285271e09f12bfb8713b01acabb76ea230157 Mon Sep 17 00:00:00 2001 From: misyaguziya Date: Thu, 26 Oct 2023 03:52:56 +0900 Subject: [PATCH 03/16] =?UTF-8?q?=F0=9F=90=9B[bugfix]=20Model=20:=20remake?= =?UTF-8?q?=20restart.bat?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- batch/restart.bat | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/batch/restart.bat b/batch/restart.bat index b86be544..c3b7418f 100644 --- a/batch/restart.bat +++ b/batch/restart.bat @@ -1,4 +1,7 @@ @if not "%~0"=="%~dp0.\%~nx0" start /min cmd /c,"%~dp0.\%~nx0" %* & goto :eof -taskkill /im %1 /F -START "" %1 \ No newline at end of file +set name=%1 + +taskkill /im %name% /F + +START "" %name% \ No newline at end of file From 7fe43cc88219efa097c1180c1971f5b8bdc80352 Mon Sep 17 00:00:00 2001 From: misyaguziya Date: Fri, 27 Oct 2023 04:08:21 +0900 Subject: [PATCH 04/16] =?UTF-8?q?=F0=9F=90=9B[bugfix]=20Installer=20:=20?= =?UTF-8?q?=E3=82=A8=E3=83=B3=E3=82=B3=E3=83=BC=E3=83=89=E3=82=92Shift-jis?= =?UTF-8?q?=20->=20UTD-8=20with=20BOM=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- installer/Install.nsi | 74 +++++++++++++++++++++---------------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/installer/Install.nsi b/installer/Install.nsi index 6221b3a5..913d0c38 100644 --- a/installer/Install.nsi +++ b/installer/Install.nsi @@ -1,41 +1,41 @@ -# Modern UI +サソ# Modern UI !include MUI2.nsh # nsDialogs !include nsDialogs.nsh # LogicLib !include LogicLib.nsh -Unicode True -# アプリケーション名 +Unicode true +# 繧「繝励Μ繧ア繝シ繧キ繝ァ繝ウ蜷 Name "VRCT Setup" -# 作成されるインストーラ +# 菴懈舌&繧後k繧、繝ウ繧ケ繝医シ繝ゥ OutFile "VRCT_Setup.exe" RequestExecutionLevel admin ShowInstDetails show -# 圧縮メソッド +# 蝨ァ邵ョ繝。繧ス繝繝 SetCompressor lzma -# インストールされるディレクトリ +# 繧、繝ウ繧ケ繝医シ繝ォ縺輔l繧九ョ繧」繝ャ繧ッ繝医Μ InstallDir "$PROGRAMFILES\VRCT" -# XPマニフェスト +# XP繝槭ル繝輔ぉ繧ケ繝 XPStyle on -# ページ +# 繝壹シ繧ク !insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_DIRECTORY Page custom OptionPage OptionPageLeave !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_FINISH -# アンインストーラ ページ +# 繧「繝ウ繧、繝ウ繧ケ繝医シ繝ゥ 繝壹シ繧ク !insertmacro MUI_UNPAGE_WELCOME !insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_INSTFILES !insertmacro MUI_UNPAGE_FINISH -# 日本語UI +# 譌・譛ャ隱朸I !insertmacro MUI_LANGUAGE "Japanese" -# インターフェース 設定 +# 繧、繝ウ繧ソ繝シ繝輔ぉ繝シ繧ケ 險ュ螳 !define MUI_ABORTWARNING -# 変数 +# 螟画焚 Var Checkbox_InstallDocs Var Checkbox_InstallShortcut Var Dialog_Options @@ -43,85 +43,85 @@ Var InstallDocs Var InstallShortcut Var Label_DescriptionOptions -# 初期化時コールバック +# 蛻晄悄蛹匁凾繧ウ繝シ繝ォ繝舌ャ繧ッ Function .onInit - # オプション値を初期化します。 + # 繧ェ繝励す繝ァ繝ウ蛟、繧貞晄悄蛹悶@縺セ縺吶 StrCpy $InstallDocs ${BST_CHECKED} StrCpy $InstallShortcut ${BST_CHECKED} FunctionEnd -# オプション ページ +# 繧ェ繝励す繝ァ繝ウ 繝壹シ繧ク Function OptionPage - # nsDialogsを作成します。 + # nsDialogs繧剃ス懈舌@縺セ縺吶 nsDialogs::Create 1018 - # 作成されたnsDialogsを変数に代入します。 + # 菴懈舌&繧後◆nsDialogs繧貞、画焚縺ォ莉」蜈・縺励∪縺吶 Pop $Dialog_Options ${If} $Dialog_Options == error - # ダイアログの作成に失敗した場合には終了します。 + # 繝繧、繧「繝ュ繧ー縺ョ菴懈舌↓螟ア謨励@縺溷エ蜷医↓縺ッ邨ゆコ縺励∪縺吶 Abort ${EndIf} - # ラベルを作成します。 - ${NSD_CreateLabel} 0 0 100% 12u "オプションを選択してください。" - # ラベルを変数に代入します。 + # 繝ゥ繝吶Ν繧剃ス懈舌@縺セ縺吶 + ${NSD_CreateLabel} 0 0 100% 12u "繧ェ繝励す繝ァ繝ウ繧帝∈謚槭@縺ヲ縺上□縺輔>縲" + # 繝ゥ繝吶Ν繧貞、画焚縺ォ莉」蜈・縺励∪縺吶 Pop $Label_DescriptionOptions - ${NSD_CreateCheckbox} 0 13u 100% 12u "ドキュメントをインストールする(&D)" + ${NSD_CreateCheckbox} 0 13u 100% 12u "繝峨く繝・繝。繝ウ繝医r繧、繝ウ繧ケ繝医シ繝ォ縺吶k(&D)" Pop $Checkbox_InstallDocs - ${NSD_CreateCheckbox} 0 26u 100% 12u "デスクトップにショートカットを作成(&D)" + ${NSD_CreateCheckbox} 0 26u 100% 12u "繝繧ケ繧ッ繝医ャ繝励↓繧キ繝ァ繝シ繝医き繝繝医r菴懈(&D)" Pop $Checkbox_InstallShortcut ${If} $InstallDocs == ${BST_CHECKED} - # チェックが入力済の場合、チェックボックスにチェックを入れます。 + # 繝√ぉ繝繧ッ縺悟・蜉帶ク医ョ蝣エ蜷医√メ繧ァ繝繧ッ繝懊ャ繧ッ繧ケ縺ォ繝√ぉ繝繧ッ繧貞・繧後∪縺吶 ${NSD_Check} $Checkbox_InstallDocs ${EndIf} ${If} $InstallShortcut == ${BST_CHECKED} - # チェックが入力済の場合、チェックボックスにチェックを入れます。 + # 繝√ぉ繝繧ッ縺悟・蜉帶ク医ョ蝣エ蜷医√メ繧ァ繝繧ッ繝懊ャ繧ッ繧ケ縺ォ繝√ぉ繝繧ッ繧貞・繧後∪縺吶 ${NSD_Check} $Checkbox_InstallShortcut ${EndIf} nsDialogs::Show FunctionEnd -# オプション ページ退出コールバック +# 繧ェ繝励す繝ァ繝ウ 繝壹シ繧ク騾蜃コ繧ウ繝シ繝ォ繝舌ャ繧ッ Function OptionPageLeave ${NSD_GetState} $Checkbox_InstallDocs $InstallDocs ${NSD_GetState} $Checkbox_InstallShortcut $InstallShortcut FunctionEnd -# デフォルト セクション +# 繝繝輔か繝ォ繝 繧サ繧ッ繧キ繝ァ繝ウ Section - # 出力先を指定します。 + # 蜃コ蜉帛医r謖螳壹@縺セ縺吶 SetOutPath "$INSTDIR" - # インストールされるファイル + # 繧、繝ウ繧ケ繝医シ繝ォ縺輔l繧九ヵ繧。繧、繝ォ File /r "..\dist\VRCT\" ${If} $InstallDocs == ${BST_CHECKED} - # ドキュメントをインストールする場合 - # 出力先を指定します。 + # 繝峨く繝・繝。繝ウ繝医r繧、繝ウ繧ケ繝医シ繝ォ縺吶k蝣エ蜷 + # 蜃コ蜉帛医r謖螳壹@縺セ縺吶 SetOutPath "$INSTDIR\docs" - # インストールされるファイル + # 繧、繝ウ繧ケ繝医シ繝ォ縺輔l繧九ヵ繧。繧、繝ォ File "..\dist\README.txt" ${EndIf} - # アンインストーラを出力 + # 繧「繝ウ繧、繝ウ繧ケ繝医シ繝ゥ繧貞コ蜉 WriteUninstaller "$INSTDIR\Uninstall.exe" ${If} $InstallDocs == ${BST_CHECKED} - # デスクトップにショートカットを作成 + # 繝繧ケ繧ッ繝医ャ繝励↓繧キ繝ァ繝シ繝医き繝繝医r菴懈 CreateShortCut "$DESKTOP\VRCT.lnk" "$INSTDIR\VRCT.exe" ${EndIf} - # スタート メニューにショートカットを登録 + # 繧ケ繧ソ繝シ繝 繝。繝九Η繝シ縺ォ繧キ繝ァ繝シ繝医き繝繝医r逋サ骭イ CreateDirectory "$SMPROGRAMS\VRCT" SetOutPath "$INSTDIR" CreateShortcut "$SMPROGRAMS\VRCT\VRCT.lnk" "$INSTDIR\VRCT.exe" "" - # レジストリに登録 + # 繝ャ繧ク繧ケ繝医Μ縺ォ逋サ骭イ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VRCT" "DisplayName" "VRCT" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VRCT" "UninstallString" '"$INSTDIR\Uninstall.exe"' WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VRCT" "DisplayIcon" '"$INSTDIR\_internal\img\vrct_logo_mark_black.ico"' SectionEnd -# アンインストーラ +# 繧「繝ウ繧、繝ウ繧ケ繝医シ繝ゥ !include Uninstall.nsi From 958cd45b0cde793f043e2a65634b6914331a1cce Mon Sep 17 00:00:00 2001 From: misyaguziya Date: Fri, 27 Oct 2023 17:14:52 +0900 Subject: [PATCH 05/16] =?UTF-8?q?[Update]=20installer=20:=20=E6=97=A2?= =?UTF-8?q?=E3=81=AB=E3=82=A4=E3=83=B3=E3=82=B9=E3=83=88=E3=83=BC=E3=83=AB?= =?UTF-8?q?=E6=B8=88=E3=81=BF=E3=81=AE=E5=A0=B4=E5=90=88=E3=80=81=E3=83=95?= =?UTF-8?q?=E3=82=A1=E3=82=A4=E3=83=AB=E3=82=92=E5=89=8A=E9=99=A4=E3=81=97?= =?UTF-8?q?=E3=81=A6=E7=BD=AE=E3=81=8D=E6=8F=9B=E3=81=88=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- installer/Install.nsi | 128 +++++++++++++++++++++++++++++----------- installer/Uninstall.nsi | 16 ----- 2 files changed, 92 insertions(+), 52 deletions(-) delete mode 100644 installer/Uninstall.nsi diff --git a/installer/Install.nsi b/installer/Install.nsi index 913d0c38..5fcb57d6 100644 --- a/installer/Install.nsi +++ b/installer/Install.nsi @@ -1,41 +1,60 @@ -サソ# Modern UI +サソ!define PRODUCT_VERSION "1.0.0.0" +!define VERSION "1.0.0.0" +VIProductVersion "${PRODUCT_VERSION}" +VIFileVersion "${VERSION}" +VIAddVersionKey "FileVersion" "${VERSION}" +VIAddVersionKey "ProductName" "VRCT" +VIAddVersionKey "ProductVersion" "${PRODUCT_VERSION}" +VIAddVersionKey "LegalCopyright" "Copyright m's software" +VIAddVersionKey "FileDescription" "Communication tool with translation & transcription for VRChat" + +; Modern UI !include MUI2.nsh -# nsDialogs +; nsDialogs !include nsDialogs.nsh -# LogicLib +; LogicLib !include LogicLib.nsh +; FileFunc +!include FileFunc.nsh + +!define MUI_ICON "..\img\vrct_logo_mark_black.ico" +!define MUI_UNICON "..\img\vrct_logo_mark_black.ico" Unicode true -# 繧「繝励Μ繧ア繝シ繧キ繝ァ繝ウ蜷 +; 繧「繝励Μ繧ア繝シ繧キ繝ァ繝ウ蜷 Name "VRCT Setup" -# 菴懈舌&繧後k繧、繝ウ繧ケ繝医シ繝ゥ +; 菴懈舌&繧後k繧、繝ウ繧ケ繝医シ繝ゥ OutFile "VRCT_Setup.exe" RequestExecutionLevel admin ShowInstDetails show -# 蝨ァ邵ョ繝。繧ス繝繝 +; 蝨ァ邵ョ繝。繧ス繝繝 SetCompressor lzma -# 繧、繝ウ繧ケ繝医シ繝ォ縺輔l繧九ョ繧」繝ャ繧ッ繝医Μ +; 繧、繝ウ繧ケ繝医シ繝ォ縺輔l繧九ョ繧」繝ャ繧ッ繝医Μ InstallDir "$PROGRAMFILES\VRCT" -# XP繝槭ル繝輔ぉ繧ケ繝 +; XP繝槭ル繝輔ぉ繧ケ繝 XPStyle on -# 繝壹シ繧ク +; 繝壹シ繧ク !insertmacro MUI_PAGE_WELCOME +!insertmacro MUI_PAGE_LICENSE "..\LICENSE" !insertmacro MUI_PAGE_DIRECTORY Page custom OptionPage OptionPageLeave !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_FINISH -# 繧「繝ウ繧、繝ウ繧ケ繝医シ繝ゥ 繝壹シ繧ク +; 繧「繝ウ繧、繝ウ繧ケ繝医シ繝ゥ 繝壹シ繧ク !insertmacro MUI_UNPAGE_WELCOME !insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_INSTFILES !insertmacro MUI_UNPAGE_FINISH -# 譌・譛ャ隱朸I +; 譌・譛ャ隱朸I !insertmacro MUI_LANGUAGE "Japanese" -# 繧、繝ウ繧ソ繝シ繝輔ぉ繝シ繧ケ 險ュ螳 +; 蠑墓焚蜿門セ励槭け繝ュ +!insertmacro GetParameters +!insertmacro GetOptions +; 繧、繝ウ繧ソ繝シ繝輔ぉ繝シ繧ケ 險ュ螳 !define MUI_ABORTWARNING -# 螟画焚 +; 螟画焚 Var Checkbox_InstallDocs Var Checkbox_InstallShortcut Var Dialog_Options @@ -43,28 +62,28 @@ Var InstallDocs Var InstallShortcut Var Label_DescriptionOptions -# 蛻晄悄蛹匁凾繧ウ繝シ繝ォ繝舌ャ繧ッ +; 蛻晄悄蛹匁凾繧ウ繝シ繝ォ繝舌ャ繧ッ Function .onInit - # 繧ェ繝励す繝ァ繝ウ蛟、繧貞晄悄蛹悶@縺セ縺吶 + ; 繧ェ繝励す繝ァ繝ウ蛟、繧貞晄悄蛹悶@縺セ縺吶 StrCpy $InstallDocs ${BST_CHECKED} StrCpy $InstallShortcut ${BST_CHECKED} FunctionEnd -# 繧ェ繝励す繝ァ繝ウ 繝壹シ繧ク +; 繧ェ繝励す繝ァ繝ウ 繝壹シ繧ク Function OptionPage - # nsDialogs繧剃ス懈舌@縺セ縺吶 + ; nsDialogs繧剃ス懈舌@縺セ縺吶 nsDialogs::Create 1018 - # 菴懈舌&繧後◆nsDialogs繧貞、画焚縺ォ莉」蜈・縺励∪縺吶 + ; 菴懈舌&繧後◆nsDialogs繧貞、画焚縺ォ莉」蜈・縺励∪縺吶 Pop $Dialog_Options ${If} $Dialog_Options == error - # 繝繧、繧「繝ュ繧ー縺ョ菴懈舌↓螟ア謨励@縺溷エ蜷医↓縺ッ邨ゆコ縺励∪縺吶 + ; 繝繧、繧「繝ュ繧ー縺ョ菴懈舌↓螟ア謨励@縺溷エ蜷医↓縺ッ邨ゆコ縺励∪縺吶 Abort ${EndIf} - # 繝ゥ繝吶Ν繧剃ス懈舌@縺セ縺吶 + ; 繝ゥ繝吶Ν繧剃ス懈舌@縺セ縺吶 ${NSD_CreateLabel} 0 0 100% 12u "繧ェ繝励す繝ァ繝ウ繧帝∈謚槭@縺ヲ縺上□縺輔>縲" - # 繝ゥ繝吶Ν繧貞、画焚縺ォ莉」蜈・縺励∪縺吶 + ; 繝ゥ繝吶Ν繧貞、画焚縺ォ莉」蜈・縺励∪縺吶 Pop $Label_DescriptionOptions ${NSD_CreateCheckbox} 0 13u 100% 12u "繝峨く繝・繝。繝ウ繝医r繧、繝ウ繧ケ繝医シ繝ォ縺吶k(&D)" @@ -74,54 +93,91 @@ Function OptionPage Pop $Checkbox_InstallShortcut ${If} $InstallDocs == ${BST_CHECKED} - # 繝√ぉ繝繧ッ縺悟・蜉帶ク医ョ蝣エ蜷医√メ繧ァ繝繧ッ繝懊ャ繧ッ繧ケ縺ォ繝√ぉ繝繧ッ繧貞・繧後∪縺吶 + ; 繝√ぉ繝繧ッ縺悟・蜉帶ク医ョ蝣エ蜷医√メ繧ァ繝繧ッ繝懊ャ繧ッ繧ケ縺ォ繝√ぉ繝繧ッ繧貞・繧後∪縺吶 ${NSD_Check} $Checkbox_InstallDocs ${EndIf} ${If} $InstallShortcut == ${BST_CHECKED} - # 繝√ぉ繝繧ッ縺悟・蜉帶ク医ョ蝣エ蜷医√メ繧ァ繝繧ッ繝懊ャ繧ッ繧ケ縺ォ繝√ぉ繝繧ッ繧貞・繧後∪縺吶 + ; 繝√ぉ繝繧ッ縺悟・蜉帶ク医ョ蝣エ蜷医√メ繧ァ繝繧ッ繝懊ャ繧ッ繧ケ縺ォ繝√ぉ繝繧ッ繧貞・繧後∪縺吶 ${NSD_Check} $Checkbox_InstallShortcut ${EndIf} nsDialogs::Show FunctionEnd -# 繧ェ繝励す繝ァ繝ウ 繝壹シ繧ク騾蜃コ繧ウ繝シ繝ォ繝舌ャ繧ッ +; 繧ェ繝励す繝ァ繝ウ 繝壹シ繧ク騾蜃コ繧ウ繝シ繝ォ繝舌ャ繧ッ Function OptionPageLeave ${NSD_GetState} $Checkbox_InstallDocs $InstallDocs ${NSD_GetState} $Checkbox_InstallShortcut $InstallShortcut FunctionEnd -# 繝繝輔か繝ォ繝 繧サ繧ッ繧キ繝ァ繝ウ +; 繝繝輔か繝ォ繝 繧サ繧ッ繧キ繝ァ繝ウ Section - # 蜃コ蜉帛医r謖螳壹@縺セ縺吶 + ; If VRCT is already running, display a warning message and exit + StrCpy $1 "VRCT.exe" + nsProcess::_FindProcess "$1" + Pop $R1 + ${If} $R1 = 0 + nsExec::ExecToStack "taskkill /IM VRCT.exe" + ${EndIf} + + ; 繝繧」繝ャ繧ッ繝医Μ繧貞炎髯、 + RMDir /r "$INSTDIR" + ; 繧ケ繧ソ繝シ繝 繝。繝九Η繝シ縺九i蜑企勁 + Delete "$SMPROGRAMS\VRCT\VRCT.lnk" + RMDir "$SMPROGRAMS\VRCT" + ; 繝繧ケ繧ッ繝医ャ繝 繧キ繝ァ繝シ繝医き繝繝医r蜑企勁 + Delete "$DESKTOP\VRCT.lnk" + ; 繝ャ繧ク繧ケ繝医Μ 繧ュ繝シ繧貞炎髯、 + DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VRCT" + + ; 蜃コ蜉帛医r謖螳壹@縺セ縺吶 SetOutPath "$INSTDIR" - # 繧、繝ウ繧ケ繝医シ繝ォ縺輔l繧九ヵ繧。繧、繝ォ + ; 繧、繝ウ繧ケ繝医シ繝ォ縺輔l繧九ヵ繧。繧、繝ォ File /r "..\dist\VRCT\" ${If} $InstallDocs == ${BST_CHECKED} - # 繝峨く繝・繝。繝ウ繝医r繧、繝ウ繧ケ繝医シ繝ォ縺吶k蝣エ蜷 - # 蜃コ蜉帛医r謖螳壹@縺セ縺吶 + ; 繝峨く繝・繝。繝ウ繝医r繧、繝ウ繧ケ繝医シ繝ォ縺吶k蝣エ蜷 + ; 蜃コ蜉帛医r謖螳壹@縺セ縺吶 SetOutPath "$INSTDIR\docs" - # 繧、繝ウ繧ケ繝医シ繝ォ縺輔l繧九ヵ繧。繧、繝ォ + ; 繧、繝ウ繧ケ繝医シ繝ォ縺輔l繧九ヵ繧。繧、繝ォ File "..\dist\README.txt" ${EndIf} - # 繧「繝ウ繧、繝ウ繧ケ繝医シ繝ゥ繧貞コ蜉 + ; 繧「繝ウ繧、繝ウ繧ケ繝医シ繝ゥ繧貞コ蜉 WriteUninstaller "$INSTDIR\Uninstall.exe" ${If} $InstallDocs == ${BST_CHECKED} - # 繝繧ケ繧ッ繝医ャ繝励↓繧キ繝ァ繝シ繝医き繝繝医r菴懈 + ; 繝繧ケ繧ッ繝医ャ繝励↓繧キ繝ァ繝シ繝医き繝繝医r菴懈 CreateShortCut "$DESKTOP\VRCT.lnk" "$INSTDIR\VRCT.exe" ${EndIf} - # 繧ケ繧ソ繝シ繝 繝。繝九Η繝シ縺ォ繧キ繝ァ繝シ繝医き繝繝医r逋サ骭イ + ; 繧ケ繧ソ繝シ繝 繝。繝九Η繝シ縺ォ繧キ繝ァ繝シ繝医き繝繝医r逋サ骭イ CreateDirectory "$SMPROGRAMS\VRCT" SetOutPath "$INSTDIR" CreateShortcut "$SMPROGRAMS\VRCT\VRCT.lnk" "$INSTDIR\VRCT.exe" "" - # 繝ャ繧ク繧ケ繝医Μ縺ォ逋サ骭イ + ; 繝ャ繧ク繧ケ繝医Μ縺ォ逋サ骭イ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VRCT" "DisplayName" "VRCT" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VRCT" "UninstallString" '"$INSTDIR\Uninstall.exe"' WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VRCT" "DisplayIcon" '"$INSTDIR\_internal\img\vrct_logo_mark_black.ico"' SectionEnd -# 繧「繝ウ繧、繝ウ繧ケ繝医シ繝ゥ -!include Uninstall.nsi +; 繧「繝ウ繧、繝ウ繧ケ繝医シ繝ゥ +Section Uninstall + ; If VRCT is already running, display a warning message and exit + StrCpy $1 "VRCT.exe" + nsProcess::_FindProcess "$1" + Pop $R1 + ${If} $R1 = 0 + MessageBox MB_OK|MB_ICONEXCLAMATION "VRCT is still running. Cannot uninstall this software.$\nPlease close VRCT and try again." /SD IDOK + Abort + ${EndIf} + ; 繝繧」繝ャ繧ッ繝医Μ繧貞炎髯、 + RMDir /r "$INSTDIR" + RMDir /r "$LOCALAPPDATA\VRCT" + ; 繧ケ繧ソ繝シ繝 繝。繝九Η繝シ縺九i蜑企勁 + Delete "$SMPROGRAMS\VRCT\VRCT.lnk" + RMDir "$SMPROGRAMS\VRCT" + ; 繝繧ケ繧ッ繝医ャ繝 繧キ繝ァ繝シ繝医き繝繝医r蜑企勁 + Delete "$DESKTOP\VRCT.lnk" + ; 繝ャ繧ク繧ケ繝医Μ 繧ュ繝シ繧貞炎髯、 + DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VRCT" +SectionEnd \ No newline at end of file diff --git a/installer/Uninstall.nsi b/installer/Uninstall.nsi deleted file mode 100644 index f44b7ac7..00000000 --- a/installer/Uninstall.nsi +++ /dev/null @@ -1,16 +0,0 @@ -# 繧「繝ウ繧、繝ウ繧ケ繝医シ繝ゥ -Section "Uninstall" - # 繧「繝ウ繧、繝ウ繧ケ繝医シ繝ゥ繧貞炎髯、 - # Delete "$INSTDIR\Uninstall.exe" - # 繝輔ぃ繧、繝ォ繧貞炎髯、 - # Delete "$INSTDIR\VRCT.exe" - # 繝繧」繝ャ繧ッ繝医Μ繧貞炎髯、 - RMDir /r "$INSTDIR" - # 繧ケ繧ソ繝シ繝 繝。繝九Η繝シ縺九i蜑企勁 - Delete "$SMPROGRAMS\VRCT\VRCT.lnk" - RMDir "$SMPROGRAMS\VRCT" - # 繝繧ケ繧ッ繝医ャ繝 繧キ繝ァ繝シ繝医き繝繝医r蜑企勁 - Delete "$DESKTOP\VRCT.lnk" - # 繝ャ繧ク繧ケ繝医Μ 繧ュ繝シ繧貞炎髯、 - DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VRCT" -SectionEnd \ No newline at end of file From 676a64d0f50d04a4fd9e9e362f9b9c41666be496 Mon Sep 17 00:00:00 2001 From: misyaguziya Date: Mon, 30 Oct 2023 18:25:22 +0900 Subject: [PATCH 06/16] =?UTF-8?q?=F0=9F=91=8D[Update]=20installer=20:=20?= =?UTF-8?q?=E3=82=A4=E3=83=B3=E3=82=B9=E3=83=88=E3=83=BC=E3=83=AB=E3=81=99?= =?UTF-8?q?=E3=82=8B=E3=83=91=E3=82=B9=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.py | 3 +-- installer/Install.nsi | 6 +++--- model.py | 5 +++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/config.py b/config.py index cf2c91bf..7b7c4c27 100644 --- a/config.py +++ b/config.py @@ -530,10 +530,9 @@ class Config: def init_config(self): # Read Only self._VERSION = "2.0.0" - self._LOCAL_PATH = os_path.join(os_getenv('LOCALAPPDATA'), "VRCT") + self._LOCAL_PATH = os_path.dirname(sys.argv[0]) self._PATH_CONFIG = os_path.join(self._LOCAL_PATH, "config.json") self._PATH_LOGS = os_path.join(self._LOCAL_PATH, "logs") - os_makedirs(self._LOCAL_PATH, exist_ok=True) self._GITHUB_URL = "https://api.github.com/repos/misyaguziya/VRCT/releases/latest" self._BOOTH_URL = "https://misyaguziya.booth.pm/" self._DOCUMENTS_URL = "https://mzsoftware.notion.site/VRCT-Documents-be79b7a165f64442ad8f326d86c22246" diff --git a/installer/Install.nsi b/installer/Install.nsi index 5fcb57d6..5ee5b8bc 100644 --- a/installer/Install.nsi +++ b/installer/Install.nsi @@ -32,13 +32,13 @@ ShowInstDetails show ; 蝨ァ邵ョ繝。繧ス繝繝 SetCompressor lzma ; 繧、繝ウ繧ケ繝医シ繝ォ縺輔l繧九ョ繧」繝ャ繧ッ繝医Μ -InstallDir "$PROGRAMFILES\VRCT" +InstallDir "$LOCALAPPDATA\VRCT" ; XP繝槭ル繝輔ぉ繧ケ繝 XPStyle on ; 繝壹シ繧ク !insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_LICENSE "..\LICENSE" -!insertmacro MUI_PAGE_DIRECTORY +;!insertmacro MUI_PAGE_DIRECTORY Page custom OptionPage OptionPageLeave !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_FINISH @@ -132,7 +132,7 @@ Section ; 蜃コ蜉帛医r謖螳壹@縺セ縺吶 SetOutPath "$INSTDIR" ; 繧、繝ウ繧ケ繝医シ繝ォ縺輔l繧九ヵ繧。繧、繝ォ - File /r "..\dist\VRCT\" + File /r "..\dist\VRCT" ${If} $InstallDocs == ${BST_CHECKED} ; 繝峨く繝・繝。繝ウ繝医r繧、繝ウ繧ケ繝医シ繝ォ縺吶k蝣エ蜷 diff --git a/model.py b/model.py index 1be1ce9f..af1d3777 100644 --- a/model.py +++ b/model.py @@ -266,7 +266,7 @@ class Model: @staticmethod def updateSoftware(restart:bool=True): - filename = 'download.zip' + filename = 'VRCT.zip' program_name = 'VRCT.exe' temporary_name = '_VRCT.exe' tmp_directory_name = 'tmp' @@ -276,7 +276,8 @@ class Model: try: res = requests_get(config.GITHUB_URL) - url = res.json()['assets'][0]['browser_download_url'] + assets = res.json()['assets'][0]['browser_download_url'] + url = [i["browser_download_url"] for i in assets if i["name"] == filename][0] res = requests_get(url, stream=True) os_makedirs(os_path.join(current_directory, tmp_directory_name), exist_ok=True) with open(os_path.join(current_directory, tmp_directory_name, filename), 'wb') as file: From a25fe345ed4204891d97695ebc95965f16a0c97e Mon Sep 17 00:00:00 2001 From: misyaguziya Date: Mon, 30 Oct 2023 20:29:18 +0900 Subject: [PATCH 07/16] =?UTF-8?q?=F0=9F=91=8D[Update]=20installer=20:=20au?= =?UTF-8?q?toupdate=E3=81=AE=E5=87=A6=E7=90=86=E3=82=92=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- batch/update.bat | 19 ++++++++++++------- installer/Install.nsi | 2 +- model.py | 6 ++---- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/batch/update.bat b/batch/update.bat index 2a7fc7b2..a492fbc4 100644 --- a/batch/update.bat +++ b/batch/update.bat @@ -1,11 +1,16 @@ @if not "%~0"=="%~dp0.\%~nx0" start /min cmd /c,"%~dp0.\%~nx0" %* & goto :eof -taskkill /im %1 /F +set exe_name=%1 +set folder_name=%2 +set tmp_name=%3 +set restart=%4 + +taskkill /im %exe_name% /F ping -n 2 127.0.0.1 > nul -del /f %1 -ping -n 2 127.0.0.1 > nul -rename %2 %1 -ping -n 2 127.0.0.1 > nul -if %3 == True ( - START "" %1 +del /f %exe_name% +rmdir /s %folder_name% +move %tmp_name%\* .\ +del /f %tmp_name% +if %restart% == True ( + START "" %exe_name% ) \ No newline at end of file diff --git a/installer/Install.nsi b/installer/Install.nsi index 5ee5b8bc..45235ed8 100644 --- a/installer/Install.nsi +++ b/installer/Install.nsi @@ -139,7 +139,7 @@ Section ; 蜃コ蜉帛医r謖螳壹@縺セ縺吶 SetOutPath "$INSTDIR\docs" ; 繧、繝ウ繧ケ繝医シ繝ォ縺輔l繧九ヵ繧。繧、繝ォ - File "..\dist\README.txt" + File "..\README.txt" ${EndIf} ; 繧「繝ウ繧、繝ウ繧ケ繝医シ繝ゥ繧貞コ蜉 diff --git a/model.py b/model.py index af1d3777..ecf57fc3 100644 --- a/model.py +++ b/model.py @@ -268,7 +268,7 @@ class Model: def updateSoftware(restart:bool=True): filename = 'VRCT.zip' program_name = 'VRCT.exe' - temporary_name = '_VRCT.exe' + folder_name = '_internal' tmp_directory_name = 'tmp' batch_name = 'update.bat' current_directory = os_path.dirname(sys.argv[0]) @@ -285,9 +285,7 @@ class Model: file.write(chunk) with ZipFile(os_path.join(current_directory, tmp_directory_name, filename)) as zf: zf.extract(program_name, os_path.join(current_directory, tmp_directory_name)) - os_rename(os_path.join(current_directory, tmp_directory_name, program_name), os_path.join(current_directory, temporary_name)) - rmtree(os_path.join(current_directory, tmp_directory_name)) - command = [os_path.join(program_directory, "batch", batch_name), program_name, temporary_name, str(restart)] + command = [os_path.join(program_directory, "batch", batch_name), program_name, folder_name, tmp_directory_name, str(restart)] Popen(command) except: webbrowser.open(config.BOOTH_URL, new=2, autoraise=True) From bfd718ce76f9a5a60083304c39a85fccb6ed4105 Mon Sep 17 00:00:00 2001 From: misyaguziya Date: Tue, 31 Oct 2023 15:31:44 +0900 Subject: [PATCH 08/16] =?UTF-8?q?=F0=9F=90=9B[bugfix]=20installer=20:=20?= =?UTF-8?q?=E3=83=91=E3=82=B9=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- installer/Install.nsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer/Install.nsi b/installer/Install.nsi index 45235ed8..f02335ee 100644 --- a/installer/Install.nsi +++ b/installer/Install.nsi @@ -132,7 +132,7 @@ Section ; 蜃コ蜉帛医r謖螳壹@縺セ縺吶 SetOutPath "$INSTDIR" ; 繧、繝ウ繧ケ繝医シ繝ォ縺輔l繧九ヵ繧。繧、繝ォ - File /r "..\dist\VRCT" + File /r "..\dist\VRCT\" ${If} $InstallDocs == ${BST_CHECKED} ; 繝峨く繝・繝。繝ウ繝医r繧、繝ウ繧ケ繝医シ繝ォ縺吶k蝣エ蜷 From 033a64a725af7c690e95631abc92430b601c3ff8 Mon Sep 17 00:00:00 2001 From: misyaguziya Date: Tue, 31 Oct 2023 16:34:05 +0900 Subject: [PATCH 09/16] =?UTF-8?q?=F0=9F=91=8D[Update]=20installer=20:=20?= =?UTF-8?q?=E6=9A=AB=E5=AE=9A=E7=9A=84=E3=81=AB=E6=9B=B4=E6=96=B0=E5=87=A6?= =?UTF-8?q?=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 --- batch/update.bat | 18 +++++++++++------- model.py | 28 +++++++++++++++++----------- 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/batch/update.bat b/batch/update.bat index a492fbc4..cb56a4bb 100644 --- a/batch/update.bat +++ b/batch/update.bat @@ -1,16 +1,20 @@ @if not "%~0"=="%~dp0.\%~nx0" start /min cmd /c,"%~dp0.\%~nx0" %* & goto :eof set exe_name=%1 -set folder_name=%2 -set tmp_name=%3 -set restart=%4 +set exe_tmp_name=%2 +set folder_name=%3 +set folder_tmp_name=%4 +set restart=%5 taskkill /im %exe_name% /F ping -n 2 127.0.0.1 > nul del /f %exe_name% -rmdir /s %folder_name% -move %tmp_name%\* .\ -del /f %tmp_name% +rename %exe_tmp_name% %exe_name% +rmdir /s /q %folder_name% +rename %folder_tmp_name% %folder_name% + if %restart% == True ( START "" %exe_name% -) \ No newline at end of file +) + +del /f "%~dp0%~nx0" \ No newline at end of file diff --git a/model.py b/model.py index ecf57fc3..119be153 100644 --- a/model.py +++ b/model.py @@ -1,9 +1,9 @@ import sys from zipfile import ZipFile -from subprocess import Popen +from subprocess import Popen, PIPE from os import makedirs as os_makedirs -from os import path as os_path, rename as os_rename -from shutil import rmtree +from os import path as os_path +from shutil import rmtree, move from datetime import datetime from logging import getLogger, FileHandler, Formatter, INFO from time import sleep @@ -268,15 +268,16 @@ class Model: def updateSoftware(restart:bool=True): filename = 'VRCT.zip' program_name = 'VRCT.exe' + program_tmp_name = '_VRCT.exe' folder_name = '_internal' + folder_tmp_name = '__internal' tmp_directory_name = 'tmp' batch_name = 'update.bat' - current_directory = os_path.dirname(sys.argv[0]) - program_directory = os_path.dirname(__file__) + current_directory = config.LOCAL_PATH try: res = requests_get(config.GITHUB_URL) - assets = res.json()['assets'][0]['browser_download_url'] + assets = res.json()['assets'] url = [i["browser_download_url"] for i in assets if i["name"] == filename][0] res = requests_get(url, stream=True) os_makedirs(os_path.join(current_directory, tmp_directory_name), exist_ok=True) @@ -284,10 +285,15 @@ class Model: for chunk in res.iter_content(chunk_size=1024): file.write(chunk) with ZipFile(os_path.join(current_directory, tmp_directory_name, filename)) as zf: - zf.extract(program_name, os_path.join(current_directory, tmp_directory_name)) - command = [os_path.join(program_directory, "batch", batch_name), program_name, folder_name, tmp_directory_name, str(restart)] - Popen(command) - except: + zf.extractall(os_path.join(current_directory, tmp_directory_name)) + move(os_path.join(current_directory, tmp_directory_name, program_name), os_path.join(current_directory, program_tmp_name)) + move(os_path.join(current_directory, tmp_directory_name, folder_name), os_path.join(current_directory, folder_tmp_name)) + move(os_path.join(current_directory, folder_name, "batch", batch_name), os_path.join(current_directory, batch_name)) + rmtree(os_path.join(current_directory, tmp_directory_name)) + command = [os_path.join(current_directory, batch_name), program_name, program_tmp_name, folder_name, folder_tmp_name, str(restart)] + Popen(command, cwd=current_directory) + except Exception as e: + print(e) webbrowser.open(config.BOOTH_URL, new=2, autoraise=True) @staticmethod @@ -296,7 +302,7 @@ class Model: batch_name = 'restart.bat' program_directory = os_path.dirname(__file__) command = [os_path.join(program_directory, "batch", batch_name), program_name] - Popen(command) + Popen(command, cwd=current_directory) @staticmethod def getListInputHost(): From 57a040f6482248541a89e74ceec702cfc3dee3f6 Mon Sep 17 00:00:00 2001 From: misyaguziya Date: Tue, 31 Oct 2023 17:24:46 +0900 Subject: [PATCH 10/16] =?UTF-8?q?=F0=9F=91=8D[Update]=20installer=20:=20?= =?UTF-8?q?=E3=83=87=E3=83=BC=E3=82=BF=E7=A7=BB=E8=A1=8C=E3=81=AE=E5=87=A6?= =?UTF-8?q?=E7=90=86=E3=82=92=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- batch/update.bat | 11 +++++------ model.py | 5 +---- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/batch/update.bat b/batch/update.bat index cb56a4bb..7353721c 100644 --- a/batch/update.bat +++ b/batch/update.bat @@ -1,17 +1,16 @@ @if not "%~0"=="%~dp0.\%~nx0" start /min cmd /c,"%~dp0.\%~nx0" %* & goto :eof set exe_name=%1 -set exe_tmp_name=%2 -set folder_name=%3 -set folder_tmp_name=%4 -set restart=%5 +set folder_name=%2 +set folder_tmp=%3 +set restart=%4 taskkill /im %exe_name% /F ping -n 2 127.0.0.1 > nul del /f %exe_name% -rename %exe_tmp_name% %exe_name% rmdir /s /q %folder_name% -rename %folder_tmp_name% %folder_name% +move /Y %exe_tmp_name%\* .\ +rmdir /s /q %exe_tmp_name% if %restart% == True ( START "" %exe_name% diff --git a/model.py b/model.py index 119be153..24d3b770 100644 --- a/model.py +++ b/model.py @@ -286,11 +286,8 @@ class Model: file.write(chunk) with ZipFile(os_path.join(current_directory, tmp_directory_name, filename)) as zf: zf.extractall(os_path.join(current_directory, tmp_directory_name)) - move(os_path.join(current_directory, tmp_directory_name, program_name), os_path.join(current_directory, program_tmp_name)) - move(os_path.join(current_directory, tmp_directory_name, folder_name), os_path.join(current_directory, folder_tmp_name)) move(os_path.join(current_directory, folder_name, "batch", batch_name), os_path.join(current_directory, batch_name)) - rmtree(os_path.join(current_directory, tmp_directory_name)) - command = [os_path.join(current_directory, batch_name), program_name, program_tmp_name, folder_name, folder_tmp_name, str(restart)] + command = [os_path.join(current_directory, batch_name), program_name, folder_name, tmp_directory_name, str(restart)] Popen(command, cwd=current_directory) except Exception as e: print(e) From 9951398c361518c4916590594fedd9bbb4a0a5bc Mon Sep 17 00:00:00 2001 From: misyaguziya Date: Wed, 1 Nov 2023 04:09:41 +0900 Subject: [PATCH 11/16] =?UTF-8?q?=F0=9F=90=9B[bugfix]=20installer=20:=20re?= =?UTF-8?q?start=E5=87=A6=E7=90=86=E6=99=82=E3=81=AB=E3=83=91=E3=82=B9?= =?UTF-8?q?=E3=81=8C=E3=81=8A=E3=81=8B=E3=81=97=E3=81=8F=E3=81=AA=E3=82=8B?= =?UTF-8?q?=E5=95=8F=E9=A1=8C=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- batch/restart.bat | 3 ++- batch/update.bat | 3 ++- model.py | 8 ++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/batch/restart.bat b/batch/restart.bat index c3b7418f..e02b64a0 100644 --- a/batch/restart.bat +++ b/batch/restart.bat @@ -1,7 +1,8 @@ @if not "%~0"=="%~dp0.\%~nx0" start /min cmd /c,"%~dp0.\%~nx0" %* & goto :eof set name=%1 +set path=%~dp0 taskkill /im %name% /F -START "" %name% \ No newline at end of file +START "" %path%/%name% \ No newline at end of file diff --git a/batch/update.bat b/batch/update.bat index 7353721c..4bc2e679 100644 --- a/batch/update.bat +++ b/batch/update.bat @@ -4,6 +4,7 @@ set exe_name=%1 set folder_name=%2 set folder_tmp=%3 set restart=%4 +set path=%~dp0 taskkill /im %exe_name% /F ping -n 2 127.0.0.1 > nul @@ -13,7 +14,7 @@ move /Y %exe_tmp_name%\* .\ rmdir /s /q %exe_tmp_name% if %restart% == True ( - START "" %exe_name% + START "" %path%/%exe_name% ) del /f "%~dp0%~nx0" \ No newline at end of file diff --git a/model.py b/model.py index 24d3b770..f79c4dfc 100644 --- a/model.py +++ b/model.py @@ -268,9 +268,7 @@ class Model: def updateSoftware(restart:bool=True): filename = 'VRCT.zip' program_name = 'VRCT.exe' - program_tmp_name = '_VRCT.exe' folder_name = '_internal' - folder_tmp_name = '__internal' tmp_directory_name = 'tmp' batch_name = 'update.bat' current_directory = config.LOCAL_PATH @@ -296,9 +294,11 @@ class Model: @staticmethod def reStartSoftware(): program_name = 'VRCT.exe' + folder_name = '_internal' batch_name = 'restart.bat' - program_directory = os_path.dirname(__file__) - command = [os_path.join(program_directory, "batch", batch_name), program_name] + current_directory = config.LOCAL_PATH + + command = [os_path.join(current_directory, folder_name, "batch", batch_name), program_name] Popen(command, cwd=current_directory) @staticmethod From 2f27ae3464222fa90c184b9e88371e8e21354369 Mon Sep 17 00:00:00 2001 From: misyaguziya Date: Wed, 1 Nov 2023 06:00:51 +0900 Subject: [PATCH 12/16] =?UTF-8?q?=F0=9F=90=9B[bugfix]=20installer=20:=20up?= =?UTF-8?q?date=E5=87=A6=E7=90=86=E3=81=AE=E3=83=91=E3=82=B9=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- batch/restart.bat | 7 ++++--- batch/update.bat | 14 +++++++------- model.py | 6 ++++-- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/batch/restart.bat b/batch/restart.bat index e02b64a0..b6e9b03b 100644 --- a/batch/restart.bat +++ b/batch/restart.bat @@ -1,8 +1,9 @@ @if not "%~0"=="%~dp0.\%~nx0" start /min cmd /c,"%~dp0.\%~nx0" %* & goto :eof set name=%1 -set path=%~dp0 +set local_path=%~dp0 taskkill /im %name% /F - -START "" %path%/%name% \ No newline at end of file +ping -n 2 127.0.0.1 > nul +START "" %local_path%%name% +del /f "%~dp0%~nx0" \ No newline at end of file diff --git a/batch/update.bat b/batch/update.bat index 4bc2e679..e0e83855 100644 --- a/batch/update.bat +++ b/batch/update.bat @@ -4,17 +4,17 @@ set exe_name=%1 set folder_name=%2 set folder_tmp=%3 set restart=%4 -set path=%~dp0 +set local_path=%~dp0 taskkill /im %exe_name% /F ping -n 2 127.0.0.1 > nul -del /f %exe_name% -rmdir /s /q %folder_name% -move /Y %exe_tmp_name%\* .\ -rmdir /s /q %exe_tmp_name% +del /f %local_path%%exe_name% +rmdir /s /q %local_path%%folder_name% +xcopy %local_path%%folder_tmp% %local_path% /E /I +rmdir /s /q %local_path%%folder_tmp% if %restart% == True ( - START "" %path%/%exe_name% + START "" %local_path%%exe_name% ) - +pause del /f "%~dp0%~nx0" \ No newline at end of file diff --git a/model.py b/model.py index f79c4dfc..ab5f49ce 100644 --- a/model.py +++ b/model.py @@ -3,6 +3,7 @@ from zipfile import ZipFile from subprocess import Popen, PIPE from os import makedirs as os_makedirs from os import path as os_path +from os import remove as os_remove from shutil import rmtree, move from datetime import datetime from logging import getLogger, FileHandler, Formatter, INFO @@ -284,6 +285,7 @@ class Model: file.write(chunk) with ZipFile(os_path.join(current_directory, tmp_directory_name, filename)) as zf: zf.extractall(os_path.join(current_directory, tmp_directory_name)) + os_remove(os_path.join(current_directory, tmp_directory_name, filename)) move(os_path.join(current_directory, folder_name, "batch", batch_name), os_path.join(current_directory, batch_name)) command = [os_path.join(current_directory, batch_name), program_name, folder_name, tmp_directory_name, str(restart)] Popen(command, cwd=current_directory) @@ -297,8 +299,8 @@ class Model: folder_name = '_internal' batch_name = 'restart.bat' current_directory = config.LOCAL_PATH - - command = [os_path.join(current_directory, folder_name, "batch", batch_name), program_name] + move(os_path.join(current_directory, folder_name, "batch", batch_name), os_path.join(current_directory, batch_name)) + command = [os_path.join(current_directory, batch_name), program_name] Popen(command, cwd=current_directory) @staticmethod From 0dca7ff6a297f4bcce4ca0179d8a10b8c1d2ce0e Mon Sep 17 00:00:00 2001 From: misyaguziya Date: Wed, 1 Nov 2023 06:24:42 +0900 Subject: [PATCH 13/16] =?UTF-8?q?=F0=9F=91=8D[Update]=20installer=20:=20bu?= =?UTF-8?q?ild.bat=E3=81=ABNSIS=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 | 3 ++- installer/{Install.nsi => installer.nsi} | 0 2 files changed, 2 insertions(+), 1 deletion(-) rename installer/{Install.nsi => installer.nsi} (100%) diff --git a/build.bat b/build.bat index 7b723572..5ad8f73a 100644 --- a/build.bat +++ b/build.bat @@ -1 +1,2 @@ -pyinstaller --windowed --clean --icon="./img/vrct_logo_mark_black.ico" --add-data "./img;img/" --add-data "./locales;locales/" --add-data "./batch;batch/" --name VRCT --exclude-module numpy --exclude-module pandas --exclude-module matplotlib --exclude-module PyQt5 main.py \ No newline at end of file +pyinstaller --windowed --clean --noconfirm --icon="./img/vrct_logo_mark_black.ico" --add-data "./img;img/" --add-data "./locales;locales/" --add-data "./batch;batch/" --name VRCT --exclude-module numpy --exclude-module pandas --exclude-module matplotlib --exclude-module PyQt5 main.py +"C:\Program Files (x86)\NSIS\makensis.exe" installer/installer.nsi \ No newline at end of file diff --git a/installer/Install.nsi b/installer/installer.nsi similarity index 100% rename from installer/Install.nsi rename to installer/installer.nsi From 4351122cb4efe871e0381fb3ac26174c40adcd69 Mon Sep 17 00:00:00 2001 From: misyaguziya Date: Wed, 8 Nov 2023 17:35:50 +0900 Subject: [PATCH 14/16] =?UTF-8?q?=F0=9F=93=9D[Refactor]=20ruff=E3=82=92?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E3=81=97=E3=82=B3=E3=83=BC=E3=83=89=E6=A4=9C?= =?UTF-8?q?=E8=A8=BC=E4=BF=AE=E6=AD=A3=E3=82=92=E8=A1=8C=E3=81=A3=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.py | 72 +++++++++---------- controller.py | 54 ++++++++------ main.py | 2 +- model.py | 26 +++---- models/osc/osc_tools.py | 3 +- .../transcription_transcriber.py | 2 +- models/translation/translation_translator.py | 6 +- models/xsoverlay/notification.py | 2 +- utils.py | 3 +- vrct_gui/_CreateConfirmationModal.py | 3 +- vrct_gui/_CreateDropdownMenuWindow.py | 3 +- vrct_gui/_CreateErrorWindow.py | 3 +- vrct_gui/_CreateSelectableLanguagesWindow.py | 3 +- .../_SettingBoxGenerator.py | 5 +- .../_create_sidebar/createSidebarFeatures.py | 2 +- vrct_gui/ui_utils/ui_utils.py | 6 +- vrct_gui/vrct_gui.py | 2 +- 17 files changed, 107 insertions(+), 90 deletions(-) diff --git a/config.py b/config.py index 7dc8f759..ccf9ad6d 100644 --- a/config.py +++ b/config.py @@ -70,7 +70,7 @@ class Config: @ENABLE_TRANSLATION.setter def ENABLE_TRANSLATION(self, value): - if type(value) is bool: + if isinstance(value, bool): self._ENABLE_TRANSLATION = value @property @@ -79,7 +79,7 @@ class Config: @ENABLE_TRANSCRIPTION_SEND.setter def ENABLE_TRANSCRIPTION_SEND(self, value): - if type(value) is bool: + if isinstance(value, bool): self._ENABLE_TRANSCRIPTION_SEND = value @property @@ -88,7 +88,7 @@ class Config: @ENABLE_TRANSCRIPTION_RECEIVE.setter def ENABLE_TRANSCRIPTION_RECEIVE(self, value): - if type(value) is bool: + if isinstance(value, bool): self._ENABLE_TRANSCRIPTION_RECEIVE = value @property @@ -97,7 +97,7 @@ class Config: @ENABLE_FOREGROUND.setter def ENABLE_FOREGROUND(self, value): - if type(value) is bool: + if isinstance(value, bool): self._ENABLE_FOREGROUND = value @property @@ -106,7 +106,7 @@ class Config: @SOURCE_COUNTRY.setter def SOURCE_COUNTRY(self, value): - if type(value) is str: + if isinstance(value, str): self._SOURCE_COUNTRY = value @property @@ -115,7 +115,7 @@ class Config: @SOURCE_LANGUAGE.setter def SOURCE_LANGUAGE(self, value): - if type(value) is str: + if isinstance(value, str): self._SOURCE_LANGUAGE = value @property @@ -124,7 +124,7 @@ class Config: @TARGET_COUNTRY.setter def TARGET_COUNTRY(self, value): - if type(value) is str: + if isinstance(value, str): self._TARGET_COUNTRY = value @property @@ -133,7 +133,7 @@ class Config: @TARGET_LANGUAGE.setter def TARGET_LANGUAGE(self, value): - if type(value) is str: + if isinstance(value, str): self._TARGET_LANGUAGE = value @property @@ -154,7 +154,7 @@ class Config: @SELECTED_TAB_NO.setter def SELECTED_TAB_NO(self, value): - if type(value) is str: + if isinstance(value, str): self._SELECTED_TAB_NO = value saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) @@ -165,7 +165,7 @@ class Config: @SELECTED_TAB_YOUR_LANGUAGES.setter def SELECTED_TAB_YOUR_LANGUAGES(self, value): - if type(value) is dict: + if isinstance(value, dict): self._SELECTED_TAB_YOUR_LANGUAGES = value saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) @@ -176,7 +176,7 @@ class Config: @SELECTED_TAB_TARGET_LANGUAGES.setter def SELECTED_TAB_TARGET_LANGUAGES(self, value): - if type(value) is dict: + if isinstance(value, dict): self._SELECTED_TAB_TARGET_LANGUAGES = value saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) @@ -187,7 +187,7 @@ class Config: @IS_MAIN_WINDOW_SIDEBAR_COMPACT_MODE.setter def IS_MAIN_WINDOW_SIDEBAR_COMPACT_MODE(self, value): - if type(value) is bool: + if isinstance(value, bool): self._IS_MAIN_WINDOW_SIDEBAR_COMPACT_MODE = value saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) @@ -199,7 +199,7 @@ class Config: @TRANSPARENCY.setter def TRANSPARENCY(self, value): - if type(value) is int and 0 <= value <= 100: + if isinstance(value, int) and 0 <= value <= 100: self._TRANSPARENCY = value saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) @@ -232,7 +232,7 @@ class Config: @TEXTBOX_UI_SCALING.setter def TEXTBOX_UI_SCALING(self, value): - if type(value) is int and 50 <= value <= 200: + if isinstance(value, int) and 50 <= value <= 200: self._TEXTBOX_UI_SCALING = value saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) @@ -290,7 +290,7 @@ class Config: @INPUT_MIC_ENERGY_THRESHOLD.setter def INPUT_MIC_ENERGY_THRESHOLD(self, value): - if type(value) is int: + if isinstance(value, int): self._INPUT_MIC_ENERGY_THRESHOLD = value saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) @@ -301,7 +301,7 @@ class Config: @INPUT_MIC_DYNAMIC_ENERGY_THRESHOLD.setter def INPUT_MIC_DYNAMIC_ENERGY_THRESHOLD(self, value): - if type(value) is bool: + if isinstance(value, bool): self._INPUT_MIC_DYNAMIC_ENERGY_THRESHOLD = value saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) @@ -312,7 +312,7 @@ class Config: @INPUT_MIC_RECORD_TIMEOUT.setter def INPUT_MIC_RECORD_TIMEOUT(self, value): - if type(value) is int: + if isinstance(value, int): self._INPUT_MIC_RECORD_TIMEOUT = value saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) @@ -323,7 +323,7 @@ class Config: @INPUT_MIC_PHRASE_TIMEOUT.setter def INPUT_MIC_PHRASE_TIMEOUT(self, value): - if type(value) is int: + if isinstance(value, int): self._INPUT_MIC_PHRASE_TIMEOUT = value saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) @@ -334,7 +334,7 @@ class Config: @INPUT_MIC_MAX_PHRASES.setter def INPUT_MIC_MAX_PHRASES(self, value): - if type(value) is int: + if isinstance(value, int): self._INPUT_MIC_MAX_PHRASES = value saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) @@ -345,7 +345,7 @@ class Config: @INPUT_MIC_WORD_FILTER.setter def INPUT_MIC_WORD_FILTER(self, value): - if type(value) is list: + if isinstance(value, list): self._INPUT_MIC_WORD_FILTER = sorted(set(value), key=value.index) saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) @@ -356,7 +356,7 @@ class Config: @INPUT_SPEAKER_ENERGY_THRESHOLD.setter def INPUT_SPEAKER_ENERGY_THRESHOLD(self, value): - if type(value) is int: + if isinstance(value, int): self._INPUT_SPEAKER_ENERGY_THRESHOLD = value saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) @@ -367,7 +367,7 @@ class Config: @INPUT_SPEAKER_DYNAMIC_ENERGY_THRESHOLD.setter def INPUT_SPEAKER_DYNAMIC_ENERGY_THRESHOLD(self, value): - if type(value) is bool: + if isinstance(value, bool): self._INPUT_SPEAKER_DYNAMIC_ENERGY_THRESHOLD = value saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) @@ -378,7 +378,7 @@ class Config: @INPUT_SPEAKER_RECORD_TIMEOUT.setter def INPUT_SPEAKER_RECORD_TIMEOUT(self, value): - if type(value) is int: + if isinstance(value, int): self._INPUT_SPEAKER_RECORD_TIMEOUT = value saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) @@ -389,7 +389,7 @@ class Config: @INPUT_SPEAKER_PHRASE_TIMEOUT.setter def INPUT_SPEAKER_PHRASE_TIMEOUT(self, value): - if type(value) is int: + if isinstance(value, int): self._INPUT_SPEAKER_PHRASE_TIMEOUT = value saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) @@ -400,7 +400,7 @@ class Config: @INPUT_SPEAKER_MAX_PHRASES.setter def INPUT_SPEAKER_MAX_PHRASES(self, value): - if type(value) is int: + if isinstance(value, int): self._INPUT_SPEAKER_MAX_PHRASES = value saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) @@ -411,7 +411,7 @@ class Config: @OSC_IP_ADDRESS.setter def OSC_IP_ADDRESS(self, value): - if type(value) is str: + if isinstance(value, str): self._OSC_IP_ADDRESS = value saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) @@ -422,7 +422,7 @@ class Config: @OSC_PORT.setter def OSC_PORT(self, value): - if type(value) is int: + if isinstance(value, int): self._OSC_PORT = value saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) @@ -433,9 +433,9 @@ class Config: @AUTH_KEYS.setter def AUTH_KEYS(self, value): - if type(value) is dict and set(value.keys()) == set(self.AUTH_KEYS.keys()): + if isinstance(value, dict) and set(value.keys()) == set(self.AUTH_KEYS.keys()): for key, value in value.items(): - if type(value) is str: + if isinstance(value, str): self._AUTH_KEYS[key] = value saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, self.AUTH_KEYS) @@ -446,7 +446,7 @@ class Config: @MESSAGE_FORMAT.setter def MESSAGE_FORMAT(self, value): - if type(value) is str: + if isinstance(value, str): if isUniqueStrings(["[message]", "[translation]"], value) is False: value = "[message]([translation])" self._MESSAGE_FORMAT = value @@ -459,7 +459,7 @@ class Config: @ENABLE_AUTO_CLEAR_MESSAGE_BOX.setter def ENABLE_AUTO_CLEAR_MESSAGE_BOX(self, value): - if type(value) is bool: + if isinstance(value, bool): self._ENABLE_AUTO_CLEAR_MESSAGE_BOX = value saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) @@ -470,7 +470,7 @@ class Config: @ENABLE_NOTICE_XSOVERLAY.setter def ENABLE_NOTICE_XSOVERLAY(self, value): - if type(value) is bool: + if isinstance(value, bool): self._ENABLE_NOTICE_XSOVERLAY = value saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) @@ -481,7 +481,7 @@ class Config: @ENABLE_SEND_MESSAGE_TO_VRC.setter def ENABLE_SEND_MESSAGE_TO_VRC(self, value): - if type(value) is bool: + if isinstance(value, bool): self._ENABLE_SEND_MESSAGE_TO_VRC = value saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) @@ -493,7 +493,7 @@ class Config: # @STARTUP_OSC_ENABLED_CHECK.setter # def STARTUP_OSC_ENABLED_CHECK(self, value): - # if type(value) is bool: + # if isinstance(value, bool): # self._STARTUP_OSC_ENABLED_CHECK = value # saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) @@ -504,7 +504,7 @@ class Config: @ENABLE_LOGGER.setter def ENABLE_LOGGER(self, value): - if type(value) is bool: + if isinstance(value, bool): self._ENABLE_LOGGER = value saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) @@ -515,7 +515,7 @@ class Config: @IS_CONFIG_WINDOW_COMPACT_MODE.setter def IS_CONFIG_WINDOW_COMPACT_MODE(self, value): - if type(value) is bool: + if isinstance(value, bool): self._IS_CONFIG_WINDOW_COMPACT_MODE = value saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) diff --git a/controller.py b/controller.py index 421330a8..19743805 100644 --- a/controller.py +++ b/controller.py @@ -30,7 +30,7 @@ def sendMicMessage(message): pass else: translation = model.getInputTranslate(message) - if translation == False: + if translation is False: config.ENABLE_TRANSLATION = False translation = "" view.translationEngineLimitErrorProcess() @@ -94,7 +94,7 @@ def receiveSpeakerMessage(message): pass else: translation = model.getOutputTranslate(message) - if translation == False: + if translation is False: config.ENABLE_TRANSLATION = False translation = "" view.translationEngineLimitErrorProcess() @@ -160,7 +160,7 @@ def sendChatMessage(message): pass else: translation = model.getInputTranslate(message) - if translation == False: + if translation is False: config.ENABLE_TRANSLATION = False translation = "" view.translationEngineLimitErrorProcess() @@ -426,7 +426,8 @@ def callbackSetMicDevice(value): def callbackSetMicEnergyThreshold(value): print("callbackSetMicEnergyThreshold", value) - if value == "": return + if value == "": + return try: value = int(value) if 0 <= value and value <= config.MAX_MIC_ENERGY_THRESHOLD: @@ -435,7 +436,7 @@ def callbackSetMicEnergyThreshold(value): view.setGuiVariable_MicEnergyThreshold(config.INPUT_MIC_ENERGY_THRESHOLD) else: raise ValueError() - except: + except Exception: view.showErrorMessage_MicEnergyThreshold() def callbackSetMicDynamicEnergyThreshold(value): @@ -462,7 +463,8 @@ def callbackCheckMicThreshold(is_turned_on): def callbackSetMicRecordTimeout(value): print("callbackSetMicRecordTimeout", value) - if value == "": return + if value == "": + return try: value = int(value) if 0 <= value and value <= config.INPUT_MIC_PHRASE_TIMEOUT: @@ -471,12 +473,13 @@ def callbackSetMicRecordTimeout(value): view.setGuiVariable_MicRecordTimeout(config.INPUT_MIC_RECORD_TIMEOUT) else: raise ValueError() - except: + except Exception: view.showErrorMessage_MicRecordTimeout() def callbackSetMicPhraseTimeout(value): print("callbackSetMicPhraseTimeout", value) - if value == "": return + if value == "": + return try: value = int(value) if 0 <= value and value >= config.INPUT_MIC_RECORD_TIMEOUT: @@ -485,12 +488,13 @@ def callbackSetMicPhraseTimeout(value): view.setGuiVariable_MicPhraseTimeout(config.INPUT_MIC_PHRASE_TIMEOUT) else: raise ValueError() - except: + except Exception: view.showErrorMessage_MicPhraseTimeout() def callbackSetMicMaxPhrases(value): print("callbackSetMicMaxPhrases", value) - if value == "": return + if value == "": + return try: value = int(value) if 0 <= value: @@ -499,7 +503,7 @@ def callbackSetMicMaxPhrases(value): view.setGuiVariable_MicMaxPhrases(config.INPUT_MIC_MAX_PHRASES) else: raise ValueError() - except: + except Exception: view.showErrorMessage_MicMaxPhrases() def callbackSetMicWordFilter(values): @@ -532,13 +536,14 @@ def callbackDeleteMicWordFilter(value): new_input_mic_word_filter_list.remove(str(value)) config.INPUT_MIC_WORD_FILTER = new_input_mic_word_filter_list view.setLatestConfigVariable("MicMicWordFilter") - except: + except Exception: print("There was no the target word in config.INPUT_MIC_WORD_FILTER") def callbackSetSpeakerEnergyThreshold(value): print("callbackSetSpeakerEnergyThreshold", value) - if value == "": return + if value == "": + return try: value = int(value) if 0 <= value and value <= config.MAX_SPEAKER_ENERGY_THRESHOLD: @@ -547,7 +552,7 @@ def callbackSetSpeakerEnergyThreshold(value): view.setGuiVariable_SpeakerEnergyThreshold(config.INPUT_SPEAKER_ENERGY_THRESHOLD) else: raise ValueError() - except: + except Exception: view.showErrorMessage_SpeakerEnergyThreshold() def callbackSetSpeakerDynamicEnergyThreshold(value): @@ -580,7 +585,8 @@ def callbackCheckSpeakerThreshold(is_turned_on): def callbackSetSpeakerRecordTimeout(value): print("callbackSetSpeakerRecordTimeout", value) - if value == "": return + if value == "": + return try: value = int(value) if 0 <= value and value <= config.INPUT_SPEAKER_PHRASE_TIMEOUT: @@ -589,12 +595,13 @@ def callbackSetSpeakerRecordTimeout(value): view.setGuiVariable_SpeakerRecordTimeout(config.INPUT_SPEAKER_RECORD_TIMEOUT) else: raise ValueError() - except: + except Exception: view.showErrorMessage_SpeakerRecordTimeout() def callbackSetSpeakerPhraseTimeout(value): print("callbackSetSpeakerPhraseTimeout", value) - if value == "": return + if value == "": + return try: value = int(value) if 0 <= value and value >= config.INPUT_SPEAKER_RECORD_TIMEOUT: @@ -603,12 +610,13 @@ def callbackSetSpeakerPhraseTimeout(value): view.setGuiVariable_SpeakerPhraseTimeout(config.INPUT_SPEAKER_PHRASE_TIMEOUT) else: raise ValueError() - except: + except Exception: view.showErrorMessage_SpeakerPhraseTimeout() def callbackSetSpeakerMaxPhrases(value): print("callbackSetSpeakerMaxPhrases", value) - if value == "": return + if value == "": + return try: value = int(value) if 0 <= value: @@ -617,7 +625,7 @@ def callbackSetSpeakerMaxPhrases(value): view.setGuiVariable_SpeakerMaxPhrases(config.INPUT_SPEAKER_MAX_PHRASES) else: raise ValueError() - except: + except Exception: view.showErrorMessage_SpeakerMaxPhrases() @@ -662,12 +670,14 @@ def callbackSetEnableSendMessageToVrc(value): # Advanced Settings Tab def callbackSetOscIpAddress(value): - if value == "": return + if value == "": + return print("callbackSetOscIpAddress", str(value)) config.OSC_IP_ADDRESS = str(value) def callbackSetOscPort(value): - if value == "": return + if value == "": + return print("callbackSetOscPort", int(value)) config.OSC_PORT = int(value) diff --git a/main.py b/main.py index 5db42c69..def1cb0b 100644 --- a/main.py +++ b/main.py @@ -12,7 +12,7 @@ if __name__ == "__main__": splash.destroySplash() controller.showMainWindow() - except Exception as e: + except Exception: import traceback with open('error.log', 'a') as f: traceback.print_exc(file=f) \ No newline at end of file diff --git a/model.py b/model.py index 51a881dd..c4e2f30b 100644 --- a/model.py +++ b/model.py @@ -82,9 +82,9 @@ class Model: self.keyword_processor = KeywordProcessor() def authenticationTranslator(self, choice_translator=None, auth_key=None): - if choice_translator == None: + if choice_translator is None: choice_translator = config.CHOICE_TRANSLATOR - if auth_key == None: + if auth_key is None: auth_key = config.AUTH_KEYS[choice_translator] result = self.translator.authentication(choice_translator, auth_key) @@ -130,10 +130,10 @@ class Model: compatible_engines.append(engine) engine_name = compatible_engines[0] - if engine_name == "DeepL" and config.AUTH_KEYS["DeepL_API"] != None: + if engine_name == "DeepL" and config.AUTH_KEYS["DeepL_API"] is not None: if self.authenticationTranslator(engine_name, config.AUTH_KEYS["DeepL_API"]) is True: engine_name = "DeepL_API" - elif engine_name == "DeepL_API" and config.AUTH_KEYS["DeepL_API"] == None: + elif engine_name == "DeepL_API" and config.AUTH_KEYS["DeepL_API"] is None: engine_name = "DeepL" return engine_name @@ -288,7 +288,7 @@ class Model: rmtree(os_path.join(current_directory, tmp_directory_name)) command = [os_path.join(program_directory, "batch", batch_name), program_name, temporary_name, str(restart)] Popen(command) - except: + except Exception: webbrowser.open(config.BOOTH_URL, new=2, autoraise=True) @staticmethod @@ -319,7 +319,7 @@ class Model: if config.CHOICE_MIC_HOST == "NoHost" or config.CHOICE_MIC_DEVICE == "NoDevice": try: error_fnc() - except: + except Exception: pass return @@ -348,7 +348,7 @@ class Model: message = mic_transcriber.getTranscript() try: fnc(message) - except: + except Exception: pass self.mic_print_transcript = threadFnc(sendMicTranscript) @@ -367,7 +367,7 @@ class Model: if config.CHOICE_MIC_HOST == "NoHost" or config.CHOICE_MIC_DEVICE == "NoDevice": try: error_fnc() - except: + except Exception: pass return @@ -376,7 +376,7 @@ class Model: energy = mic_energy_queue.get() try: fnc(energy) - except: + except Exception: pass sleep(0.01) @@ -401,7 +401,7 @@ class Model: if speaker_device["name"] == "NoDevice": try: error_fnc() - except: + except Exception: pass return @@ -429,7 +429,7 @@ class Model: message = speaker_transcriber.getTranscript() try: fnc(message) - except: + except Exception: pass self.speaker_print_transcript = threadFnc(sendSpeakerTranscript) @@ -449,7 +449,7 @@ class Model: if speaker_device["name"] == "NoDevice": try: error_fnc() - except: + except Exception: pass return @@ -458,7 +458,7 @@ class Model: energy = speaker_energy_queue.get() try: fnc(energy) - except: + except Exception: pass sleep(0.01) diff --git a/models/osc/osc_tools.py b/models/osc/osc_tools.py index 7cb926c2..80f2b785 100644 --- a/models/osc/osc_tools.py +++ b/models/osc/osc_tools.py @@ -1,5 +1,4 @@ from time import sleep -from typing import List from pythonosc import osc_message_builder from pythonosc import udp_client from pythonosc import dispatcher @@ -15,7 +14,7 @@ def sendTyping(flag=False, ip_address="127.0.0.1", port=9000): # send OSC message def sendMessage(message=None, ip_address="127.0.0.1", port=9000): - if message != None: + if message is not None: msg = osc_message_builder.OscMessageBuilder(address="/chatbox/input") msg.add_arg(f"{message}") msg.add_arg(True) diff --git a/models/transcription/transcription_transcriber.py b/models/transcription/transcription_transcriber.py index b058f4ec..bf78566e 100644 --- a/models/transcription/transcription_transcriber.py +++ b/models/transcription/transcription_transcriber.py @@ -38,7 +38,7 @@ class AudioTranscriber: # os.close(fd) audio_data = self.audio_sources["process_data_func"]() text = self.audio_recognizer.recognize_google(audio_data, language=transcription_lang[language][country]) - except Exception as e: + except Exception: pass finally: pass diff --git a/models/translation/translation_translator.py b/models/translation/translation_translator.py index 18d2c394..c3a5682b 100644 --- a/models/translation/translation_translator.py +++ b/models/translation/translation_translator.py @@ -1,7 +1,7 @@ from deepl import Translator as deepl_Translator from deepl_translate import translate as deepl_web_Translator from translators import translate_text as other_web_Translator -from .translation_languages import translatorEngine, translation_lang +from .translation_languages import translation_lang # Translator class Translator(): @@ -16,7 +16,7 @@ class Translator(): try: self.deepl_client = deepl_Translator(authkey) self.deepl_client.translate_text(" ", target_lang="EN-US") - except: + except Exception: result = False return result @@ -52,7 +52,7 @@ class Translator(): from_language=source_language, to_language=target_language, ) - except Exception as e: + except Exception: import traceback with open('error.log', 'a') as f: traceback.print_exc(file=f) diff --git a/models/xsoverlay/notification.py b/models/xsoverlay/notification.py index 7c179f5a..cb2c03b5 100644 --- a/models/xsoverlay/notification.py +++ b/models/xsoverlay/notification.py @@ -33,7 +33,7 @@ def XSOverlay( with open(icon, "rb") as f: icon_data_bytes = f.read() icon_data = base64.b64encode(icon_data_bytes).decode("utf-8") - except: + except Exception: icon_data = "default" else: icon_data = icon diff --git a/utils.py b/utils.py index 9cb0dc94..a5e38fda 100644 --- a/utils.py +++ b/utils.py @@ -13,7 +13,8 @@ def get_key_by_value(dictionary, value): return None def callFunctionIfCallable(function, *args): - if callable(function) is True: function(*args) + if callable(function) is True: + function(*args) def isEven(number): return number % 2 == 0 diff --git a/vrct_gui/_CreateConfirmationModal.py b/vrct_gui/_CreateConfirmationModal.py index 1d7a5de4..935f0447 100644 --- a/vrct_gui/_CreateConfirmationModal.py +++ b/vrct_gui/_CreateConfirmationModal.py @@ -233,7 +233,8 @@ class _CreateConfirmationModal(CTkToplevel): self.grab_release() def focusOutFunction(self, e): - if str(e.widget) != ".!_createconfirmationmodal": return + if str(e.widget) != ".!_createconfirmationmodal": + return callFunctionIfCallable(self._view_variable.CALLBACK_HIDE_CONFIRMATION_MODAL) def _grab_set(self): diff --git a/vrct_gui/_CreateDropdownMenuWindow.py b/vrct_gui/_CreateDropdownMenuWindow.py index 948e00e1..b0f459dd 100644 --- a/vrct_gui/_CreateDropdownMenuWindow.py +++ b/vrct_gui/_CreateDropdownMenuWindow.py @@ -262,7 +262,8 @@ class _CreateDropdownMenuWindow(CTkToplevel): def show(self, dropdown_menu_widget_id): - if self.hide is False: return + if self.hide is False: + return self.wm_attributes("-alpha", 0) diff --git a/vrct_gui/_CreateErrorWindow.py b/vrct_gui/_CreateErrorWindow.py index 4b00047a..ef7ff5fb 100644 --- a/vrct_gui/_CreateErrorWindow.py +++ b/vrct_gui/_CreateErrorWindow.py @@ -80,7 +80,8 @@ class _CreateErrorWindow(CTkToplevel): def show(self, target_widget): - if self.hide is False: return + if self.hide is False: + return self.attach_widget = target_widget diff --git a/vrct_gui/_CreateSelectableLanguagesWindow.py b/vrct_gui/_CreateSelectableLanguagesWindow.py index daa369c0..8c666a20 100644 --- a/vrct_gui/_CreateSelectableLanguagesWindow.py +++ b/vrct_gui/_CreateSelectableLanguagesWindow.py @@ -178,5 +178,6 @@ class _CreateSelectableLanguagesWindow(CTkToplevel): def focusOutFunction(self, e): - if str(e.widget) != ".!_createselectablelanguageswindow": return + if str(e.widget) != ".!_createselectablelanguageswindow": + return self.vrct_gui._closeSelectableLanguagesWindow() \ No newline at end of file diff --git a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py index 099c40ae..d8b31a39 100644 --- a/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py +++ b/vrct_gui/config_window/widgets/createSideMenuAndSettingsBoxContainers/setting_box_containers/_SettingBoxGenerator.py @@ -2,7 +2,7 @@ from functools import partial from types import SimpleNamespace from typing import Union -from customtkinter import CTkOptionMenu, CTkFont, CTkFrame, CTkLabel, CTkRadioButton, CTkEntry, CTkSlider, CTkSwitch, CTkCheckBox, CTkProgressBar, CTkImage +from customtkinter import CTkFont, CTkFrame, CTkLabel, CTkEntry, CTkSlider, CTkSwitch, CTkCheckBox, CTkProgressBar, CTkImage from CTkToolTip import * from vrct_gui.ui_utils import createButtonWithImage, getLatestWidth, createOptionMenuBox, getLatestHeight, bindButtonFunctionAndColor @@ -1068,7 +1068,8 @@ class _SettingBoxGenerator(): items[i] = item_data is_replaced = True break - if is_replaced is False: items.append(item_data) + if is_replaced is False: + items.append(item_data) return mic_word_filter_item_wrapper diff --git a/vrct_gui/main_window/widgets/_create_sidebar/createSidebarFeatures.py b/vrct_gui/main_window/widgets/_create_sidebar/createSidebarFeatures.py index b46ab3cc..bce4113f 100644 --- a/vrct_gui/main_window/widgets/_create_sidebar/createSidebarFeatures.py +++ b/vrct_gui/main_window/widgets/_create_sidebar/createSidebarFeatures.py @@ -2,7 +2,7 @@ from functools import partial from customtkinter import CTkFont, CTkFrame, CTkLabel, CTkSwitch, CTkImage -from ....ui_utils import openImageKeepAspectRatio, retag, getLatestHeight, bindEnterAndLeaveFunction, bindButtonReleaseFunction, bindButtonPressAndReleaseFunction +from ....ui_utils import openImageKeepAspectRatio, retag, bindEnterAndLeaveFunction, bindButtonReleaseFunction, bindButtonPressAndReleaseFunction from utils import callFunctionIfCallable diff --git a/vrct_gui/ui_utils/ui_utils.py b/vrct_gui/ui_utils/ui_utils.py index 5138fb5c..bd6e5a9c 100644 --- a/vrct_gui/ui_utils/ui_utils.py +++ b/vrct_gui/ui_utils/ui_utils.py @@ -162,10 +162,12 @@ def createOptionMenuBox(parent_widget, optionmenu_bg_color, optionmenu_hovered_b option_menu_box = CTkFrame(parent_widget, corner_radius=6, fg_color=optionmenu_bg_color, cursor="hand2") option_menu_box.grid_rowconfigure(0, weight=1) - if optionmenu_min_height is not None: option_menu_box.grid_rowconfigure(0, minsize=optionmenu_min_height) + if optionmenu_min_height is not None: + option_menu_box.grid_rowconfigure(0, minsize=optionmenu_min_height) option_menu_box.grid_columnconfigure(0, weight=1) - if optionmenu_min_width is not None: option_menu_box.grid_columnconfigure(0, minsize=optionmenu_min_width) + if optionmenu_min_width is not None: + option_menu_box.grid_columnconfigure(0, minsize=optionmenu_min_width) optionmenu_label_wrapper = CTkFrame(option_menu_box, corner_radius=0, fg_color=optionmenu_bg_color) optionmenu_label_wrapper.grid(row=0, column=0, padx=(optionmenu_ipadx[0],0), pady=optionmenu_ipady, sticky="ew") diff --git a/vrct_gui/vrct_gui.py b/vrct_gui/vrct_gui.py index da9939dd..a0926150 100644 --- a/vrct_gui/vrct_gui.py +++ b/vrct_gui/vrct_gui.py @@ -269,7 +269,7 @@ class VRCT_GUI(CTk): def _clearErrorMessage(self): try: self.error_message_window._withdraw() - except: + except Exception: pass From 5e1a293e9ffbd18b3195fdcdcaf22966b3ed22d7 Mon Sep 17 00:00:00 2001 From: misyaguziya Date: Wed, 8 Nov 2023 17:40:14 +0900 Subject: [PATCH 15/16] =?UTF-8?q?=F0=9F=93=9D[Refactor]=20ruff=E3=82=92?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E3=81=97=E3=82=B3=E3=83=BC=E3=83=89=E6=A4=9C?= =?UTF-8?q?=E8=A8=BC=E4=BF=AE=E6=AD=A3=E3=82=92=E8=A1=8C=E3=81=A3=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.py | 2 -- model.py | 5 ++--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/config.py b/config.py index 592a7d2a..fd603c87 100644 --- a/config.py +++ b/config.py @@ -1,8 +1,6 @@ import sys import inspect from os import path as os_path -from os import getenv as os_getenv -from os import makedirs as os_makedirs from json import load as json_load from json import dump as json_dump import tkinter as tk diff --git a/model.py b/model.py index 538b8bb1..25a7951f 100644 --- a/model.py +++ b/model.py @@ -1,10 +1,9 @@ -import sys from zipfile import ZipFile -from subprocess import Popen, PIPE +from subprocess import Popen from os import makedirs as os_makedirs from os import path as os_path from os import remove as os_remove -from shutil import rmtree, move +from shutil import move from datetime import datetime from logging import getLogger, FileHandler, Formatter, INFO from time import sleep From cbd717666abe125989f9bbe4de0e5f212a25f148 Mon Sep 17 00:00:00 2001 From: misyaguziya Date: Wed, 8 Nov 2023 22:00:31 +0900 Subject: [PATCH 16/16] =?UTF-8?q?=F0=9F=91=8D[Update]=20Controller=20:=20c?= =?UTF-8?q?onfig=20file=E3=81=A8logs=20folder=E3=81=AE=E3=83=AA=E3=83=B3?= =?UTF-8?q?=E3=82=AF=E3=81=8C=E9=96=8B=E3=81=8F=E6=98=A8=E6=97=A5=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.py | 3 ++- controller.py | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/config.py b/config.py index fd603c87..8ed25736 100644 --- a/config.py +++ b/config.py @@ -1,6 +1,6 @@ import sys import inspect -from os import path as os_path +from os import path as os_path, makedirs as os_makedirs from json import load as json_load from json import dump as json_dump import tkinter as tk @@ -533,6 +533,7 @@ class Config: self._LOCAL_PATH = os_path.dirname(sys.argv[0]) self._PATH_CONFIG = os_path.join(self._LOCAL_PATH, "config.json") self._PATH_LOGS = os_path.join(self._LOCAL_PATH, "logs") + os_makedirs(self._PATH_LOGS, exist_ok=True) self._GITHUB_URL = "https://api.github.com/repos/misyaguziya/VRCT/releases/latest" self._BOOTH_URL = "https://misyaguziya.booth.pm/" self._DOCUMENTS_URL = "https://mzsoftware.notion.site/VRCT-Documents-be79b7a165f64442ad8f326d86c22246" diff --git a/controller.py b/controller.py index 19743805..d7bdc414 100644 --- a/controller.py +++ b/controller.py @@ -1,4 +1,5 @@ from time import sleep +from subprocess import Popen from threading import Thread from config import config from model import model @@ -14,10 +15,12 @@ def callbackRestartSoftware(): model.reStartSoftware() def callbackFilepathLogs(): - print("callbackFilepathLogs") + print("callbackFilepathLogs", config.PATH_LOGS.replace('/', '\\')) + Popen(['explorer', config.PATH_LOGS.replace('/', '\\')], shell=True) def callbackFilepathConfigFile(): - print("callbackFilepathConfigFile") + print("callbackFilepathConfigFile", config.LOCAL_PATH.replace('/', '\\')) + Popen(['explorer', config.LOCAL_PATH.replace('/', '\\')], shell=True) # func transcription send message def sendMicMessage(message):