refactor: fix&patch see changelog for 0.11.0

This commit is contained in:
Mr Finchum 2025-02-05 14:04:37 +00:00
parent cb016ae98f
commit 0d416aaf8d
15 changed files with 3266 additions and 42 deletions

View file

@ -29,10 +29,10 @@ build:
- sed -i "s/0.0.1/${GitVersion_MajorMinorPatch}/" src/OptimaLab35/__init__.py
- cat src/OptimaLab35/__init__.py
- python3 -m pip install build
- python3 -m build
- python3 -m build --wheel --sdist -s src
artifacts:
paths:
- dist/*
- src/dist/*
expire_in: 1 day
publish:

View file

@ -1,5 +1,13 @@
# Changelog
## 0.11.0: Refactor and Patches
- Fixed an issue with the updater: The updater window wouldn't start if the `updater_log.json` file was missing or lacked a valid last `time.time()` float value.
- Corrected layout issues in the preview window, repositioning elements to their proper places.
- Added an application icon (may not work on all desktop environments).
- Refactored code to reduce the size of the PyPi package by removing unnecessary folders.
---
## 0.10.x
### 0.10.1: Fixed Updater
- Fixed an issue where the updater was permanently disabled.

View file

@ -7,14 +7,8 @@ name = "OptimaLab35"
dynamic = ["version"]
authors = [{ name = "Mr Finchum" }]
description = "User interface for optima35."
readme = "pip_README.md"
requires-python = ">=3.8"
dependencies = [
"optima35>=1.0.0, <2.0.0",
"PyPiUpdater>=0.6.0, <1.0.0",
"pyside6",
"PyYAML",
]
dependencies = ["optima35>=1.0.0, <2.0.0", "PyYAML", "PyPyUpdater"]
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)",
@ -28,7 +22,7 @@ Source = "https://gitlab.com/CodeByMrFinchum/OptimaLab35"
OptimaLab35 = "OptimaLab35.__main__:main"
[tool.hatch.build.targets.wheel]
packages = ["src/OptimaLab35"]
packages = ["OptimaLab35"]
[tool.hatch.version]
path = "src/OptimaLab35/__init__.py"
path = "OptimaLab35/__init__.py"

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."""

View file

@ -85,13 +85,10 @@ class Ui_Preview_Window(object):
self.verticalLayout.addWidget(self.reset_brightness_Button)
self.contrast_Slider = QSlider(self.widget_2)
self.contrast_Slider.setObjectName(u"contrast_Slider")
self.contrast_Slider.setMinimum(-100)
self.contrast_Slider.setMaximum(100)
self.contrast_Slider.setOrientation(Qt.Horizontal)
self.label_2 = QLabel(self.widget_2)
self.label_2.setObjectName(u"label_2")
self.verticalLayout.addWidget(self.contrast_Slider)
self.verticalLayout.addWidget(self.label_2)
self.contrast_spinBox = QSpinBox(self.widget_2)
self.contrast_spinBox.setObjectName(u"contrast_spinBox")
@ -100,10 +97,13 @@ class Ui_Preview_Window(object):
self.verticalLayout.addWidget(self.contrast_spinBox)
self.label_2 = QLabel(self.widget_2)
self.label_2.setObjectName(u"label_2")
self.contrast_Slider = QSlider(self.widget_2)
self.contrast_Slider.setObjectName(u"contrast_Slider")
self.contrast_Slider.setMinimum(-100)
self.contrast_Slider.setMaximum(100)
self.contrast_Slider.setOrientation(Qt.Horizontal)
self.verticalLayout.addWidget(self.label_2)
self.verticalLayout.addWidget(self.contrast_Slider)
self.reset_contrast_Button = QPushButton(self.widget_2)
self.reset_contrast_Button.setObjectName(u"reset_contrast_Button")

View file

@ -128,15 +128,9 @@
</widget>
</item>
<item>
<widget class="QSlider" name="contrast_Slider">
<property name="minimum">
<number>-100</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Contrast</string>
</property>
</widget>
</item>
@ -151,9 +145,15 @@
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Contrast</string>
<widget class="QSlider" name="contrast_Slider">
<property name="minimum">
<number>-100</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>

File diff suppressed because it is too large Load diff

View file

@ -167,7 +167,13 @@ class Ui_Updater_Window(object):
self.restart_checkBox.setText(QCoreApplication.translate("Updater_Window", u"Restart", None))
self.label_last_check.setText(QCoreApplication.translate("Updater_Window", u"Last update check:", None))
self.label_last_check_2.setText(QCoreApplication.translate("Updater_Window", u"TextLabel", None))
#if QT_CONFIG(tooltip)
self.check_local_Button.setToolTip(QCoreApplication.translate("Updater_Window", u"FOR DEVELOPER", None))
#endif // QT_CONFIG(tooltip)
self.check_local_Button.setText(QCoreApplication.translate("Updater_Window", u"Check local", None))
#if QT_CONFIG(tooltip)
self.update_local_Button.setToolTip(QCoreApplication.translate("Updater_Window", u"FOR DEVELOPER", None))
#endif // QT_CONFIG(tooltip)
self.update_local_Button.setText(QCoreApplication.translate("Updater_Window", u"Update local", None))
# retranslateUi

View file

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 49 KiB

Before After
Before After

View file

@ -0,0 +1,6 @@
<!DOCTYPE RCC>
<RCC version="1.0">
<qresource>
<file>app-icon.png</file>
</qresource>
</RCC>

3
src/generate_qrc.sh Normal file
View file

@ -0,0 +1,3 @@
#!/bin/bash
echo "Updating resources.qrc file and placing in ui folder..."
pyside6-rcc app_resources/resources.qrc -o OptimaLab35/ui/resources_rc.py

View file

@ -7,8 +7,14 @@ name = "OptimaLab35"
dynamic = ["version"]
authors = [{ name = "Mr Finchum" }]
description = "User interface for optima35."
readme = "../pip_README.md"
requires-python = ">=3.8"
dependencies = ["optima35>=1.0.0, <2.0.0", "PyYAML", "PyPyUpdater"]
dependencies = [
"optima35>=1.0.0, <2.0.0",
"PyPiUpdater>=0.6.0, <1.0.0",
"pyside6",
"PyYAML",
]
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)",