From 7f62608976be3a859db0deb9cbaa396578fca930 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 15 Apr 2024 13:48:02 +0000 Subject: [PATCH] Add warning --- tab_settings.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/tab_settings.py b/tab_settings.py index c985205..3a1dbda 100644 --- a/tab_settings.py +++ b/tab_settings.py @@ -5,6 +5,8 @@ from PyQt6.QtWidgets import ( QGraphicsScene, QGraphicsView, QGraphicsPixmapItem, QLayout, QScrollArea, QVBoxLayout, QHBoxLayout, + + QMessageBox ) from PyQt6.QtGui import QPixmap from PyQt6.QtCore import Qt, QAbstractListModel @@ -162,7 +164,7 @@ class subpage_requirements(QFrame): setting_echo_test.SetButtonText("Run action") 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(): run = echo_test.run() setting_echo_test.SetText("Echo Test Complete") @@ -180,11 +182,23 @@ class subpage_requirements(QFrame): setting_install_ffprobe.SetButtonText("Run action") 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() print("Status:", installed) - print(installed and "FFPROBE Upadting." or "FFPROBE Installing.") - ffprobe_installer.run() - print(installed and "FFPROBE Upadted." or "FFPROBE Installed.") + print(installed and "FFMPEG Upadting." or "FFMPEG Installing.") + FFMPEG_installer.run() + print(installed and "FFMPEG Upadted." or "FFMPEG Installed.") setting_install_ffprobe.SetText( installed and "FFPROBE Upadted." or "FFPROBE Installed." ) setting_install_ffprobe.SetButtonPressed(install_ffprobe)