Fix: fixed wrong link to changelog #11
1 changed files with 51 additions and 37 deletions
|
|
@ -1,32 +1,20 @@
|
||||||
import sys
|
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from PyPiUpdater import PyPiUpdater
|
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 OptimaLab35 import __version__
|
||||||
from .const import (
|
|
||||||
CONFIG_BASE_PATH
|
|
||||||
)
|
|
||||||
|
|
||||||
|
from .const import CONFIG_BASE_PATH
|
||||||
from .ui import resources_rc
|
from .ui import resources_rc
|
||||||
from .utils.utility import Utilities
|
|
||||||
from .ui.settings_window import Ui_Settings_Window
|
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):
|
class SettingsWindow(QMainWindow, Ui_Settings_Window):
|
||||||
# Mixture of code by me, code/functions refactored by ChatGPT and code directly from ChatGPT
|
# 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.optimalab35_localversion = optimalab35_localversion
|
||||||
self.optima35_localversion = optima35_localversion
|
self.optima35_localversion = optima35_localversion
|
||||||
# Create PyPiUpdater instances
|
# Create PyPiUpdater instances
|
||||||
self.ppu_ol35 = PyPiUpdater("OptimaLab35", self.optimalab35_localversion, self.update_log_file)
|
self.ppu_ol35 = PyPiUpdater(
|
||||||
self.ppu_o35 = PyPiUpdater("optima35", self.optima35_localversion, self.update_log_file)
|
"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.ol35_last_state = self.ppu_ol35.get_last_state()
|
||||||
self.o35_last_state = self.ppu_o35.get_last_state()
|
self.o35_last_state = self.ppu_o35.get_last_state()
|
||||||
# Track which packages need an update
|
# Track which packages need an update
|
||||||
|
|
@ -68,7 +60,9 @@ class SettingsWindow(QMainWindow, Ui_Settings_Window):
|
||||||
# Connect buttons to functions
|
# Connect buttons to functions
|
||||||
self.ui.check_for_update_Button.clicked.connect(self.check_for_updates)
|
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.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)
|
self.ui.dev_widget.setVisible(False)
|
||||||
|
|
||||||
# Timer for long press detection
|
# Timer for long press detection
|
||||||
|
|
@ -79,9 +73,11 @@ class SettingsWindow(QMainWindow, Ui_Settings_Window):
|
||||||
# Connect button press/release
|
# Connect button press/release
|
||||||
self.ui.check_for_update_Button.pressed.connect(self.start_long_press)
|
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.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)
|
self.ui.label_5.setOpenExternalLinks(True)
|
||||||
#settings related
|
# settings related
|
||||||
self.load_settings_into_ui()
|
self.load_settings_into_ui()
|
||||||
self.ui.reset_exif_Button.clicked.connect(self.ask_reset_exif)
|
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_close_Button.clicked.connect(self.save_and_close)
|
||||||
|
|
@ -92,7 +88,7 @@ class SettingsWindow(QMainWindow, Ui_Settings_Window):
|
||||||
self.ui.restart_checkBox.setChecked(False)
|
self.ui.restart_checkBox.setChecked(False)
|
||||||
self.ui.restart_checkBox.setVisible(False)
|
self.ui.restart_checkBox.setVisible(False)
|
||||||
|
|
||||||
# setting related
|
# setting related
|
||||||
def load_settings_into_ui(self):
|
def load_settings_into_ui(self):
|
||||||
"""Loads the settings into the UI elements."""
|
"""Loads the settings into the UI elements."""
|
||||||
settings = self.app_settings
|
settings = self.app_settings
|
||||||
|
|
@ -101,7 +97,9 @@ class SettingsWindow(QMainWindow, Ui_Settings_Window):
|
||||||
pkg_available = settings["theme"]["theme_pkg"]
|
pkg_available = settings["theme"]["theme_pkg"]
|
||||||
|
|
||||||
if pkg_available:
|
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:
|
if index != -1:
|
||||||
self.ui.theme_selection_comboBox.setCurrentIndex(index)
|
self.ui.theme_selection_comboBox.setCurrentIndex(index)
|
||||||
self.ui.enable_theme_checkBox.setChecked(use_custom_theme)
|
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?")
|
self.ui.install_pkg_Button.setText("Try again?")
|
||||||
|
|
||||||
def save_settings(self):
|
def save_settings(self):
|
||||||
self.app_settings["theme"]["mode"] = self.ui.theme_selection_comboBox.currentText()
|
self.app_settings["theme"]["mode"] = (
|
||||||
self.app_settings["theme"]["use_custom_theme"] = self.ui.enable_theme_checkBox.isChecked()
|
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)
|
self.u.save_settings(self.app_settings)
|
||||||
|
|
||||||
def save_and_close(self):
|
def save_and_close(self):
|
||||||
|
|
@ -143,7 +145,9 @@ class SettingsWindow(QMainWindow, Ui_Settings_Window):
|
||||||
msg.setIcon(QMessageBox.Icon.Question)
|
msg.setIcon(QMessageBox.Icon.Question)
|
||||||
msg.setWindowTitle("Confirm Reset")
|
msg.setWindowTitle("Confirm Reset")
|
||||||
msg.setText("Are you sure you want to restart the app?")
|
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
|
# Show the message box and wait for the user's response
|
||||||
response = msg.exec()
|
response = msg.exec()
|
||||||
|
|
@ -162,7 +166,9 @@ class SettingsWindow(QMainWindow, Ui_Settings_Window):
|
||||||
msg.setIcon(QMessageBox.Icon.Question)
|
msg.setIcon(QMessageBox.Icon.Question)
|
||||||
msg.setWindowTitle("Confirm Reset")
|
msg.setWindowTitle("Confirm Reset")
|
||||||
msg.setText("Are you sure you want to reset the EXIF options to default?")
|
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
|
# Show the message box and wait for the user's response
|
||||||
response = msg.exec()
|
response = msg.exec()
|
||||||
|
|
@ -173,7 +179,7 @@ class SettingsWindow(QMainWindow, Ui_Settings_Window):
|
||||||
else:
|
else:
|
||||||
pass # Do nothing if "No" is selected
|
pass # Do nothing if "No" is selected
|
||||||
|
|
||||||
# update related parts
|
# update related parts
|
||||||
def start_long_press(self):
|
def start_long_press(self):
|
||||||
"""Start the timer when button is pressed."""
|
"""Start the timer when button is pressed."""
|
||||||
# brave AI
|
# brave AI
|
||||||
|
|
@ -214,7 +220,9 @@ class SettingsWindow(QMainWindow, Ui_Settings_Window):
|
||||||
|
|
||||||
def local_update(self):
|
def local_update(self):
|
||||||
dist_folder = os.path.expanduser("~/.config/OptimaLab35/dist/")
|
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:
|
if not packages_to_update:
|
||||||
QMessageBox.information(self, "Update", "No updates available.")
|
QMessageBox.information(self, "Update", "No updates available.")
|
||||||
|
|
@ -243,7 +251,9 @@ class SettingsWindow(QMainWindow, Ui_Settings_Window):
|
||||||
elif package == "optima35":
|
elif package == "optima35":
|
||||||
pkg_info = self.ppu_o35.update_from_local(dist_folder)
|
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 summary of updates
|
||||||
# Show update completion message
|
# Show update completion message
|
||||||
|
|
@ -302,7 +312,9 @@ class SettingsWindow(QMainWindow, Ui_Settings_Window):
|
||||||
|
|
||||||
def update_and_restart(self):
|
def update_and_restart(self):
|
||||||
"""Update selected packages and restart the application."""
|
"""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:
|
if not packages_to_update:
|
||||||
QMessageBox.information(self, "Update", "No updates available.")
|
QMessageBox.information(self, "Update", "No updates available.")
|
||||||
|
|
@ -331,7 +343,9 @@ class SettingsWindow(QMainWindow, Ui_Settings_Window):
|
||||||
elif package == "optima35":
|
elif package == "optima35":
|
||||||
pkg_info = self.ppu_o35.update_package()
|
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 summary of updates
|
||||||
# Show update completion message
|
# Show update completion message
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue