Merge branch 'feat/exifs' into 'main'

patch: Added check if any exif options are empty

See merge request CodeByMrFinchum/OptimaLab35!10
This commit is contained in:
Mr Finchum 2025-01-23 15:33:47 +00:00
commit 513f29a89c
3 changed files with 26 additions and 21 deletions

View file

@ -295,7 +295,13 @@ class OptimaLab35(QMainWindow, Ui_MainWindow):
def start_process(self):
self.toggle_buttons(False)
self.update_settings() # Get all user selected data
u = self.update_settings()
print(f"u in startinset_xif: {u}")
if u != None: # Get all user selected data
QMessageBox.warning(self, "Warning", f"Error: {u}")
self.toggle_buttons(True)
return
if self.control_before_start("image") == False:
self.toggle_buttons(True)
return
@ -327,7 +333,13 @@ class OptimaLab35(QMainWindow, Ui_MainWindow):
def startinsert_exif(self):
self.toggle_buttons(False)
self.update_settings() # Get all user selected data
u = self.update_settings()
print(f"u in startinset_xif: {u}")
if u != None: # Get all user selected data
QMessageBox.warning(self, "Warning", f"Error: {u}")
self.toggle_buttons(True)
return
if self.control_before_start("exif") == False:
self.toggle_buttons(True)
return
@ -384,6 +396,12 @@ class OptimaLab35(QMainWindow, Ui_MainWindow):
self.settings["gps"] = None
return selected_exif
def check_selected_exif(self, exif):
for key in exif:
if len(exif[key]) == 0:
return f"{key} is empty"
return True
def update_settings(self):
"""Update .settings from all GUI elements."""
# Basic
@ -417,6 +435,10 @@ class OptimaLab35(QMainWindow, Ui_MainWindow):
self.settings["user_selected_exif"] = None
self.settings["gps"] = None
u = self.check_selected_exif(self.settings["user_selected_exif"])
if u != True:
return u
# Helper functions, low level
def handle_exif_file(self, do):
# TODO: add check if data is missing.

View file

@ -344,7 +344,7 @@ class Ui_MainWindow(object):
self.edit_exif_button = QPushButton(self.exif_group)
self.edit_exif_button.setObjectName(u"edit_exif_button")
self.edit_exif_button.setEnabled(False)
self.edit_exif_button.setEnabled(True)
self.horizontalLayout.addWidget(self.edit_exif_button)
@ -584,7 +584,6 @@ class Ui_MainWindow(object):
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.jpg_quality_spinBox.valueChanged.connect(self.jpg_quality_Slider.setValue)
self.rename_checkbox.toggled.connect(self.revert_checkbox.setEnabled)

View file

@ -575,7 +575,7 @@
<item>
<widget class="QPushButton" name="edit_exif_button">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="text">
<string>Edit Exif</string>
@ -1172,22 +1172,6 @@
</hint>
</hints>
</connection>
<connection>
<sender>exif_checkbox</sender>
<signal>toggled(bool)</signal>
<receiver>edit_exif_button</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>134</x>
<y>107</y>
</hint>
<hint type="destinationlabel">
<x>79</x>
<y>170</y>
</hint>
</hints>
</connection>
<connection>
<sender>add_date_checkBox</sender>
<signal>toggled(bool)</signal>