Made that setting are stored in the home folder of the user.

This commit is contained in:
Mr Finchum 2025-01-02 23:05:43 +01:00
parent 01823f50d6
commit 9f0aece4bf
2 changed files with 17 additions and 35 deletions

25
gui.py
View file

@ -25,7 +25,7 @@ from PySide6.QtWidgets import (
)
class OptimaLab35(QMainWindow, Ui_MainWindow):
def __init__(self, exif_file):
def __init__(self):
super(OptimaLab35, self).__init__()
self.name = "OptimaLab35"
self.version = "0.0.1"
@ -33,7 +33,8 @@ class OptimaLab35(QMainWindow, Ui_MainWindow):
self.ui.setupUi(self)
self.o = OptimaManager()
self.u = Utilities()
self.exif_file = exif_file
self.u.program_configs()
self.exif_file = os.path.expanduser("~/.config/OptimaLab35/exif.yaml")
self.available_exif_data = None
self.settings = {}
self.setWindowTitle(f"{self.name} v{self.version}")
@ -41,9 +42,7 @@ class OptimaLab35(QMainWindow, Ui_MainWindow):
self._define_gui_interaction()
self.sd = SimpleDialog()
if exif_file == "config/exif_example.yaml":
self._change_statusbar("Using example exif...", 10000)
self._change_statusbar(f"Using {self.o.name} v{self.o.version}", 5000)
def _default_ui_layout(self):
self.ui.png_quality_spinBox.setVisible(False)
@ -273,21 +272,11 @@ class OptimaLab35(QMainWindow, Ui_MainWindow):
user_data["software"] = f"{self.o.name} {self.o.version}"
return user_data
def main(exif_file):
def main():
app = QtWidgets.QApplication(sys.argv)
window = OptimaLab35(exif_file = exif_file)
window = OptimaLab35()
window.show()
app.exec()
if __name__ == "__main__":
if os.path.isfile("config/exif.yaml"):
exif_file = "config/exif.yaml"
print("Fall back to exif example file...")
elif os.path.isfile("config/exif_example.yaml"):
exif_file = "config/exif_example.yaml"
else:
print("Exif file missing, please ensure an exif file exist in config folder (exif.yaml, or exif_example_yaml)\nExiting...")
exit()
main(exif_file)
main()