Merge branch 'model_update_notification' into UI_2.0

This commit is contained in:
misyaguziya
2023-09-24 05:42:59 +09:00
3 changed files with 9 additions and 24 deletions

View File

@@ -399,15 +399,6 @@ class Config:
self._STARTUP_OSC_ENABLED_CHECK = value
saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value)
@property
def UPDATE_FLAG(self):
return self._UPDATE_FLAG
@UPDATE_FLAG.setter
def UPDATE_FLAG(self, value):
if type(value) is bool:
self._UPDATE_FLAG = value
@property
def GITHUB_URL(self):
return self._GITHUB_URL
@@ -519,7 +510,6 @@ class Config:
self._ENABLE_NOTICE_XSOVERLAY = False
self._ENABLE_SEND_MESSAGE_TO_VRC = True
self._STARTUP_OSC_ENABLED_CHECK = True
self._UPDATE_FLAG = False
self._GITHUB_URL = "https://api.github.com/repos/misyaguziya/VRCT/releases/latest"
# self._BREAK_KEYSYM_LIST = [
# "Delete", "Select", "Up", "Down", "Next", "End", "Print",

View File

@@ -223,9 +223,6 @@ def callbackSelectedLanguagePresetTab(selected_tab_no):
def callbackSetAuthKeys(keys):
config.AUTH_KEYS = keys
def callbackChangeStatusSoftwareUpdated(value):
config.UPDATE_FLAG = value
# command func
def callbackToggleTranslation(is_turned_on):
config.ENABLE_TRANSLATION = is_turned_on
@@ -583,7 +580,8 @@ if config.STARTUP_OSC_ENABLED_CHECK is True and config.ENABLE_SEND_MESSAGE_TO_VR
model.checkOSCStarted(view.printToTextbox_OSCError)
# check Software Updated
model.checkSoftwareUpdated(callbackChangeStatusSoftwareUpdated)
if model.checkSoftwareUpdated() is True:
view.showUpdateAvailableButton()
# init logger
if config.ENABLE_LOGGER is True:
@@ -668,8 +666,5 @@ view.register(
},
)
if config.UPDATE_FLAG is True:
view.showUpdateAvailableButton()
if __name__ == "__main__":
view.startMainLoop()

View File

@@ -219,15 +219,15 @@ class Model:
fnc()
@staticmethod
def checkSoftwareUpdated(fnc):
def checkSoftwareUpdated():
# check update
update_flag = False
response = requests_get(config.GITHUB_URL)
tag_name = response.json()["tag_name"]
if tag_name != config.VERSION:
try:
fnc(True)
except:
pass
new_version = response.json()["name"]
if new_version != config.VERSION:
update_flag = True
print("software version", "now:", config.VERSION, "new:", new_version)
return update_flag
@staticmethod
def getListInputHost():