Compare commits

...

13 commits
1.0.1 ... main

Author SHA1 Message Date
894d444f91
feat: dateEdit is now, instead of static day.
All checks were successful
ci/woodpecker/push/woodpecker_ci Pipeline was successful
ci/woodpecker/tag/woodpecker_ci Pipeline was successful
2025-05-30 12:17:12 +02:00
a89f43ba2e
fix: fixed linkage and changelog
All checks were successful
ci/woodpecker/pr/woodpecker_ci Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker_ci Pipeline was successful
ci/woodpecker/push/woodpecker_ci Pipeline was successful
ci/woodpecker/tag/woodpecker_ci Pipeline was successful
2025-04-11 15:57:58 +02:00
d93d3de859 fix: fixing woodpecker ci (#2)
All checks were successful
ci/woodpecker/push/woodpecker_ci Pipeline was successful
ci/woodpecker/tag/woodpecker_ci Pipeline was successful
Reviewed-on: #2
Co-authored-by: Mr Finchum <mr.finchum@pm.me>
Co-committed-by: Mr Finchum <mr.finchum@pm.me>
2025-04-11 13:41:24 +02:00
011249e002
ci: switch to woodpecker ci.
Some checks failed
ci/woodpecker/pr/woodpecker_ci Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker_ci Pipeline was successful
ci/woodpecker/push/woodpecker_ci Pipeline failed
ci/woodpecker/tag/woodpecker_ci Pipeline was successful
2025-04-11 13:34:29 +02:00
d4e8a25b1e fix: fixed misspelling 2025-04-01 18:37:11 +02:00
419dc1eada patch: better performance for preview window 2025-04-01 16:30:21 +00:00
63422ccd88 fix: fixed app path 2025-03-30 19:29:54 +02:00
d356937e41 fix: fixed insert exif feature 2025-03-27 11:07:58 +00:00
ef92ffb5b9 feat: image adjustments written to exif. 2025-03-24 15:34:29 +01:00
7adea3084a patch: Patched pyproject file. 2025-03-23 23:09:05 +01:00
35a9f1af55 patch: patched formation of file. 2025-03-23 23:02:39 +01:00
17f08bc74f refactor: Splitting Classes into Separate Files 2025-03-23 21:48:46 +00:00
ce2dd90a39 feat: added feature to show original image in preview window. 2025-03-23 12:37:56 +00:00
21 changed files with 1096 additions and 906 deletions

1
.gitignore vendored
View file

@ -4,3 +4,4 @@ dist/
__pycache__/
.flatpak-builder/
flatpak-build-dir/
*.jpg

View file

@ -1,69 +0,0 @@
---
include:
- local: .gitlab-ci/versioning/gitversion.yml
- local: .gitlab-ci/git/create_tag.yml
stages:
- build
- release
gitversion:
extends: .versioning:gitversion
stage: .pre
tags:
- gitlab-org-docker
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Run this job when commits are pushed or merged to the default branch
build:
stage: build
image: python:3.9.21
tags:
- gitlab-org-docker
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Run this job when commits are pushed or merged to the default branch
needs:
- job: gitversion
artifacts: true
script:
- 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 --wheel --sdist -s src
artifacts:
paths:
- src/dist/*
expire_in: 1 day
publish:
stage: release
image: python:3.9.21
tags:
- gitlab-org-docker
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Run this job when commits are pushed or merged to the default branch
variables:
TWINE_USERNAME: "__token__"
TWINE_PASSWORD: $TWINE_API
needs:
- job: build
artifacts: true
script:
- python3 -m pip install twine
- python3 -m twine upload src/dist/*
create_tag:
extends: .git:create_tag
stage: release
tags:
- gitlab-org-docker
variables:
VERSION: $GitVersion_SemVer
TOKEN: $GITLAB_TOKEN
needs:
- job: gitversion
artifacts: true
rules:
- if: $CI_COMMIT_TAG
when: never # Do not run this job when a tag is created manually
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Run this job when commits are pushed or merged to the default branch

View file

@ -1,15 +0,0 @@
---
.git:create_tag:
image: alpine:3.21
variables:
GIT_STRATEGY: clone
GIT_DEPTH: 0
GIT_LFS_SKIP_SMUDGE: 1
VERSION: ''
TOKEN: '' # Token with push privileges
script:
- apk add git
- git remote set-url origin https://oauth2:$TOKEN@$CI_SERVER_HOST/$CI_PROJECT_PATH
- git tag $VERSION
- git push origin tag $VERSION

View file

@ -1,31 +0,0 @@
---
.versioning:gitversion:
image:
name: mcr.microsoft.com/dotnet/sdk:9.0
variables:
GIT_STRATEGY: clone
GIT_DEPTH: 0 # force a deep/non-shallow fetch need by gitversion
GIT_LFS_SKIP_SMUDGE: 1
cache: [] # caches and before / after scripts can mess things up
script:
- |
dotnet tool install --global GitVersion.Tool --version 5.*
export PATH="$PATH:/root/.dotnet/tools"
dotnet-gitversion -output buildserver
# We could just collect the output file gitversion.properties (with artifacts:report:dotenv: gitversion.properties as it is already in DOTENV format,
# however it contains ~33 variables which unnecessarily consumes many of the 50 max DOTENV variables of the free GitLab version.
# Limits are higher for licensed editions, see https://docs.gitlab.com/ee/ci/yaml/artifacts_reports.html#artifactsreportsdotenv
grep 'GitVersion_LegacySemVer=' gitversion.properties >> gitversion.env
grep 'GitVersion_SemVer=' gitversion.properties >> gitversion.env
grep 'GitVersion_FullSemVer=' gitversion.properties >> gitversion.env
grep 'GitVersion_Major=' gitversion.properties >> gitversion.env
grep 'GitVersion_Minor=' gitversion.properties >> gitversion.env
grep 'GitVersion_Patch=' gitversion.properties >> gitversion.env
grep 'GitVersion_MajorMinorPatch=' gitversion.properties >> gitversion.env
grep 'GitVersion_BuildMetaData=' gitversion.properties >> gitversion.env
artifacts:
reports:
# propagates variables into the pipeline level
dotenv: gitversion.env

View file

@ -0,0 +1,92 @@
steps:
- name: gitversion
depends_on: [] # nothing start emititly
when:
event: push
branch: main
image: mcr.microsoft.com/dotnet/sdk:9.0
environment:
CI_TOKEN:
from_secret: CI_TOKEN
commands:
- git remote set-url origin https://CodeByMrFinchum:$CI_TOKEN@code.boxyfoxy.net/$CI_REPO.git
- git fetch --unshallow --tags
- apt-get update && apt-get install -y jq
- dotnet tool install --global GitVersion.Tool --version 5.*
- export PATH="$PATH:/root/.dotnet/tools"
- dotnet-gitversion -output json > version.json
- ls
- cat version.json
- |
echo "GitVersion_SemVer=$(jq -r '.SemVer' version.json)" >> gitversion.env
echo "GitVersion_LegacySemVer=$(jq -r '.LegacySemVer' version.json)" >> gitversion.env
echo "GitVersion_FullSemVer=$(jq -r '.FullSemVer' version.json)" >> gitversion.env
echo "GitVersion_Major=$(jq -r '.Major' version.json)" >> gitversion.env
echo "GitVersion_Minor=$(jq -r '.Minor' version.json)" >> gitversion.env
echo "GitVersion_Patch=$(jq -r '.Patch' version.json)" >> gitversion.env
echo "GitVersion_MajorMinorPatch=$(jq -r '.MajorMinorPatch' version.json)" >> gitversion.env
echo "GitVersion_BuildMetaData=$(jq -r '.BuildMetaData' version.json)" >> gitversion.env
- name: tagging
depends_on: [gitversion]
when:
event: push
branch: main
image: alpine/git
environment:
CI_TOKEN:
from_secret: CI_TOKEN
commands:
- ls
- cat gitversion.env
- git config --global user.email "ci@noreply.boxyfoxy.net"
- git config --global user.name "CI Bot"
- git remote set-url origin https://CodeByMrFinchum:$${CI_TOKEN}@code.boxyfoxy.net/$${CI_REPO}.git
- . gitversion.env
- git tag $GitVersion_SemVer
- git push origin tag $GitVersion_SemVer
- name: build
depends_on: [gitversion, tagging]
when:
event: push
branch: main
image: python:3.9.21
commands:
- ls
- cat gitversion.env
- export $(cat gitversion.env | xargs)
- sed -i "s/0.0.1/$GitVersion_SemVer/" src/OptimaLab35/__init__.py
- cat src/OptimaLab35/__init__.py
- python3 -m pip install build
- python3 -m build --wheel --sdist -s src
- name: publish_pypi
depends_on: [gitversion, tagging, build]
when:
event: push
branch: main
image: python:3.9.21
environment:
TWINE_PASSWORD:
from_secret: TWINE_API
TWINE_USERNAME: "__token__"
commands:
- ls
- python3 -m pip install twine
- python3 -m twine upload src/dist/*
- name: publish_forgejo
depends_on: [gitversion, tagging, build]
when:
event: push
branch: main
image: python:3.9.21
environment:
TWINE_PASSWORD:
from_secret: PKG_TOKEN
TWINE_USERNAME: "CodeByMrFinchum"
commands:
- ls
- python3 -m pip install twine
- python3 -m twine upload --repository-url https://code.boxyfoxy.net/api/packages/CodeByMrFinchum/pypi src/dist/*

View file

@ -1,61 +1,124 @@
# Changelog
## 1.5.x
### 1.5.0: Feature - Time of dateEdit now today
- Changes that instead of the dateEdit elements being always set to a last day of 2024 it is the current day.
## 1.0.x
## 1.4.x
### 1.4.2: Fix links
- Fixed that changelog was linked to GitLab, not it is to code.boxyfoxy.net
- Fixed Changelog
### 1.4.1: Fix CI
- Fixed pipline
### 1.4.0: New CI
- Migrated repo from GitLab to my forgejo instance, therefore switching to woodpecker CI
---
## 1.3.x
### 1.3.4: Fix - Spelling (25.04.01)
- Fixed misspelling in preview window.
### 1.3.3: Patch - Increased Preview Performance x2 (25.04.01)
- Reduced preview stutter: Previously, the image was updated twice when changing brightness or contrast. Now, it updates only once, improving performance by 100%.
- There is still room for improvement. Analysis shows that image processing takes the most time, while displaying in Qt is relatively fast. Reducing the image size impacts performance, so resizing to 50% is a good idea.
- There is an issue where `QRunner` does not always finish in the correct order when brightness or contrast values are changed rapidly. ATM I do not know how to fix this easly.
- The "Preview" watermark now displays the brightness and contrast levels of the shown image.
### 1.3.2: Fix - Fixed problem with app folders (25.03.30)
- Fixed a problem that the app folder path was not generated correctly.
### 1.3.1: Fix - Fixed insert exif not working (25.03.27)
- Fixed the feature that inserted exif into images without modifying them.
### 1.3.0: Feature - Write Adjustments into EXIF (25.03.24)
- Changes to contrast and brightness are now recorded in the EXIF comment section (labeled *Scanner* in the program).
- This allows users to track what adjustments were made to an image.
---
## 1.2.x
### 1.2.2: Patch - Pyproject file (25.03.23)
- Fixed `Development Status` Classifier
- Added <4.0 python version
### 1.2.1: Patch - Changelog file (25.03.23)
- Patches formation in changelog file.
### 1.2.0: Refactor - Splitting Classes into Separate Files (25.03.23)
- Refactored `gui.py`, which previously contained almost all the code, into multiple files.
- Each window's logic is now in its own file, improving code organization.
- Window layouts remain in `.ui` folder, while their logic is now properly separated.
## 1.1.x
### 1.1.0: Feature - New Function in Preview Window (25.03.23)
- Added a new feature to the preview window: **Hold a button to temporarily view the original (unedited) image.** This makes it easier to compare changes.
- Minor UI adjustments.
---
## 1.0.x (25.03.06)
### 1.0.1: Fixed spelling
- Fixes spelling some places
### 1.0.0: Fix version bump
- Version was not bumped correctly
## 0.15.1: Final Polish (06.03.25)
---
## 0.15.1: Final Polish (25.03.06)
- Fixed a bug where the GPS field being empty but selected caused issues.
- EXIF insertion is now canceled if any image in the folder does not end with a number.
- Minor GUI adjustments for a more polished experience.
- Disabled preview adjustment controls until an image is loaded to prevent errors.
## 0.15.0: Preview Image Resizing Update (12.02.25)
## 0.15.0: Preview Image Resizing Update (25.02.12)
- Added the ability to change the preview image size dynamically.
- Previously, the image was processed and displayed at its original size, causing lag or unresponsiveness when adjusting the slider.
- Reducing the processed image size should help improve performance.
- Default preview image size is now **25%**, but users can adjust it between **10% and 100%**.
---
## 0.14.x
### 0.14.1: Patch changelog (12.02.25)
### 0.14.1: Patch changelog (25.02.12)
- Updated the changelog to include missing entries.
### 0.14.0: Code refactor (by Mr. Finch) (11.02.25)
### 0.14.0: Code refactor (by Mr. Finch) (25.02.11)
- Introduced constants and optimized the code.
## 0.13.x (11.02.25)
## 0.13.x (25.02.11)
### 0.13.1: Fixed image processing
- Fixed a bug that made it impossible to process images.
### 0.13.0: Requirements file (by Mr. Finch)
- Added a requirements file.
---
## 0.12.x
### 0.12.6: Disabled app restart on Windows (11.02.25)
### 0.12.6: Disabled app restart on Windows (25.02.11)
- The app can not restart properly on Windows, so the restart button has been hidden when the OS is `nt`.
- Also updated tool tip to indicate that changing theme requeres are restart.
### 0.12.5: Fixed EXIF File Generation Bug (10.02.25)
### 0.12.5: Fixed EXIF File Generation Bug (25.02.10)
- Fixed a bug where the application failed to generate a new default EXIF file if none was available. Now, the file is correctly created when missing.
### 0.12.4: Updated README (10.02.25)
### 0.12.4: Updated README (25.02.10)
- The README file (project description) now includes updates description and screenshots.
### 0.12.3: UI Adjustments (10.02.25)
### 0.12.3: UI Adjustments (25.02.10)
- Minor changes to maintain a unified layout across all windows.
- Added option to sync app theme with OS (if supported).
- Set auto theme as the default value.
### 0.12.2: Minor UI Improvements for Theme Compatibility (10.02.25)
### 0.12.2: Minor UI Improvements for Theme Compatibility (25.02.10)
- Fixed text clipping issues when using the new theme options.
### 0.12.1: Removed Unnecessary Debug Prints (09.02.25)
### 0.12.1: Removed Unnecessary Debug Prints (25.02.09)
- Removed leftover debug statements.
### 0.12.0: New Settings Menu & Patches (09.02.25)
### 0.12.0: New Settings Menu & Patches (25.02.09)
- **New Settings Window:**
- The updater window has been reworked into a settings window.
- **Initial settings (first tab) include:**
@ -68,9 +131,10 @@
- Fixed an issue where links in labels (About window) did not open a browser.
- Added a changelog link in the About window.
- Minor changes to `utility.py` to handle settings.
---
## 0.11.x (05.02.25)
## 0.11.x (25.02.05)
### 0.11.1: Fixed pipeline
- Fixed pipeline publish error
@ -82,7 +146,7 @@
---
## 0.10.x (04.02.25)
## 0.10.x (25.02.04)
### 0.10.1: Fixed Updater
- Fixed an issue where the updater was permanently disabled.
@ -120,7 +184,7 @@
- Improved error handling for updater: now displays the specific error message instead of just **"error"** when an issue occurs during update checks.
- Ensured all child windows close when the main window is closed.
### 0.8.3: Fix OptimaLab35 Not Closing After Update
### 0.8.3: Fix - OptimaLab35 Not Closing After Update
- Fixed an issue where **OptimaLab35** would not close properly when updating, resulting in an unresponsive instance and multiple running processes.
### 0.8.2: Patch for New PyPiUpdater Version

View file

@ -1,11 +1,11 @@
# **OptimaLab35**
Last updated: 06 Mar 2025 (v.1.0.0)
Developed on my [forgejo instance](https://code.boxyfoxy.net/CodeByMrFinchum), [GitLab](https://gitlab.com/CodeByMrFinchum) is used as backup.
## **Overview**
**OptimaLab35** enhances **OPTIMA35** (**Organizing, Processing, Tweaking Images, and Modifying scanned Analogs from 35mm Film**) by offering a user-friendly graphical interface for efficient image and metadata management.
It serves as a GUI for the [OPTIMA35 library](https://gitlab.com/CodeByMrFinchum/optima35), providing an intuitive way to interact with the core functionalities.
It serves as a GUI for the [optima35 library](https://code.boxyfoxy.net/CodeByMrFinchum/optima35), providing an intuitive way to interact with the core functionalities.
---
@ -55,28 +55,28 @@ The UI is OS-dependent, but a custom theme can be enabled in the settings.
**Main tab**
![main](https://gitlab.com/CodeByMrFinchum/OptimaLab35/-/raw/main/media/mainwindow_light.png){width=40%}
![main](https://gitlab.com/CodeByMrFinchum/OptimaLab35/-/raw/main/media/mainwindow_dark.png){width=40%}
![main](https://code.boxyfoxy.net/CodeByMrFinchum/OptimaLab35/raw/branch/main/media/mainwindow_light.png){width=40%}
![main](https://code.boxyfoxy.net/CodeByMrFinchum/OptimaLab35/raw/branch/main/media/mainwindow_dark.png){width=40%}
**Exif tab**
![main](https://gitlab.com/CodeByMrFinchum/OptimaLab35/-/raw/main/media/mainwindow_exif_light.png){width=40%}
![main](https://gitlab.com/CodeByMrFinchum/OptimaLab35/-/raw/main/media/mainwindow_exif_dark.png){width=40%}
![main](https://code.boxyfoxy.net/CodeByMrFinchum/OptimaLab35/raw/branch/main/media/mainwindow_exif_light.png){width=40%}
![main](https://code.boxyfoxy.net/CodeByMrFinchum/OptimaLab35/raw/branch/main/media/mainwindow_exif_dark.png){width=40%}
**Preview window**
![main](https://gitlab.com/CodeByMrFinchum/OptimaLab35/-/raw/main/media/previewwindow_light.png){width=40%}
![main](https://gitlab.com/CodeByMrFinchum/OptimaLab35/-/raw/main/media/previewwindow_dark.png){width=40%}
![main](https://code.boxyfoxy.net/CodeByMrFinchum/OptimaLab35/raw/branch/main/media/previewwindow_light.png){width=40%}
![main](https://code.boxyfoxy.net/CodeByMrFinchum/OptimaLab35/raw/branch/main/media/previewwindow_dark.png){width=40%}
**Settings**
![main](https://gitlab.com/CodeByMrFinchum/OptimaLab35/-/raw/main/media/settingswindow_light.png){width=40%}
![main](https://gitlab.com/CodeByMrFinchum/OptimaLab35/-/raw/main/media/settingswindow_dark.png){width=40%}
![main](https://code.boxyfoxy.net/CodeByMrFinchum/OptimaLab35/raw/branch/main/media/settingswindow_light.png){width=40%}
![main](https://code.boxyfoxy.net/CodeByMrFinchum/OptimaLab35/raw/branch/main/media/settingswindow_dark.png){width=40%}
**Updater**
![main](https://gitlab.com/CodeByMrFinchum/OptimaLab35/-/raw/main/media/settingswindow_updater_light.png){width=40%}
![main](https://gitlab.com/CodeByMrFinchum/OptimaLab35/-/raw/main/media/settingswindow_updater_dark.png){width=40%}
![main](https://code.boxyfoxy.net/CodeByMrFinchum/OptimaLab35/raw/branch/main/media/settingswindow_updater_light.png){width=40%}
![main](https://code.boxyfoxy.net/CodeByMrFinchum/OptimaLab35/raw/branch/main/media/settingswindow_updater_dark.png){width=40%}
---

View file

@ -1,6 +0,0 @@
# TODO
## Improvments
### Preview window
Improve performence by changing when the images is updated.
Right now, when moving the slider, the image gets updated for every single step increase resulting in lagging

View file

@ -1,4 +1,6 @@
**[OptimaLab35](https://gitlab.com/CodeByMrFinchum/OptimaLab35)** is a graphical interface for the [OPTIMA35 library](https://gitlab.com/CodeByMrFinchum/optima35), designed for efficient image and metadata management.
**[OptimaLab35](https://code.boxyfoxy.net/CodeByMrFinchum/OptimaLab35)** is a graphical interface for the [optima35 library](https://code.boxyfoxy.net/CodeByMrFinchum/optima35), designed for efficient image and metadata management.
Developed on my [forgejo instance](https://code.boxyfoxy.net/CodeByMrFinchum), [GitLab](https://gitlab.com/CodeByMrFinchum) is used as backup.
### **Features**
- Resize, adjust brightness/contrast, and convert images to grayscale

View file

@ -1,4 +1,30 @@
from .gui import main
import sys
from PySide6 import QtWidgets
from .utils.utility import Utilities
from .mainWindow import OptimaLab35
from .const import (
CONFIG_BASE_PATH
)
def main():
u = Utilities(CONFIG_BASE_PATH)
app_settings = u.load_settings()
app = QtWidgets.QApplication(sys.argv)
try:
import qdarktheme
app_settings["theme"]["theme_pkg"] = True
except ImportError:
app_settings["theme"]["theme_pkg"] = False
if app_settings["theme"]["use_custom_theme"] and app_settings["theme"]["theme_pkg"]:
qdarktheme.setup_theme(app_settings["theme"]["mode"].lower())
u.save_settings(app_settings)
window = OptimaLab35()
window.show()
app.exec()
if __name__ == "__main__":
main()

View file

@ -1,23 +1,22 @@
import sys
import os
from datetime import datetime
from .ui import resources_rc
from PyPiUpdater import PyPiUpdater
from optima35.core import OptimaManager
from .utils.utility import Utilities
from .ui.main_window import Ui_MainWindow
from .ui.preview_window import Ui_Preview_Window
from .ui.settings_window import Ui_Settings_Window
from .ui.exif_handler_window import ExifEditor
from .ui.simple_dialog import SimpleDialog # Import the SimpleDialog class
from OptimaLab35 import __version__
from .const import (
APPLICATION_NAME,
CONFIG_BASE_PATH
)
from .ui import resources_rc
from .previewWindow import PreviewWindow
from .settingsWindow import SettingsWindow
from .utils.utility import Utilities
from .ui.main_window import Ui_MainWindow
from .ui.exif_handler_window import ExifEditor
from .ui.simple_dialog import SimpleDialog # Import the SimpleDialog class
from PySide6 import QtWidgets, QtCore
from PySide6.QtCore import (
@ -27,8 +26,7 @@ from PySide6.QtCore import (
QObject,
QRegularExpression,
Qt,
QTimer,
Slot
QDate
)
from PySide6.QtWidgets import (
@ -38,7 +36,7 @@ from PySide6.QtWidgets import (
QFileDialog
)
from PySide6.QtGui import QPixmap, QRegularExpressionValidator, QIcon
from PySide6.QtGui import QRegularExpressionValidator, QIcon
class OptimaLab35(QMainWindow, Ui_MainWindow):
def __init__(self):
@ -99,9 +97,7 @@ class OptimaLab35(QMainWindow, Ui_MainWindow):
validator = QRegularExpressionValidator(regex)
self.ui.lat_lineEdit.setValidator(validator)
self.ui.long_lineEdit.setValidator(validator)
#layout.addWidget(self.ui.lat_lineEdit)
#layout.addWidget(self.ui.long_lineEdit)
self.ui.dateEdit.setDate(QDate.currentDate())
# UI related function, changing parts, open, etc.
def open_preview_window(self):
self.preview_window = PreviewWindow()
@ -135,7 +131,7 @@ class OptimaLab35(QMainWindow, Ui_MainWindow):
<p>For more details, visit:</p>
<ul>
<li><a href="https://gitlab.com/CodeByMrFinchum/OptimaLab35/-/blob/main/CHANGELOG.md?ref_type=heads">Changelog</a></li>
<li><a href="https://code.boxyfoxy.net/CodeByMrFinchum/OptimaLab35/src/branch/main/CHANGELOG.md">Changelog</a></li>
<li><a href="https://gitlab.com/CodeByMrFinchum/OptimaLab35">OptimaLab35 GitLab</a></li>
<li><a href="https://gitlab.com/CodeByMrFinchum/optima35">optima35 GitLab</a></li>
</ul>
@ -346,7 +342,7 @@ class OptimaLab35(QMainWindow, Ui_MainWindow):
def control_ending(self, name_lst):
for item in name_lst:
try:
int(item[-1])
int(item[-5])
except ValueError:
return False
return True
@ -382,6 +378,7 @@ class OptimaLab35(QMainWindow, Ui_MainWindow):
return
image_list = self.image_list_from_folder(self.settings["input_folder"])
print(image_list)
if not self.control_ending(image_list):
QMessageBox.warning(self, "Warning", f"Error: one or more filenames do not end on a number.\nCan not adjust time")
self.toggle_buttons(True)
@ -420,10 +417,14 @@ class OptimaLab35(QMainWindow, Ui_MainWindow):
user_data["lens"] = self.ui.lens_comboBox.currentText()
user_data["iso"] = self.ui.iso_comboBox.currentText()
user_data["image_description"] = self.ui.image_description_comboBox.currentText()
user_data["user_comment"] = self.ui.user_comment_comboBox.currentText()
user_data["artist"] = self.ui.artist_comboBox.currentText()
user_data["copyright_info"] = self.ui.copyright_info_comboBox.currentText()
user_data["software"] = f"{self.name} {self.version} with {self.o.name} {self.o.version}"
if int(self.ui.contrast_spinBox.text()) != 0 or int(self.ui.brightness_spinBox.text()) != 0:
user_data["user_comment"] = f"{self.ui.user_comment_comboBox.currentText()}, contrast: {self.ui.contrast_spinBox.text()}, brightness: {self.ui.brightness_spinBox.text()}"
else:
user_data["user_comment"] = self.ui.user_comment_comboBox.currentText()
return user_data
def get_selected_exif(self):
@ -501,424 +502,6 @@ class OptimaLab35(QMainWindow, Ui_MainWindow):
QApplication.closeAllWindows()
event.accept()
class SettingsWindow(QMainWindow, Ui_Settings_Window):
# Mixture of code by me, code/functions refactored by ChatGPT and code directly from ChatGPT
def __init__(self, optimalab35_localversion, optima35_localversion):
super(SettingsWindow, self).__init__()
self.ui = Ui_Settings_Window()
self.ui.setupUi(self)
self.u = Utilities(os.path.expanduser("~/.config/OptimaLab35"))
self.app_settings = self.u.load_settings()
self.dev_mode = True if optimalab35_localversion == "0.0.1" else False
from PyPiUpdater import PyPiUpdater
# Update log file location
self.update_log_file = os.path.expanduser("~/.config/OptimaLab35/update_log.json")
# Store local versions
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.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
self.updates_available = {"OptimaLab35": False, "optima35": False}
self.define_gui_interaction()
def define_gui_interaction(self):
"""Setup UI interactions."""
# Updater related
self.ui.label_optimalab35_localversion.setText(self.optimalab35_localversion)
self.ui.label_optima35_localversion.setText(self.optima35_localversion)
self.ui.label_latest_version.setText("Latest version")
self.ui.label_optimalab35_latestversion.setText("...")
self.ui.label_optima35_latestversion.setText("...")
self.ui.update_and_restart_Button.setEnabled(False)
# 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.dev_widget.setVisible(False)
# Timer for long press detection
self.timer = QTimer()
self.timer.setSingleShot(True)
self.timer.timeout.connect(self.toggle_dev_ui)
# 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://gitlab.com/CodeByMrFinchum/OptimaLab35/-/blob/main/CHANGELOG.md?ref_type=heads">Changelog</a></li>')
self.ui.label_5.setOpenExternalLinks(True)
#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.
self.ui.save_and_restart_Button.setVisible(False)
self.ui.restart_checkBox.setChecked(False)
self.ui.restart_checkBox.setVisible(False)
# setting related
def load_settings_into_ui(self):
"""Loads the settings into the UI elements."""
settings = self.app_settings
theme_mode = settings["theme"]["mode"]
use_custom_theme = settings["theme"]["use_custom_theme"]
pkg_available = settings["theme"]["theme_pkg"]
if pkg_available:
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)
self.ui.install_pkg_Button.setVisible(False)
self.ui.enable_theme_checkBox.setEnabled(True)
else:
self.ui.enable_theme_checkBox.setEnabled(False)
self.ui.install_pkg_Button.clicked.connect(self.install_theme_pkg)
def install_theme_pkg(self):
a = self.ppu_ol35.install_package("PyQtDarkTheme-fork")
self.ui.install_pkg_Button.setEnabled(False)
self.ui.install_pkg_Button.setText("Please wait...")
msg_box = QMessageBox()
msg_box.setIcon(QMessageBox.Information)
msg_box.setWindowTitle("Message")
msg_box.setText(a[1])
msg_box.setStandardButtons(QMessageBox.Ok)
msg_box.exec()
if a[0]:
self.app_settings["theme"]["theme_pkg"] = True
self.load_settings_into_ui()
else:
self.ui.install_pkg_Button.setEnabled(True)
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.u.save_settings(self.app_settings)
def save_and_close(self):
self.save_settings()
self.close()
def save_and_restart(self):
msg = QMessageBox()
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)
# Show the message box and wait for the user's response
response = msg.exec()
# Check response and perform action
if response == QMessageBox.StandardButton.Yes:
self.save_settings()
self.restart_program()
else:
pass # Do nothing if "No" is selected
def ask_reset_exif(self):
"""Shows a dialog to ask the user if they are sure about resetting EXIF options to default."""
# Create a QMessageBox with a Yes/No question
msg = QMessageBox()
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)
# Show the message box and wait for the user's response
response = msg.exec()
# Check response and perform action
if response == QMessageBox.StandardButton.Yes:
self.u.default_exif() # Reset EXIF options to default
else:
pass # Do nothing if "No" is selected
# update related parts
def start_long_press(self):
"""Start the timer when button is pressed."""
# brave AI
self.timer.start(1000) # 1-second long press
def cancel_long_press(self):
"""Cancel long press if released early."""
# brave AI
self.timer.stop()
def toggle_dev_ui(self):
"""Show or hide the hidden UI when long press is detected."""
self.ui.dev_widget.setVisible(True)
self.ui.check_local_Button.clicked.connect(self.local_check_for_updates)
self.ui.update_local_Button.clicked.connect(self.local_update)
def local_check_for_updates(self):
dist_folder = os.path.expanduser("~/.config/OptimaLab35/dist/")
self.ui.label_optimalab35_latestversion.setText("Checking...")
self.ui.label_optima35_latestversion.setText("Checking...")
# Check OptimaLab35 update
ol35_pkg_info = self.ppu_ol35.check_update_local(dist_folder)
if ol35_pkg_info[0] is None:
self.ui.label_optimalab35_latestversion.setText(ol35_pkg_info[1][0:13])
else:
self.ui.label_optimalab35_latestversion.setText(ol35_pkg_info[1])
self.updates_available["OptimaLab35"] = ol35_pkg_info[0]
# Check optima35 update
o35_pkg_info = self.ppu_o35.check_update_local(dist_folder)
if o35_pkg_info[0] is None:
self.ui.label_optima35_latestversion.setText(o35_pkg_info[1][0:13])
else:
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("~/.config/OptimaLab35/dist/")
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.")
return
# Confirm update
msg = QMessageBox()
msg.setWindowTitle("Update Available")
message = f"Updating: {', '.join(packages_to_update)}\nUpdate "
if self.ui.restart_checkBox.isChecked():
message = message + "and restart app?"
else:
message = message + "app?"
msg.setText(message)
msg.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
result = msg.exec()
if result == QMessageBox.Yes:
update_results = [] # Store results
for package in packages_to_update:
if package == "OptimaLab35":
pkg_info = self.ppu_ol35.update_from_local(dist_folder)
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]}")
# Show summary of updates
# Show update completion message
msg = QMessageBox()
msg.setWindowTitle("Update Complete")
msg.setText("\n\n".join(update_results))
msg.setStandardButtons(QMessageBox.Ok)
msg.exec()
# Restart the application after user clicks "OK"
if self.ui.restart_checkBox.isChecked():
self.restart_program()
def time_to_string(self, time_time):
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."""
self.ui.check_for_update_Button.setEnabled(False)
self.ui.label_optimalab35_latestversion.setText("Checking...")
self.ui.label_optima35_latestversion.setText("Checking...")
# Check OptimaLab35 update
ol35_pkg_info = self.ppu_ol35.check_for_update()
if ol35_pkg_info[0] is None:
self.ui.label_optimalab35_latestversion.setText(ol35_pkg_info[1][0:13])
else:
self.ui.label_optimalab35_latestversion.setText(ol35_pkg_info[1])
self.updates_available["OptimaLab35"] = ol35_pkg_info[0]
# Check optima35 update
o35_pkg_info = self.ppu_o35.check_for_update()
if o35_pkg_info[0] is None:
self.ui.label_optima35_latestversion.setText(o35_pkg_info[1][0:13])
else:
self.ui.label_optima35_latestversion.setText(o35_pkg_info[1])
self.updates_available["optima35"] = o35_pkg_info[0]
# Enable update button if any update is available
if any(self.updates_available.values()):
if self.dev_mode:
self.ui.update_and_restart_Button.setEnabled(False)
self.ui.update_and_restart_Button.setText("Update disabled")
else:
self.ui.update_and_restart_Button.setEnabled(True)
last_date = self.time_to_string(self.ppu_ol35.get_last_state()[0])
self.ui.label_last_check.setText(f"Last check: {last_date}")
self.ui.label_latest_version.setText("Online version")
self.ui.check_for_update_Button.setEnabled(True)
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]
if not packages_to_update:
QMessageBox.information(self, "Update", "No updates available.")
return
# Confirm update
msg = QMessageBox()
msg.setWindowTitle("Update Available")
message = f"Updating: {', '.join(packages_to_update)}\nUpdate "
if self.ui.restart_checkBox.isChecked():
message = message + "and restart app?"
else:
message = message + "app?"
msg.setText(message)
msg.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
result = msg.exec()
if result == QMessageBox.Yes:
update_results = [] # Store results
for package in packages_to_update:
if package == "OptimaLab35":
pkg_info = self.ppu_ol35.update_package()
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]}")
# Show summary of updates
# Show update completion message
msg = QMessageBox()
msg.setWindowTitle("Update Complete")
msg.setText("\n\n".join(update_results))
msg.setStandardButtons(QMessageBox.Ok)
msg.exec()
# Restart the application after user clicks "OK"
if self.ui.restart_checkBox.isChecked():
self.restart_program()
def restart_program(self):
"""Restart the Python program after an update."""
print("Restarting the application...")
# Close all running Qt windows before restarting
app = QApplication.instance()
if app:
app.quit()
python = sys.executable
os.execl(python, python, *sys.argv)
class PreviewWindow(QMainWindow, Ui_Preview_Window):
values_selected = Signal(int, int, bool)
# Large ChatGPT with rewrite and bug fixes from me.
def __init__(self):
super(PreviewWindow, self).__init__()
self.ui = Ui_Preview_Window()
self.ui.setupUi(self)
self.o = OptimaManager()
self.threadpool = QThreadPool() # Thread pool for managing worker threads
self.ui.QLabel.setAlignment(Qt.AlignCenter)
# UI interactions
self.ui.load_Button.clicked.connect(self.browse_file)
self.ui.update_Button.clicked.connect(self.update_preview)
self.ui.close_Button.clicked.connect(self.close_window)
self.ui.reset_brightness_Button.clicked.connect(lambda: self.ui.brightness_spinBox.setValue(0))
self.ui.reset_contrast_Button.clicked.connect(lambda: self.ui.contrast_spinBox.setValue(0))
# Connect UI elements to `on_ui_change`
self.ui.brightness_spinBox.valueChanged.connect(self.on_ui_change)
self.ui.brightness_Slider.valueChanged.connect(self.on_ui_change)
self.ui.contrast_spinBox.valueChanged.connect(self.on_ui_change)
self.ui.contrast_Slider.valueChanged.connect(self.on_ui_change)
self.ui.grayscale_checkBox.stateChanged.connect(self.on_ui_change)
self.ui_elements(False)
def on_ui_change(self):
"""Triggers update only if live update is enabled."""
if self.ui.live_update.isChecked():
self.update_preview()
def browse_file(self):
file = QFileDialog.getOpenFileName(self, caption="Select File", filter="Images (*.png *.webp *.jpg *.jpeg)")
if file[0]:
self.ui.image_path_lineEdit.setText(file[0])
self.update_preview()
self.ui_elements(True)
def ui_elements(self, state):
self.ui.groupBox_2.setEnabled(state)
self.ui.groupBox.setEnabled(state)
self.ui.groupBox_5.setEnabled(state)
def update_preview(self):
"""Handles loading and displaying the image in a separate thread."""
path = self.ui.image_path_lineEdit.text()
worker = ImageProcessorWorker(
path = path,
optima_manager = self.o,
brightness = int(self.ui.brightness_spinBox.text()),
contrast = int(self.ui.contrast_spinBox.text()),
grayscale = self.ui.grayscale_checkBox.isChecked(),
resize = self.ui.scale_Slider.value(),
callback = self.display_image # Callback to update UI
)
self.threadpool.start(worker) # Run worker in a thread
def display_image(self, pixmap):
"""Adjusts the image to fit within the QLabel."""
if pixmap is None:
QMessageBox.warning(self, "Warning", "Error processing image...")
return
max_size = self.ui.QLabel.size()
scaled_pixmap = pixmap.scaled(max_size, Qt.KeepAspectRatio, Qt.SmoothTransformation)
self.ui.QLabel.setPixmap(scaled_pixmap)
self.ui.QLabel.resize(scaled_pixmap.size())
def resizeEvent(self, event):
"""Triggered when the preview window is resized."""
file_path = self.ui.image_path_lineEdit.text()
if os.path.exists(file_path):
self.update_preview() # Re-process and display the image
super().resizeEvent(event) # Keep the default behavior
def close_window(self):
"""Emits signal and closes the window."""
if self.ui.checkBox.isChecked():
self.values_selected.emit(self.ui.brightness_spinBox.value(), self.ui.contrast_spinBox.value(), self.ui.grayscale_checkBox.isChecked())
self.close()
class WorkerSignals(QObject):
# ChatGPT
progress = Signal(int)
@ -967,61 +550,3 @@ class ImageProcessorRunnable(QRunnable):
self.signals.progress.emit(int((i / len(self.image_files)) * 100))
self.signals.finished.emit()
class ImageProcessorWorker(QRunnable):
"""Worker class to load and process the image in a separate thread."""
# ChatGPT
def __init__(self, path, optima_manager, brightness, contrast, grayscale, resize, callback):
super().__init__()
self.path = path
self.optima_manager = optima_manager
self.brightness = brightness
self.contrast = contrast
self.grayscale = grayscale
self.resize = resize
self.callback = callback # Function to call when processing is done
@Slot()
def run(self):
"""Runs the image processing in a separate thread."""
if not os.path.isfile(self.path):
self.callback(None)
return
try:
img = self.optima_manager.process_image_object(
image_input_file = self.path,
watermark = "PREVIEW",
resize = self.resize,
grayscale = self.grayscale,
brightness = self.brightness,
contrast = self.contrast
)
pixmap = QPixmap.fromImage(img)
self.callback(pixmap)
except Exception as e:
print(f"Error processing image: {e}")
self.callback(None)
def main():
u = Utilities(os.path.expanduser(CONFIG_BASE_PATH))
app_settings = u.load_settings()
app = QtWidgets.QApplication(sys.argv)
try:
import qdarktheme
app_settings["theme"]["theme_pkg"] = True
except Exception:
app_settings["theme"]["theme_pkg"] = False
if app_settings["theme"]["use_custom_theme"] and app_settings["theme"]["theme_pkg"]:
qdarktheme.setup_theme(app_settings["theme"]["mode"].lower())
u.save_settings(app_settings)
del u
window = OptimaLab35()
window.show()
app.exec()
if __name__ == "__main__":
main()

View file

@ -0,0 +1,166 @@
import os
from optima35.core import OptimaManager
from OptimaLab35 import __version__
from .ui import resources_rc
from .ui.preview_window import Ui_Preview_Window
from PySide6 import QtWidgets, QtCore
from PySide6.QtCore import (
QRunnable,
QThreadPool,
Signal,
QObject,
QRegularExpression,
Qt,
QTimer,
Slot
)
from PySide6.QtWidgets import (
QMessageBox,
QApplication,
QMainWindow,
QFileDialog
)
from PySide6.QtGui import QPixmap, QRegularExpressionValidator, QIcon
class PreviewWindow(QMainWindow, Ui_Preview_Window):
values_selected = Signal(int, int, bool)
# Large ChatGPT with rewrite and bug fixes from me.
def __init__(self):
super(PreviewWindow, self).__init__()
self.ui = Ui_Preview_Window()
self.ui.setupUi(self)
self.o = OptimaManager()
self.threadpool = QThreadPool() # Thread pool for managing worker threads
self.setWindowIcon(QIcon(":app-icon.png"))
self.ui.QLabel.setAlignment(Qt.AlignCenter)
# UI interactions
self.ui.load_Button.clicked.connect(self.browse_file)
self.ui.update_Button.clicked.connect(self.update_preview)
self.ui.close_Button.clicked.connect(self.close_window)
self.ui.reset_brightness_Button.clicked.connect(lambda: self.ui.brightness_spinBox.setValue(0))
self.ui.reset_contrast_Button.clicked.connect(lambda: self.ui.contrast_spinBox.setValue(0))
# Connect UI elements to `on_ui_change`
self.ui.brightness_spinBox.valueChanged.connect(self.on_ui_change) # brightness slider changes spinbox value, do not need an event for the slider
self.ui.contrast_spinBox.valueChanged.connect(self.on_ui_change) # contrast slider changes spinbox value, do not need an event for the slider
self.ui.grayscale_checkBox.stateChanged.connect(self.on_ui_change)
self.ui_elements(False)
self.ui.show_OG_Button.pressed.connect(self.show_OG_image)
self.ui.show_OG_Button.released.connect(self.update_preview)
def on_ui_change(self):
"""Triggers update only if live update is enabled."""
if self.ui.live_update.isChecked():
self.update_preview()
def browse_file(self):
file = QFileDialog.getOpenFileName(self, caption="Select File", filter="Images (*.png *.webp *.jpg *.jpeg)")
if file[0]:
self.ui.image_path_lineEdit.setText(file[0])
self.update_preview()
self.ui_elements(True)
def show_OG_image(self):
"""Handles loading and displaying the image in a separate thread."""
path = self.ui.image_path_lineEdit.text()
worker = ImageProcessorWorker(
path = path,
optima_manager = self.o,
brightness = 0,
contrast = 0,
grayscale = False,
resize = self.ui.scale_Slider.value(),
callback = self.display_image # Callback to update UI
)
self.threadpool.start(worker)
def ui_elements(self, state):
self.ui.groupBox_2.setEnabled(state)
self.ui.groupBox.setEnabled(state)
self.ui.groupBox_5.setEnabled(state)
self.ui.show_OG_Button.setEnabled(state)
def update_preview(self):
"""Handles loading and displaying the image in a separate thread."""
path = self.ui.image_path_lineEdit.text()
worker = ImageProcessorWorker(
path = path,
optima_manager = self.o,
brightness = int(self.ui.brightness_spinBox.text()),
contrast = int(self.ui.contrast_spinBox.text()),
grayscale = self.ui.grayscale_checkBox.isChecked(),
resize = self.ui.scale_Slider.value(),
callback = self.display_image # Callback to update UI
)
self.threadpool.start(worker) # Run worker in a thread
def display_image(self, pixmap):
"""Adjusts the image to fit within the QLabel."""
if pixmap is None:
QMessageBox.warning(self, "Warning", "Error processing image...")
return
max_size = self.ui.QLabel.size()
scaled_pixmap = pixmap.scaled(max_size, Qt.KeepAspectRatio, Qt.SmoothTransformation)
self.ui.QLabel.setPixmap(scaled_pixmap)
self.ui.QLabel.resize(scaled_pixmap.size())
def resizeEvent(self, event):
"""Triggered when the preview window is resized."""
file_path = self.ui.image_path_lineEdit.text()
if os.path.exists(file_path):
self.update_preview() # Re-process and display the image
super().resizeEvent(event) # Keep the default behavior
def close_window(self):
"""Emits signal and closes the window."""
if self.ui.checkBox.isChecked():
self.values_selected.emit(self.ui.brightness_spinBox.value(), self.ui.contrast_spinBox.value(), self.ui.grayscale_checkBox.isChecked())
self.close()
class ImageProcessorWorker(QRunnable):
"""Worker class to load and process the image in a separate thread."""
# ChatGPT
def __init__(self, path, optima_manager, brightness, contrast, grayscale, resize, callback):
super().__init__()
self.path = path
self.optima_manager = optima_manager
self.brightness = brightness
self.contrast = contrast
self.grayscale = grayscale
self.resize = resize
self.callback = callback # Function to call when processing is done
@Slot()
def run(self):
"""Runs the image processing in a separate thread."""
if not os.path.isfile(self.path):
self.callback(None)
return
try:
img = self.optima_manager.process_image_object(
image_input_file = self.path,
watermark = f"PREVIEW B:{self.brightness} C:{self.contrast}",
font_size = 1,
resize = self.resize,
grayscale = self.grayscale,
brightness = self.brightness,
contrast = self.contrast
)
pixmap = QPixmap.fromImage(img)
self.callback(pixmap)
except Exception as e:
print(f"Error processing image: {e}")
self.callback(None)

View file

@ -0,0 +1,357 @@
import sys
import os
from datetime import datetime
from PyPiUpdater import PyPiUpdater
from OptimaLab35 import __version__
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 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
def __init__(self, optimalab35_localversion, optima35_localversion):
super(SettingsWindow, self).__init__()
self.ui = Ui_Settings_Window()
self.ui.setupUi(self)
self.u = Utilities(os.path.expanduser(CONFIG_BASE_PATH))
self.app_settings = self.u.load_settings()
self.dev_mode = True if optimalab35_localversion == "0.0.1" else False
self.setWindowIcon(QIcon(":app-icon.png"))
# Update log file location
self.update_log_file = os.path.expanduser(f"{CONFIG_BASE_PATH}/update_log.json")
# Store local versions
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.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
self.updates_available = {"OptimaLab35": False, "optima35": False}
self.define_gui_interaction()
def define_gui_interaction(self):
"""Setup UI interactions."""
# Updater related
self.ui.label_optimalab35_localversion.setText(self.optimalab35_localversion)
self.ui.label_optima35_localversion.setText(self.optima35_localversion)
self.ui.label_latest_version.setText("Latest version")
self.ui.label_optimalab35_latestversion.setText("...")
self.ui.label_optima35_latestversion.setText("...")
self.ui.update_and_restart_Button.setEnabled(False)
# 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.dev_widget.setVisible(False)
# Timer for long press detection
self.timer = QTimer()
self.timer.setSingleShot(True)
self.timer.timeout.connect(self.toggle_dev_ui)
# 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.setOpenExternalLinks(True)
#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.
self.ui.save_and_restart_Button.setVisible(False)
self.ui.restart_checkBox.setChecked(False)
self.ui.restart_checkBox.setVisible(False)
# setting related
def load_settings_into_ui(self):
"""Loads the settings into the UI elements."""
settings = self.app_settings
theme_mode = settings["theme"]["mode"]
use_custom_theme = settings["theme"]["use_custom_theme"]
pkg_available = settings["theme"]["theme_pkg"]
if pkg_available:
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)
self.ui.install_pkg_Button.setVisible(False)
self.ui.enable_theme_checkBox.setEnabled(True)
else:
self.ui.enable_theme_checkBox.setEnabled(False)
self.ui.install_pkg_Button.clicked.connect(self.install_theme_pkg)
def install_theme_pkg(self):
a = self.ppu_ol35.install_package("PyQtDarkTheme-fork")
self.ui.install_pkg_Button.setEnabled(False)
self.ui.install_pkg_Button.setText("Please wait...")
msg_box = QMessageBox()
msg_box.setIcon(QMessageBox.Information)
msg_box.setWindowTitle("Message")
msg_box.setText(a[1])
msg_box.setStandardButtons(QMessageBox.Ok)
msg_box.exec()
if a[0]:
self.app_settings["theme"]["theme_pkg"] = True
self.load_settings_into_ui()
else:
self.ui.install_pkg_Button.setEnabled(True)
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.u.save_settings(self.app_settings)
def save_and_close(self):
self.save_settings()
self.close()
def save_and_restart(self):
msg = QMessageBox()
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)
# Show the message box and wait for the user's response
response = msg.exec()
# Check response and perform action
if response == QMessageBox.StandardButton.Yes:
self.save_settings()
self.restart_program()
else:
pass # Do nothing if "No" is selected
def ask_reset_exif(self):
"""Shows a dialog to ask the user if they are sure about resetting EXIF options to default."""
# Create a QMessageBox with a Yes/No question
msg = QMessageBox()
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)
# Show the message box and wait for the user's response
response = msg.exec()
# Check response and perform action
if response == QMessageBox.StandardButton.Yes:
self.u.default_exif() # Reset EXIF options to default
else:
pass # Do nothing if "No" is selected
# update related parts
def start_long_press(self):
"""Start the timer when button is pressed."""
# brave AI
self.timer.start(1000) # 1-second long press
def cancel_long_press(self):
"""Cancel long press if released early."""
# brave AI
self.timer.stop()
def toggle_dev_ui(self):
"""Show or hide the hidden UI when long press is detected."""
self.ui.dev_widget.setVisible(True)
self.ui.check_local_Button.clicked.connect(self.local_check_for_updates)
self.ui.update_local_Button.clicked.connect(self.local_update)
def local_check_for_updates(self):
dist_folder = os.path.expanduser("~/.config/OptimaLab35/dist/")
self.ui.label_optimalab35_latestversion.setText("Checking...")
self.ui.label_optima35_latestversion.setText("Checking...")
# Check OptimaLab35 update
ol35_pkg_info = self.ppu_ol35.check_update_local(dist_folder)
if ol35_pkg_info[0] is None:
self.ui.label_optimalab35_latestversion.setText(ol35_pkg_info[1][0:13])
else:
self.ui.label_optimalab35_latestversion.setText(ol35_pkg_info[1])
self.updates_available["OptimaLab35"] = ol35_pkg_info[0]
# Check optima35 update
o35_pkg_info = self.ppu_o35.check_update_local(dist_folder)
if o35_pkg_info[0] is None:
self.ui.label_optima35_latestversion.setText(o35_pkg_info[1][0:13])
else:
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("~/.config/OptimaLab35/dist/")
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.")
return
# Confirm update
msg = QMessageBox()
msg.setWindowTitle("Update Available")
message = f"Updating: {', '.join(packages_to_update)}\nUpdate "
if self.ui.restart_checkBox.isChecked():
message = message + "and restart app?"
else:
message = message + "app?"
msg.setText(message)
msg.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
result = msg.exec()
if result == QMessageBox.Yes:
update_results = [] # Store results
for package in packages_to_update:
if package == "OptimaLab35":
pkg_info = self.ppu_ol35.update_from_local(dist_folder)
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]}")
# Show summary of updates
# Show update completion message
msg = QMessageBox()
msg.setWindowTitle("Update Complete")
msg.setText("\n\n".join(update_results))
msg.setStandardButtons(QMessageBox.Ok)
msg.exec()
# Restart the application after user clicks "OK"
if self.ui.restart_checkBox.isChecked():
self.restart_program()
def time_to_string(self, time_time):
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."""
self.ui.check_for_update_Button.setEnabled(False)
self.ui.label_optimalab35_latestversion.setText("Checking...")
self.ui.label_optima35_latestversion.setText("Checking...")
# Check OptimaLab35 update
ol35_pkg_info = self.ppu_ol35.check_for_update()
if ol35_pkg_info[0] is None:
self.ui.label_optimalab35_latestversion.setText(ol35_pkg_info[1][0:13])
else:
self.ui.label_optimalab35_latestversion.setText(ol35_pkg_info[1])
self.updates_available["OptimaLab35"] = ol35_pkg_info[0]
# Check optima35 update
o35_pkg_info = self.ppu_o35.check_for_update()
if o35_pkg_info[0] is None:
self.ui.label_optima35_latestversion.setText(o35_pkg_info[1][0:13])
else:
self.ui.label_optima35_latestversion.setText(o35_pkg_info[1])
self.updates_available["optima35"] = o35_pkg_info[0]
# Enable update button if any update is available
if any(self.updates_available.values()):
if self.dev_mode:
self.ui.update_and_restart_Button.setEnabled(False)
self.ui.update_and_restart_Button.setText("Update disabled")
else:
self.ui.update_and_restart_Button.setEnabled(True)
last_date = self.time_to_string(self.ppu_ol35.get_last_state()[0])
self.ui.label_last_check.setText(f"Last check: {last_date}")
self.ui.label_latest_version.setText("Online version")
self.ui.check_for_update_Button.setEnabled(True)
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]
if not packages_to_update:
QMessageBox.information(self, "Update", "No updates available.")
return
# Confirm update
msg = QMessageBox()
msg.setWindowTitle("Update Available")
message = f"Updating: {', '.join(packages_to_update)}\nUpdate "
if self.ui.restart_checkBox.isChecked():
message = message + "and restart app?"
else:
message = message + "app?"
msg.setText(message)
msg.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
result = msg.exec()
if result == QMessageBox.Yes:
update_results = [] # Store results
for package in packages_to_update:
if package == "OptimaLab35":
pkg_info = self.ppu_ol35.update_package()
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]}")
# Show summary of updates
# Show update completion message
msg = QMessageBox()
msg.setWindowTitle("Update Complete")
msg.setText("\n\n".join(update_results))
msg.setStandardButtons(QMessageBox.Ok)
msg.exec()
# Restart the application after user clicks "OK"
if self.ui.restart_checkBox.isChecked():
self.restart_program()
def restart_program(self):
"""Restart the Python program after an update."""
print("Restarting the application...")
# Close all running Qt windows before restarting
app = QApplication.instance()
if app:
app.quit()
python = sys.executable
os.execl(python, python, *sys.argv)

View file

@ -3,7 +3,7 @@
################################################################################
## Form generated from reading UI file 'main_window.ui'
##
## Created by: Qt User Interface Compiler version 6.8.1
## Created by: Qt User Interface Compiler version 6.8.2
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
@ -116,6 +116,7 @@ class Ui_MainWindow(object):
self.png_quality_Slider.setPageStep(1)
self.png_quality_Slider.setSliderPosition(6)
self.png_quality_Slider.setOrientation(Qt.Orientation.Horizontal)
self.png_quality_Slider.setTickPosition(QSlider.TickPosition.TicksBothSides)
self.gridLayout_4.addWidget(self.png_quality_Slider, 4, 2, 1, 1)
@ -147,6 +148,7 @@ class Ui_MainWindow(object):
self.jpg_quality_Slider.setMaximum(100)
self.jpg_quality_Slider.setSliderPosition(90)
self.jpg_quality_Slider.setOrientation(Qt.Orientation.Horizontal)
self.jpg_quality_Slider.setTickPosition(QSlider.TickPosition.TicksBothSides)
self.gridLayout_4.addWidget(self.jpg_quality_Slider, 3, 2, 1, 1)
@ -161,6 +163,7 @@ class Ui_MainWindow(object):
self.resize_Slider.setMaximum(200)
self.resize_Slider.setValue(100)
self.resize_Slider.setOrientation(Qt.Orientation.Horizontal)
self.resize_Slider.setTickPosition(QSlider.TickPosition.TicksBothSides)
self.gridLayout_4.addWidget(self.resize_Slider, 5, 2, 1, 1)
@ -193,6 +196,7 @@ class Ui_MainWindow(object):
self.brightness_horizontalSlider.setMinimum(-100)
self.brightness_horizontalSlider.setMaximum(100)
self.brightness_horizontalSlider.setOrientation(Qt.Orientation.Horizontal)
self.brightness_horizontalSlider.setTickPosition(QSlider.TickPosition.TicksBothSides)
self.gridLayout_3.addWidget(self.brightness_horizontalSlider, 1, 1, 1, 1)
@ -224,6 +228,7 @@ class Ui_MainWindow(object):
self.contrast_horizontalSlider.setMinimum(-100)
self.contrast_horizontalSlider.setMaximum(100)
self.contrast_horizontalSlider.setOrientation(Qt.Orientation.Horizontal)
self.contrast_horizontalSlider.setTickPosition(QSlider.TickPosition.TicksBelow)
self.gridLayout_3.addWidget(self.contrast_horizontalSlider, 4, 1, 1, 1)
@ -538,7 +543,7 @@ class Ui_MainWindow(object):
self.dateEdit = QDateEdit(self.date_groupBox)
self.dateEdit.setObjectName(u"dateEdit")
self.dateEdit.setEnabled(False)
self.dateEdit.setDateTime(QDateTime(QDate(2024, 12, 31), QTime(23, 0, 0)))
self.dateEdit.setDateTime(QDateTime(QDate(2024, 12, 31), QTime(22, 0, 0)))
self.dateEdit.setMaximumDate(QDate(2038, 12, 31))
self.dateEdit.setMinimumDate(QDate(1970, 1, 1))
self.dateEdit.setCalendarPopup(True)
@ -558,7 +563,7 @@ class Ui_MainWindow(object):
MainWindow.setStatusBar(self.statusBar)
self.menuBar = QMenuBar(MainWindow)
self.menuBar.setObjectName(u"menuBar")
self.menuBar.setGeometry(QRect(0, 0, 450, 22))
self.menuBar.setGeometry(QRect(0, 0, 450, 19))
self.menuHelp = QMenu(self.menuBar)
self.menuHelp.setObjectName(u"menuHelp")
self.menuSettings = QMenu(self.menuBar)

View file

@ -188,6 +188,9 @@
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TickPosition::TicksBothSides</enum>
</property>
</widget>
</item>
<item row="4" column="3">
@ -249,6 +252,9 @@
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TickPosition::TicksBothSides</enum>
</property>
</widget>
</item>
<item row="5" column="0">
@ -278,6 +284,9 @@
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TickPosition::TicksBothSides</enum>
</property>
</widget>
</item>
<item row="5" column="3">
@ -338,6 +347,9 @@
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TickPosition::TicksBothSides</enum>
</property>
</widget>
</item>
<item row="1" column="2">
@ -390,6 +402,9 @@
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TickPosition::TicksBelow</enum>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
@ -881,7 +896,7 @@
</property>
<property name="dateTime">
<datetime>
<hour>23</hour>
<hour>22</hour>
<minute>0</minute>
<second>0</second>
<year>2024</year>
@ -924,7 +939,7 @@
<x>0</x>
<y>0</y>
<width>450</width>
<height>22</height>
<height>19</height>
</rect>
</property>
<widget class="QMenu" name="menuHelp">

View file

@ -3,7 +3,7 @@
################################################################################
## Form generated from reading UI file 'preview_window.ui'
##
## Created by: Qt User Interface Compiler version 6.8.1
## Created by: Qt User Interface Compiler version 6.8.2
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
@ -51,6 +51,7 @@ class Ui_Preview_Window(object):
self.verticalLayout_3.setObjectName(u"verticalLayout_3")
self.image_path_lineEdit = QLineEdit(self.groupBox_3)
self.image_path_lineEdit.setObjectName(u"image_path_lineEdit")
self.image_path_lineEdit.setEnabled(False)
self.verticalLayout_3.addWidget(self.image_path_lineEdit)
@ -78,6 +79,7 @@ class Ui_Preview_Window(object):
self.brightness_Slider.setMinimum(-100)
self.brightness_Slider.setMaximum(100)
self.brightness_Slider.setOrientation(Qt.Orientation.Horizontal)
self.brightness_Slider.setTickPosition(QSlider.TickPosition.TicksBothSides)
self.verticalLayout.addWidget(self.brightness_Slider)
@ -105,6 +107,7 @@ class Ui_Preview_Window(object):
self.contrast_Slider.setMinimum(-100)
self.contrast_Slider.setMaximum(100)
self.contrast_Slider.setOrientation(Qt.Orientation.Horizontal)
self.contrast_Slider.setTickPosition(QSlider.TickPosition.TicksBothSides)
self.verticalLayout_2.addWidget(self.contrast_Slider)
@ -132,6 +135,20 @@ class Ui_Preview_Window(object):
self.verticalLayout_4.addItem(self.verticalSpacer)
self.label = QLabel(self.widget)
self.label.setObjectName(u"label")
self.label.setLayoutDirection(Qt.LayoutDirection.LeftToRight)
self.label.setAutoFillBackground(False)
self.label.setAlignment(Qt.AlignmentFlag.AlignCenter)
self.label.setWordWrap(True)
self.verticalLayout_4.addWidget(self.label)
self.show_OG_Button = QPushButton(self.widget)
self.show_OG_Button.setObjectName(u"show_OG_Button")
self.verticalLayout_4.addWidget(self.show_OG_Button)
self.groupBox_4 = QGroupBox(self.widget)
self.groupBox_4.setObjectName(u"groupBox_4")
self.groupBox_4.setMaximumSize(QSize(170, 16777215))
@ -163,8 +180,9 @@ class Ui_Preview_Window(object):
self.scale_Slider.setMinimum(10)
self.scale_Slider.setMaximum(100)
self.scale_Slider.setPageStep(10)
self.scale_Slider.setValue(25)
self.scale_Slider.setValue(50)
self.scale_Slider.setOrientation(Qt.Orientation.Horizontal)
self.scale_Slider.setTickPosition(QSlider.TickPosition.TicksBothSides)
self.gridLayout_2.addWidget(self.scale_Slider, 1, 0, 1, 2)
@ -192,7 +210,7 @@ class Ui_Preview_Window(object):
Preview_Window.setCentralWidget(self.centralwidget)
self.menubar = QMenuBar(Preview_Window)
self.menubar.setObjectName(u"menubar")
self.menubar.setGeometry(QRect(0, 0, 875, 26))
self.menubar.setGeometry(QRect(0, 0, 875, 19))
Preview_Window.setMenuBar(self.menubar)
self.retranslateUi(Preview_Window)
@ -230,6 +248,8 @@ class Ui_Preview_Window(object):
self.grayscale_checkBox.setToolTip(QCoreApplication.translate("Preview_Window", u"Convert the image to grayscale (black and white).", None))
#endif // QT_CONFIG(tooltip)
self.grayscale_checkBox.setText(QCoreApplication.translate("Preview_Window", u"Black and White", None))
self.label.setText(QCoreApplication.translate("Preview_Window", u"Hold button to show original image", None))
self.show_OG_Button.setText(QCoreApplication.translate("Preview_Window", u"Show", None))
self.groupBox_4.setTitle(QCoreApplication.translate("Preview_Window", u"Behavior", None))
#if QT_CONFIG(tooltip)
self.checkBox.setToolTip(QCoreApplication.translate("Preview_Window", u"Enable to copy adjustments to the main window upon closing", None))
@ -253,6 +273,6 @@ class Ui_Preview_Window(object):
#if QT_CONFIG(tooltip)
self.scale_label.setToolTip(QCoreApplication.translate("Preview_Window", u"Sets the resize value for the preview image. A high value may cause the application to freeze.", None))
#endif // QT_CONFIG(tooltip)
self.scale_label.setText(QCoreApplication.translate("Preview_Window", u"25", None))
self.scale_label.setText(QCoreApplication.translate("Preview_Window", u"50", None))
# retranslateUi

View file

@ -63,6 +63,9 @@
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLineEdit" name="image_path_lineEdit">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Enter the path to the image file or use the 'Select Image' button to browse.</string>
</property>
@ -108,6 +111,9 @@
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TickPosition::TicksBothSides</enum>
</property>
</widget>
</item>
<item>
@ -150,6 +156,9 @@
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TickPosition::TicksBothSides</enum>
</property>
</widget>
</item>
<item>
@ -197,6 +206,32 @@
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label">
<property name="layoutDirection">
<enum>Qt::LayoutDirection::LeftToRight</enum>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="text">
<string>Hold button to show original image</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="show_OG_Button">
<property name="text">
<string>Show</string>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_4">
<property name="maximumSize">
@ -268,11 +303,14 @@
<number>10</number>
</property>
<property name="value">
<number>25</number>
<number>50</number>
</property>
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TickPosition::TicksBothSides</enum>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
@ -302,7 +340,7 @@
<string>Sets the resize value for the preview image. A high value may cause the application to freeze.</string>
</property>
<property name="text">
<string>25</string>
<string>50</string>
</property>
</widget>
</item>
@ -320,7 +358,7 @@
<x>0</x>
<y>0</y>
<width>875</width>
<height>26</height>
<height>19</height>
</rect>
</property>
</widget>

View file

@ -3,7 +3,7 @@
################################################################################
## Form generated from reading UI file 'settings_window.ui'
##
## Created by: Qt User Interface Compiler version 6.8.1
## Created by: Qt User Interface Compiler version 6.8.2
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
@ -36,79 +36,6 @@ class Ui_Settings_Window(object):
self.tabWidget = QTabWidget(self.centralwidget)
self.tabWidget.setObjectName(u"tabWidget")
self.tabWidget.setMaximumSize(QSize(500, 500))
self.tabWidgetPage1 = QWidget()
self.tabWidgetPage1.setObjectName(u"tabWidgetPage1")
self.verticalLayout_2 = QVBoxLayout(self.tabWidgetPage1)
self.verticalLayout_2.setObjectName(u"verticalLayout_2")
self.groupBox_4 = QGroupBox(self.tabWidgetPage1)
self.groupBox_4.setObjectName(u"groupBox_4")
self.horizontalLayout_3 = QHBoxLayout(self.groupBox_4)
self.horizontalLayout_3.setObjectName(u"horizontalLayout_3")
self.label_4 = QLabel(self.groupBox_4)
self.label_4.setObjectName(u"label_4")
self.label_4.setWordWrap(True)
self.horizontalLayout_3.addWidget(self.label_4)
self.reset_exif_Button = QPushButton(self.groupBox_4)
self.reset_exif_Button.setObjectName(u"reset_exif_Button")
self.reset_exif_Button.setMinimumSize(QSize(100, 0))
self.reset_exif_Button.setMaximumSize(QSize(100, 16777215))
self.horizontalLayout_3.addWidget(self.reset_exif_Button)
self.verticalLayout_2.addWidget(self.groupBox_4)
self.groupBox_3 = QGroupBox(self.tabWidgetPage1)
self.groupBox_3.setObjectName(u"groupBox_3")
self.gridLayout_3 = QGridLayout(self.groupBox_3)
self.gridLayout_3.setObjectName(u"gridLayout_3")
self.label_3 = QLabel(self.groupBox_3)
self.label_3.setObjectName(u"label_3")
self.gridLayout_3.addWidget(self.label_3, 0, 0, 1, 3)
self.enable_theme_checkBox = QCheckBox(self.groupBox_3)
self.enable_theme_checkBox.setObjectName(u"enable_theme_checkBox")
self.enable_theme_checkBox.setChecked(False)
self.gridLayout_3.addWidget(self.enable_theme_checkBox, 1, 0, 1, 1)
self.theme_selection_comboBox = QComboBox(self.groupBox_3)
self.theme_selection_comboBox.addItem("")
self.theme_selection_comboBox.addItem("")
self.theme_selection_comboBox.addItem("")
self.theme_selection_comboBox.setObjectName(u"theme_selection_comboBox")
self.theme_selection_comboBox.setEnabled(False)
self.theme_selection_comboBox.setMinimumSize(QSize(100, 0))
self.theme_selection_comboBox.setMaximumSize(QSize(100, 16777215))
self.gridLayout_3.addWidget(self.theme_selection_comboBox, 1, 2, 1, 1)
self.save_and_close_Button = QPushButton(self.groupBox_3)
self.save_and_close_Button.setObjectName(u"save_and_close_Button")
self.gridLayout_3.addWidget(self.save_and_close_Button, 3, 0, 1, 1)
self.horizontalSpacer_2 = QSpacerItem(98, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum)
self.gridLayout_3.addItem(self.horizontalSpacer_2, 1, 1, 1, 1)
self.install_pkg_Button = QPushButton(self.groupBox_3)
self.install_pkg_Button.setObjectName(u"install_pkg_Button")
self.gridLayout_3.addWidget(self.install_pkg_Button, 2, 0, 1, 3)
self.save_and_restart_Button = QPushButton(self.groupBox_3)
self.save_and_restart_Button.setObjectName(u"save_and_restart_Button")
self.gridLayout_3.addWidget(self.save_and_restart_Button, 3, 1, 1, 2)
self.verticalLayout_2.addWidget(self.groupBox_3)
self.tabWidget.addTab(self.tabWidgetPage1, "")
self.tabWidgetPage2 = QWidget()
self.tabWidgetPage2.setObjectName(u"tabWidgetPage2")
self.gridLayout_2 = QGridLayout(self.tabWidgetPage2)
@ -227,6 +154,79 @@ class Ui_Settings_Window(object):
self.gridLayout_2.addWidget(self.widget, 5, 0, 1, 2)
self.tabWidget.addTab(self.tabWidgetPage2, "")
self.tabWidgetPage1 = QWidget()
self.tabWidgetPage1.setObjectName(u"tabWidgetPage1")
self.verticalLayout_2 = QVBoxLayout(self.tabWidgetPage1)
self.verticalLayout_2.setObjectName(u"verticalLayout_2")
self.groupBox_4 = QGroupBox(self.tabWidgetPage1)
self.groupBox_4.setObjectName(u"groupBox_4")
self.horizontalLayout_3 = QHBoxLayout(self.groupBox_4)
self.horizontalLayout_3.setObjectName(u"horizontalLayout_3")
self.label_4 = QLabel(self.groupBox_4)
self.label_4.setObjectName(u"label_4")
self.label_4.setWordWrap(True)
self.horizontalLayout_3.addWidget(self.label_4)
self.reset_exif_Button = QPushButton(self.groupBox_4)
self.reset_exif_Button.setObjectName(u"reset_exif_Button")
self.reset_exif_Button.setMinimumSize(QSize(100, 0))
self.reset_exif_Button.setMaximumSize(QSize(100, 16777215))
self.horizontalLayout_3.addWidget(self.reset_exif_Button)
self.verticalLayout_2.addWidget(self.groupBox_4)
self.groupBox_3 = QGroupBox(self.tabWidgetPage1)
self.groupBox_3.setObjectName(u"groupBox_3")
self.gridLayout_3 = QGridLayout(self.groupBox_3)
self.gridLayout_3.setObjectName(u"gridLayout_3")
self.label_3 = QLabel(self.groupBox_3)
self.label_3.setObjectName(u"label_3")
self.gridLayout_3.addWidget(self.label_3, 0, 0, 1, 3)
self.enable_theme_checkBox = QCheckBox(self.groupBox_3)
self.enable_theme_checkBox.setObjectName(u"enable_theme_checkBox")
self.enable_theme_checkBox.setChecked(False)
self.gridLayout_3.addWidget(self.enable_theme_checkBox, 1, 0, 1, 1)
self.theme_selection_comboBox = QComboBox(self.groupBox_3)
self.theme_selection_comboBox.addItem("")
self.theme_selection_comboBox.addItem("")
self.theme_selection_comboBox.addItem("")
self.theme_selection_comboBox.setObjectName(u"theme_selection_comboBox")
self.theme_selection_comboBox.setEnabled(False)
self.theme_selection_comboBox.setMinimumSize(QSize(100, 0))
self.theme_selection_comboBox.setMaximumSize(QSize(100, 16777215))
self.gridLayout_3.addWidget(self.theme_selection_comboBox, 1, 2, 1, 1)
self.save_and_close_Button = QPushButton(self.groupBox_3)
self.save_and_close_Button.setObjectName(u"save_and_close_Button")
self.gridLayout_3.addWidget(self.save_and_close_Button, 3, 0, 1, 1)
self.horizontalSpacer_2 = QSpacerItem(98, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum)
self.gridLayout_3.addItem(self.horizontalSpacer_2, 1, 1, 1, 1)
self.install_pkg_Button = QPushButton(self.groupBox_3)
self.install_pkg_Button.setObjectName(u"install_pkg_Button")
self.gridLayout_3.addWidget(self.install_pkg_Button, 2, 0, 1, 3)
self.save_and_restart_Button = QPushButton(self.groupBox_3)
self.save_and_restart_Button.setObjectName(u"save_and_restart_Button")
self.gridLayout_3.addWidget(self.save_and_restart_Button, 3, 1, 1, 2)
self.verticalLayout_2.addWidget(self.groupBox_3)
self.tabWidget.addTab(self.tabWidgetPage1, "")
self.verticalLayout.addWidget(self.tabWidget)
@ -243,29 +243,6 @@ class Ui_Settings_Window(object):
def retranslateUi(self, Settings_Window):
Settings_Window.setWindowTitle(QCoreApplication.translate("Settings_Window", u"Settings", None))
self.groupBox_4.setTitle(QCoreApplication.translate("Settings_Window", u"EXIF", None))
self.label_4.setText(QCoreApplication.translate("Settings_Window", u"Reset selectable EXIF data to default", None))
self.reset_exif_Button.setText(QCoreApplication.translate("Settings_Window", u"Reset", None))
self.groupBox_3.setTitle(QCoreApplication.translate("Settings_Window", u"Theme", None))
self.label_3.setText(QCoreApplication.translate("Settings_Window", u"Change theme from OS to PyQT Dark or Light", None))
#if QT_CONFIG(tooltip)
self.enable_theme_checkBox.setToolTip(QCoreApplication.translate("Settings_Window", u"Changes will take effect after restarting the application.", None))
#endif // QT_CONFIG(tooltip)
self.enable_theme_checkBox.setText(QCoreApplication.translate("Settings_Window", u"Custom theme", None))
self.theme_selection_comboBox.setItemText(0, QCoreApplication.translate("Settings_Window", u"Auto", None))
self.theme_selection_comboBox.setItemText(1, QCoreApplication.translate("Settings_Window", u"Dark", None))
self.theme_selection_comboBox.setItemText(2, QCoreApplication.translate("Settings_Window", u"Light", None))
#if QT_CONFIG(tooltip)
self.theme_selection_comboBox.setToolTip(QCoreApplication.translate("Settings_Window", u"Changes will take effect after restarting the application.", None))
#endif // QT_CONFIG(tooltip)
#if QT_CONFIG(tooltip)
self.save_and_close_Button.setToolTip(QCoreApplication.translate("Settings_Window", u"Changes will take effect after restarting the application.", None))
#endif // QT_CONFIG(tooltip)
self.save_and_close_Button.setText(QCoreApplication.translate("Settings_Window", u"Apply theme", None))
self.install_pkg_Button.setText(QCoreApplication.translate("Settings_Window", u"Install package for custom theme", None))
self.save_and_restart_Button.setText(QCoreApplication.translate("Settings_Window", u"Apply and restart", None))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabWidgetPage1), QCoreApplication.translate("Settings_Window", u"Preferences", None))
self.pkg_info_groupBox.setTitle(QCoreApplication.translate("Settings_Window", u"Package information", None))
self.label_optima35_latestversion.setText(QCoreApplication.translate("Settings_Window", u"unknown", None))
self.label_latest_version.setText(QCoreApplication.translate("Settings_Window", u"Latest version", None))
@ -293,5 +270,28 @@ class Ui_Settings_Window(object):
#endif // QT_CONFIG(tooltip)
self.restart_checkBox.setText(QCoreApplication.translate("Settings_Window", u"Restart", None))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabWidgetPage2), QCoreApplication.translate("Settings_Window", u"Updater", None))
self.groupBox_4.setTitle(QCoreApplication.translate("Settings_Window", u"EXIF", None))
self.label_4.setText(QCoreApplication.translate("Settings_Window", u"Reset selectable EXIF data to default", None))
self.reset_exif_Button.setText(QCoreApplication.translate("Settings_Window", u"Reset", None))
self.groupBox_3.setTitle(QCoreApplication.translate("Settings_Window", u"Theme", None))
self.label_3.setText(QCoreApplication.translate("Settings_Window", u"Change theme from OS to PyQT Dark or Light", None))
#if QT_CONFIG(tooltip)
self.enable_theme_checkBox.setToolTip(QCoreApplication.translate("Settings_Window", u"Changes will take effect after restarting the application.", None))
#endif // QT_CONFIG(tooltip)
self.enable_theme_checkBox.setText(QCoreApplication.translate("Settings_Window", u"Custom theme", None))
self.theme_selection_comboBox.setItemText(0, QCoreApplication.translate("Settings_Window", u"Auto", None))
self.theme_selection_comboBox.setItemText(1, QCoreApplication.translate("Settings_Window", u"Dark", None))
self.theme_selection_comboBox.setItemText(2, QCoreApplication.translate("Settings_Window", u"Light", None))
#if QT_CONFIG(tooltip)
self.theme_selection_comboBox.setToolTip(QCoreApplication.translate("Settings_Window", u"Changes will take effect after restarting the application.", None))
#endif // QT_CONFIG(tooltip)
#if QT_CONFIG(tooltip)
self.save_and_close_Button.setToolTip(QCoreApplication.translate("Settings_Window", u"Changes will take effect after restarting the application.", None))
#endif // QT_CONFIG(tooltip)
self.save_and_close_Button.setText(QCoreApplication.translate("Settings_Window", u"Apply theme", None))
self.install_pkg_Button.setText(QCoreApplication.translate("Settings_Window", u"Install package for custom theme", None))
self.save_and_restart_Button.setText(QCoreApplication.translate("Settings_Window", u"Apply and restart", None))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabWidgetPage1), QCoreApplication.translate("Settings_Window", u"Preferences", None))
# retranslateUi

View file

@ -47,154 +47,6 @@
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tabWidgetPage1">
<attribute name="title">
<string>Preferences</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>EXIF</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Reset selectable EXIF data to default</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="reset_exif_Button">
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Reset</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Theme</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0" colspan="3">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Change theme from OS to PyQT Dark or Light</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="enable_theme_checkBox">
<property name="toolTip">
<string>Changes will take effect after restarting the application.</string>
</property>
<property name="text">
<string>Custom theme</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QComboBox" name="theme_selection_comboBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Changes will take effect after restarting the application.</string>
</property>
<item>
<property name="text">
<string>Auto</string>
</property>
</item>
<item>
<property name="text">
<string>Dark</string>
</property>
</item>
<item>
<property name="text">
<string>Light</string>
</property>
</item>
</widget>
</item>
<item row="3" column="0">
<widget class="QPushButton" name="save_and_close_Button">
<property name="toolTip">
<string>Changes will take effect after restarting the application.</string>
</property>
<property name="text">
<string>Apply theme</string>
</property>
</widget>
</item>
<item row="1" column="1">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>98</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0" colspan="3">
<widget class="QPushButton" name="install_pkg_Button">
<property name="text">
<string>Install package for custom theme</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QPushButton" name="save_and_restart_Button">
<property name="text">
<string>Apply and restart</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabWidgetPage2">
<attribute name="title">
<string>Updater</string>
@ -381,6 +233,154 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tabWidgetPage1">
<attribute name="title">
<string>Preferences</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>EXIF</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Reset selectable EXIF data to default</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="reset_exif_Button">
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Reset</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Theme</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0" colspan="3">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Change theme from OS to PyQT Dark or Light</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="enable_theme_checkBox">
<property name="toolTip">
<string>Changes will take effect after restarting the application.</string>
</property>
<property name="text">
<string>Custom theme</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QComboBox" name="theme_selection_comboBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Changes will take effect after restarting the application.</string>
</property>
<item>
<property name="text">
<string>Auto</string>
</property>
</item>
<item>
<property name="text">
<string>Dark</string>
</property>
</item>
<item>
<property name="text">
<string>Light</string>
</property>
</item>
</widget>
</item>
<item row="3" column="0">
<widget class="QPushButton" name="save_and_close_Button">
<property name="toolTip">
<string>Changes will take effect after restarting the application.</string>
</property>
<property name="text">
<string>Apply theme</string>
</property>
</widget>
</item>
<item row="1" column="1">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>98</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0" colspan="3">
<widget class="QPushButton" name="install_pkg_Button">
<property name="text">
<string>Install package for custom theme</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QPushButton" name="save_and_restart_Button">
<property name="text">
<string>Apply and restart</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>

View file

@ -3,7 +3,7 @@ import os
class Utilities:
def __init__(self, app_folder_path):
self.folder_path = app_folder_path
self.folder_path = os.path.expanduser(app_folder_path)
self._ensure_program_folder_exists()
self.exif_path = os.path.expanduser(f"{app_folder_path}/exif.yaml")
self.settings_path = os.path.expanduser(f"{app_folder_path}/settings.yaml")

View file

@ -8,7 +8,7 @@ dynamic = ["version"]
authors = [{ name = "Mr Finchum" }]
description = "User interface for optima35."
readme = "../pip_README.md"
requires-python = ">=3.8"
requires-python = ">=3.8, <4.0"
dependencies = [
"optima35>=1.0.0, <2.0.0",
"PyPiUpdater>=0.7.2, <1.0.0",
@ -16,7 +16,7 @@ dependencies = [
"PyYAML",
]
classifiers = [
"Development Status :: 4 - Beta",
"Development Status :: 5 - Production/Stable",
"Environment :: X11 Applications :: Qt",
"Topic :: Multimedia :: Graphics :: Editors",
"Programming Language :: Python :: 3",