Main starts either GUI or TUI. UI split from optima35.

This commit is contained in:
Mr Finchum 2024-12-31 12:06:11 +01:00
parent 1285e5a844
commit 40b7ca0782
3 changed files with 352 additions and 7 deletions

17
gui.py
View file

@ -2,7 +2,7 @@ import sys
import os
from datetime import datetime
from optima35 import OPTIMA35
from optima.optima35 import OPTIMA35
from utils.utility import Utilities
from ui.main_window import Ui_MainWindow
from ui.exif_handler_window import ExifEditor
@ -37,6 +37,9 @@ class Optima35GUI(QMainWindow, Ui_MainWindow):
self.default_ui_layout()
self.define_gui_interaction()
if exif_file == "config/exif_example.yaml":
self.change_statusbar("Using example exif...", 10000)
def default_ui_layout(self):
self.ui.png_quality_spinBox.setVisible(False)
@ -254,11 +257,19 @@ class Optima35GUI(QMainWindow, Ui_MainWindow):
python = sys.executable # Path to the Python interpreter
os.execv(python, [python] + sys.argv)
def main(exif_file="local_files/exif.yaml"):
def main(exif_file):
app = QtWidgets.QApplication(sys.argv)
window = Optima35GUI(exif_file=exif_file)
window.show()
app.exec()
if __name__ == "__main__":
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)