Merge branch 'overlay_mask' into develop

# Conflicts:
#	view.py
#	vrct_gui/main_window/createMainWindowWidgets.py
This commit is contained in:
Sakamoto Shiina
2024-04-28 17:20:02 +09:00
7 changed files with 260 additions and 260 deletions

112
config.py
View File

@@ -736,57 +736,57 @@ class Config:
self._ENABLE_NOTICE_XSOVERLAY = value self._ENABLE_NOTICE_XSOVERLAY = value
saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value)
@property # @property
@json_serializable('OVERLAY_SETTINGS') # @json_serializable('OVERLAY_SETTINGS')
def OVERLAY_SETTINGS(self): # def OVERLAY_SETTINGS(self):
return self._OVERLAY_SETTINGS # return self._OVERLAY_SETTINGS
@OVERLAY_SETTINGS.setter # @OVERLAY_SETTINGS.setter
def OVERLAY_SETTINGS(self, value): # def OVERLAY_SETTINGS(self, value):
if isinstance(value, dict) and set(value.keys()) == set(self.OVERLAY_SETTINGS.keys()): # if isinstance(value, dict) and set(value.keys()) == set(self.OVERLAY_SETTINGS.keys()):
for key, value in value.items(): # for key, value in value.items():
if isinstance(value, float): # if isinstance(value, float):
self._OVERLAY_SETTINGS[key] = value # self._OVERLAY_SETTINGS[key] = value
saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, self.OVERLAY_SETTINGS) # saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, self.OVERLAY_SETTINGS)
@property # @property
@json_serializable('ENABLE_OVERLAY_SMALL_LOG') # @json_serializable('ENABLE_OVERLAY_SMALL_LOG')
def ENABLE_OVERLAY_SMALL_LOG(self): # def ENABLE_OVERLAY_SMALL_LOG(self):
return self._ENABLE_OVERLAY_SMALL_LOG # return self._ENABLE_OVERLAY_SMALL_LOG
@ENABLE_OVERLAY_SMALL_LOG.setter # @ENABLE_OVERLAY_SMALL_LOG.setter
def ENABLE_OVERLAY_SMALL_LOG(self, value): # def ENABLE_OVERLAY_SMALL_LOG(self, value):
if isinstance(value, bool): # if isinstance(value, bool):
self._ENABLE_OVERLAY_SMALL_LOG = value # self._ENABLE_OVERLAY_SMALL_LOG = value
saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) # saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value)
@property # @property
@json_serializable('OVERLAY_SMALL_LOG_SETTINGS') # @json_serializable('OVERLAY_SMALL_LOG_SETTINGS')
def OVERLAY_SMALL_LOG_SETTINGS(self): # def OVERLAY_SMALL_LOG_SETTINGS(self):
return self._OVERLAY_SMALL_LOG_SETTINGS # return self._OVERLAY_SMALL_LOG_SETTINGS
@OVERLAY_SMALL_LOG_SETTINGS.setter # @OVERLAY_SMALL_LOG_SETTINGS.setter
def OVERLAY_SMALL_LOG_SETTINGS(self, value): # def OVERLAY_SMALL_LOG_SETTINGS(self, value):
if isinstance(value, dict) and set(value.keys()) == set(self.OVERLAY_SMALL_LOG_SETTINGS.keys()): # if isinstance(value, dict) and set(value.keys()) == set(self.OVERLAY_SMALL_LOG_SETTINGS.keys()):
for key, value in value.items(): # for key, value in value.items():
match (key): # match (key):
case "x_pos" | "y_pos" | "depth": # case "x_pos" | "y_pos" | "depth":
if isinstance(value, float): # if isinstance(value, float):
self._OVERLAY_SMALL_LOG_SETTINGS[key] = value # self._OVERLAY_SMALL_LOG_SETTINGS[key] = value
case "display_duration" | "fadeout_duration": # case "display_duration" | "fadeout_duration":
if isinstance(value, int): # if isinstance(value, int):
self._OVERLAY_SMALL_LOG_SETTINGS[key] = value # self._OVERLAY_SMALL_LOG_SETTINGS[key] = value
saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, self.OVERLAY_SMALL_LOG_SETTINGS) # saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, self.OVERLAY_SMALL_LOG_SETTINGS)
@property # @property
@json_serializable('OVERLAY_UI_TYPE') # @json_serializable('OVERLAY_UI_TYPE')
def OVERLAY_UI_TYPE(self): # def OVERLAY_UI_TYPE(self):
return self._OVERLAY_UI_TYPE # return self._OVERLAY_UI_TYPE
@OVERLAY_UI_TYPE.setter # @OVERLAY_UI_TYPE.setter
def OVERLAY_UI_TYPE(self, value): # def OVERLAY_UI_TYPE(self, value):
if isinstance(value, str): # if isinstance(value, str):
self._OVERLAY_UI_TYPE = value # self._OVERLAY_UI_TYPE = value
# saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value) # saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value)
@property @property
@@ -1054,18 +1054,18 @@ class Config:
self._ENABLE_SEND_ONLY_TRANSLATED_MESSAGES = False self._ENABLE_SEND_ONLY_TRANSLATED_MESSAGES = False
self._SEND_MESSAGE_BUTTON_TYPE = "show" self._SEND_MESSAGE_BUTTON_TYPE = "show"
self._ENABLE_NOTICE_XSOVERLAY = False self._ENABLE_NOTICE_XSOVERLAY = False
self._OVERLAY_SETTINGS = { # self._OVERLAY_SETTINGS = {
"opacity": 1.0, # "opacity": 1.0,
"ui_scaling": 1.0, # "ui_scaling": 1.0,
} # }
self._ENABLE_OVERLAY_SMALL_LOG = False # self._ENABLE_OVERLAY_SMALL_LOG = False
self._OVERLAY_SMALL_LOG_SETTINGS = { # self._OVERLAY_SMALL_LOG_SETTINGS = {
"x_pos": 0.0, # "x_pos": 0.0,
"y_pos": -0.41, # "y_pos": -0.41,
"depth": 1.0, # "depth": 1.0,
"display_duration": 5, # "display_duration": 5,
"fadeout_duration": 2, # "fadeout_duration": 2,
} # }
self._OVERLAY_UI_TYPE = "default" self._OVERLAY_UI_TYPE = "default"
self._ENABLE_SEND_MESSAGE_TO_VRC = True self._ENABLE_SEND_MESSAGE_TO_VRC = True
self._ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC = False # Speaker2Chatbox self._ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC = False # Speaker2Chatbox

View File

@@ -27,10 +27,10 @@ def callbackFilepathConfigFile():
def callbackQuitVrct(): def callbackQuitVrct():
setMainWindowGeometry() setMainWindowGeometry()
def callbackEnableEasterEgg(): # def callbackEnableEasterEgg():
config.IS_EASTER_EGG_ENABLED = True # config.IS_EASTER_EGG_ENABLED = True
config.OVERLAY_UI_TYPE = "sakura" # config.OVERLAY_UI_TYPE = "sakura"
view.printToTextbox_enableEasterEgg() # view.printToTextbox_enableEasterEgg()
def setMainWindowGeometry(): def setMainWindowGeometry():
PRE_SCALING_INT = strPctToInt(view.getPreUiScaling()) PRE_SCALING_INT = strPctToInt(view.getPreUiScaling())
@@ -161,14 +161,14 @@ def receiveSpeakerMessage(message):
xsoverlay_message = messageFormatter("RECEIVED", translation, message) xsoverlay_message = messageFormatter("RECEIVED", translation, message)
model.notificationXSOverlay(xsoverlay_message) model.notificationXSOverlay(xsoverlay_message)
if model.overlay.initialized is False: # if model.overlay.initialized is False:
model.startOverlay() # model.startOverlay()
else: # else:
if config.ENABLE_OVERLAY_SMALL_LOG is True: # if config.ENABLE_OVERLAY_SMALL_LOG is True:
overlay_image = model.createOverlayImageShort(message, translation) # overlay_image = model.createOverlayImageShort(message, translation)
model.updateOverlay(overlay_image) # model.updateOverlay(overlay_image)
# overlay_image = model.createOverlayImageLong("receive", message, translation) # # overlay_image = model.createOverlayImageLong("receive", message, translation)
# model.updateOverlay(overlay_image) # # model.updateOverlay(overlay_image)
# ------------Speaker2Chatbox------------ # ------------Speaker2Chatbox------------
if config.ENABLE_SPEAKER2CHATBOX is True: if config.ENABLE_SPEAKER2CHATBOX is True:
@@ -858,44 +858,44 @@ def callbackSetWhisperWeightType(value):
config.SELECTED_TRANSCRIPTION_ENGINE = "Google" config.SELECTED_TRANSCRIPTION_ENGINE = "Google"
view.showRestartButtonIfRequired() view.showRestartButtonIfRequired()
# VR Tab # # VR Tab
def callbackSetOverlaySettings(value, set_type:str): # def callbackSetOverlaySettings(value, set_type:str):
print("callbackSetOverlaySettings", value, set_type) # print("callbackSetOverlaySettings", value, set_type)
pre_settings = config.OVERLAY_SETTINGS # pre_settings = config.OVERLAY_SETTINGS
pre_settings[set_type] = value # pre_settings[set_type] = value
config.OVERLAY_SETTINGS = pre_settings # config.OVERLAY_SETTINGS = pre_settings
match (set_type): # match (set_type):
case "opacity": # case "opacity":
model.updateOverlayImageOpacity() # model.updateOverlayImageOpacity()
case "ui_scaling": # case "ui_scaling":
model.updateOverlayImageUiScaling() # model.updateOverlayImageUiScaling()
def callbackSetEnableOverlaySmallLog(value): # def callbackSetEnableOverlaySmallLog(value):
print("callbackSetEnableOverlaySmallLog", value) # print("callbackSetEnableOverlaySmallLog", value)
config.ENABLE_OVERLAY_SMALL_LOG = value # config.ENABLE_OVERLAY_SMALL_LOG = value
if config.ENABLE_OVERLAY_SMALL_LOG is True: # if config.ENABLE_OVERLAY_SMALL_LOG is True:
pass # pass
else: # else:
if model.overlay.initialized is True: # if model.overlay.initialized is True:
model.clearOverlayImage() # model.clearOverlayImage()
def callbackSetOverlaySmallLogSettings(value, set_type:str): # def callbackSetOverlaySmallLogSettings(value, set_type:str):
print("callbackSetOverlaySmallLogSettings", value, set_type) # print("callbackSetOverlaySmallLogSettings", value, set_type)
pre_settings = config.OVERLAY_SMALL_LOG_SETTINGS # pre_settings = config.OVERLAY_SMALL_LOG_SETTINGS
pre_settings[set_type] = value # pre_settings[set_type] = value
config.OVERLAY_SMALL_LOG_SETTINGS = pre_settings # config.OVERLAY_SMALL_LOG_SETTINGS = pre_settings
match (set_type): # match (set_type):
case "x_pos": # case "x_pos":
model.updateOverlayPosition() # model.updateOverlayPosition()
case "y_pos": # case "y_pos":
model.updateOverlayPosition() # model.updateOverlayPosition()
case "depth": # case "depth":
model.updateOverlayPosition() # model.updateOverlayPosition()
case "display_duration": # case "display_duration":
model.updateOverlayTimes() # model.updateOverlayTimes()
case "fadeout_duration": # case "fadeout_duration":
model.updateOverlayTimes() # model.updateOverlayTimes()
# Others Tab # Others Tab
def callbackSetEnableAutoClearMessageBox(value): def callbackSetEnableAutoClearMessageBox(value):
@@ -1049,7 +1049,7 @@ def createMainWindow(splash):
# set UI and callback # set UI and callback
view.register( view.register(
common_registers={ common_registers={
"callback_enable_easter_egg": callbackEnableEasterEgg, # "callback_enable_easter_egg": callbackEnableEasterEgg,
"callback_update_software": callbackUpdateSoftware, "callback_update_software": callbackUpdateSoftware,
"callback_restart_software": callbackRestartSoftware, "callback_restart_software": callbackRestartSoftware,
@@ -1137,10 +1137,10 @@ def createMainWindow(splash):
"callback_set_use_whisper_feature": callbackSetUserWhisperFeature, "callback_set_use_whisper_feature": callbackSetUserWhisperFeature,
"callback_set_whisper_weight_type": callbackSetWhisperWeightType, "callback_set_whisper_weight_type": callbackSetWhisperWeightType,
# VR Tab # # VR Tab
"callback_set_overlay_settings": callbackSetOverlaySettings, # "callback_set_overlay_settings": callbackSetOverlaySettings,
"callback_set_enable_overlay_small_log": callbackSetEnableOverlaySmallLog, # "callback_set_enable_overlay_small_log": callbackSetEnableOverlaySmallLog,
"callback_set_overlay_small_log_settings": callbackSetOverlaySmallLogSettings, # "callback_set_overlay_small_log_settings": callbackSetOverlaySmallLogSettings,
# Others Tab # Others Tab
"callback_set_enable_auto_clear_chatbox": callbackSetEnableAutoClearMessageBox, "callback_set_enable_auto_clear_chatbox": callbackSetEnableAutoClearMessageBox,

130
model.py
View File

@@ -26,8 +26,8 @@ from models.translation.translation_languages import translation_lang
from models.transcription.transcription_languages import transcription_lang from models.transcription.transcription_languages import transcription_lang
from models.translation.translation_utils import checkCTranslate2Weight from models.translation.translation_utils import checkCTranslate2Weight
from models.transcription.transcription_whisper import checkWhisperWeight from models.transcription.transcription_whisper import checkWhisperWeight
from models.overlay.overlay import Overlay # from models.overlay.overlay import Overlay
from models.overlay.overlay_image import OverlayImage # from models.overlay.overlay_image import OverlayImage
from config import config from config import config
@@ -72,18 +72,18 @@ class Model:
self.previous_receive_message = "" self.previous_receive_message = ""
self.translator = Translator() self.translator = Translator()
self.keyword_processor = KeywordProcessor() self.keyword_processor = KeywordProcessor()
self.overlay = Overlay( # self.overlay = Overlay(
config.OVERLAY_SMALL_LOG_SETTINGS["x_pos"], # config.OVERLAY_SMALL_LOG_SETTINGS["x_pos"],
config.OVERLAY_SMALL_LOG_SETTINGS["y_pos"], # config.OVERLAY_SMALL_LOG_SETTINGS["y_pos"],
config.OVERLAY_SMALL_LOG_SETTINGS["depth"], # config.OVERLAY_SMALL_LOG_SETTINGS["depth"],
config.OVERLAY_SMALL_LOG_SETTINGS["display_duration"], # config.OVERLAY_SMALL_LOG_SETTINGS["display_duration"],
config.OVERLAY_SMALL_LOG_SETTINGS["fadeout_duration"], # config.OVERLAY_SMALL_LOG_SETTINGS["fadeout_duration"],
config.OVERLAY_SETTINGS["opacity"], # config.OVERLAY_SETTINGS["opacity"],
config.OVERLAY_SETTINGS["ui_scaling"], # config.OVERLAY_SETTINGS["ui_scaling"],
) # )
self.overlay_image = OverlayImage() # self.overlay_image = OverlayImage()
self.pre_overlay_message = None # self.pre_overlay_message = None
self.th_overlay = None # self.th_overlay = None
def checkCTranslatorCTranslate2ModelWeight(self): def checkCTranslatorCTranslate2ModelWeight(self):
return checkCTranslate2Weight(config.PATH_LOCAL, config.CTRANSLATE2_WEIGHT_TYPE) return checkCTranslate2Weight(config.PATH_LOCAL, config.CTRANSLATE2_WEIGHT_TYPE)
@@ -427,7 +427,7 @@ class Model:
self.mic_print_transcript.stop() self.mic_print_transcript.stop()
self.mic_print_transcript = None self.mic_print_transcript = None
if isinstance(self.mic_audio_recorder, SelectedMicEnergyAndAudioRecorder): if isinstance(self.mic_audio_recorder, SelectedMicEnergyAndAudioRecorder):
self.mic_audio_recorder.stop(wait_for_stop=False) self.mic_audio_recorder.stop(wait_for_stop=True)
self.mic_audio_recorder = None self.mic_audio_recorder = None
# if isinstance(self.mic_get_energy, threadFnc): # if isinstance(self.mic_get_energy, threadFnc):
# self.mic_get_energy.stop() # self.mic_get_energy.stop()
@@ -465,7 +465,7 @@ class Model:
self.mic_energy_plot_progressbar.stop() self.mic_energy_plot_progressbar.stop()
self.mic_energy_plot_progressbar = None self.mic_energy_plot_progressbar = None
if isinstance(self.mic_energy_recorder, SelectedMicEnergyRecorder): if isinstance(self.mic_energy_recorder, SelectedMicEnergyRecorder):
self.mic_energy_recorder.stop(wait_for_stop=False) self.mic_energy_recorder.stop(wait_for_stop=True)
self.mic_energy_recorder = None self.mic_energy_recorder = None
def startSpeakerTranscript(self, fnc, error_fnc=None): def startSpeakerTranscript(self, fnc, error_fnc=None):
@@ -540,7 +540,7 @@ class Model:
self.speaker_print_transcript.stop() self.speaker_print_transcript.stop()
self.speaker_print_transcript = None self.speaker_print_transcript = None
if isinstance(self.speaker_audio_recorder, SelectedSpeakerEnergyAndAudioRecorder): if isinstance(self.speaker_audio_recorder, SelectedSpeakerEnergyAndAudioRecorder):
self.speaker_audio_recorder.stop(wait_for_stop=False) self.speaker_audio_recorder.stop(wait_for_stop=True)
self.speaker_audio_recorder = None self.speaker_audio_recorder = None
# if isinstance(self.speaker_get_energy, threadFnc): # if isinstance(self.speaker_get_energy, threadFnc):
# self.speaker_get_energy.stop() # self.speaker_get_energy.stop()
@@ -578,71 +578,71 @@ class Model:
self.speaker_energy_plot_progressbar.stop() self.speaker_energy_plot_progressbar.stop()
self.speaker_energy_plot_progressbar = None self.speaker_energy_plot_progressbar = None
if isinstance(self.speaker_energy_recorder, SelectedSpeakerEnergyRecorder): if isinstance(self.speaker_energy_recorder, SelectedSpeakerEnergyRecorder):
self.speaker_energy_recorder.stop(wait_for_stop=False) self.speaker_energy_recorder.stop(wait_for_stop=True)
self.speaker_energy_recorder = None self.speaker_energy_recorder = None
def notificationXSOverlay(self, message): def notificationXSOverlay(self, message):
xsoverlayForVRCT(content=f"{message}") xsoverlayForVRCT(content=f"{message}")
def createOverlayImageShort(self, message, translation): # def createOverlayImageShort(self, message, translation):
your_language = config.TARGET_LANGUAGE # your_language = config.TARGET_LANGUAGE
target_language = config.SOURCE_LANGUAGE # target_language = config.SOURCE_LANGUAGE
ui_type = config.OVERLAY_UI_TYPE # ui_type = config.OVERLAY_UI_TYPE
self.pre_overlay_message = { # self.pre_overlay_message = {
"message" : message, # "message" : message,
"your_language" : your_language, # "your_language" : your_language,
"translation" : translation, # "translation" : translation,
"target_language" : target_language, # "target_language" : target_language,
"ui_type" : ui_type, # "ui_type" : ui_type,
} # }
return self.overlay_image.createOverlayImageShort(message, your_language, translation, target_language, ui_type) # return self.overlay_image.createOverlayImageShort(message, your_language, translation, target_language, ui_type)
# def createOverlayImageLong(self, message_type, message, translation): # def createOverlayImageLong(self, message_type, message, translation):
# your_language = config.TARGET_LANGUAGE if message_type == "receive" else config.SOURCE_LANGUAGE # your_language = config.TARGET_LANGUAGE if message_type == "receive" else config.SOURCE_LANGUAGE
# target_language = config.SOURCE_LANGUAGE if message_type == "receive" else config.TARGET_LANGUAGE # target_language = config.SOURCE_LANGUAGE if message_type == "receive" else config.TARGET_LANGUAGE
# return self.overlay_image.create_overlay_image_long(message_type, message, your_language, translation, target_language) # return self.overlay_image.create_overlay_image_long(message_type, message, your_language, translation, target_language)
def clearOverlayImage(self): # def clearOverlayImage(self):
if self.overlay.initialized is True: # if self.overlay.initialized is True:
self.overlay.uiManager.uiClear() # self.overlay.uiManager.uiClear()
def updateOverlay(self, img): # def updateOverlay(self, img):
if self.overlay.initialized is True: # if self.overlay.initialized is True:
self.overlay.uiManager.uiUpdate(img) # self.overlay.uiManager.uiUpdate(img)
def startOverlay(self): # def startOverlay(self):
if self.overlay.initialized is False: # if self.overlay.initialized is False:
self.overlay.init() # self.overlay.init()
if self.overlay.initialized is True and self.th_overlay is None: # if self.overlay.initialized is True and self.th_overlay is None:
self.th_overlay = Thread(target=self.overlay.startOverlay) # self.th_overlay = Thread(target=self.overlay.startOverlay)
self.th_overlay.daemon = True # self.th_overlay.daemon = True
self.th_overlay.start() # self.th_overlay.start()
def updateOverlayPosition(self): # def updateOverlayPosition(self):
if self.overlay.initialized is True: # if self.overlay.initialized is True:
pos = (config.OVERLAY_SMALL_LOG_SETTINGS["x_pos"], config.OVERLAY_SMALL_LOG_SETTINGS["y_pos"]) # pos = (config.OVERLAY_SMALL_LOG_SETTINGS["x_pos"], config.OVERLAY_SMALL_LOG_SETTINGS["y_pos"])
self.overlay.uiManager.setPosition(pos) # self.overlay.uiManager.setPosition(pos)
depth = config.OVERLAY_SMALL_LOG_SETTINGS["depth"] # depth = config.OVERLAY_SMALL_LOG_SETTINGS["depth"]
self.overlay.uiManager.setDepth(depth) # self.overlay.uiManager.setDepth(depth)
self.overlay.uiManager.posUpdate() # self.overlay.uiManager.posUpdate()
def updateOverlayTimes(self): # def updateOverlayTimes(self):
if self.overlay.initialized is True: # if self.overlay.initialized is True:
display_duration = config.OVERLAY_SMALL_LOG_SETTINGS["display_duration"] # display_duration = config.OVERLAY_SMALL_LOG_SETTINGS["display_duration"]
self.overlay.uiManager.setFadeTime(display_duration) # self.overlay.uiManager.setFadeTime(display_duration)
fadeout_duration = config.OVERLAY_SMALL_LOG_SETTINGS["fadeout_duration"] # fadeout_duration = config.OVERLAY_SMALL_LOG_SETTINGS["fadeout_duration"]
self.overlay.uiManager.setFadeInterval(fadeout_duration) # self.overlay.uiManager.setFadeInterval(fadeout_duration)
self.overlay.uiManager.update() # self.overlay.uiManager.update()
def updateOverlayImageOpacity(self): # def updateOverlayImageOpacity(self):
if self.overlay.initialized is True: # if self.overlay.initialized is True:
opacity = config.OVERLAY_SETTINGS["opacity"] # opacity = config.OVERLAY_SETTINGS["opacity"]
self.overlay.uiManager.setTransparency(opacity) # self.overlay.uiManager.setTransparency(opacity)
def updateOverlayImageUiScaling(self): # def updateOverlayImageUiScaling(self):
if self.overlay.initialized is True: # if self.overlay.initialized is True:
ui_scaling = config.OVERLAY_SETTINGS["ui_scaling"] # ui_scaling = config.OVERLAY_SETTINGS["ui_scaling"]
self.overlay.uiManager.setUiScaling(ui_scaling) # self.overlay.uiManager.setUiScaling(ui_scaling)
model = Model() model = Model()

46
view.py
View File

@@ -101,7 +101,7 @@ class View():
self.view_variable = SimpleNamespace( self.view_variable = SimpleNamespace(
# Common # Common
CALLBACK_ENABLE_EASTER_EGG=None, # CALLBACK_ENABLE_EASTER_EGG=None,
CALLBACK_RESTART_SOFTWARE=None, CALLBACK_RESTART_SOFTWARE=None,
CALLBACK_UPDATE_SOFTWARE=None, CALLBACK_UPDATE_SOFTWARE=None,
@@ -160,7 +160,7 @@ class View():
CALLBACK_SET_OVERLAY_SMALL_LOG_SETTINGS=None, # CALLBACK_SET_OVERLAY_SMALL_LOG_SETTINGS=None,
VAR_LABEL_OVERLAY_SMALL_LOG_X_POS=StringVar(value=i18n.t("overlay_settings.x_position")), VAR_LABEL_OVERLAY_SMALL_LOG_X_POS=StringVar(value=i18n.t("overlay_settings.x_position")),
SLIDER_RANGE_OVERLAY_SMALL_LOG_X_POS=(-0.5, 0.5), SLIDER_RANGE_OVERLAY_SMALL_LOG_X_POS=(-0.5, 0.5),
@@ -631,7 +631,7 @@ class View():
if common_registers is not None: if common_registers is not None:
self.view_variable.CALLBACK_ENABLE_EASTER_EGG=common_registers.get("callback_enable_easter_egg", None) # self.view_variable.CALLBACK_ENABLE_EASTER_EGG=common_registers.get("callback_enable_easter_egg", None)
self.view_variable.CALLBACK_UPDATE_SOFTWARE=common_registers.get("callback_update_software", None) self.view_variable.CALLBACK_UPDATE_SOFTWARE=common_registers.get("callback_update_software", None)
self.view_variable.CALLBACK_RESTART_SOFTWARE=common_registers.get("callback_restart_software", None) self.view_variable.CALLBACK_RESTART_SOFTWARE=common_registers.get("callback_restart_software", None)
@@ -756,11 +756,11 @@ class View():
# VR Tab # VR Tab
# VR Tab (Quick Settings) # VR Tab (Quick Settings)
self.view_variable.CALLBACK_SET_OVERLAY_SETTINGS=config_window_registers.get("callback_set_overlay_settings", None) # self.view_variable.CALLBACK_SET_OVERLAY_SETTINGS=config_window_registers.get("callback_set_overlay_settings", None)
self.view_variable.CALLBACK_SET_ENABLE_OVERLAY_SMALL_LOG=config_window_registers.get("callback_set_enable_overlay_small_log", None) # self.view_variable.CALLBACK_SET_ENABLE_OVERLAY_SMALL_LOG=config_window_registers.get("callback_set_enable_overlay_small_log", None)
# VR Tab (Quick Settings) # # VR Tab (Quick Settings)
self.view_variable.CALLBACK_SET_OVERLAY_SMALL_LOG_SETTINGS=config_window_registers.get("callback_set_overlay_small_log_settings", None) # self.view_variable.CALLBACK_SET_OVERLAY_SMALL_LOG_SETTINGS=config_window_registers.get("callback_set_overlay_small_log_settings", None)
# Others Tab # Others Tab
@@ -858,21 +858,21 @@ class View():
# Set Easter Egg # Set Easter Egg
self.count = 0 # self.count = 0
def clickedCounter(_e): # def clickedCounter(_e):
if self.count < 2: # if self.count < 2:
self.count+=1 # self.count+=1
print("Easter egg count:", self.count) # print("Easter egg count:", self.count)
else: # else:
print("Easter egg count:", self.count, "Easter egg has enabled.") # print("Easter egg count:", self.count, "Easter egg has enabled.")
callFunctionIfCallable(self.view_variable.CALLBACK_ENABLE_EASTER_EGG) # callFunctionIfCallable(self.view_variable.CALLBACK_ENABLE_EASTER_EGG)
print(config.OVERLAY_UI_TYPE) # print(config.OVERLAY_UI_TYPE)
vrct_gui.sidebar_logo.bind( # vrct_gui.sidebar_logo.bind(
"<ButtonRelease>", # "<ButtonRelease>",
clickedCounter, # clickedCounter,
"+" # "+"
) # )
# Insert sample conversation for testing. # Insert sample conversation for testing.
@@ -1894,8 +1894,8 @@ class View():
# Print To Textbox. # Print To Textbox.
def printToTextbox_enableEasterEgg(self): # def printToTextbox_enableEasterEgg(self):
self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.enabled_easter_egg")) # self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.enabled_easter_egg"))
def printToTextbox_enableTranslation(self): def printToTextbox_enableTranslation(self):
self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.enabled_translation")) self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.enabled_translation"))

View File

@@ -104,21 +104,21 @@ def createSideMenuAndSettingsBoxContainers(config_window, settings, view_variabl
] ]
}, },
}, },
{ # {
"side_menu_tab_attr_name": "side_menu_tab_vr", # "side_menu_tab_attr_name": "side_menu_tab_vr",
"label_attr_name": "label_vr", # "label_attr_name": "label_vr",
"selected_mark_attr_name": "selected_mark_vr", # "selected_mark_attr_name": "selected_mark_vr",
"textvariable": view_variable.VAR_SIDE_MENU_LABEL_VR, # "textvariable": view_variable.VAR_SIDE_MENU_LABEL_VR,
"setting_box_container_settings": { # "setting_box_container_settings": {
"setting_box_container_attr_name": "setting_box_container_vr", # "setting_box_container_attr_name": "setting_box_container_vr",
"setting_boxes": [ # "setting_boxes": [
{ # {
"var_section_title": None, # "var_section_title": None,
"setting_box": createSettingBox_Vr # "setting_box": createSettingBox_Vr
} # }
] # ]
}, # },
}, # },
{ {
"side_menu_tab_attr_name": "side_menu_tab_others", "side_menu_tab_attr_name": "side_menu_tab_others",
"label_attr_name": "label_others", "label_attr_name": "label_others",

View File

@@ -48,59 +48,59 @@ def createMainWindowWidgets(vrct_gui, settings, view_variable):
# start from 3 # start from 3
main_topbar_column=3 main_topbar_column=3
# Overlay Settings Button # # Overlay Settings Button
vrct_gui.overlay_settings_container = CTkFrame( # vrct_gui.overlay_settings_container = CTkFrame(
vrct_gui.main_topbar_container, # vrct_gui.main_topbar_container,
corner_radius=settings.uism.UPDATE_AVAILABLE_BUTTON_CORNER_RADIUS, # corner_radius=settings.uism.UPDATE_AVAILABLE_BUTTON_CORNER_RADIUS,
fg_color=settings.ctm.MAIN_BG_COLOR, # fg_color=settings.ctm.MAIN_BG_COLOR,
cursor="hand2", # cursor="hand2",
) # )
vrct_gui.overlay_settings_container.grid(row=0, column=main_topbar_column, padx=settings.uism.UPDATE_AVAILABLE_BUTTON_PADX, pady=settings.uism.TOP_BAR_BUTTON_PADY, sticky="nsw") # vrct_gui.overlay_settings_container.grid(row=0, column=main_topbar_column, padx=settings.uism.UPDATE_AVAILABLE_BUTTON_PADX, pady=settings.uism.TOP_BAR_BUTTON_PADY, sticky="nsw")
# vrct_gui.overlay_settings_container.grid_remove() # # vrct_gui.overlay_settings_container.grid_remove()
vrct_gui.overlay_settings_container.grid_rowconfigure((0,2), weight=1) # vrct_gui.overlay_settings_container.grid_rowconfigure((0,2), weight=1)
vrct_gui.overlay_settings_icon = CTkLabel( # vrct_gui.overlay_settings_icon = CTkLabel(
vrct_gui.overlay_settings_container, # vrct_gui.overlay_settings_container,
text=None, # text=None,
corner_radius=0, # corner_radius=0,
height=0, # height=0,
image=CTkImage(settings.image_file.CONFIGURATION_ICON_DISABLED, size=settings.uism.UPDATE_AVAILABLE_BUTTON_SIZE) # image=CTkImage(settings.image_file.CONFIGURATION_ICON_DISABLED, size=settings.uism.UPDATE_AVAILABLE_BUTTON_SIZE)
) # )
vrct_gui.overlay_settings_icon.grid(row=1, column=0, padx=(settings.uism.UPDATE_AVAILABLE_BUTTON_IPADX, settings.uism.UPDATE_AVAILABLE_PADX_BETWEEN_LABEL_AND_ICON), pady=0) # vrct_gui.overlay_settings_icon.grid(row=1, column=0, padx=(settings.uism.UPDATE_AVAILABLE_BUTTON_IPADX, settings.uism.UPDATE_AVAILABLE_PADX_BETWEEN_LABEL_AND_ICON), pady=0)
vrct_gui.overlay_settings_label = CTkLabel( # vrct_gui.overlay_settings_label = CTkLabel(
vrct_gui.overlay_settings_container, # vrct_gui.overlay_settings_container,
textvariable=view_variable.VAR_OVERLAY_SETTINGS, # textvariable=view_variable.VAR_OVERLAY_SETTINGS,
height=0, # height=0,
corner_radius=0, # corner_radius=0,
font=CTkFont(family=settings.FONT_FAMILY, size=settings.uism.UPDATE_AVAILABLE_BUTTON_FONT_SIZE, weight="normal"), # font=CTkFont(family=settings.FONT_FAMILY, size=settings.uism.UPDATE_AVAILABLE_BUTTON_FONT_SIZE, weight="normal"),
anchor="e", # anchor="e",
text_color=settings.ctm.TOP_BAR_BUTTON_TEXT_COLOR, # text_color=settings.ctm.TOP_BAR_BUTTON_TEXT_COLOR,
# text_color=settings.ctm.UPDATE_AVAILABLE_BUTTON_TEXT_COLOR, # # text_color=settings.ctm.UPDATE_AVAILABLE_BUTTON_TEXT_COLOR,
) # )
# This "right padx +1" is for fixing a bug that sticks out from the frame. I don't know why that happens... # # This "right padx +1" is for fixing a bug that sticks out from the frame. I don't know why that happens...
vrct_gui.overlay_settings_label.grid(row=1, column=1, padx=(0,settings.uism.UPDATE_AVAILABLE_BUTTON_IPADX+1), pady=0) # vrct_gui.overlay_settings_label.grid(row=1, column=1, padx=(0,settings.uism.UPDATE_AVAILABLE_BUTTON_IPADX+1), pady=0)
bindButtonFunctionAndColor( # bindButtonFunctionAndColor(
target_widgets=[ # target_widgets=[
vrct_gui.overlay_settings_container, # vrct_gui.overlay_settings_container,
vrct_gui.overlay_settings_label, # vrct_gui.overlay_settings_label,
vrct_gui.overlay_settings_icon, # vrct_gui.overlay_settings_icon,
], # ],
enter_color=settings.ctm.TOP_BAR_BUTTON_HOVERED_BG_COLOR, # enter_color=settings.ctm.TOP_BAR_BUTTON_HOVERED_BG_COLOR,
leave_color=settings.ctm.TOP_BAR_BUTTON_BG_COLOR, # leave_color=settings.ctm.TOP_BAR_BUTTON_BG_COLOR,
clicked_color=settings.ctm.TOP_BAR_BUTTON_CLICKED_BG_COLOR, # clicked_color=settings.ctm.TOP_BAR_BUTTON_CLICKED_BG_COLOR,
buttonReleasedFunction=lambda e: callFunctionIfCallable(view_variable.CALLBACK_SET_OPEN_OVERLAY_SETTINGS_WINDOW), # buttonReleasedFunction=lambda e: callFunctionIfCallable(view_variable.CALLBACK_SET_OPEN_OVERLAY_SETTINGS_WINDOW),
) # )
main_topbar_column+=1 # main_topbar_column+=1
# Update Available Button # Update Available Button
vrct_gui.update_available_container = CTkFrame( vrct_gui.update_available_container = CTkFrame(
vrct_gui.main_topbar_container, vrct_gui.main_topbar_container,

View File

@@ -14,7 +14,7 @@ from ._PrintToTextbox import _PrintToTextbox
from .main_window import createMainWindowWidgets from .main_window import createMainWindowWidgets
from .config_window import ConfigWindow from .config_window import ConfigWindow
from .quick_settings_window import QuickSettingsWindow # from .quick_settings_window import QuickSettingsWindow
from .ui_utils import setDefaultActiveTab, setGeometryToCenterOfScreen, fadeInAnimation from .ui_utils import setDefaultActiveTab, setGeometryToCenterOfScreen, fadeInAnimation
from utils import callFunctionIfCallable from utils import callFunctionIfCallable
@@ -131,11 +131,11 @@ class VRCT_GUI(CTk):
view_variable=self._view_variable view_variable=self._view_variable
) )
self.quick_settings_window = QuickSettingsWindow( # self.quick_settings_window = QuickSettingsWindow(
vrct_gui=self, # vrct_gui=self,
settings=self.settings.config_window, # settings=self.settings.config_window,
view_variable=self._view_variable # view_variable=self._view_variable
) # )
# self.quick_settings_window.show() # self.quick_settings_window.show()
self.selectable_languages_window = _CreateSelectableLanguagesWindow( self.selectable_languages_window = _CreateSelectableLanguagesWindow(