[WIP/TEST] UI: 機能と見た目を繋ぎました。設定画面からいじれます。
This commit is contained in:
@@ -767,6 +767,35 @@ def callbackSetSpeakerMaxPhrases(value):
|
||||
except Exception:
|
||||
view.showErrorMessage_SpeakerMaxPhrases()
|
||||
|
||||
# Transcription (Internal AI Model)
|
||||
def callbackSetUserWhisperFeature(value):
|
||||
print("callbackSetUserWhisperFeature", value)
|
||||
config.USE_WHISPER_FEATURE = value
|
||||
if config.USE_WHISPER_FEATURE is True:
|
||||
view.openWhisperWeightTypeWidget()
|
||||
else:
|
||||
view.closeWhisperWeightTypeWidget()
|
||||
|
||||
def callbackSetWhisperWeightType(value):
|
||||
print("callbackSetWhisperWeightType", value)
|
||||
config.WHISPER_WEIGHT_TYPE = str(value)
|
||||
view.updateSelectedWhisperWeightType(config.WHISPER_WEIGHT_TYPE)
|
||||
# view.setWidgetsStatus_changeWeightType_Pending()
|
||||
# if model.checkCTranslatorCTranslate2ModelWeight():
|
||||
# config.IS_RESET_BUTTON_DISPLAYED_FOR_TRANSLATION = False
|
||||
# def callback():
|
||||
# model.changeTranslatorCTranslate2Model()
|
||||
# view.useTranslationFeatureProcess("Normal")
|
||||
# view.setWidgetsStatus_changeWeightType_Done()
|
||||
# th_callback = Thread(target=callback)
|
||||
# th_callback.daemon = True
|
||||
# th_callback.start()
|
||||
# else:
|
||||
# config.IS_RESET_BUTTON_DISPLAYED_FOR_TRANSLATION = True
|
||||
# view.useTranslationFeatureProcess("Restart")
|
||||
# view.setWidgetsStatus_changeWeightType_Done()
|
||||
# view.showRestartButtonIfRequired()
|
||||
|
||||
|
||||
# Others Tab
|
||||
def callbackSetEnableAutoClearMessageBox(value):
|
||||
@@ -993,6 +1022,10 @@ def createMainWindow(splash):
|
||||
"callback_set_speaker_phrase_timeout": callbackSetSpeakerPhraseTimeout,
|
||||
"callback_set_speaker_max_phrases": callbackSetSpeakerMaxPhrases,
|
||||
|
||||
# Transcription Tab (Internal AI Model)
|
||||
"callback_set_use_whisper_feature": callbackSetUserWhisperFeature,
|
||||
"callback_set_whisper_weight_type": callbackSetWhisperWeightType,
|
||||
|
||||
# Others Tab
|
||||
"callback_set_enable_auto_clear_chatbox": callbackSetEnableAutoClearMessageBox,
|
||||
"callback_set_send_only_translated_messages": callbackSetEnableSendOnlyTranslatedMessages,
|
||||
|
||||
@@ -79,6 +79,7 @@ config_window:
|
||||
transcription: Transcription
|
||||
transcription_mic: Mic
|
||||
transcription_speaker: Speaker
|
||||
transcription_internal_model: Internal Model
|
||||
others: Others
|
||||
others_send_message_formats: Message Formats (Send)
|
||||
others_received_message_formats: Message Formats (Received)
|
||||
@@ -125,6 +126,21 @@ config_window:
|
||||
small: "Basic model (%{capacity})"
|
||||
large: "High accuracy model (%{capacity})"
|
||||
|
||||
use_whisper_feature:
|
||||
label: Use Whisper Feature
|
||||
desc: Description
|
||||
|
||||
whisper_weight_type:
|
||||
label: Select Whisper Model
|
||||
desc: Description
|
||||
tiny: "tiny model (%{capacity})"
|
||||
base: "base model (%{capacity})"
|
||||
small: "small model (%{capacity})"
|
||||
medium: "medium model (%{capacity})"
|
||||
large_v1: "large_v1 model (%{capacity})"
|
||||
large_v2: "large_v2 model (%{capacity})"
|
||||
large_v3: "large_v3 model (%{capacity})"
|
||||
|
||||
deepl_auth_key:
|
||||
label: DeepL Auth Key
|
||||
desc: Please select %{translator} on the main screen with DeepL_API when using. ※Some languages may not be supported.
|
||||
|
||||
52
view.py
52
view.py
@@ -211,6 +211,7 @@ class View():
|
||||
VAR_SIDE_MENU_LABEL_TRANSCRIPTION=StringVar(value=i18n.t("config_window.side_menu_labels.transcription")),
|
||||
VAR_SECOND_TITLE_TRANSCRIPTION_MIC=StringVar(value=i18n.t("config_window.side_menu_labels.transcription_mic")),
|
||||
VAR_SECOND_TITLE_TRANSCRIPTION_SPEAKER=StringVar(value=i18n.t("config_window.side_menu_labels.transcription_speaker")),
|
||||
VAR_SECOND_TITLE_TRANSCRIPTION_INTERNAL_MODEL=StringVar(value=i18n.t("config_window.side_menu_labels.transcription_internal_model")),
|
||||
VAR_SIDE_MENU_LABEL_OTHERS=StringVar(value=i18n.t("config_window.side_menu_labels.others")),
|
||||
VAR_SIDE_MENU_LABEL_ADVANCED_SETTINGS=StringVar(value=i18n.t("config_window.side_menu_labels.advanced_settings")),
|
||||
|
||||
@@ -381,6 +382,19 @@ class View():
|
||||
CALLBACK_FOCUS_OUT_SPEAKER_MAX_PHRASES=self.callbackBindFocusOut_SpeakerMaxPhrases,
|
||||
|
||||
|
||||
# Transcription Tab (Whisper Internal AI Model)
|
||||
VAR_LABEL_USE_WHISPER_FEATURE=StringVar(value=i18n.t("config_window.use_whisper_feature.label")),
|
||||
VAR_DESC_USE_WHISPER_FEATURE=StringVar(value=i18n.t("config_window.use_whisper_feature.desc")),
|
||||
CALLBACK_SET_USE_WHISPER_FEATURE=None,
|
||||
VAR_USE_WHISPER_FEATURE=BooleanVar(value=config.USE_WHISPER_FEATURE),
|
||||
|
||||
VAR_LABEL_WHISPER_WEIGHT_TYPE=StringVar(value=i18n.t("config_window.whisper_weight_type.label")),
|
||||
VAR_DESC_WHISPER_WEIGHT_TYPE=StringVar(value=i18n.t("config_window.whisper_weight_type.desc")),
|
||||
DICT_WHISPER_WEIGHT_TYPE=self.getSelectableWhisperWeightTypeDict(),
|
||||
CALLBACK_SET_WHISPER_WEIGHT_TYPE=None,
|
||||
VAR_WHISPER_WEIGHT_TYPE=StringVar(value=self.getSelectableWhisperWeightTypeDict()[config.WHISPER_WEIGHT_TYPE]),
|
||||
|
||||
|
||||
# Others Tab
|
||||
VAR_LABEL_ENABLE_AUTO_CLEAR_MESSAGE_BOX=StringVar(value=i18n.t("config_window.auto_clear_the_message_box.label")),
|
||||
VAR_DESC_ENABLE_AUTO_CLEAR_MESSAGE_BOX=None,
|
||||
@@ -624,6 +638,11 @@ class View():
|
||||
self.view_variable.CALLBACK_SET_SPEAKER_PHRASE_TIMEOUT = config_window_registers.get("callback_set_speaker_phrase_timeout", None)
|
||||
self.view_variable.CALLBACK_SET_SPEAKER_MAX_PHRASES = config_window_registers.get("callback_set_speaker_max_phrases", None)
|
||||
|
||||
# Transcription Tab (Internal AI Model)
|
||||
self.view_variable.CALLBACK_SET_USE_WHISPER_FEATURE = config_window_registers.get("callback_set_use_whisper_feature", None)
|
||||
self.view_variable.CALLBACK_SET_WHISPER_WEIGHT_TYPE = config_window_registers.get("callback_set_whisper_weight_type", None)
|
||||
|
||||
|
||||
# Others Tab
|
||||
self.view_variable.CALLBACK_SET_ENABLE_AUTO_CLEAR_MESSAGE_BOX = config_window_registers.get("callback_set_enable_auto_clear_chatbox", None)
|
||||
self.view_variable.CALLBACK_SET_ENABLE_SEND_ONLY_TRANSLATED_MESSAGES = config_window_registers.get("callback_set_send_only_translated_messages", None)
|
||||
@@ -678,6 +697,11 @@ class View():
|
||||
)
|
||||
self.replaceMicThresholdCheckButton_Disabled()
|
||||
|
||||
if config.USE_WHISPER_FEATURE is True:
|
||||
self.openWhisperWeightTypeWidget()
|
||||
else:
|
||||
self.closeWhisperWeightTypeWidget()
|
||||
|
||||
if config.ENABLE_SPEAKER2CHATBOX is False:
|
||||
vrct_gui._changeConfigWindowWidgetsStatus(
|
||||
status="disabled",
|
||||
@@ -919,6 +943,17 @@ class View():
|
||||
vrct_gui.update()
|
||||
vrct_gui.config_window.lift()
|
||||
|
||||
@staticmethod
|
||||
def getSelectableWhisperWeightTypeDict():
|
||||
return {
|
||||
config.SELECTABLE_WHISPER_WEIGHT_TYPE_DICT["tiny"]: i18n.t("config_window.whisper_weight_type.tiny", capacity="t"),
|
||||
config.SELECTABLE_WHISPER_WEIGHT_TYPE_DICT["base"]: i18n.t("config_window.whisper_weight_type.base", capacity="b"),
|
||||
config.SELECTABLE_WHISPER_WEIGHT_TYPE_DICT["small"]: i18n.t("config_window.whisper_weight_type.small", capacity="s"),
|
||||
config.SELECTABLE_WHISPER_WEIGHT_TYPE_DICT["medium"]: i18n.t("config_window.whisper_weight_type.medium", capacity="m"),
|
||||
config.SELECTABLE_WHISPER_WEIGHT_TYPE_DICT["large-v1"]: i18n.t("config_window.whisper_weight_type.large_v1", capacity="l_v1"),
|
||||
config.SELECTABLE_WHISPER_WEIGHT_TYPE_DICT["large-v2"]: i18n.t("config_window.whisper_weight_type.large_v2", capacity="l_v2"),
|
||||
config.SELECTABLE_WHISPER_WEIGHT_TYPE_DICT["large-v3"]: i18n.t("config_window.whisper_weight_type.large_v3", capacity="l_v3"),
|
||||
}
|
||||
|
||||
# Open Webpage Functions
|
||||
def openWebPage_Booth(self):
|
||||
@@ -1082,6 +1117,23 @@ class View():
|
||||
vrct_gui.config_window.sb__ctranslate2_weight_type.grid_remove()
|
||||
|
||||
|
||||
def openWhisperWeightTypeWidget(self):
|
||||
vrct_gui.config_window.sb__use_whisper_feature.grid()
|
||||
vrct_gui.config_window.sb__whisper_weight_type.grid()
|
||||
|
||||
def closeWhisperWeightTypeWidget(self):
|
||||
vrct_gui.config_window.sb__use_whisper_feature.grid()
|
||||
vrct_gui.config_window.sb__whisper_weight_type.grid_remove()
|
||||
|
||||
|
||||
def updateSelectedWhisperWeightType(self, selected_weight_type:str):
|
||||
self.view_variable.VAR_WHISPER_WEIGHT_TYPE.set(self.getSelectableWhisperWeightTypeDict()[selected_weight_type])
|
||||
|
||||
def setLatestCTranslate2WeightType(self):
|
||||
selected_weight_type = self.getSelectableWhisperWeightTypeDict()[config.WHISPER_WEIGHT_TYPE]
|
||||
self.view_variable.VAR_WHISPER_WEIGHT_TYPE.set(selected_weight_type)
|
||||
|
||||
|
||||
def openMicEnergyThresholdWidget(self):
|
||||
self.view_variable.VAR_LABEL_MIC_DYNAMIC_ENERGY_THRESHOLD.set(i18n.t("config_window.mic_dynamic_energy_threshold.label_for_manual"))
|
||||
self.view_variable.VAR_DESC_MIC_DYNAMIC_ENERGY_THRESHOLD.set(i18n.t("config_window.mic_dynamic_energy_threshold.desc_for_manual"))
|
||||
|
||||
@@ -7,7 +7,7 @@ from ._createSettingBoxContainer import _createSettingBoxContainer
|
||||
|
||||
|
||||
from .setting_box_containers.setting_box_appearance import createSettingBox_Appearance
|
||||
from .setting_box_containers.setting_box_transcription import createSettingBox_Mic, createSettingBox_Speaker
|
||||
from .setting_box_containers.setting_box_transcription import createSettingBox_Mic, createSettingBox_Speaker, createSettingBox_InternalModel
|
||||
from .setting_box_containers.setting_box_others import createSettingBox_Others, createSettingBox_Others_SendMessageFormats, createSettingBox_Others_ReceivedMessageFormats, createSettingBox_Others_Additional
|
||||
from .setting_box_containers.setting_box_advanced_settings import createSettingBox_AdvancedSettings
|
||||
from .setting_box_containers.setting_box_translation import createSettingBox_Translation
|
||||
@@ -94,6 +94,10 @@ def createSideMenuAndSettingsBoxContainers(config_window, settings, view_variabl
|
||||
"var_section_title": view_variable.VAR_SECOND_TITLE_TRANSCRIPTION_SPEAKER,
|
||||
"setting_box": createSettingBox_Speaker
|
||||
},
|
||||
{
|
||||
"var_section_title": view_variable.VAR_SECOND_TITLE_TRANSCRIPTION_INTERNAL_MODEL,
|
||||
"setting_box": createSettingBox_InternalModel
|
||||
},
|
||||
]
|
||||
},
|
||||
},
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
from .createSettingBox_Mic import createSettingBox_Mic
|
||||
from .createSettingBox_Speaker import createSettingBox_Speaker
|
||||
from .createSettingBox_Speaker import createSettingBox_Speaker
|
||||
from .createSettingBox_InternalModel import createSettingBox_InternalModel
|
||||
@@ -0,0 +1,37 @@
|
||||
from utils import callFunctionIfCallable
|
||||
|
||||
from .._SettingBoxGenerator import _SettingBoxGenerator
|
||||
|
||||
def createSettingBox_InternalModel(setting_box_wrapper, config_window, settings, view_variable):
|
||||
sbg = _SettingBoxGenerator(setting_box_wrapper, config_window, settings, view_variable)
|
||||
createSettingBoxSwitch = sbg.createSettingBoxSwitch
|
||||
createSettingBoxDropdownMenu = sbg.createSettingBoxDropdownMenu
|
||||
|
||||
def switchUseWhisperFeatureCallback(switch_widget):
|
||||
callFunctionIfCallable(view_variable.CALLBACK_SET_USE_WHISPER_FEATURE, switch_widget.get())
|
||||
|
||||
def optionmenuWhisperWeightTypeCallback(value):
|
||||
callFunctionIfCallable(view_variable.CALLBACK_SET_WHISPER_WEIGHT_TYPE, value)
|
||||
|
||||
|
||||
row=0
|
||||
config_window.sb__use_whisper_feature = createSettingBoxSwitch(
|
||||
for_var_label_text=view_variable.VAR_LABEL_USE_WHISPER_FEATURE,
|
||||
for_var_desc_text=view_variable.VAR_DESC_USE_WHISPER_FEATURE,
|
||||
switch_attr_name="sb__switch_use_whisper_feature",
|
||||
command=lambda: switchUseWhisperFeatureCallback(config_window.sb__switch_use_whisper_feature),
|
||||
variable=view_variable.VAR_USE_WHISPER_FEATURE
|
||||
)
|
||||
config_window.sb__use_whisper_feature.grid(row=row, pady=0)
|
||||
row+=1
|
||||
|
||||
config_window.sb__whisper_weight_type = createSettingBoxDropdownMenu(
|
||||
for_var_label_text=view_variable.VAR_LABEL_WHISPER_WEIGHT_TYPE,
|
||||
for_var_desc_text=view_variable.VAR_DESC_WHISPER_WEIGHT_TYPE,
|
||||
optionmenu_attr_name="sb__optionmenu_whisper_weight_type",
|
||||
dropdown_menu_values=view_variable.DICT_WHISPER_WEIGHT_TYPE,
|
||||
command=lambda value: optionmenuWhisperWeightTypeCallback(value),
|
||||
variable=view_variable.VAR_WHISPER_WEIGHT_TYPE,
|
||||
)
|
||||
config_window.sb__whisper_weight_type.grid(row=row, pady=0)
|
||||
row+=1
|
||||
Reference in New Issue
Block a user