diff --git a/src/OptimaLab35/gui.py b/src/OptimaLab35/gui.py
index 2f03582..1f5cc1b 100644
--- a/src/OptimaLab35/gui.py
+++ b/src/OptimaLab35/gui.py
@@ -32,7 +32,7 @@ from PySide6.QtWidgets import (
QProgressBar,
)
-from PySide6.QtGui import QPixmap
+from PySide6.QtGui import QPixmap, QIcon
class PreviewWindow(QMainWindow, Ui_Preview_Window):
values_selected = Signal(int, int, bool)
@@ -108,14 +108,13 @@ class OptimaLab35(QMainWindow, Ui_MainWindow):
# Instantiate the second window
self.preview_window = PreviewWindow()
- # Connect button to open the second window
-
def open_preview_window(self):
self.preview_window.values_selected.connect(self.update_values)
self.preview_window.show()
def update_values(self, value1, value2, checkbox_state):
# Update main window's widgets with the received values
+ # ChatGPT
self.ui.brightness_spinBox.setValue(value1)
self.ui.contrast_spinBox.setValue(value2)
self.ui.grayscale_checkBox.setChecked(checkbox_state)
@@ -129,6 +128,7 @@ class OptimaLab35(QMainWindow, Ui_MainWindow):
self.ui.input_folder_button.clicked.connect(self._browse_input_folder)
self.ui.output_folder_button.clicked.connect(self._browse_output_folder)
self.ui.start_button.clicked.connect(self._start_process)
+ self.ui.insert_exif_Button.clicked.connect(self._start_insert_exif)
self.ui.image_type.currentIndexChanged.connect(self._update_quality_options)
self.ui.exif_checkbox.stateChanged.connect(
@@ -154,6 +154,7 @@ class OptimaLab35(QMainWindow, Ui_MainWindow):
# ChatGPT, mainly
info_text = f"""
{self.name} v{self.version}
+ (C) 2024-2025 Mr. Finchum aka CodeByMrFinchum
{self.name} is a GUI for {self.o.name} (v{self.o.version}).
Both projects are in active development, for more details, visit:
@@ -216,6 +217,9 @@ class OptimaLab35(QMainWindow, Ui_MainWindow):
def _toggle_buttons(self, state):
self.ui.start_button.setEnabled(state)
+ if self.ui.exif_checkbox.isChecked():
+ self.ui.insert_exif_Button.setEnabled(state)
+
def _process_images(self, image_files):
input_folder = self.settings["input_folder"]
output_folder = self.settings["output_folder"]
@@ -250,6 +254,65 @@ class OptimaLab35(QMainWindow, Ui_MainWindow):
self.ui.progressBar.setValue(0)
+ def _insert_exif(self, image_files):
+ input_folder = self.settings["input_folder"]
+
+ i = 1
+ for image_file in image_files:
+
+ input_path = os.path.join(input_folder, image_file)
+ print(input_path)
+
+ self.o.insert_dict_to_image(
+ exif_dict = self.user_selected_exif,
+ image_path = input_path,
+ gps = self.settings["gps"])
+ self._change_statusbar(image_file, 100)
+ self._handle_qprogressbar(i, len(image_files))
+ i += 1
+
+ self.ui.progressBar.setValue(0)
+
+ def _start_insert_exif(self):
+ self._toggle_buttons(False)
+ self._update_settings() # Get all user selected data
+ input_folder = self.settings["input_folder"]
+ output_folder = self.settings["output_folder"]
+ if not input_folder:
+ QMessageBox.warning(self, "Warning", "Input not selected")
+ self._toggle_buttons(True)
+ return
+
+ if output_folder:
+ reply = QMessageBox.question(
+ self,
+ "Confirmation",
+ "Output folder selected, but insert exif is done to images in input folder, Continue?",
+ QMessageBox.Yes | QMessageBox.No,
+ )
+
+ if reply == QMessageBox.No:
+ self._toggle_buttons(True)
+ return
+
+ input_folder_valid = os.path.exists(input_folder)
+ if not input_folder_valid :
+ QMessageBox.warning(self, "Warning", f"Input location {input_folder_valid}")
+ self._toggle_buttons(True)
+ return
+
+ image_list = self._image_list_from_folder(input_folder)
+ if len(image_list) == 0:
+ QMessageBox.warning(self, "Warning", "Selected folder has no supported files.")
+ self._toggle_buttons(True)
+ return
+
+ self._insert_exif(image_list)
+
+ self._toggle_buttons(True)
+ QMessageBox.information(self, "Information", "Finished")
+
+
def _open_exif_editor(self):
"""Open the EXIF Editor."""
self.exif_editor = ExifEditor(self.available_exif_data)
diff --git a/src/OptimaLab35/ui/main_window.py b/src/OptimaLab35/ui/main_window.py
index f93435c..9738dc7 100644
--- a/src/OptimaLab35/ui/main_window.py
+++ b/src/OptimaLab35/ui/main_window.py
@@ -27,6 +27,7 @@ class Ui_MainWindow(object):
def setupUi(self, MainWindow):
if not MainWindow.objectName():
MainWindow.setObjectName(u"MainWindow")
+ MainWindow.setWindowModality(Qt.NonModal)
MainWindow.resize(440, 756)
MainWindow.setMinimumSize(QSize(350, 677))
MainWindow.setMaximumSize(QSize(1000, 1000))
@@ -54,6 +55,8 @@ class Ui_MainWindow(object):
self.gridLayout_5.setObjectName(u"gridLayout_5")
self.input_folder_button = QPushButton(self.folder_group)
self.input_folder_button.setObjectName(u"input_folder_button")
+ self.input_folder_button.setMinimumSize(QSize(70, 0))
+ self.input_folder_button.setFlat(False)
self.gridLayout_5.addWidget(self.input_folder_button, 0, 1, 1, 1)
@@ -69,6 +72,7 @@ class Ui_MainWindow(object):
self.output_folder_button = QPushButton(self.folder_group)
self.output_folder_button.setObjectName(u"output_folder_button")
+ self.output_folder_button.setMinimumSize(QSize(70, 0))
self.gridLayout_5.addWidget(self.output_folder_button, 0, 3, 1, 1)
@@ -308,6 +312,12 @@ class Ui_MainWindow(object):
self.horizontalLayout_3.addWidget(self.start_button)
+ self.insert_exif_Button = QPushButton(self.widget_9)
+ self.insert_exif_Button.setObjectName(u"insert_exif_Button")
+ self.insert_exif_Button.setEnabled(False)
+
+ self.horizontalLayout_3.addWidget(self.insert_exif_Button)
+
self.verticalLayout_10.addWidget(self.widget_9)
@@ -540,39 +550,40 @@ class Ui_MainWindow(object):
self.menuBar = QMenuBar(MainWindow)
self.menuBar.setObjectName(u"menuBar")
self.menuBar.setGeometry(QRect(0, 0, 440, 27))
- self.menuInfo = QMenu(self.menuBar)
- self.menuInfo.setObjectName(u"menuInfo")
+ self.menuSettings = QMenu(self.menuBar)
+ self.menuSettings.setObjectName(u"menuSettings")
self.menuHelp = QMenu(self.menuBar)
self.menuHelp.setObjectName(u"menuHelp")
MainWindow.setMenuBar(self.menuBar)
- self.menuBar.addAction(self.menuInfo.menuAction())
+ self.menuBar.addAction(self.menuSettings.menuAction())
self.menuBar.addAction(self.menuHelp.menuAction())
- self.menuInfo.addAction(self.actionPreview)
+ self.menuSettings.addAction(self.actionPreview)
self.menuHelp.addAction(self.actionAbout)
self.retranslateUi(MainWindow)
self.rename_checkbox.toggled.connect(self.filename.setEnabled)
self.exif_checkbox.toggled.connect(self.exif_options_group.setEnabled)
- self.exif_checkbox.toggled.connect(self.exif_copy_checkBox.setDisabled)
+ self.jpg_quality_Slider.valueChanged.connect(self.jpg_quality_spinBox.setValue)
self.exif_copy_checkBox.toggled.connect(self.exif_checkbox.setDisabled)
+ self.exif_checkbox.toggled.connect(self.exif_copy_checkBox.setDisabled)
+ self.resize_spinBox.valueChanged.connect(self.resize_Slider.setValue)
+ self.png_quality_spinBox.valueChanged.connect(self.png_quality_Slider.setValue)
+ self.contrast_horizontalSlider.valueChanged.connect(self.contrast_spinBox.setValue)
+ self.resize_Slider.valueChanged.connect(self.resize_spinBox.setValue)
+ self.brightness_horizontalSlider.valueChanged.connect(self.brightness_spinBox.setValue)
+ self.exif_checkbox.toggled.connect(self.date_groupBox.setEnabled)
+ self.png_quality_Slider.valueChanged.connect(self.png_quality_spinBox.setValue)
+ self.gps_checkBox.toggled.connect(self.lat_lineEdit.setEnabled)
+ self.exif_checkbox.toggled.connect(self.insert_exif_Button.setEnabled)
+ self.gps_checkBox.toggled.connect(self.long_lineEdit.setEnabled)
+ self.brightness_spinBox.valueChanged.connect(self.brightness_horizontalSlider.setValue)
+ self.resize_Slider.valueChanged.connect(self.resize_spinBox.setValue)
+ self.exif_checkbox.toggled.connect(self.gps_groupBox.setEnabled)
+ self.contrast_spinBox.valueChanged.connect(self.contrast_horizontalSlider.setValue)
self.exif_checkbox.toggled.connect(self.edit_exif_button.setEnabled)
self.add_date_checkBox.toggled.connect(self.dateEdit.setEnabled)
- self.exif_checkbox.toggled.connect(self.date_groupBox.setEnabled)
- self.exif_checkbox.toggled.connect(self.gps_groupBox.setEnabled)
- self.gps_checkBox.toggled.connect(self.lat_lineEdit.setEnabled)
- self.gps_checkBox.toggled.connect(self.long_lineEdit.setEnabled)
- self.brightness_horizontalSlider.valueChanged.connect(self.brightness_spinBox.setValue)
- self.brightness_spinBox.valueChanged.connect(self.brightness_horizontalSlider.setValue)
- self.contrast_horizontalSlider.valueChanged.connect(self.contrast_spinBox.setValue)
- self.contrast_spinBox.valueChanged.connect(self.contrast_horizontalSlider.setValue)
- self.resize_Slider.valueChanged.connect(self.resize_spinBox.setValue)
- self.jpg_quality_Slider.valueChanged.connect(self.jpg_quality_spinBox.setValue)
self.jpg_quality_spinBox.valueChanged.connect(self.jpg_quality_Slider.setValue)
- self.resize_spinBox.valueChanged.connect(self.resize_Slider.setValue)
- self.resize_Slider.valueChanged.connect(self.resize_spinBox.setValue)
- self.png_quality_Slider.valueChanged.connect(self.png_quality_spinBox.setValue)
- self.png_quality_spinBox.valueChanged.connect(self.png_quality_Slider.setValue)
self.tabWidget.setCurrentIndex(0)
self.font_size_comboBox.setCurrentIndex(2)
@@ -582,16 +593,16 @@ class Ui_MainWindow(object):
# setupUi
def retranslateUi(self, MainWindow):
- MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"OPTIMA-35", None))
+ MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"OptimaLab35", None))
self.actionInfo.setText(QCoreApplication.translate("MainWindow", u"About", None))
self.actionPreview.setText(QCoreApplication.translate("MainWindow", u"Preview image", None))
self.actionAbout.setText(QCoreApplication.translate("MainWindow", u"About", None))
- self.input_folder_button.setText(QCoreApplication.translate("MainWindow", u"input", None))
+ self.input_folder_button.setText(QCoreApplication.translate("MainWindow", u"Input", None))
self.output_path.setText("")
- self.output_path.setPlaceholderText(QCoreApplication.translate("MainWindow", u"Enter output folder", None))
+ self.output_path.setPlaceholderText(QCoreApplication.translate("MainWindow", u"Output folder", None))
self.input_path.setText("")
- self.input_path.setPlaceholderText(QCoreApplication.translate("MainWindow", u"Enter input folder", None))
- self.output_folder_button.setText(QCoreApplication.translate("MainWindow", u"output", None))
+ self.input_path.setPlaceholderText(QCoreApplication.translate("MainWindow", u"Input folder", None))
+ self.output_folder_button.setText(QCoreApplication.translate("MainWindow", u"Output", None))
self.groupBox.setTitle(QCoreApplication.translate("MainWindow", u"Essential group", None))
self.quality_label_2.setText(QCoreApplication.translate("MainWindow", u"Quality", None))
self.label_11.setText(QCoreApplication.translate("MainWindow", u"Export Format", None))
@@ -621,11 +632,12 @@ class Ui_MainWindow(object):
self.filename.setText("")
self.filename.setPlaceholderText(QCoreApplication.translate("MainWindow", u"Enter file name", None))
self.start_button.setText(QCoreApplication.translate("MainWindow", u"Convert", None))
+ self.insert_exif_Button.setText(QCoreApplication.translate("MainWindow", u"Insert Exif", None))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_1), QCoreApplication.translate("MainWindow", u"Main", None))
self.exif_group.setTitle(QCoreApplication.translate("MainWindow", u"EXIF EXPERIMENTAL", None))
self.exif_checkbox.setText(QCoreApplication.translate("MainWindow", u"own exif", None))
self.exif_copy_checkBox.setText(QCoreApplication.translate("MainWindow", u"copy exif", None))
- self.edit_exif_button.setText(QCoreApplication.translate("MainWindow", u"edit exif", None))
+ self.edit_exif_button.setText(QCoreApplication.translate("MainWindow", u"Edit Exif", None))
self.exif_options_group.setTitle(QCoreApplication.translate("MainWindow", u"Must", None))
self.label_7.setText(QCoreApplication.translate("MainWindow", u"Artist", None))
self.label_4.setText(QCoreApplication.translate("MainWindow", u"ISO", None))
@@ -646,7 +658,7 @@ class Ui_MainWindow(object):
self.date_groupBox.setTitle(QCoreApplication.translate("MainWindow", u"Optional", None))
self.add_date_checkBox.setText(QCoreApplication.translate("MainWindow", u"add date", None))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), QCoreApplication.translate("MainWindow", u"EXIF", None))
- self.menuInfo.setTitle(QCoreApplication.translate("MainWindow", u"Settings", None))
+ self.menuSettings.setTitle(QCoreApplication.translate("MainWindow", u"Settings", None))
self.menuHelp.setTitle(QCoreApplication.translate("MainWindow", u"Help", None))
# retranslateUi
diff --git a/src/OptimaLab35/ui/main_window.ui b/src/OptimaLab35/ui/main_window.ui
index f4e3ac7..1466580 100644
--- a/src/OptimaLab35/ui/main_window.ui
+++ b/src/OptimaLab35/ui/main_window.ui
@@ -2,6 +2,9 @@
MainWindow
+
+ Qt::NonModal
+
0
@@ -23,7 +26,7 @@
- OPTIMA-35
+ OptimaLab35
@@ -54,8 +57,17 @@
-
+
+
+ 70
+ 0
+
+
- input
+ Input
+
+
+ false
@@ -65,7 +77,7 @@
- Enter output folder
+ Output folder
@@ -75,14 +87,20 @@
- Enter input folder
+ Input folder
-
+
+
+ 70
+ 0
+
+
- output
+ Output
@@ -508,6 +526,16 @@
+ -
+
+
+ false
+
+
+ Insert Exif
+
+
+
@@ -547,7 +575,7 @@
false
- edit exif
+ Edit Exif
@@ -798,7 +826,7 @@
27
-
@@ -864,18 +892,18 @@
- exif_checkbox
- toggled(bool)
- exif_copy_checkBox
- setDisabled(bool)
+ jpg_quality_Slider
+ valueChanged(int)
+ jpg_quality_spinBox
+ setValue(int)
- 130
- 105
+ 218
+ 289
- 332
- 105
+ 380
+ 289
@@ -895,6 +923,246 @@
+
+ exif_checkbox
+ toggled(bool)
+ exif_copy_checkBox
+ setDisabled(bool)
+
+
+ 130
+ 105
+
+
+ 332
+ 105
+
+
+
+
+ resize_spinBox
+ valueChanged(int)
+ resize_Slider
+ setValue(int)
+
+
+ 380
+ 252
+
+
+ 218
+ 252
+
+
+
+
+ png_quality_spinBox
+ valueChanged(int)
+ png_quality_Slider
+ setValue(int)
+
+
+ 380
+ 326
+
+
+ 218
+ 326
+
+
+
+
+ contrast_horizontalSlider
+ valueChanged(int)
+ contrast_spinBox
+ setValue(int)
+
+
+ 187
+ 458
+
+
+ 378
+ 458
+
+
+
+
+ resize_Slider
+ valueChanged(int)
+ resize_spinBox
+ setValue(int)
+
+
+ 218
+ 252
+
+
+ 380
+ 252
+
+
+
+
+ brightness_horizontalSlider
+ valueChanged(int)
+ brightness_spinBox
+ setValue(int)
+
+
+ 187
+ 393
+
+
+ 378
+ 393
+
+
+
+
+ exif_checkbox
+ toggled(bool)
+ date_groupBox
+ setEnabled(bool)
+
+
+ 126
+ 103
+
+
+ 224
+ 589
+
+
+
+
+ png_quality_Slider
+ valueChanged(int)
+ png_quality_spinBox
+ setValue(int)
+
+
+ 218
+ 326
+
+
+ 380
+ 326
+
+
+
+
+ gps_checkBox
+ toggled(bool)
+ lat_lineEdit
+ setEnabled(bool)
+
+
+ 72
+ 547
+
+
+ 192
+ 547
+
+
+
+
+ exif_checkbox
+ toggled(bool)
+ insert_exif_Button
+ setEnabled(bool)
+
+
+ 92
+ 130
+
+
+ 369
+ 684
+
+
+
+
+ gps_checkBox
+ toggled(bool)
+ long_lineEdit
+ setEnabled(bool)
+
+
+ 72
+ 547
+
+
+ 344
+ 547
+
+
+
+
+ brightness_spinBox
+ valueChanged(int)
+ brightness_horizontalSlider
+ setValue(int)
+
+
+ 378
+ 393
+
+
+ 187
+ 393
+
+
+
+
+ resize_Slider
+ valueChanged(int)
+ resize_spinBox
+ setValue(int)
+
+
+ 218
+ 252
+
+
+ 380
+ 252
+
+
+
+
+ exif_checkbox
+ toggled(bool)
+ gps_groupBox
+ setEnabled(bool)
+
+
+ 94
+ 103
+
+
+ 224
+ 535
+
+
+
+
+ contrast_spinBox
+ valueChanged(int)
+ contrast_horizontalSlider
+ setValue(int)
+
+
+ 378
+ 458
+
+
+ 187
+ 458
+
+
+
exif_checkbox
toggled(bool)
@@ -927,166 +1195,6 @@
-
- exif_checkbox
- toggled(bool)
- date_groupBox
- setEnabled(bool)
-
-
- 126
- 103
-
-
- 224
- 589
-
-
-
-
- exif_checkbox
- toggled(bool)
- gps_groupBox
- setEnabled(bool)
-
-
- 94
- 103
-
-
- 224
- 535
-
-
-
-
- gps_checkBox
- toggled(bool)
- lat_lineEdit
- setEnabled(bool)
-
-
- 72
- 547
-
-
- 192
- 547
-
-
-
-
- gps_checkBox
- toggled(bool)
- long_lineEdit
- setEnabled(bool)
-
-
- 72
- 547
-
-
- 344
- 547
-
-
-
-
- brightness_horizontalSlider
- valueChanged(int)
- brightness_spinBox
- setValue(int)
-
-
- 187
- 393
-
-
- 378
- 393
-
-
-
-
- brightness_spinBox
- valueChanged(int)
- brightness_horizontalSlider
- setValue(int)
-
-
- 378
- 393
-
-
- 187
- 393
-
-
-
-
- contrast_horizontalSlider
- valueChanged(int)
- contrast_spinBox
- setValue(int)
-
-
- 187
- 458
-
-
- 378
- 458
-
-
-
-
- contrast_spinBox
- valueChanged(int)
- contrast_horizontalSlider
- setValue(int)
-
-
- 378
- 458
-
-
- 187
- 458
-
-
-
-
- resize_Slider
- valueChanged(int)
- resize_spinBox
- setValue(int)
-
-
- 218
- 252
-
-
- 380
- 252
-
-
-
-
- jpg_quality_Slider
- valueChanged(int)
- jpg_quality_spinBox
- setValue(int)
-
-
- 218
- 289
-
-
- 380
- 289
-
-
-
jpg_quality_spinBox
valueChanged(int)
@@ -1103,69 +1211,5 @@
-
- resize_spinBox
- valueChanged(int)
- resize_Slider
- setValue(int)
-
-
- 380
- 252
-
-
- 218
- 252
-
-
-
-
- resize_Slider
- valueChanged(int)
- resize_spinBox
- setValue(int)
-
-
- 218
- 252
-
-
- 380
- 252
-
-
-
-
- png_quality_Slider
- valueChanged(int)
- png_quality_spinBox
- setValue(int)
-
-
- 218
- 326
-
-
- 380
- 326
-
-
-
-
- png_quality_spinBox
- valueChanged(int)
- png_quality_Slider
- setValue(int)
-
-
- 380
- 326
-
-
- 218
- 326
-
-
-