From bf943bc50ae264288e818aee3bea0705d83efb3a Mon Sep 17 00:00:00 2001 From: TNTwise Date: Wed, 2 Oct 2024 19:45:04 -0500 Subject: [PATCH] add output select dialog --- REAL-Video-Enhancer.py | 1 + src/ui/SettingsTab.py | 38 +++++++++++++++++++++++++++++--------- testRVEInterface.ui | 12 +++++++++++- 3 files changed, 41 insertions(+), 10 deletions(-) diff --git a/REAL-Video-Enhancer.py b/REAL-Video-Enhancer.py index 87894ebe..25963f39 100644 --- a/REAL-Video-Enhancer.py +++ b/REAL-Video-Enhancer.py @@ -392,6 +392,7 @@ def loadVideo(self, inputFile): videoHandler.getDataFromLocalVideo() else: RegularQTPopup("Not a valid input!") + return ( self.videoWidth, self.videoHeight, diff --git a/src/ui/SettingsTab.py b/src/ui/SettingsTab.py index e1fe3e07..847c59f1 100644 --- a/src/ui/SettingsTab.py +++ b/src/ui/SettingsTab.py @@ -1,6 +1,6 @@ import os -from PySide6.QtWidgets import QMainWindow +from PySide6.QtWidgets import QMainWindow, QFileDialog from ..Util import currentDirectory, getPlatform, homedir, checkForWritePermissions from .QTcustom import RegularQTPopup @@ -104,13 +104,14 @@ def connectWriteSettings(self): def writeOutputFolder(self): outputlocation = self.parent.output_folder_location.text() - if checkForWritePermissions(outputlocation): - self.settings.writeSetting( - "output_folder_location", - str(outputlocation), - ) - else: - RegularQTPopup("No permissions to export here!") + if os.path.exists(outputlocation) and os.path.isdir(outputlocation): + if checkForWritePermissions(outputlocation): + self.settings.writeSetting( + "output_folder_location", + str(outputlocation), + ) + else: + RegularQTPopup("No permissions to export here!") def resetSettings(self): self.settings.writeDefaultSettings() @@ -146,6 +147,26 @@ def connectSettingText(self): self.parent.output_folder_location.setText( self.settings.settings["output_folder_location"] ) + self.parent.select_output_folder_location_btn.clicked.connect( + self.selectOutputFolder + ) + + def selectOutputFolder(self): + outputFile = QFileDialog.getExistingDirectory( + parent=self.parent, + caption="Select Folder", + dir=os.path.expanduser("~"), + ) + outputlocation = outputFile + if os.path.exists(outputlocation) and os.path.isdir(outputlocation): + if checkForWritePermissions(outputlocation): + self.settings.writeSetting( + "output_folder_location", + str(outputlocation), + ) + self.parent.output_folder_location.setText(outputlocation) + else: + RegularQTPopup("No permissions to export here!") class Settings: @@ -244,7 +265,6 @@ def writeOutCurrentSettings(self): with open(self.settingsFile, "w") as file: for key, value in self.settings.items(): if key in self.defaultSettings: # check if the key is valid - print(value) if ( value in self.allowedSettings[key] or self.allowedSettings[key] == "ANY" ): # check if it is in the allowed settings dict diff --git a/testRVEInterface.ui b/testRVEInterface.ui index 64081590..b2663b2e 100644 --- a/testRVEInterface.ui +++ b/testRVEInterface.ui @@ -1529,9 +1529,12 @@ QDoubleSpinBox::down-button { Qt::Orientation::Horizontal + + QSizePolicy::Policy::Minimum + - 255 + 20 20 @@ -1547,6 +1550,13 @@ QDoubleSpinBox::down-button { + + + + Select Output Folder + + +