diff --git a/config.py b/config.py index 45a2bf54..e2326b98 100644 --- a/config.py +++ b/config.py @@ -379,15 +379,6 @@ class Config: self._ENABLE_NOTICE_XSOVERLAY = value saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) - @property - def ENABLE_OSC(self): - return self._ENABLE_OSC - - @ENABLE_OSC.setter - def ENABLE_OSC(self, value): - if type(value) is bool: - self._ENABLE_OSC = value - @property def ENABLE_SEND_MESSAGE_TO_VRC(self): return self._ENABLE_SEND_MESSAGE_TO_VRC @@ -408,6 +399,15 @@ class Config: self._STARTUP_OSC_ENABLED_CHECK = value saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) + @property + def IS_VALID_OSC(self): + return self._IS_VALID_OSC + + @IS_VALID_OSC.setter + def IS_VALID_OSC(self, value): + if type(value) is bool: + self._IS_VALID_OSC = value + @property def UPDATE_FLAG(self): return self._UPDATE_FLAG @@ -526,9 +526,9 @@ class Config: self._MESSAGE_FORMAT = "[message]([translation])" self._ENABLE_AUTO_CLEAR_MESSAGE_BOX = True self._ENABLE_NOTICE_XSOVERLAY = False - self._ENABLE_OSC = False self._ENABLE_SEND_MESSAGE_TO_VRC = True self._STARTUP_OSC_ENABLED_CHECK = True + self._IS_VALID_OSC = False self._UPDATE_FLAG = False self._GITHUB_URL = "https://api.github.com/repos/misyaguziya/VRCT/releases/latest" # self._BREAK_KEYSYM_LIST = [ diff --git a/main.py b/main.py index efba02c8..3ebab849 100644 --- a/main.py +++ b/main.py @@ -25,16 +25,13 @@ def sendMicMessage(message): translation = "" if config.ENABLE_TRANSCRIPTION_SEND is True: - if config.ENABLE_OSC is True: + if config.ENABLE_SEND_MESSAGE_TO_VRC is True: if len(translation) > 0: osc_message = config.MESSAGE_FORMAT.replace("[message]", message) osc_message = osc_message.replace("[translation]", translation) else: osc_message = message model.oscSendMessage(osc_message) - else: - if config.STARTUP_OSC_ENABLED_CHECK is True: - view.printToTextbox_OSCError() view.printToTextbox_SentMessage(message, translation) if config.ENABLE_LOGGER is True: @@ -124,16 +121,13 @@ def sendChatMessage(message): translation = "" # send OSC message - if config.ENABLE_OSC is True: + if config.ENABLE_SEND_MESSAGE_TO_VRC is True: if len(translation) > 0: osc_message = config.MESSAGE_FORMAT.replace("[message]", message) osc_message = osc_message.replace("[translation]", translation) else: osc_message = message model.oscSendMessage(osc_message) - else: - if config.STARTUP_OSC_ENABLED_CHECK is True: - view.printToTextbox_OSCError() # update textbox message log view.printToTextbox_SentMessage(message, translation) @@ -197,8 +191,8 @@ def callbackSelectedLanguagePresetTab(selected_tab_no): def callbackSetAuthKeys(keys): config.AUTH_KEYS = keys -def callbackChangeStatusOSC(value): - config.ENABLE_OSC = value +def callbackChangeStatusIsValidOSC(value): + config.IS_VALID_OSC = value def callbackChangeStatusSoftwareUpdated(value): config.UPDATE_FLAG = value @@ -554,7 +548,11 @@ if model.authenticationTranslator(callbackSetAuthKeys) is False: model.addKeywords() # check OSC started -model.checkOSCStarted(callbackChangeStatusOSC) +if config.STARTUP_OSC_ENABLED_CHECK is True: + model.checkOSCStarted(callbackChangeStatusIsValidOSC) + sleep(2) + if config.IS_VALID_OSC is False: + view.printToTextbox_OSCError() # check Software Updated model.checkSoftwareUpdated(callbackChangeStatusSoftwareUpdated) diff --git a/model.py b/model.py index b6964143..7a1756e0 100644 --- a/model.py +++ b/model.py @@ -180,7 +180,7 @@ class Model: @staticmethod def checkOSCStarted(fnc): def checkOscReceive(address, osc_arguments): - if config.ENABLE_OSC is False: + if config.IS_VALID_OSC is False: fnc(True) # start receive osc