update button fg_color

This commit is contained in:
misyaguziya
2023-07-03 11:09:36 +09:00
parent 92b80c1e1d
commit d67b383716

13
VRCT.py
View File

@@ -1,7 +1,6 @@
import os import os
import json import json
import queue import queue
import time
import tkinter as tk import tkinter as tk
import customtkinter import customtkinter
from PIL import Image from PIL import Image
@@ -424,14 +423,14 @@ class App(customtkinter.CTk):
def checkbox_translation_callback(self): def checkbox_translation_callback(self):
self.ENABLE_TRANSLATION = self.checkbox_translation.get() self.ENABLE_TRANSLATION = self.checkbox_translation.get()
if self.ENABLE_TRANSLATION: if self.ENABLE_TRANSLATION:
self.button_config.configure(state="disabled") self.button_config.configure(state="disabled", fg_color=["gray92", "gray14"])
utils.print_textbox(self.textbox_message_log, "Start translation", "INFO") utils.print_textbox(self.textbox_message_log, "Start translation", "INFO")
utils.print_textbox(self.textbox_message_system_log, "Start translation", "INFO") utils.print_textbox(self.textbox_message_system_log, "Start translation", "INFO")
else: else:
if ((self.checkbox_translation.get() is False) and if ((self.checkbox_translation.get() is False) and
(self.checkbox_transcription_send.get() is False) and (self.checkbox_transcription_send.get() is False) and
(self.checkbox_transcription_receive.get() is False)): (self.checkbox_transcription_receive.get() is False)):
self.button_config.configure(state="normal") self.button_config.configure(state="normal", fg_color=["#3B8ED0", "#1F6AA5"])
utils.print_textbox(self.textbox_message_log, "Stop translation", "INFO") utils.print_textbox(self.textbox_message_log, "Stop translation", "INFO")
utils.print_textbox(self.textbox_message_system_log, "Stop translation", "INFO") utils.print_textbox(self.textbox_message_system_log, "Stop translation", "INFO")
utils.save_json(self.PATH_CONFIG, "ENABLE_TRANSLATION", self.ENABLE_TRANSLATION) utils.save_json(self.PATH_CONFIG, "ENABLE_TRANSLATION", self.ENABLE_TRANSLATION)
@@ -439,7 +438,7 @@ class App(customtkinter.CTk):
def checkbox_transcription_send_callback(self): def checkbox_transcription_send_callback(self):
self.ENABLE_TRANSCRIPTION_SEND = self.checkbox_transcription_send.get() self.ENABLE_TRANSCRIPTION_SEND = self.checkbox_transcription_send.get()
if self.ENABLE_TRANSCRIPTION_SEND is True: if self.ENABLE_TRANSCRIPTION_SEND is True:
self.button_config.configure(state="disabled") self.button_config.configure(state="disabled", fg_color=["gray92", "gray14"])
self.mic_audio_queue = queue.Queue() self.mic_audio_queue = queue.Queue()
mic_device = [device for device in audio_utils.get_input_device_list() if device["name"] == self.CHOICE_MIC_DEVICE][0] mic_device = [device for device in audio_utils.get_input_device_list() if device["name"] == self.CHOICE_MIC_DEVICE][0]
self.mic_audio_recorder = audio_recorder.SelectedMicRecorder( self.mic_audio_recorder = audio_recorder.SelectedMicRecorder(
@@ -493,7 +492,7 @@ class App(customtkinter.CTk):
if ((self.checkbox_translation.get() is False) and if ((self.checkbox_translation.get() is False) and
(self.checkbox_transcription_send.get() is False) and (self.checkbox_transcription_send.get() is False) and
(self.checkbox_transcription_receive.get() is False)): (self.checkbox_transcription_receive.get() is False)):
self.button_config.configure(state="normal") self.button_config.configure(state="normal", fg_color=["#3B8ED0", "#1F6AA5"])
if isinstance(self.mic_print_transcript, utils.thread_fnc): if isinstance(self.mic_print_transcript, utils.thread_fnc):
self.mic_print_transcript.stop() self.mic_print_transcript.stop()
if self.mic_audio_recorder.stop != None: if self.mic_audio_recorder.stop != None:
@@ -507,7 +506,7 @@ class App(customtkinter.CTk):
def checkbox_transcription_receive_callback(self): def checkbox_transcription_receive_callback(self):
self.ENABLE_TRANSCRIPTION_RECEIVE = self.checkbox_transcription_receive.get() self.ENABLE_TRANSCRIPTION_RECEIVE = self.checkbox_transcription_receive.get()
if self.ENABLE_TRANSCRIPTION_RECEIVE is True: if self.ENABLE_TRANSCRIPTION_RECEIVE is True:
self.button_config.configure(state="disabled") self.button_config.configure(state="disabled", fg_color=["gray92", "gray92"])
self.spk_audio_queue = queue.Queue() self.spk_audio_queue = queue.Queue()
spk_device = [device for device in audio_utils.get_output_device_list() if device["name"] == self.CHOICE_SPEAKER_DEVICE][0] spk_device = [device for device in audio_utils.get_output_device_list() if device["name"] == self.CHOICE_SPEAKER_DEVICE][0]
self.spk_audio_recorder = audio_recorder.SelectedSpeakerRecorder( self.spk_audio_recorder = audio_recorder.SelectedSpeakerRecorder(
@@ -561,7 +560,7 @@ class App(customtkinter.CTk):
if ((self.checkbox_translation.get() is False) and if ((self.checkbox_translation.get() is False) and
(self.checkbox_transcription_send.get() is False) and (self.checkbox_transcription_send.get() is False) and
(self.checkbox_transcription_receive.get() is False)): (self.checkbox_transcription_receive.get() is False)):
self.button_config.configure(state="normal") self.button_config.configure(state="normal", fg_color=["#3B8ED0", "#1F6AA5"])
if isinstance(self.spk_print_transcript, utils.thread_fnc): if isinstance(self.spk_print_transcript, utils.thread_fnc):
self.spk_print_transcript.stop() self.spk_print_transcript.stop()
if self.spk_audio_recorder.stop != None: if self.spk_audio_recorder.stop != None: