Merge branch 'model' into UI_2.0
This commit is contained in:
10
config.py
10
config.py
@@ -399,15 +399,6 @@ class Config:
|
|||||||
self._STARTUP_OSC_ENABLED_CHECK = value
|
self._STARTUP_OSC_ENABLED_CHECK = value
|
||||||
saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, 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
|
@property
|
||||||
def UPDATE_FLAG(self):
|
def UPDATE_FLAG(self):
|
||||||
return self._UPDATE_FLAG
|
return self._UPDATE_FLAG
|
||||||
@@ -528,7 +519,6 @@ class Config:
|
|||||||
self._ENABLE_NOTICE_XSOVERLAY = False
|
self._ENABLE_NOTICE_XSOVERLAY = False
|
||||||
self._ENABLE_SEND_MESSAGE_TO_VRC = True
|
self._ENABLE_SEND_MESSAGE_TO_VRC = True
|
||||||
self._STARTUP_OSC_ENABLED_CHECK = True
|
self._STARTUP_OSC_ENABLED_CHECK = True
|
||||||
self._IS_VALID_OSC = False
|
|
||||||
self._UPDATE_FLAG = False
|
self._UPDATE_FLAG = False
|
||||||
self._GITHUB_URL = "https://api.github.com/repos/misyaguziya/VRCT/releases/latest"
|
self._GITHUB_URL = "https://api.github.com/repos/misyaguziya/VRCT/releases/latest"
|
||||||
# self._BREAK_KEYSYM_LIST = [
|
# self._BREAK_KEYSYM_LIST = [
|
||||||
|
|||||||
10
main.py
10
main.py
@@ -191,9 +191,6 @@ def callbackSelectedLanguagePresetTab(selected_tab_no):
|
|||||||
def callbackSetAuthKeys(keys):
|
def callbackSetAuthKeys(keys):
|
||||||
config.AUTH_KEYS = keys
|
config.AUTH_KEYS = keys
|
||||||
|
|
||||||
def callbackChangeStatusIsValidOSC(value):
|
|
||||||
config.IS_VALID_OSC = value
|
|
||||||
|
|
||||||
def callbackChangeStatusSoftwareUpdated(value):
|
def callbackChangeStatusSoftwareUpdated(value):
|
||||||
config.UPDATE_FLAG = value
|
config.UPDATE_FLAG = value
|
||||||
|
|
||||||
@@ -548,11 +545,8 @@ if model.authenticationTranslator(callbackSetAuthKeys) is False:
|
|||||||
model.addKeywords()
|
model.addKeywords()
|
||||||
|
|
||||||
# check OSC started
|
# check OSC started
|
||||||
if config.STARTUP_OSC_ENABLED_CHECK is True:
|
if config.STARTUP_OSC_ENABLED_CHECK is True and config.ENABLE_SEND_MESSAGE_TO_VRC is True:
|
||||||
model.checkOSCStarted(callbackChangeStatusIsValidOSC)
|
model.checkOSCStarted(view.printToTextbox_OSCError)
|
||||||
sleep(2)
|
|
||||||
if config.IS_VALID_OSC is False:
|
|
||||||
view.printToTextbox_OSCError()
|
|
||||||
|
|
||||||
# check Software Updated
|
# check Software Updated
|
||||||
model.checkSoftwareUpdated(callbackChangeStatusSoftwareUpdated)
|
model.checkSoftwareUpdated(callbackChangeStatusSoftwareUpdated)
|
||||||
|
|||||||
29
model.py
29
model.py
@@ -180,21 +180,26 @@ class Model:
|
|||||||
def oscSendMessage(message):
|
def oscSendMessage(message):
|
||||||
sendMessage(message, config.OSC_IP_ADDRESS, config.OSC_PORT)
|
sendMessage(message, config.OSC_IP_ADDRESS, config.OSC_PORT)
|
||||||
|
|
||||||
@staticmethod
|
def checkOSCStarted(self, fnc):
|
||||||
def checkOSCStarted(fnc):
|
self.is_valid_osc = False
|
||||||
def checkOscReceive(address, osc_arguments):
|
def checkOscReceive(address, osc_arguments):
|
||||||
if config.IS_VALID_OSC is False and config.STARTUP_OSC_ENABLED_CHECK is True:
|
if self.is_valid_osc is False:
|
||||||
try:
|
self.is_valid_osc = True
|
||||||
fnc(True)
|
|
||||||
except:
|
self.listening_server = receiveOscParameters(checkOscReceive)
|
||||||
pass
|
def oscListener():
|
||||||
|
self.listening_server.serve_forever()
|
||||||
|
|
||||||
def sendTestActionLoop():
|
def sendTestActionLoop():
|
||||||
while config.IS_VALID_OSC is False and config.STARTUP_OSC_ENABLED_CHECK is True:
|
for _ in range(10):
|
||||||
sendTestAction()
|
sendTestAction()
|
||||||
|
if self.is_valid_osc is True:
|
||||||
|
break
|
||||||
|
sleep(0.1)
|
||||||
|
self.listening_server.shutdown()
|
||||||
|
|
||||||
# start receive osc
|
# start receive osc
|
||||||
th_receive_osc_parameters = Thread(target=receiveOscParameters, args=(checkOscReceive,))
|
th_receive_osc_parameters = Thread(target=oscListener)
|
||||||
th_receive_osc_parameters.daemon = True
|
th_receive_osc_parameters.daemon = True
|
||||||
th_receive_osc_parameters.start()
|
th_receive_osc_parameters.start()
|
||||||
|
|
||||||
@@ -203,6 +208,12 @@ class Model:
|
|||||||
th_send_osc_test_action.daemon = True
|
th_send_osc_test_action.daemon = True
|
||||||
th_send_osc_test_action.start()
|
th_send_osc_test_action.start()
|
||||||
|
|
||||||
|
th_receive_osc_parameters.join()
|
||||||
|
th_send_osc_test_action.join()
|
||||||
|
|
||||||
|
if self.is_valid_osc is False:
|
||||||
|
fnc()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def checkSoftwareUpdated(fnc):
|
def checkSoftwareUpdated(fnc):
|
||||||
# check update
|
# check update
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ def receiveOscParameters(target, filter="/*", ip_address="127.0.0.1", port=9001)
|
|||||||
_dispatcher = dispatcher.Dispatcher()
|
_dispatcher = dispatcher.Dispatcher()
|
||||||
_dispatcher.map(filter, target)
|
_dispatcher.map(filter, target)
|
||||||
server = osc_server.ThreadingOSCUDPServer((ip_address, port), _dispatcher)
|
server = osc_server.ThreadingOSCUDPServer((ip_address, port), _dispatcher)
|
||||||
server.serve_forever()
|
return server
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
sendChangeVoice()
|
sendChangeVoice()
|
||||||
|
|||||||
Reference in New Issue
Block a user