diff options
| author | Vidhu Kant Sharma <vidhukant@vidhukant.com> | 2026-07-24 18:00:52 +0530 |
|---|---|---|
| committer | Vidhu Kant Sharma <vidhukant@vidhukant.com> | 2026-07-24 18:00:52 +0530 |
| commit | bc7d62ca9a406bc30419e985016c7f4f56e54e76 (patch) | |
| tree | b4f1091e7f008df31d20039f0fa4c683d05785e5 /main.py | |
first commit
Diffstat (limited to 'main.py')
| -rw-r--r-- | main.py | 59 |
1 files changed, 59 insertions, 0 deletions
@@ -0,0 +1,59 @@ +# Soundboard Engine - customizable soundboard +# Copyright (C) 2026 Vidhu Kant Sharma <vidhukant@vidhukant.com> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + +import os +import platform +import sys +from pathlib import Path + +from PySide6.QtWidgets import QApplication + +from Soundboard import Soundboard +from SoundboardEngine import SoundboardEngineWindow + +APP_VERSION = "0.1.0" + +if __name__ == "__main__": + config_path = ( + Path(sys.argv[1]).resolve() + if len(sys.argv) > 1 and sys.argv[1].endswith(".json") + else Path("soundboard.json").resolve() + ) + + if not config_path.exists(): + print(f"Error: Could not find soundboard JSON at {config_path}") + sys.exit(1) + + os.chdir(config_path.parent) + + _soundboard = Soundboard(config_path) + _soundboard.build() + + if platform.system() == "Linux": + os.environ["QT_QPA_PLATFORMTHEME"] = "gtk3" + + app = QApplication(sys.argv) + + if platform.system() == "Linux": + app.setStyle("Fusion") + + app.setOrganizationName("VidhuKant") + app.setApplicationName(_soundboard.soundboard_id) + + window = SoundboardEngineWindow(_soundboard, APP_VERSION) + window.show() + + sys.exit(app.exec()) |