Merge branch 'installer' into develop

This commit is contained in:
misyaguziya
2023-11-08 22:08:38 +09:00
21 changed files with 354 additions and 123 deletions

View File

@@ -1,4 +1,9 @@
@if not "%~0"=="%~dp0.\%~nx0" start /min cmd /c,"%~dp0.\%~nx0" %* & goto :eof
taskkill /im %1 /F
START "" %1
set name=%1
set local_path=%~dp0
taskkill /im %name% /F
ping -n 2 127.0.0.1 > nul
START "" %local_path%%name%
del /f "%~dp0%~nx0"

View File

@@ -1,11 +1,20 @@
@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 folder_tmp=%3
set restart=%4
set local_path=%~dp0
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 %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 "" %local_path%%exe_name%
)
pause
del /f "%~dp0%~nx0"

View File

@@ -1 +1,2 @@
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
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

View File

@@ -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
@@ -39,10 +39,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
@@ -70,7 +78,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 +87,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 +96,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 +105,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 +114,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 +123,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 +132,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 +141,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 +162,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 +173,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 +184,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 +195,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 +207,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 +240,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 +298,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 +309,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 +320,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 +331,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 +342,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 +353,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 +364,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 +375,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 +386,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 +397,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 +408,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 +419,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 +430,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 +441,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 +454,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 +467,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 +478,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 +489,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 +501,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 +512,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,14 +523,17 @@ 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)
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.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"

View File

@@ -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):
@@ -30,7 +33,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 +97,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 +163,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 +429,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 +439,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 +466,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 +476,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 +491,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 +506,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 +539,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 +555,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 +588,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 +598,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 +613,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 +628,7 @@ def callbackSetSpeakerMaxPhrases(value):
view.setGuiVariable_SpeakerMaxPhrases(config.INPUT_SPEAKER_MAX_PHRASES)
else:
raise ValueError()
except:
except Exception:
view.showErrorMessage_SpeakerMaxPhrases()
@@ -662,12 +673,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)

183
installer/installer.nsi Normal file
View File

@@ -0,0 +1,183 @@
!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
!include nsDialogs.nsh
; 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"
; 作成されるインストーラ
OutFile "VRCT_Setup.exe"
RequestExecutionLevel admin
ShowInstDetails show
; 圧縮メソッド
SetCompressor lzma
; インストールされるディレクトリ
InstallDir "$LOCALAPPDATA\VRCT"
; 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
; 日本語UI
!insertmacro MUI_LANGUAGE "Japanese"
; 引数取得マクロ
!insertmacro GetParameters
!insertmacro GetOptions
; インターフェース 設定
!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
; オプション ページ
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
${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
; デフォルト セクション
Section
; 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"
; スタート メニューから削除
Delete "$SMPROGRAMS\VRCT\VRCT.lnk"
RMDir "$SMPROGRAMS\VRCT"
; デスクトップ ショートカットを削除
Delete "$DESKTOP\VRCT.lnk"
; レジストリ キーを削除
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VRCT"
; 出力先を指定します。
SetOutPath "$INSTDIR"
; インストールされるファイル
File /r "..\dist\VRCT\"
${If} $InstallDocs == ${BST_CHECKED}
; ドキュメントをインストールする場合
; 出力先を指定します。
SetOutPath "$INSTDIR\docs"
; インストールされるファイル
File "..\README.txt"
${EndIf}
; アンインストーラを出力
WriteUninstaller "$INSTDIR\Uninstall.exe"
${If} $InstallDocs == ${BST_CHECKED}
; デスクトップにショートカットを作成
CreateShortCut "$DESKTOP\VRCT.lnk" "$INSTDIR\VRCT.exe"
${EndIf}
; スタート メニューにショートカットを登録
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
; アンインストーラ
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"
; スタート メニューから削除
Delete "$SMPROGRAMS\VRCT\VRCT.lnk"
RMDir "$SMPROGRAMS\VRCT"
; デスクトップ ショートカットを削除
Delete "$DESKTOP\VRCT.lnk"
; レジストリ キーを削除
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VRCT"
SectionEnd

View File

@@ -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)

View File

@@ -1,9 +1,9 @@
import sys
from zipfile import ZipFile
from subprocess import Popen
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 os import remove as os_remove
from shutil import move
from datetime import datetime
from logging import getLogger, FileHandler, Formatter, INFO
from time import sleep
@@ -82,19 +82,19 @@ 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)
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)
@@ -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
@@ -266,38 +266,40 @@ class Model:
@staticmethod
def updateSoftware(restart:bool=True):
filename = 'download.zip'
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])
program_directory = os_path.dirname(__file__)
current_directory = config.LOCAL_PATH
try:
res = requests_get(config.GITHUB_URL)
url = 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)
with open(os_path.join(current_directory, tmp_directory_name, filename), 'wb') as file:
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))
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)]
Popen(command)
except:
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)
except Exception:
webbrowser.open(config.BOOTH_URL, new=2, autoraise=True)
@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]
Popen(command)
current_directory = config.LOCAL_PATH
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
def getListInputHost():
@@ -319,7 +321,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 +350,7 @@ class Model:
message = mic_transcriber.getTranscript()
try:
fnc(message)
except:
except Exception:
pass
self.mic_print_transcript = threadFnc(sendMicTranscript)
@@ -367,7 +369,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 +378,7 @@ class Model:
energy = mic_energy_queue.get()
try:
fnc(energy)
except:
except Exception:
pass
sleep(0.01)
@@ -401,7 +403,7 @@ class Model:
if speaker_device["name"] == "NoDevice":
try:
error_fnc()
except:
except Exception:
pass
return
@@ -429,7 +431,7 @@ class Model:
message = speaker_transcriber.getTranscript()
try:
fnc(message)
except:
except Exception:
pass
self.speaker_print_transcript = threadFnc(sendSpeakerTranscript)
@@ -449,7 +451,7 @@ class Model:
if speaker_device["name"] == "NoDevice":
try:
error_fnc()
except:
except Exception:
pass
return
@@ -458,7 +460,7 @@ class Model:
energy = speaker_energy_queue.get()
try:
fnc(energy)
except:
except Exception:
pass
sleep(0.01)

View File

@@ -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)

View File

@@ -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

View File

@@ -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)

View File

@@ -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

View File

@@ -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

View File

@@ -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):

View File

@@ -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)

View File

@@ -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

View File

@@ -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()

View File

@@ -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

View File

@@ -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

View File

@@ -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")

View File

@@ -269,7 +269,7 @@ class VRCT_GUI(CTk):
def _clearErrorMessage(self):
try:
self.error_message_window._withdraw()
except:
except Exception:
pass