Merge branch 'overlay_mask' into develop
# Conflicts: # view.py # vrct_gui/main_window/createMainWindowWidgets.py
This commit is contained in:
112
config.py
112
config.py
@@ -736,57 +736,57 @@ class Config:
|
||||
self._ENABLE_NOTICE_XSOVERLAY = value
|
||||
saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value)
|
||||
|
||||
@property
|
||||
@json_serializable('OVERLAY_SETTINGS')
|
||||
def OVERLAY_SETTINGS(self):
|
||||
return self._OVERLAY_SETTINGS
|
||||
# @property
|
||||
# @json_serializable('OVERLAY_SETTINGS')
|
||||
# def OVERLAY_SETTINGS(self):
|
||||
# return self._OVERLAY_SETTINGS
|
||||
|
||||
@OVERLAY_SETTINGS.setter
|
||||
def OVERLAY_SETTINGS(self, value):
|
||||
if isinstance(value, dict) and set(value.keys()) == set(self.OVERLAY_SETTINGS.keys()):
|
||||
for key, value in value.items():
|
||||
if isinstance(value, float):
|
||||
self._OVERLAY_SETTINGS[key] = value
|
||||
saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, self.OVERLAY_SETTINGS)
|
||||
# @OVERLAY_SETTINGS.setter
|
||||
# def OVERLAY_SETTINGS(self, value):
|
||||
# if isinstance(value, dict) and set(value.keys()) == set(self.OVERLAY_SETTINGS.keys()):
|
||||
# for key, value in value.items():
|
||||
# if isinstance(value, float):
|
||||
# self._OVERLAY_SETTINGS[key] = value
|
||||
# saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, self.OVERLAY_SETTINGS)
|
||||
|
||||
@property
|
||||
@json_serializable('ENABLE_OVERLAY_SMALL_LOG')
|
||||
def ENABLE_OVERLAY_SMALL_LOG(self):
|
||||
return self._ENABLE_OVERLAY_SMALL_LOG
|
||||
# @property
|
||||
# @json_serializable('ENABLE_OVERLAY_SMALL_LOG')
|
||||
# def ENABLE_OVERLAY_SMALL_LOG(self):
|
||||
# return self._ENABLE_OVERLAY_SMALL_LOG
|
||||
|
||||
@ENABLE_OVERLAY_SMALL_LOG.setter
|
||||
def ENABLE_OVERLAY_SMALL_LOG(self, value):
|
||||
if isinstance(value, bool):
|
||||
self._ENABLE_OVERLAY_SMALL_LOG = value
|
||||
saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value)
|
||||
# @ENABLE_OVERLAY_SMALL_LOG.setter
|
||||
# def ENABLE_OVERLAY_SMALL_LOG(self, value):
|
||||
# if isinstance(value, bool):
|
||||
# self._ENABLE_OVERLAY_SMALL_LOG = value
|
||||
# saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value)
|
||||
|
||||
@property
|
||||
@json_serializable('OVERLAY_SMALL_LOG_SETTINGS')
|
||||
def OVERLAY_SMALL_LOG_SETTINGS(self):
|
||||
return self._OVERLAY_SMALL_LOG_SETTINGS
|
||||
# @property
|
||||
# @json_serializable('OVERLAY_SMALL_LOG_SETTINGS')
|
||||
# def OVERLAY_SMALL_LOG_SETTINGS(self):
|
||||
# return self._OVERLAY_SMALL_LOG_SETTINGS
|
||||
|
||||
@OVERLAY_SMALL_LOG_SETTINGS.setter
|
||||
def OVERLAY_SMALL_LOG_SETTINGS(self, value):
|
||||
if isinstance(value, dict) and set(value.keys()) == set(self.OVERLAY_SMALL_LOG_SETTINGS.keys()):
|
||||
for key, value in value.items():
|
||||
match (key):
|
||||
case "x_pos" | "y_pos" | "depth":
|
||||
if isinstance(value, float):
|
||||
self._OVERLAY_SMALL_LOG_SETTINGS[key] = value
|
||||
case "display_duration" | "fadeout_duration":
|
||||
if isinstance(value, int):
|
||||
self._OVERLAY_SMALL_LOG_SETTINGS[key] = value
|
||||
saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, self.OVERLAY_SMALL_LOG_SETTINGS)
|
||||
# @OVERLAY_SMALL_LOG_SETTINGS.setter
|
||||
# def OVERLAY_SMALL_LOG_SETTINGS(self, value):
|
||||
# if isinstance(value, dict) and set(value.keys()) == set(self.OVERLAY_SMALL_LOG_SETTINGS.keys()):
|
||||
# for key, value in value.items():
|
||||
# match (key):
|
||||
# case "x_pos" | "y_pos" | "depth":
|
||||
# if isinstance(value, float):
|
||||
# self._OVERLAY_SMALL_LOG_SETTINGS[key] = value
|
||||
# case "display_duration" | "fadeout_duration":
|
||||
# if isinstance(value, int):
|
||||
# self._OVERLAY_SMALL_LOG_SETTINGS[key] = value
|
||||
# saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, self.OVERLAY_SMALL_LOG_SETTINGS)
|
||||
|
||||
@property
|
||||
@json_serializable('OVERLAY_UI_TYPE')
|
||||
def OVERLAY_UI_TYPE(self):
|
||||
return self._OVERLAY_UI_TYPE
|
||||
# @property
|
||||
# @json_serializable('OVERLAY_UI_TYPE')
|
||||
# def OVERLAY_UI_TYPE(self):
|
||||
# return self._OVERLAY_UI_TYPE
|
||||
|
||||
@OVERLAY_UI_TYPE.setter
|
||||
def OVERLAY_UI_TYPE(self, value):
|
||||
if isinstance(value, str):
|
||||
self._OVERLAY_UI_TYPE = value
|
||||
# @OVERLAY_UI_TYPE.setter
|
||||
# def OVERLAY_UI_TYPE(self, value):
|
||||
# if isinstance(value, str):
|
||||
# self._OVERLAY_UI_TYPE = value
|
||||
# saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value)
|
||||
|
||||
@property
|
||||
@@ -1054,18 +1054,18 @@ class Config:
|
||||
self._ENABLE_SEND_ONLY_TRANSLATED_MESSAGES = False
|
||||
self._SEND_MESSAGE_BUTTON_TYPE = "show"
|
||||
self._ENABLE_NOTICE_XSOVERLAY = False
|
||||
self._OVERLAY_SETTINGS = {
|
||||
"opacity": 1.0,
|
||||
"ui_scaling": 1.0,
|
||||
}
|
||||
self._ENABLE_OVERLAY_SMALL_LOG = False
|
||||
self._OVERLAY_SMALL_LOG_SETTINGS = {
|
||||
"x_pos": 0.0,
|
||||
"y_pos": -0.41,
|
||||
"depth": 1.0,
|
||||
"display_duration": 5,
|
||||
"fadeout_duration": 2,
|
||||
}
|
||||
# self._OVERLAY_SETTINGS = {
|
||||
# "opacity": 1.0,
|
||||
# "ui_scaling": 1.0,
|
||||
# }
|
||||
# self._ENABLE_OVERLAY_SMALL_LOG = False
|
||||
# self._OVERLAY_SMALL_LOG_SETTINGS = {
|
||||
# "x_pos": 0.0,
|
||||
# "y_pos": -0.41,
|
||||
# "depth": 1.0,
|
||||
# "display_duration": 5,
|
||||
# "fadeout_duration": 2,
|
||||
# }
|
||||
self._OVERLAY_UI_TYPE = "default"
|
||||
self._ENABLE_SEND_MESSAGE_TO_VRC = True
|
||||
self._ENABLE_SEND_RECEIVED_MESSAGE_TO_VRC = False # Speaker2Chatbox
|
||||
|
||||
106
controller.py
106
controller.py
@@ -27,10 +27,10 @@ def callbackFilepathConfigFile():
|
||||
def callbackQuitVrct():
|
||||
setMainWindowGeometry()
|
||||
|
||||
def callbackEnableEasterEgg():
|
||||
config.IS_EASTER_EGG_ENABLED = True
|
||||
config.OVERLAY_UI_TYPE = "sakura"
|
||||
view.printToTextbox_enableEasterEgg()
|
||||
# def callbackEnableEasterEgg():
|
||||
# config.IS_EASTER_EGG_ENABLED = True
|
||||
# config.OVERLAY_UI_TYPE = "sakura"
|
||||
# view.printToTextbox_enableEasterEgg()
|
||||
|
||||
def setMainWindowGeometry():
|
||||
PRE_SCALING_INT = strPctToInt(view.getPreUiScaling())
|
||||
@@ -161,14 +161,14 @@ def receiveSpeakerMessage(message):
|
||||
xsoverlay_message = messageFormatter("RECEIVED", translation, message)
|
||||
model.notificationXSOverlay(xsoverlay_message)
|
||||
|
||||
if model.overlay.initialized is False:
|
||||
model.startOverlay()
|
||||
else:
|
||||
if config.ENABLE_OVERLAY_SMALL_LOG is True:
|
||||
overlay_image = model.createOverlayImageShort(message, translation)
|
||||
model.updateOverlay(overlay_image)
|
||||
# overlay_image = model.createOverlayImageLong("receive", message, translation)
|
||||
# model.updateOverlay(overlay_image)
|
||||
# if model.overlay.initialized is False:
|
||||
# model.startOverlay()
|
||||
# else:
|
||||
# if config.ENABLE_OVERLAY_SMALL_LOG is True:
|
||||
# overlay_image = model.createOverlayImageShort(message, translation)
|
||||
# model.updateOverlay(overlay_image)
|
||||
# # overlay_image = model.createOverlayImageLong("receive", message, translation)
|
||||
# # model.updateOverlay(overlay_image)
|
||||
|
||||
# ------------Speaker2Chatbox------------
|
||||
if config.ENABLE_SPEAKER2CHATBOX is True:
|
||||
@@ -858,44 +858,44 @@ def callbackSetWhisperWeightType(value):
|
||||
config.SELECTED_TRANSCRIPTION_ENGINE = "Google"
|
||||
view.showRestartButtonIfRequired()
|
||||
|
||||
# VR Tab
|
||||
def callbackSetOverlaySettings(value, set_type:str):
|
||||
print("callbackSetOverlaySettings", value, set_type)
|
||||
pre_settings = config.OVERLAY_SETTINGS
|
||||
pre_settings[set_type] = value
|
||||
config.OVERLAY_SETTINGS = pre_settings
|
||||
match (set_type):
|
||||
case "opacity":
|
||||
model.updateOverlayImageOpacity()
|
||||
case "ui_scaling":
|
||||
model.updateOverlayImageUiScaling()
|
||||
# # VR Tab
|
||||
# def callbackSetOverlaySettings(value, set_type:str):
|
||||
# print("callbackSetOverlaySettings", value, set_type)
|
||||
# pre_settings = config.OVERLAY_SETTINGS
|
||||
# pre_settings[set_type] = value
|
||||
# config.OVERLAY_SETTINGS = pre_settings
|
||||
# match (set_type):
|
||||
# case "opacity":
|
||||
# model.updateOverlayImageOpacity()
|
||||
# case "ui_scaling":
|
||||
# model.updateOverlayImageUiScaling()
|
||||
|
||||
def callbackSetEnableOverlaySmallLog(value):
|
||||
print("callbackSetEnableOverlaySmallLog", value)
|
||||
config.ENABLE_OVERLAY_SMALL_LOG = value
|
||||
|
||||
if config.ENABLE_OVERLAY_SMALL_LOG is True:
|
||||
pass
|
||||
else:
|
||||
if model.overlay.initialized is True:
|
||||
model.clearOverlayImage()
|
||||
# def callbackSetEnableOverlaySmallLog(value):
|
||||
# print("callbackSetEnableOverlaySmallLog", value)
|
||||
# config.ENABLE_OVERLAY_SMALL_LOG = value
|
||||
|
||||
def callbackSetOverlaySmallLogSettings(value, set_type:str):
|
||||
print("callbackSetOverlaySmallLogSettings", value, set_type)
|
||||
pre_settings = config.OVERLAY_SMALL_LOG_SETTINGS
|
||||
pre_settings[set_type] = value
|
||||
config.OVERLAY_SMALL_LOG_SETTINGS = pre_settings
|
||||
match (set_type):
|
||||
case "x_pos":
|
||||
model.updateOverlayPosition()
|
||||
case "y_pos":
|
||||
model.updateOverlayPosition()
|
||||
case "depth":
|
||||
model.updateOverlayPosition()
|
||||
case "display_duration":
|
||||
model.updateOverlayTimes()
|
||||
case "fadeout_duration":
|
||||
model.updateOverlayTimes()
|
||||
# if config.ENABLE_OVERLAY_SMALL_LOG is True:
|
||||
# pass
|
||||
# else:
|
||||
# if model.overlay.initialized is True:
|
||||
# model.clearOverlayImage()
|
||||
|
||||
# def callbackSetOverlaySmallLogSettings(value, set_type:str):
|
||||
# print("callbackSetOverlaySmallLogSettings", value, set_type)
|
||||
# pre_settings = config.OVERLAY_SMALL_LOG_SETTINGS
|
||||
# pre_settings[set_type] = value
|
||||
# config.OVERLAY_SMALL_LOG_SETTINGS = pre_settings
|
||||
# match (set_type):
|
||||
# case "x_pos":
|
||||
# model.updateOverlayPosition()
|
||||
# case "y_pos":
|
||||
# model.updateOverlayPosition()
|
||||
# case "depth":
|
||||
# model.updateOverlayPosition()
|
||||
# case "display_duration":
|
||||
# model.updateOverlayTimes()
|
||||
# case "fadeout_duration":
|
||||
# model.updateOverlayTimes()
|
||||
|
||||
# Others Tab
|
||||
def callbackSetEnableAutoClearMessageBox(value):
|
||||
@@ -1049,7 +1049,7 @@ def createMainWindow(splash):
|
||||
# set UI and callback
|
||||
view.register(
|
||||
common_registers={
|
||||
"callback_enable_easter_egg": callbackEnableEasterEgg,
|
||||
# "callback_enable_easter_egg": callbackEnableEasterEgg,
|
||||
|
||||
"callback_update_software": callbackUpdateSoftware,
|
||||
"callback_restart_software": callbackRestartSoftware,
|
||||
@@ -1137,10 +1137,10 @@ def createMainWindow(splash):
|
||||
"callback_set_use_whisper_feature": callbackSetUserWhisperFeature,
|
||||
"callback_set_whisper_weight_type": callbackSetWhisperWeightType,
|
||||
|
||||
# VR Tab
|
||||
"callback_set_overlay_settings": callbackSetOverlaySettings,
|
||||
"callback_set_enable_overlay_small_log": callbackSetEnableOverlaySmallLog,
|
||||
"callback_set_overlay_small_log_settings": callbackSetOverlaySmallLogSettings,
|
||||
# # VR Tab
|
||||
# "callback_set_overlay_settings": callbackSetOverlaySettings,
|
||||
# "callback_set_enable_overlay_small_log": callbackSetEnableOverlaySmallLog,
|
||||
# "callback_set_overlay_small_log_settings": callbackSetOverlaySmallLogSettings,
|
||||
|
||||
# Others Tab
|
||||
"callback_set_enable_auto_clear_chatbox": callbackSetEnableAutoClearMessageBox,
|
||||
|
||||
130
model.py
130
model.py
@@ -26,8 +26,8 @@ from models.translation.translation_languages import translation_lang
|
||||
from models.transcription.transcription_languages import transcription_lang
|
||||
from models.translation.translation_utils import checkCTranslate2Weight
|
||||
from models.transcription.transcription_whisper import checkWhisperWeight
|
||||
from models.overlay.overlay import Overlay
|
||||
from models.overlay.overlay_image import OverlayImage
|
||||
# from models.overlay.overlay import Overlay
|
||||
# from models.overlay.overlay_image import OverlayImage
|
||||
|
||||
from config import config
|
||||
|
||||
@@ -72,18 +72,18 @@ class Model:
|
||||
self.previous_receive_message = ""
|
||||
self.translator = Translator()
|
||||
self.keyword_processor = KeywordProcessor()
|
||||
self.overlay = Overlay(
|
||||
config.OVERLAY_SMALL_LOG_SETTINGS["x_pos"],
|
||||
config.OVERLAY_SMALL_LOG_SETTINGS["y_pos"],
|
||||
config.OVERLAY_SMALL_LOG_SETTINGS["depth"],
|
||||
config.OVERLAY_SMALL_LOG_SETTINGS["display_duration"],
|
||||
config.OVERLAY_SMALL_LOG_SETTINGS["fadeout_duration"],
|
||||
config.OVERLAY_SETTINGS["opacity"],
|
||||
config.OVERLAY_SETTINGS["ui_scaling"],
|
||||
)
|
||||
self.overlay_image = OverlayImage()
|
||||
self.pre_overlay_message = None
|
||||
self.th_overlay = None
|
||||
# self.overlay = Overlay(
|
||||
# config.OVERLAY_SMALL_LOG_SETTINGS["x_pos"],
|
||||
# config.OVERLAY_SMALL_LOG_SETTINGS["y_pos"],
|
||||
# config.OVERLAY_SMALL_LOG_SETTINGS["depth"],
|
||||
# config.OVERLAY_SMALL_LOG_SETTINGS["display_duration"],
|
||||
# config.OVERLAY_SMALL_LOG_SETTINGS["fadeout_duration"],
|
||||
# config.OVERLAY_SETTINGS["opacity"],
|
||||
# config.OVERLAY_SETTINGS["ui_scaling"],
|
||||
# )
|
||||
# self.overlay_image = OverlayImage()
|
||||
# self.pre_overlay_message = None
|
||||
# self.th_overlay = None
|
||||
|
||||
def checkCTranslatorCTranslate2ModelWeight(self):
|
||||
return checkCTranslate2Weight(config.PATH_LOCAL, config.CTRANSLATE2_WEIGHT_TYPE)
|
||||
@@ -427,7 +427,7 @@ class Model:
|
||||
self.mic_print_transcript.stop()
|
||||
self.mic_print_transcript = None
|
||||
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
|
||||
# if isinstance(self.mic_get_energy, threadFnc):
|
||||
# self.mic_get_energy.stop()
|
||||
@@ -465,7 +465,7 @@ class Model:
|
||||
self.mic_energy_plot_progressbar.stop()
|
||||
self.mic_energy_plot_progressbar = None
|
||||
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
|
||||
|
||||
def startSpeakerTranscript(self, fnc, error_fnc=None):
|
||||
@@ -540,7 +540,7 @@ class Model:
|
||||
self.speaker_print_transcript.stop()
|
||||
self.speaker_print_transcript = None
|
||||
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
|
||||
# if isinstance(self.speaker_get_energy, threadFnc):
|
||||
# self.speaker_get_energy.stop()
|
||||
@@ -578,71 +578,71 @@ class Model:
|
||||
self.speaker_energy_plot_progressbar.stop()
|
||||
self.speaker_energy_plot_progressbar = None
|
||||
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
|
||||
|
||||
def notificationXSOverlay(self, message):
|
||||
xsoverlayForVRCT(content=f"{message}")
|
||||
|
||||
def createOverlayImageShort(self, message, translation):
|
||||
your_language = config.TARGET_LANGUAGE
|
||||
target_language = config.SOURCE_LANGUAGE
|
||||
ui_type = config.OVERLAY_UI_TYPE
|
||||
self.pre_overlay_message = {
|
||||
"message" : message,
|
||||
"your_language" : your_language,
|
||||
"translation" : translation,
|
||||
"target_language" : target_language,
|
||||
"ui_type" : ui_type,
|
||||
}
|
||||
return self.overlay_image.createOverlayImageShort(message, your_language, translation, target_language, ui_type)
|
||||
# def createOverlayImageShort(self, message, translation):
|
||||
# your_language = config.TARGET_LANGUAGE
|
||||
# target_language = config.SOURCE_LANGUAGE
|
||||
# ui_type = config.OVERLAY_UI_TYPE
|
||||
# self.pre_overlay_message = {
|
||||
# "message" : message,
|
||||
# "your_language" : your_language,
|
||||
# "translation" : translation,
|
||||
# "target_language" : target_language,
|
||||
# "ui_type" : ui_type,
|
||||
# }
|
||||
# return self.overlay_image.createOverlayImageShort(message, your_language, translation, target_language, ui_type)
|
||||
|
||||
# def createOverlayImageLong(self, message_type, message, translation):
|
||||
# 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
|
||||
# return self.overlay_image.create_overlay_image_long(message_type, message, your_language, translation, target_language)
|
||||
|
||||
def clearOverlayImage(self):
|
||||
if self.overlay.initialized is True:
|
||||
self.overlay.uiManager.uiClear()
|
||||
# def clearOverlayImage(self):
|
||||
# if self.overlay.initialized is True:
|
||||
# self.overlay.uiManager.uiClear()
|
||||
|
||||
def updateOverlay(self, img):
|
||||
if self.overlay.initialized is True:
|
||||
self.overlay.uiManager.uiUpdate(img)
|
||||
# def updateOverlay(self, img):
|
||||
# if self.overlay.initialized is True:
|
||||
# self.overlay.uiManager.uiUpdate(img)
|
||||
|
||||
def startOverlay(self):
|
||||
if self.overlay.initialized is False:
|
||||
self.overlay.init()
|
||||
# def startOverlay(self):
|
||||
# if self.overlay.initialized is False:
|
||||
# self.overlay.init()
|
||||
|
||||
if self.overlay.initialized is True and self.th_overlay is None:
|
||||
self.th_overlay = Thread(target=self.overlay.startOverlay)
|
||||
self.th_overlay.daemon = True
|
||||
self.th_overlay.start()
|
||||
# if self.overlay.initialized is True and self.th_overlay is None:
|
||||
# self.th_overlay = Thread(target=self.overlay.startOverlay)
|
||||
# self.th_overlay.daemon = True
|
||||
# self.th_overlay.start()
|
||||
|
||||
def updateOverlayPosition(self):
|
||||
if self.overlay.initialized is True:
|
||||
pos = (config.OVERLAY_SMALL_LOG_SETTINGS["x_pos"], config.OVERLAY_SMALL_LOG_SETTINGS["y_pos"])
|
||||
self.overlay.uiManager.setPosition(pos)
|
||||
depth = config.OVERLAY_SMALL_LOG_SETTINGS["depth"]
|
||||
self.overlay.uiManager.setDepth(depth)
|
||||
self.overlay.uiManager.posUpdate()
|
||||
# def updateOverlayPosition(self):
|
||||
# if self.overlay.initialized is True:
|
||||
# pos = (config.OVERLAY_SMALL_LOG_SETTINGS["x_pos"], config.OVERLAY_SMALL_LOG_SETTINGS["y_pos"])
|
||||
# self.overlay.uiManager.setPosition(pos)
|
||||
# depth = config.OVERLAY_SMALL_LOG_SETTINGS["depth"]
|
||||
# self.overlay.uiManager.setDepth(depth)
|
||||
# self.overlay.uiManager.posUpdate()
|
||||
|
||||
def updateOverlayTimes(self):
|
||||
if self.overlay.initialized is True:
|
||||
display_duration = config.OVERLAY_SMALL_LOG_SETTINGS["display_duration"]
|
||||
self.overlay.uiManager.setFadeTime(display_duration)
|
||||
fadeout_duration = config.OVERLAY_SMALL_LOG_SETTINGS["fadeout_duration"]
|
||||
self.overlay.uiManager.setFadeInterval(fadeout_duration)
|
||||
self.overlay.uiManager.update()
|
||||
# def updateOverlayTimes(self):
|
||||
# if self.overlay.initialized is True:
|
||||
# display_duration = config.OVERLAY_SMALL_LOG_SETTINGS["display_duration"]
|
||||
# self.overlay.uiManager.setFadeTime(display_duration)
|
||||
# fadeout_duration = config.OVERLAY_SMALL_LOG_SETTINGS["fadeout_duration"]
|
||||
# self.overlay.uiManager.setFadeInterval(fadeout_duration)
|
||||
# self.overlay.uiManager.update()
|
||||
|
||||
def updateOverlayImageOpacity(self):
|
||||
if self.overlay.initialized is True:
|
||||
opacity = config.OVERLAY_SETTINGS["opacity"]
|
||||
self.overlay.uiManager.setTransparency(opacity)
|
||||
# def updateOverlayImageOpacity(self):
|
||||
# if self.overlay.initialized is True:
|
||||
# opacity = config.OVERLAY_SETTINGS["opacity"]
|
||||
# self.overlay.uiManager.setTransparency(opacity)
|
||||
|
||||
def updateOverlayImageUiScaling(self):
|
||||
if self.overlay.initialized is True:
|
||||
ui_scaling = config.OVERLAY_SETTINGS["ui_scaling"]
|
||||
self.overlay.uiManager.setUiScaling(ui_scaling)
|
||||
# def updateOverlayImageUiScaling(self):
|
||||
# if self.overlay.initialized is True:
|
||||
# ui_scaling = config.OVERLAY_SETTINGS["ui_scaling"]
|
||||
# self.overlay.uiManager.setUiScaling(ui_scaling)
|
||||
|
||||
model = Model()
|
||||
46
view.py
46
view.py
@@ -101,7 +101,7 @@ class View():
|
||||
|
||||
self.view_variable = SimpleNamespace(
|
||||
# Common
|
||||
CALLBACK_ENABLE_EASTER_EGG=None,
|
||||
# CALLBACK_ENABLE_EASTER_EGG=None,
|
||||
|
||||
CALLBACK_RESTART_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")),
|
||||
SLIDER_RANGE_OVERLAY_SMALL_LOG_X_POS=(-0.5, 0.5),
|
||||
@@ -631,7 +631,7 @@ class View():
|
||||
|
||||
|
||||
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_RESTART_SOFTWARE=common_registers.get("callback_restart_software", None)
|
||||
@@ -756,11 +756,11 @@ class View():
|
||||
|
||||
# VR Tab
|
||||
# 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)
|
||||
# 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_ENABLE_OVERLAY_SMALL_LOG=config_window_registers.get("callback_set_enable_overlay_small_log", None)
|
||||
# # VR Tab (Quick Settings)
|
||||
# self.view_variable.CALLBACK_SET_OVERLAY_SMALL_LOG_SETTINGS=config_window_registers.get("callback_set_overlay_small_log_settings", None)
|
||||
|
||||
|
||||
# Others Tab
|
||||
@@ -858,21 +858,21 @@ class View():
|
||||
|
||||
|
||||
# Set Easter Egg
|
||||
self.count = 0
|
||||
def clickedCounter(_e):
|
||||
if self.count < 2:
|
||||
self.count+=1
|
||||
print("Easter egg count:", self.count)
|
||||
else:
|
||||
print("Easter egg count:", self.count, "Easter egg has enabled.")
|
||||
callFunctionIfCallable(self.view_variable.CALLBACK_ENABLE_EASTER_EGG)
|
||||
print(config.OVERLAY_UI_TYPE)
|
||||
# self.count = 0
|
||||
# def clickedCounter(_e):
|
||||
# if self.count < 2:
|
||||
# self.count+=1
|
||||
# print("Easter egg count:", self.count)
|
||||
# else:
|
||||
# print("Easter egg count:", self.count, "Easter egg has enabled.")
|
||||
# callFunctionIfCallable(self.view_variable.CALLBACK_ENABLE_EASTER_EGG)
|
||||
# print(config.OVERLAY_UI_TYPE)
|
||||
|
||||
vrct_gui.sidebar_logo.bind(
|
||||
"<ButtonRelease>",
|
||||
clickedCounter,
|
||||
"+"
|
||||
)
|
||||
# vrct_gui.sidebar_logo.bind(
|
||||
# "<ButtonRelease>",
|
||||
# clickedCounter,
|
||||
# "+"
|
||||
# )
|
||||
|
||||
|
||||
# Insert sample conversation for testing.
|
||||
@@ -1894,8 +1894,8 @@ class View():
|
||||
|
||||
|
||||
# Print To Textbox.
|
||||
def printToTextbox_enableEasterEgg(self):
|
||||
self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.enabled_easter_egg"))
|
||||
# def printToTextbox_enableEasterEgg(self):
|
||||
# self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.enabled_easter_egg"))
|
||||
|
||||
def printToTextbox_enableTranslation(self):
|
||||
self._printToTextbox_Info(i18n.t("main_window.textbox_system_message.enabled_translation"))
|
||||
|
||||
@@ -104,21 +104,21 @@ def createSideMenuAndSettingsBoxContainers(config_window, settings, view_variabl
|
||||
]
|
||||
},
|
||||
},
|
||||
{
|
||||
"side_menu_tab_attr_name": "side_menu_tab_vr",
|
||||
"label_attr_name": "label_vr",
|
||||
"selected_mark_attr_name": "selected_mark_vr",
|
||||
"textvariable": view_variable.VAR_SIDE_MENU_LABEL_VR,
|
||||
"setting_box_container_settings": {
|
||||
"setting_box_container_attr_name": "setting_box_container_vr",
|
||||
"setting_boxes": [
|
||||
{
|
||||
"var_section_title": None,
|
||||
"setting_box": createSettingBox_Vr
|
||||
}
|
||||
]
|
||||
},
|
||||
},
|
||||
# {
|
||||
# "side_menu_tab_attr_name": "side_menu_tab_vr",
|
||||
# "label_attr_name": "label_vr",
|
||||
# "selected_mark_attr_name": "selected_mark_vr",
|
||||
# "textvariable": view_variable.VAR_SIDE_MENU_LABEL_VR,
|
||||
# "setting_box_container_settings": {
|
||||
# "setting_box_container_attr_name": "setting_box_container_vr",
|
||||
# "setting_boxes": [
|
||||
# {
|
||||
# "var_section_title": None,
|
||||
# "setting_box": createSettingBox_Vr
|
||||
# }
|
||||
# ]
|
||||
# },
|
||||
# },
|
||||
{
|
||||
"side_menu_tab_attr_name": "side_menu_tab_others",
|
||||
"label_attr_name": "label_others",
|
||||
|
||||
@@ -48,59 +48,59 @@ def createMainWindowWidgets(vrct_gui, settings, view_variable):
|
||||
# start from 3
|
||||
main_topbar_column=3
|
||||
|
||||
# Overlay Settings Button
|
||||
vrct_gui.overlay_settings_container = CTkFrame(
|
||||
vrct_gui.main_topbar_container,
|
||||
corner_radius=settings.uism.UPDATE_AVAILABLE_BUTTON_CORNER_RADIUS,
|
||||
fg_color=settings.ctm.MAIN_BG_COLOR,
|
||||
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_remove()
|
||||
# # Overlay Settings Button
|
||||
# vrct_gui.overlay_settings_container = CTkFrame(
|
||||
# vrct_gui.main_topbar_container,
|
||||
# corner_radius=settings.uism.UPDATE_AVAILABLE_BUTTON_CORNER_RADIUS,
|
||||
# fg_color=settings.ctm.MAIN_BG_COLOR,
|
||||
# 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_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_container,
|
||||
text=None,
|
||||
corner_radius=0,
|
||||
height=0,
|
||||
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 = CTkLabel(
|
||||
# vrct_gui.overlay_settings_container,
|
||||
# text=None,
|
||||
# corner_radius=0,
|
||||
# height=0,
|
||||
# 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_label = CTkLabel(
|
||||
vrct_gui.overlay_settings_container,
|
||||
textvariable=view_variable.VAR_OVERLAY_SETTINGS,
|
||||
height=0,
|
||||
corner_radius=0,
|
||||
font=CTkFont(family=settings.FONT_FAMILY, size=settings.uism.UPDATE_AVAILABLE_BUTTON_FONT_SIZE, weight="normal"),
|
||||
anchor="e",
|
||||
text_color=settings.ctm.TOP_BAR_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...
|
||||
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 = CTkLabel(
|
||||
# vrct_gui.overlay_settings_container,
|
||||
# textvariable=view_variable.VAR_OVERLAY_SETTINGS,
|
||||
# height=0,
|
||||
# corner_radius=0,
|
||||
# font=CTkFont(family=settings.FONT_FAMILY, size=settings.uism.UPDATE_AVAILABLE_BUTTON_FONT_SIZE, weight="normal"),
|
||||
# anchor="e",
|
||||
# text_color=settings.ctm.TOP_BAR_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...
|
||||
# vrct_gui.overlay_settings_label.grid(row=1, column=1, padx=(0,settings.uism.UPDATE_AVAILABLE_BUTTON_IPADX+1), pady=0)
|
||||
|
||||
|
||||
bindButtonFunctionAndColor(
|
||||
target_widgets=[
|
||||
vrct_gui.overlay_settings_container,
|
||||
vrct_gui.overlay_settings_label,
|
||||
vrct_gui.overlay_settings_icon,
|
||||
],
|
||||
enter_color=settings.ctm.TOP_BAR_BUTTON_HOVERED_BG_COLOR,
|
||||
leave_color=settings.ctm.TOP_BAR_BUTTON_BG_COLOR,
|
||||
clicked_color=settings.ctm.TOP_BAR_BUTTON_CLICKED_BG_COLOR,
|
||||
buttonReleasedFunction=lambda e: callFunctionIfCallable(view_variable.CALLBACK_SET_OPEN_OVERLAY_SETTINGS_WINDOW),
|
||||
)
|
||||
# bindButtonFunctionAndColor(
|
||||
# target_widgets=[
|
||||
# vrct_gui.overlay_settings_container,
|
||||
# vrct_gui.overlay_settings_label,
|
||||
# vrct_gui.overlay_settings_icon,
|
||||
# ],
|
||||
# enter_color=settings.ctm.TOP_BAR_BUTTON_HOVERED_BG_COLOR,
|
||||
# leave_color=settings.ctm.TOP_BAR_BUTTON_BG_COLOR,
|
||||
# clicked_color=settings.ctm.TOP_BAR_BUTTON_CLICKED_BG_COLOR,
|
||||
# buttonReleasedFunction=lambda e: callFunctionIfCallable(view_variable.CALLBACK_SET_OPEN_OVERLAY_SETTINGS_WINDOW),
|
||||
# )
|
||||
|
||||
|
||||
|
||||
|
||||
main_topbar_column+=1
|
||||
# main_topbar_column+=1
|
||||
# Update Available Button
|
||||
vrct_gui.update_available_container = CTkFrame(
|
||||
vrct_gui.main_topbar_container,
|
||||
|
||||
@@ -14,7 +14,7 @@ from ._PrintToTextbox import _PrintToTextbox
|
||||
|
||||
from .main_window import createMainWindowWidgets
|
||||
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 utils import callFunctionIfCallable
|
||||
@@ -131,11 +131,11 @@ class VRCT_GUI(CTk):
|
||||
view_variable=self._view_variable
|
||||
)
|
||||
|
||||
self.quick_settings_window = QuickSettingsWindow(
|
||||
vrct_gui=self,
|
||||
settings=self.settings.config_window,
|
||||
view_variable=self._view_variable
|
||||
)
|
||||
# self.quick_settings_window = QuickSettingsWindow(
|
||||
# vrct_gui=self,
|
||||
# settings=self.settings.config_window,
|
||||
# view_variable=self._view_variable
|
||||
# )
|
||||
# self.quick_settings_window.show()
|
||||
|
||||
self.selectable_languages_window = _CreateSelectableLanguagesWindow(
|
||||
|
||||
Reference in New Issue
Block a user