Add warning

This commit is contained in:
Alex 2024-04-15 13:48:02 +00:00
parent a08c62a976
commit 7f62608976

View File

@ -5,6 +5,8 @@ from PyQt6.QtWidgets import (
QGraphicsScene, QGraphicsView, QGraphicsPixmapItem, QGraphicsScene, QGraphicsView, QGraphicsPixmapItem,
QLayout, QScrollArea, QVBoxLayout, QHBoxLayout, QLayout, QScrollArea, QVBoxLayout, QHBoxLayout,
QMessageBox
) )
from PyQt6.QtGui import QPixmap from PyQt6.QtGui import QPixmap
from PyQt6.QtCore import Qt, QAbstractListModel from PyQt6.QtCore import Qt, QAbstractListModel
@ -162,7 +164,7 @@ class subpage_requirements(QFrame):
setting_echo_test.SetButtonText("Run action") setting_echo_test.SetButtonText("Run action")
echo_test = ActionRunner("echo", ["Hello World!"]) echo_test = ActionRunner("echo", ["Hello World!"])
ffprobe_installer = ActionRunner("winget", ["install", "-e", "--id", "Gyan.FFmpeg"]) FFMPEG_installer = ActionRunner("winget", ["install", "-e", "--id", "Gyan.FFmpeg"])
def echo_test_button(): def echo_test_button():
run = echo_test.run() run = echo_test.run()
setting_echo_test.SetText("Echo Test Complete") setting_echo_test.SetText("Echo Test Complete")
@ -180,11 +182,23 @@ class subpage_requirements(QFrame):
setting_install_ffprobe.SetButtonText("Run action") setting_install_ffprobe.SetButtonText("Run action")
def install_ffprobe(): def install_ffprobe():
warnmessage = QMessageBox()
warnmessage.setWindowTitle("Winget Install")
warnmessage.setIcon(QMessageBox.Icon.Warning)
warnmessage.setText("It is recommended to install and update winget first.")
warnmessage.setInformativeText("Do you want to continue?")
warnmessage.setStandardButtons(QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No)
warnmessage.setDefaultButton(QMessageBox.StandardButton.No)
ret = warnmessage.exec()
if ret == QMessageBox.StandardButton.No:
return
installed = CheckFFPROBE() installed = CheckFFPROBE()
print("Status:", installed) print("Status:", installed)
print(installed and "FFPROBE Upadting." or "FFPROBE Installing.") print(installed and "FFMPEG Upadting." or "FFMPEG Installing.")
ffprobe_installer.run() FFMPEG_installer.run()
print(installed and "FFPROBE Upadted." or "FFPROBE Installed.") print(installed and "FFMPEG Upadted." or "FFMPEG Installed.")
setting_install_ffprobe.SetText( installed and "FFPROBE Upadted." or "FFPROBE Installed." ) setting_install_ffprobe.SetText( installed and "FFPROBE Upadted." or "FFPROBE Installed." )
setting_install_ffprobe.SetButtonPressed(install_ffprobe) setting_install_ffprobe.SetButtonPressed(install_ffprobe)