Merge branch 'refactor_and_chore' into develop
This commit is contained in:
@@ -407,6 +407,18 @@ class Config:
|
||||
self._MESSAGE_BOX_RATIO = value
|
||||
self.saveConfig(inspect.currentframe().f_code.co_name, value, immediate_save=True)
|
||||
|
||||
@property
|
||||
@json_serializable('SEND_MESSAGE_BUTTON_TYPE')
|
||||
def SEND_MESSAGE_BUTTON_TYPE(self):
|
||||
return self._SEND_MESSAGE_BUTTON_TYPE
|
||||
|
||||
@SEND_MESSAGE_BUTTON_TYPE.setter
|
||||
def SEND_MESSAGE_BUTTON_TYPE(self, value):
|
||||
if isinstance(value, str):
|
||||
if value in self.SEND_MESSAGE_BUTTON_TYPE_LIST:
|
||||
self._SEND_MESSAGE_BUTTON_TYPE = value
|
||||
self.saveConfig(inspect.currentframe().f_code.co_name, value)
|
||||
|
||||
@property
|
||||
@json_serializable('SHOW_RESEND_BUTTON')
|
||||
def SHOW_RESEND_BUTTON(self):
|
||||
@@ -815,18 +827,6 @@ class Config:
|
||||
self._SEND_ONLY_TRANSLATED_MESSAGES = value
|
||||
self.saveConfig(inspect.currentframe().f_code.co_name, value)
|
||||
|
||||
@property
|
||||
@json_serializable('SEND_MESSAGE_BUTTON_TYPE')
|
||||
def SEND_MESSAGE_BUTTON_TYPE(self):
|
||||
return self._SEND_MESSAGE_BUTTON_TYPE
|
||||
|
||||
@SEND_MESSAGE_BUTTON_TYPE.setter
|
||||
def SEND_MESSAGE_BUTTON_TYPE(self, value):
|
||||
if isinstance(value, str):
|
||||
if value in self.SEND_MESSAGE_BUTTON_TYPE_LIST:
|
||||
self._SEND_MESSAGE_BUTTON_TYPE = value
|
||||
self.saveConfig(inspect.currentframe().f_code.co_name, value)
|
||||
|
||||
@property
|
||||
@json_serializable('OVERLAY_SMALL_LOG')
|
||||
def OVERLAY_SMALL_LOG(self):
|
||||
@@ -1101,6 +1101,7 @@ class Config:
|
||||
self._UI_SCALING = 100
|
||||
self._TEXTBOX_UI_SCALING = 100
|
||||
self._MESSAGE_BOX_RATIO = 10
|
||||
self._SEND_MESSAGE_BUTTON_TYPE = "show"
|
||||
self._SHOW_RESEND_BUTTON = False
|
||||
self._FONT_FAMILY = "Yu Gothic UI"
|
||||
self._UI_LANGUAGE = "en"
|
||||
@@ -1149,7 +1150,6 @@ class Config:
|
||||
self._WHISPER_WEIGHT_TYPE = "base"
|
||||
self._AUTO_CLEAR_MESSAGE_BOX = True
|
||||
self._SEND_ONLY_TRANSLATED_MESSAGES = False
|
||||
self._SEND_MESSAGE_BUTTON_TYPE = "show"
|
||||
self._OVERLAY_SMALL_LOG = False
|
||||
self._OVERLAY_SMALL_LOG_SETTINGS = {
|
||||
"x_pos": 0.0,
|
||||
|
||||
@@ -832,6 +832,15 @@ class Controller:
|
||||
config.MESSAGE_BOX_RATIO = data
|
||||
return {"status":200, "result":config.MESSAGE_BOX_RATIO}
|
||||
|
||||
@staticmethod
|
||||
def getSendMessageButtonType(*args, **kwargs) -> dict:
|
||||
return {"status":200, "result":config.SEND_MESSAGE_BUTTON_TYPE}
|
||||
|
||||
@staticmethod
|
||||
def setSendMessageButtonType(data, *args, **kwargs) -> dict:
|
||||
config.SEND_MESSAGE_BUTTON_TYPE = data
|
||||
return {"status":200, "result":config.SEND_MESSAGE_BUTTON_TYPE}
|
||||
|
||||
@staticmethod
|
||||
def getShowResendButton(*args, **kwargs) -> dict:
|
||||
return {"status":200, "result":config.SHOW_RESEND_BUTTON}
|
||||
@@ -1420,15 +1429,6 @@ class Controller:
|
||||
config.SEND_ONLY_TRANSLATED_MESSAGES = False
|
||||
return {"status":200, "result":config.SEND_ONLY_TRANSLATED_MESSAGES}
|
||||
|
||||
@staticmethod
|
||||
def getSendMessageButtonType(*args, **kwargs) -> dict:
|
||||
return {"status":200, "result":config.SEND_MESSAGE_BUTTON_TYPE}
|
||||
|
||||
@staticmethod
|
||||
def setSendMessageButtonType(data, *args, **kwargs) -> dict:
|
||||
config.SEND_MESSAGE_BUTTON_TYPE = data
|
||||
return {"status":200, "result":config.SEND_MESSAGE_BUTTON_TYPE}
|
||||
|
||||
@staticmethod
|
||||
def getOverlaySmallLog(*args, **kwargs) -> dict:
|
||||
return {"status":200, "result":config.OVERLAY_SMALL_LOG}
|
||||
|
||||
@@ -131,6 +131,9 @@ mapping = {
|
||||
"/get/data/message_box_ratio": {"status": True, "variable":controller.getMessageBoxRatio},
|
||||
"/set/data/message_box_ratio": {"status": True, "variable":controller.setMessageBoxRatio},
|
||||
|
||||
"/get/data/send_message_button_type": {"status": True, "variable":controller.getSendMessageButtonType},
|
||||
"/set/data/send_message_button_type": {"status": True, "variable":controller.setSendMessageButtonType},
|
||||
|
||||
"/get/data/show_resend_button": {"status": True, "variable":controller.getShowResendButton},
|
||||
"/set/enable/show_resend_button": {"status": True, "variable":controller.setEnableShowResendButton},
|
||||
"/set/disable/show_resend_button": {"status": True, "variable":controller.setDisableShowResendButton},
|
||||
@@ -290,9 +293,6 @@ mapping = {
|
||||
"/set/enable/send_only_translated_messages": {"status": True, "variable":controller.setEnableSendOnlyTranslatedMessages},
|
||||
"/set/disable/send_only_translated_messages": {"status": True, "variable":controller.setDisableSendOnlyTranslatedMessages},
|
||||
|
||||
"/get/data/send_message_button_type": {"status": True, "variable":controller.getSendMessageButtonType},
|
||||
"/set/data/send_message_button_type": {"status": True, "variable":controller.setSendMessageButtonType},
|
||||
|
||||
"/get/data/logger_feature": {"status": True, "variable":controller.getLoggerFeature},
|
||||
"/set/enable/logger_feature": {"status": True, "variable":controller.setEnableLoggerFeature},
|
||||
"/set/disable/logger_feature": {"status": True, "variable":controller.setDisableLoggerFeature},
|
||||
@@ -539,6 +539,8 @@ if __name__ == "__main__":
|
||||
data = 1.5
|
||||
case "/set/data/message_box_ratio":
|
||||
data = 0.5
|
||||
case "/set/data/send_message_button_type":
|
||||
data = "show"
|
||||
case "/set/data/font_family":
|
||||
data = "Yu Gothic UI"
|
||||
case "/set/data/ui_language":
|
||||
@@ -559,7 +561,7 @@ if __name__ == "__main__":
|
||||
data = 5
|
||||
case "/set/data/mic_max_phrases":
|
||||
data = 5
|
||||
case "/set//data/mic_word_filter":
|
||||
case "/set/data/mic_word_filter":
|
||||
data = "test0, test1, test2"
|
||||
case "/set/data/selected_speaker_device":
|
||||
data = "スピーカー (Realtek High Definition Audio)"
|
||||
@@ -589,8 +591,6 @@ if __name__ == "__main__":
|
||||
"display_duration": 5,
|
||||
"fadeout_duration": 0.5,
|
||||
}
|
||||
case "/set/data/send_message_button_type":
|
||||
data = "show"
|
||||
case "/set/data/send_message_format":
|
||||
data = "[message]"
|
||||
case "/set/data/send_message_format_with_t":
|
||||
|
||||
@@ -10,9 +10,9 @@ export const useSendMessageButtonType = () => {
|
||||
asyncStdoutToPython("/get/data/send_message_button_type");
|
||||
};
|
||||
|
||||
const setSendMessageButtonType = (selected_type) => {
|
||||
const setSendMessageButtonType = (send_message_button_type) => {
|
||||
pendingSendMessageButtonType();
|
||||
asyncStdoutToPython("/set/data/send_message_button_type", selected_type);
|
||||
asyncStdoutToPython("/set/data/send_message_button_type", send_message_button_type);
|
||||
};
|
||||
|
||||
return {
|
||||
|
||||
@@ -3,7 +3,7 @@ export { useDevice } from "./device/useDevice";
|
||||
export { useMessageLogUiScaling } from "./appearance/useMessageLogUiScaling";
|
||||
export { useSelectedFontFamily } from "./appearance/useSelectedFontFamily";
|
||||
export { useTransparency } from "./appearance/useTransparency";
|
||||
export { useSendMessageButtonType } from "./others/useSendMessageButtonType";
|
||||
export { useSendMessageButtonType } from "./appearance/useSendMessageButtonType";
|
||||
export { useShowResendButton } from "./appearance/useShowResendButton";
|
||||
export { useUiLanguage } from "./appearance/useUiLanguage";
|
||||
export { useUiScaling } from "./appearance/useUiScaling";
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
import { useStore_SendMessageButtonType } from "@store";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useSendMessageButtonType = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { currentSendMessageButtonType, updateSendMessageButtonType, pendingSendMessageButtonType } = useStore_SendMessageButtonType();
|
||||
|
||||
const getSendMessageButtonType = () => {
|
||||
pendingSendMessageButtonType();
|
||||
asyncStdoutToPython("/get/data/send_message_button_type");
|
||||
};
|
||||
|
||||
const setSendMessageButtonType = (send_message_button_type) => {
|
||||
pendingSendMessageButtonType();
|
||||
asyncStdoutToPython("/set/data/send_message_button_type", send_message_button_type);
|
||||
};
|
||||
|
||||
return {
|
||||
currentSendMessageButtonType,
|
||||
getSendMessageButtonType,
|
||||
setSendMessageButtonType,
|
||||
updateSendMessageButtonType,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user