-
Notifications
You must be signed in to change notification settings - Fork 0
/
application.py
68 lines (55 loc) · 2.05 KB
/
application.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# VoivoClip
#
# アプリケーションクラス
#
# Copyright (c) 2023-2024 led-mirage
# このソースコードは MITライセンス の下でライセンスされています。
# ライセンスの詳細については、このプロジェクトのLICENSEファイルを参照してください。
import argparse
import sys
from tkinter import messagebox
from settings import Settings
from voicevox import Voicevox
from voicevox_api import VoicevoxAPI
APP_NAME = "VoivoClip"
APP_VERSION = "0.3.3"
COPYRIGHT = "Copyright 2023-2024 led-mirage"
SETTING_FILE = "settings.json"
class Application:
# コンストラクタ
def __init__(self):
self.speakers = None
self.settings = None
pass
# 開始
def start(self):
parser = argparse.ArgumentParser(description=f"{APP_NAME} {APP_VERSION}")
parser.add_argument("--setting", type=str, default=SETTING_FILE, help="設定ファイル名")
args = parser.parse_args()
self.print_apptitle()
self.settings = Settings(args.setting)
self.settings.load()
VoicevoxAPI.server = self.settings.get_voicevox_server()
Voicevox.run_voicevox(self.settings.get_voicevox_install_path())
self.speakers = VoicevoxAPI.get_speakers()
if self.speakers is None:
message = "VOICEVOX を起動してから使ってね"
print(message)
messagebox.showerror(f"{APP_NAME}", message)
sys.exit()
from main_window import MainWindow
main_window = MainWindow(self)
main_window.show()
main_window.terminate()
# タイトルを表示する
def print_apptitle(self):
print(f"----------------------------------------------------------------------")
print(f" {APP_NAME} {APP_VERSION}")
print(f"")
print(f" {COPYRIGHT}")
print(f"----------------------------------------------------------------------")
print(f"")
if __name__ == "__main__":
from application import Application
app = Application()
app.start()