Patch: updater, icon, more

This commit is contained in:
Mr Finchum 2025-02-05 14:35:12 +01:00
parent 746d0b6cdc
commit 73273266cf

View file

@ -1,6 +1,12 @@
import sys
import os
from datetime import datetime
import importlib.resources as pkg_resources
try:
from OptimaLab35.ui import resources_rc
# keep the try for now
except Exception as e:
print(e)
from PyPiUpdater import PyPiUpdater
from optima35.core import OptimaManager
@ -12,7 +18,7 @@ from OptimaLab35.ui.exif_handler_window import ExifEditor
from OptimaLab35.ui.simple_dialog import SimpleDialog # Import the SimpleDialog class
from OptimaLab35 import __version__
from PySide6.QtCore import QRunnable, QThreadPool, Signal, QObject, QRegularExpression, Qt, QTimer, Slot
from PySide6.QtCore import QRunnable, QThreadPool, Signal, QObject, QRegularExpression, Qt, QTimer, Slot, QDir
from PySide6 import QtWidgets
from PySide6.QtWidgets import (
@ -31,7 +37,7 @@ from PySide6.QtWidgets import (
QProgressBar,
)
from PySide6.QtGui import QPixmap, QRegularExpressionValidator
from PySide6.QtGui import QPixmap, QRegularExpressionValidator, QIcon
class OptimaLab35(QMainWindow, Ui_MainWindow):
def __init__(self):
@ -57,6 +63,13 @@ class OptimaLab35(QMainWindow, Ui_MainWindow):
self.default_ui_layout()
self.define_gui_interaction()
try:
self.setWindowIcon(QIcon(":app-icon.png"))
# keep the try for now
except Exception as e:
print(e)
# Init function
def default_ui_layout(self):
self.ui.png_quality_spinBox.setVisible(False)
@ -543,8 +556,7 @@ class UpdaterWindow(QMainWindow, Ui_Updater_Window):
self.ui.check_for_update_Button.released.connect(self.cancel_long_press)
def local_check_for_updates(self):
dist_folder = os.path.expanduser("~/git/gitlab_public/OptimaLab35/dist/")
self.ui.check_local_Button.setEnabled(False)
dist_folder = os.path.expanduser("~/.config/OptimaLab35/dist/")
self.ui.label_optimalab35_latestversion.setText("Checking...")
self.ui.label_optima35_latestversion.setText("Checking...")
@ -564,9 +576,8 @@ class UpdaterWindow(QMainWindow, Ui_Updater_Window):
self.ui.label_optima35_latestversion.setText(o35_pkg_info[1])
self.updates_available["optima35"] = o35_pkg_info[0]
def local_update(self):
dist_folder = os.path.expanduser("~/git/gitlab_public/OptimaLab35/dist/")
dist_folder = os.path.expanduser("~/.config/OptimaLab35/dist/")
packages_to_update = [pkg for pkg, update in self.updates_available.items() if update]
if not packages_to_update:
@ -611,9 +622,12 @@ class UpdaterWindow(QMainWindow, Ui_Updater_Window):
self.restart_program()
def time_to_string(self, time_time):
dt_obj = datetime.fromtimestamp(time_time)
date_string = dt_obj.strftime("%d %h %H:%M")
return date_string
try:
dt_obj = datetime.fromtimestamp(time_time)
date_string = dt_obj.strftime("%d %h %H:%M")
return date_string
except TypeError:
return "Missing information"
def check_for_updates(self):
"""Check for updates and update the UI."""