Skip to content

Commit

Permalink
add output select dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
TNTwise committed Oct 3, 2024
1 parent 96da3a7 commit bf943bc
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 10 deletions.
1 change: 1 addition & 0 deletions REAL-Video-Enhancer.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ def loadVideo(self, inputFile):
videoHandler.getDataFromLocalVideo()
else:
RegularQTPopup("Not a valid input!")
return
(
self.videoWidth,
self.videoHeight,
Expand Down
38 changes: 29 additions & 9 deletions src/ui/SettingsTab.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
12 changes: 11 additions & 1 deletion testRVEInterface.ui
Original file line number Diff line number Diff line change
Expand Up @@ -1529,9 +1529,12 @@ QDoubleSpinBox::down-button {
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Policy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>255</width>
<width>20</width>
<height>20</height>
</size>
</property>
Expand All @@ -1547,6 +1550,13 @@ QDoubleSpinBox::down-button {
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="select_output_folder_location_btn">
<property name="text">
<string>Select Output Folder</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
Expand Down

0 comments on commit bf943bc

Please sign in to comment.