Fix: fixed wrong link to changelog #11

Merged
CodeByMrFinchum merged 1 commit from fix/changeloglink into main 2026-01-04 10:51:14 +01:00
Showing only changes of commit 547dec03a7 - Show all commits

View file

@ -1,32 +1,20 @@
import sys
import os
import sys
from datetime import datetime
from PyPiUpdater import PyPiUpdater
from PySide6 import QtCore, QtWidgets
from PySide6.QtCore import QRegularExpression, Qt, QTimer
from PySide6.QtGui import QIcon
from PySide6.QtWidgets import QApplication, QMainWindow, QMessageBox
from OptimaLab35 import __version__
from .const import (
CONFIG_BASE_PATH
)
from .const import CONFIG_BASE_PATH
from .ui import resources_rc
from .utils.utility import Utilities
from .ui.settings_window import Ui_Settings_Window
from .utils.utility import Utilities
from PySide6 import QtWidgets, QtCore
from PySide6.QtCore import (
QRegularExpression,
Qt,
QTimer
)
from PySide6.QtWidgets import (
QMessageBox,
QApplication,
QMainWindow
)
from PySide6.QtGui import QIcon
class SettingsWindow(QMainWindow, Ui_Settings_Window):
# Mixture of code by me, code/functions refactored by ChatGPT and code directly from ChatGPT
@ -45,8 +33,12 @@ class SettingsWindow(QMainWindow, Ui_Settings_Window):
self.optimalab35_localversion = optimalab35_localversion
self.optima35_localversion = optima35_localversion
# Create PyPiUpdater instances
self.ppu_ol35 = PyPiUpdater("OptimaLab35", self.optimalab35_localversion, self.update_log_file)
self.ppu_o35 = PyPiUpdater("optima35", self.optima35_localversion, self.update_log_file)
self.ppu_ol35 = PyPiUpdater(
"OptimaLab35", self.optimalab35_localversion, self.update_log_file
)
self.ppu_o35 = PyPiUpdater(
"optima35", self.optima35_localversion, self.update_log_file
)
self.ol35_last_state = self.ppu_ol35.get_last_state()
self.o35_last_state = self.ppu_o35.get_last_state()
# Track which packages need an update
@ -68,7 +60,9 @@ class SettingsWindow(QMainWindow, Ui_Settings_Window):
# Connect buttons to functions
self.ui.check_for_update_Button.clicked.connect(self.check_for_updates)
self.ui.update_and_restart_Button.clicked.connect(self.update_and_restart)
self.ui.label_last_check.setText(f"Last check: {self.time_to_string(self.ol35_last_state[0])}")
self.ui.label_last_check.setText(
f"Last check: {self.time_to_string(self.ol35_last_state[0])}"
)
self.ui.dev_widget.setVisible(False)
# Timer for long press detection
@ -79,20 +73,22 @@ class SettingsWindow(QMainWindow, Ui_Settings_Window):
# Connect button press/release
self.ui.check_for_update_Button.pressed.connect(self.start_long_press)
self.ui.check_for_update_Button.released.connect(self.cancel_long_press)
self.ui.label_5.setText('<li><a href="https://code.boxyfoxy.net/CodeByMrFinchum/OptimaLab35/src/branch/main/CHANGELOG.md">Changelog</a></li>')
self.ui.label_5.setText(
'<li><a href="https://code.boxyfoxy.net/CodeByMrFinchum/OptimaLab35/wiki/Changelog">Changelog</a></li>'
)
self.ui.label_5.setOpenExternalLinks(True)
#settings related
# settings related
self.load_settings_into_ui()
self.ui.reset_exif_Button.clicked.connect(self.ask_reset_exif)
self.ui.save_and_close_Button.clicked.connect(self.save_and_close)
self.ui.save_and_restart_Button.clicked.connect(self.save_and_restart)
if os.name == "nt": # Disable restart app when windows.
if os.name == "nt": # Disable restart app when windows.
self.ui.save_and_restart_Button.setVisible(False)
self.ui.restart_checkBox.setChecked(False)
self.ui.restart_checkBox.setVisible(False)
# setting related
# setting related
def load_settings_into_ui(self):
"""Loads the settings into the UI elements."""
settings = self.app_settings
@ -101,7 +97,9 @@ class SettingsWindow(QMainWindow, Ui_Settings_Window):
pkg_available = settings["theme"]["theme_pkg"]
if pkg_available:
index = self.ui.theme_selection_comboBox.findText(theme_mode, QtCore.Qt.MatchFlag.MatchExactly)
index = self.ui.theme_selection_comboBox.findText(
theme_mode, QtCore.Qt.MatchFlag.MatchExactly
)
if index != -1:
self.ui.theme_selection_comboBox.setCurrentIndex(index)
self.ui.enable_theme_checkBox.setChecked(use_custom_theme)
@ -130,8 +128,12 @@ class SettingsWindow(QMainWindow, Ui_Settings_Window):
self.ui.install_pkg_Button.setText("Try again?")
def save_settings(self):
self.app_settings["theme"]["mode"] = self.ui.theme_selection_comboBox.currentText()
self.app_settings["theme"]["use_custom_theme"] = self.ui.enable_theme_checkBox.isChecked()
self.app_settings["theme"]["mode"] = (
self.ui.theme_selection_comboBox.currentText()
)
self.app_settings["theme"]["use_custom_theme"] = (
self.ui.enable_theme_checkBox.isChecked()
)
self.u.save_settings(self.app_settings)
def save_and_close(self):
@ -143,7 +145,9 @@ class SettingsWindow(QMainWindow, Ui_Settings_Window):
msg.setIcon(QMessageBox.Icon.Question)
msg.setWindowTitle("Confirm Reset")
msg.setText("Are you sure you want to restart the app?")
msg.setStandardButtons(QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No)
msg.setStandardButtons(
QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No
)
# Show the message box and wait for the user's response
response = msg.exec()
@ -162,7 +166,9 @@ class SettingsWindow(QMainWindow, Ui_Settings_Window):
msg.setIcon(QMessageBox.Icon.Question)
msg.setWindowTitle("Confirm Reset")
msg.setText("Are you sure you want to reset the EXIF options to default?")
msg.setStandardButtons(QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No)
msg.setStandardButtons(
QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No
)
# Show the message box and wait for the user's response
response = msg.exec()
@ -173,7 +179,7 @@ class SettingsWindow(QMainWindow, Ui_Settings_Window):
else:
pass # Do nothing if "No" is selected
# update related parts
# update related parts
def start_long_press(self):
"""Start the timer when button is pressed."""
# brave AI
@ -214,7 +220,9 @@ class SettingsWindow(QMainWindow, Ui_Settings_Window):
def local_update(self):
dist_folder = os.path.expanduser("~/.config/OptimaLab35/dist/")
packages_to_update = [pkg for pkg, update in self.updates_available.items() if update]
packages_to_update = [
pkg for pkg, update in self.updates_available.items() if update
]
if not packages_to_update:
QMessageBox.information(self, "Update", "No updates available.")
@ -243,7 +251,9 @@ class SettingsWindow(QMainWindow, Ui_Settings_Window):
elif package == "optima35":
pkg_info = self.ppu_o35.update_from_local(dist_folder)
update_results.append(f"{package}: {'Success' if pkg_info[0] else 'Failed'}\n{pkg_info[1]}")
update_results.append(
f"{package}: {'Success' if pkg_info[0] else 'Failed'}\n{pkg_info[1]}"
)
# Show summary of updates
# Show update completion message
@ -302,7 +312,9 @@ class SettingsWindow(QMainWindow, Ui_Settings_Window):
def update_and_restart(self):
"""Update selected packages and restart the application."""
packages_to_update = [pkg for pkg, update in self.updates_available.items() if update]
packages_to_update = [
pkg for pkg, update in self.updates_available.items() if update
]
if not packages_to_update:
QMessageBox.information(self, "Update", "No updates available.")
@ -331,7 +343,9 @@ class SettingsWindow(QMainWindow, Ui_Settings_Window):
elif package == "optima35":
pkg_info = self.ppu_o35.update_package()
update_results.append(f"{package}: {'Success' if pkg_info[0] else 'Failed'}\n{pkg_info[1]}")
update_results.append(
f"{package}: {'Success' if pkg_info[0] else 'Failed'}\n{pkg_info[1]}"
)
# Show summary of updates
# Show update completion message