Skip to content

Commit

Permalink
fixed bug of translator
Browse files Browse the repository at this point in the history
  • Loading branch information
CheshireCC committed Mar 24, 2024
1 parent c7dee02 commit fc201ce
Show file tree
Hide file tree
Showing 11 changed files with 3,478 additions and 3,403 deletions.
10 changes: 8 additions & 2 deletions FasterWhisperGUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from faster_whisper_GUI.version import __version__
from faster_whisper_GUI.util import outputWithDateTime


log_f.write(f"\nfaster_whisper_GUI: {__version__}")

outputWithDateTime("Start")
Expand Down Expand Up @@ -85,6 +84,7 @@ def mousePressEvent(self, event):

# MainWindows_moudle = LazyImport("faster_whisper_GUI.mainWindows")
from faster_whisper_GUI.mainWindows import MainWindows

pb.setValue(60)

from resource import rc_Translater
Expand Down Expand Up @@ -141,7 +141,13 @@ def mousePressEvent(self, event):

# splash.showMessage("Load Windows...") #, Qt.AlignmentFlag.AlignBottom | Qt.AlignmentFlag.AlignHCenter, Qt.white)

mainWindows = MainWindows(translator=translator)
splash.showMessage(
"start app...",
Qt.AlignmentFlag.AlignBottom | Qt.AlignmentFlag.AlignHCenter,
Qt.white
)

mainWindows = MainWindows()
pb.setValue(100)

# splash.requestInterruption()
Expand Down
362 changes: 209 additions & 153 deletions en.ts

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions fasterWhisperGUIConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
},
"vad_param": {
"use_VAD": true,
"threshold": 0.3,
"threshold": 0.5,
"minSpeechDuration": "250",
"minSilenceDuration": "2000",
"maxSpeechDuration": "inf",
Expand All @@ -39,7 +39,7 @@
},
"Transcription_param": {
"aggregate_contents": true,
"language": 0,
"language": 2,
"task": false,
"beam_size": "5",
"best_of": "5",
Expand Down Expand Up @@ -67,10 +67,10 @@
"tabMovable": false,
"tabScrollable": false,
"tabShadowEnabled": false,
"tabMaxWidth": 257,
"tabMaxWidth": 361,
"closeDisplayMode": 0,
"whisperXMinSpeaker": 2,
"whisperXMaxSpeaker": 3,
"whisperXMinSpeaker": 0,
"whisperXMaxSpeaker": 0,
"outputFormat": 0,
"outputEncoding": 1
}
Expand Down
36 changes: 12 additions & 24 deletions faster_whisper_GUI/UI_MainWindows.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,24 +69,18 @@
from .fasterWhisperGuiIcon import FasterWhisperGUIIcon
from .settingPageNavigation import SettingPageNavigationInterface

class aa(QWidget):
def __init__(self, parent: QWidget | None = ..., f: Qt.WindowType = ...) -> None:
super().__init__(parent, f)
# =======================================================================================
# UI
# =======================================================================================
class UIMainWin(FramelessMainWindow):
"""V"""

def tr(self, text):
return QCoreApplication.translate(self.__class__.__name__, text)

# def install_uninstall_translator(self):
# if self.translator.filePath() == "":
# self.translator.load(":/resource/Translater/en.qm")
# else:
# self.translator.load("")
# app = QApplication.instance()
# app.installTranslator(self.translator)

# def tr(self, text):
# return QCoreApplication.translate(self.__class__.__name__, text)


def readConfigJson(self, config_file_path: str = ""):
self.default_theme = "light"
self.model_param = {}
Expand Down Expand Up @@ -168,16 +162,10 @@ def setConfig(self):

if self.vad_param != {}:
self.page_VAD.setParam(self.vad_param)


def __init__(self, translator:QTranslator=None):

def __init__(self, parent=None, f=None) -> None:
super().__init__()

if translator is None:
self.translator = TRANSLATOR
else:
self.translator = translator

# self.setWindowFlags(Qt.FramelessWindowHint)
# self.setAttribute(Qt.WA_TranslucentBackground)

Expand Down Expand Up @@ -223,7 +211,7 @@ def initWin(self):
StyleSheet.MAIN_WINDOWS.apply(self)

# self.resize(800, 500)
self.setGeometry(100, 100, 1250, 825)
self.setGeometry(100, 100, 1250, 915)

# TODO: 添加标题栏
self.setTitleBar(StandardTitleBar(self))
Expand Down Expand Up @@ -287,15 +275,15 @@ def setupUI(self):
self.pages.append(self.page_home)

self.page_demucs = DemucsPageNavigation(self)
self.addSubInterface(self.page_demucs, "pageDecums", self.tr("声乐移除"), icon=FasterWhisperGUIIcon.DEMUCS)
self.addSubInterface(self.page_demucs, "pageDecums", self.tr("声乐分离"), icon=FasterWhisperGUIIcon.DEMUCS)
self.pages.append(self.page_demucs)

self.page_model = ModelNavigationInterface(self)
self.addSubInterface(self.page_model, "pageModelParameter", self.tr("模型参数"), icon=FluentIcon.BOOK_SHELF)
self.pages.append(self.page_model)

self.page_VAD = VADNavigationInterface(self)
self.addSubInterface(self.page_VAD, "pageVADParameter", self.tr("VAD及WhisperX"), icon=FasterWhisperGUIIcon.VAD_PAGE)
self.addSubInterface(self.page_VAD, "pageVADParameter", self.tr("人声活动检测"), icon=FasterWhisperGUIIcon.VAD_PAGE)
self.pages.append(self.page_VAD)

self.page_transcribes = TranscribeNavigationInterface(self)
Expand All @@ -307,7 +295,7 @@ def setupUI(self):
self.pages.append(self.page_process)

self.page_output = OutputPageNavigationInterface(self)
self.addSubInterface(self.page_output, "pageOutput", self.tr("后处理及输出"), icon=FluentIcon.SAVE_AS)
self.addSubInterface(self.page_output, "pageOutput", self.tr("whiperX及字幕编辑"), icon=FluentIcon.SAVE_AS)
self.pages.append(self.page_output)

self.page_About = AboutPageNavigationInterface(self)
Expand Down
2 changes: 1 addition & 1 deletion faster_whisper_GUI/demucsPageNavigationInterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def setupUI(self):

class DemucsPageNavigation(NavigationBaseInterface):
def __init__(self, parent=None):
super().__init__(title="Demucs", subtitle=self.tr("使用 Demucs4.0 模型的 AVE(自动人声提取)方案"), parent=parent)
super().__init__(title="Demucs", subtitle=self.tr("使用 Demucs4.0 模型的 AVS(自动人声分离)方案"), parent=parent)
# self.parent = parent

self.setupUI()
Expand Down
2 changes: 1 addition & 1 deletion faster_whisper_GUI/homePageNavigationInterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def parent(self) -> QObject:

def __init__(self, parent=None):
# self.parent = parent
super().__init__(title=self.tr("Home"), subtitle=self.tr("faster-whisper 为主要后端的 ASR 及 AVE 软件"), parent=parent)
super().__init__(title=self.tr("Home"), subtitle=self.tr("faster-whisper 为主要后端的 ASR 及 AVS 软件"), parent=parent)
self.steupUI()

def steupUI(self):
Expand Down
Loading

0 comments on commit fc201ce

Please sign in to comment.