diff --git a/gui.py b/gui.py index 1def77ae..ff060f92 100644 --- a/gui.py +++ b/gui.py @@ -1,5 +1,10 @@ import os import sys +import time +import random + +from pypresence import Presence +from pypresence.exceptions import DiscordNotFound from PyQt6.QtWidgets import ( QApplication, @@ -40,15 +45,15 @@ ) logger = logging.getLogger(__name__) -TITLE = "The Anime Scripter - 1.8.6 (Alpha)" +TITLE = "The Anime Scripter - 1.8.7 (Alpha)" W, H = 1280, 720 +REPOSITORY = "https://github.com/NevermindNilas/TheAnimeScripter" if getattr(sys, "frozen", False): mainPath = os.path.dirname(sys.executable) else: mainPath = os.path.dirname(os.path.abspath(__file__)) - class VideoProcessingApp(QMainWindow): def __init__(self): super().__init__() @@ -58,6 +63,7 @@ def __init__(self): GlobalBlur(self.winId(), Acrylic=True) + self.pyPresence() self.setStyleSheet(Style()) self.centralWidget = QWidget() self.stackedWidget = QStackedWidget() @@ -71,6 +77,44 @@ def __init__(self): loadSettings(self, self.settingsFile) fadeIn(self, self.centralWidget, 500) + + def pyPresence(self): + presetTitles = [ + "Enhancing my videos", + "True 4K Enjoyer", + "Editing with Style", + "Crafting Cinematic Masterpieces", + "Bringing Pixels to Life", + "Cutting and Splicing Magic", + "From Raw to Refined", + "Harnessing the Power of AI", + "Journey Through Editing", + "Creating the Perfect Video", + "Transforming Media", + "Mastering the Art of Video", + "From Pixels to Perfection", + ] + chosenTitle = random.choice(presetTitles) + + # Get version from TITLE: + version = TITLE.split(" - ")[1].split(" (")[0] + try: + clientID = "1213461768785891388" + RPC = Presence(clientID) + RPC.connect() + RPC.update( + state=chosenTitle, + details=f"Version: {version}", + large_image="icon", + large_text="The Anime Scripter", + start=int(time.time()), + buttons=[{"label": "View on GitHub", "url": REPOSITORY}] + ) + except ConnectionRefusedError: + print("Could not connect to Discord. Is Discord running?") + except DiscordNotFound: + print("Discord is not installed or not running.") + def createLayouts(self): self.layout = QVBoxLayout() self.centralWidget.setLayout(self.layout) diff --git a/requirements-linux.txt b/requirements-linux.txt index 041cdcd8..e985ebe4 100644 --- a/requirements-linux.txt +++ b/requirements-linux.txt @@ -1,5 +1,5 @@ --extra-index-url https://download.pytorch.org/whl/cu121 -#pypresence +pypresence pyqt6 opencv-python timm diff --git a/requirements-windows.txt b/requirements-windows.txt index aab740b0..e6f72592 100644 --- a/requirements-windows.txt +++ b/requirements-windows.txt @@ -1,5 +1,5 @@ --extra-index-url https://download.pytorch.org/whl/cu121 -#pypresence +pypresence pyqt6 opencv-python timm diff --git a/src/uiLogic.py b/src/uiLogic.py index 7fa7b1a6..d5dbd37c 100644 --- a/src/uiLogic.py +++ b/src/uiLogic.py @@ -1,9 +1,7 @@ -import subprocess import os import json import threading import logging -import time from PyQt6.QtWidgets import QCheckBox, QGraphicsOpacityEffect from PyQt6.QtCore import QPropertyAnimation, QEasingCurve @@ -15,14 +13,14 @@ def Style() -> str: """ return """ * { - font-family: Tahoma; - font-size: 12px; + font-family: Segoe UI; + font-size: 14px; color: #FFFFFF; } QMainWindow { background-color: rgba(0, 0, 0, 0); - border-radius: 10px; + border-radius: 5px; } QWidget { @@ -32,9 +30,8 @@ def Style() -> str: QPushButton { background-color: rgba(60, 60, 60, 0.5); color: #FFFFFF; - border: none; border-radius: 5px; - padding: 5px 10px; + min-height: 25px; } QPushButton:hover { @@ -44,14 +41,29 @@ def Style() -> str: QLineEdit { background-color: rgba(60, 60, 60, 0.5); color: #FFFFFF; - border: none; border-radius: 5px; - padding: 5px; + min-height: 25px; } + QComboBox { + min-width: 100px; + background-color: rgba(60, 60, 60, 0.5); + color: #FFFFFF; + border-radius: 5px; + min-height: 25px; + } + + QComboBox QAbstractItemView { + border: 2px solid darkgray; /* Border for the dropdown list */ + selection-background-color: #606060; /* Background color of hovered item */ + color: #FFFFFF; /* Text color of items */ + background-color: rgba(60, 60, 60, 0.8); /* Background of the dropdown */ + border-radius: 5px; /* Rounded corners for the dropdown list */ + } + + QCheckBox { color: #FFFFFF; - padding: 5px; } QTextEdit { @@ -65,7 +77,7 @@ def Style() -> str: QGroupBox { border: 1px solid #4A4A4A; border-radius: 5px; - margin-top: 1ex; + margin-top: 2ex; } QGroupBox::title { @@ -73,8 +85,6 @@ def Style() -> str: subcontrol-position: top center; padding: -7px 5px 0 5px; } - - """ def runCommand(self, mainPath, settingsFile) -> None: @@ -120,13 +130,13 @@ def runCommand(self, mainPath, settingsFile) -> None: command = " ".join(command) print(command) def runCommandInTerminal(command): - os.system(f'start cmd /c "{command} & exit"') + os.system(f'start cmd /c {command}') threading.Thread(target=runCommandInTerminal, args=(command,), daemon=True).start() except Exception as e: - self.outputWindow.append(f"An error occurred while running the command, {e}") + print(f"An error occurred while running the command, {e}") logging.error(f"An error occurred while running, {e}")