diff --git a/.gitignore b/.gitignore index 7a56971..e8383c6 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ dist/ __pycache__/ .flatpak-builder/ flatpak-build-dir/ +*.jpg diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 12386d8..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -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 - artifacts: - paths: - - 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 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 diff --git a/.gitlab-ci/git/create_tag.yml b/.gitlab-ci/git/create_tag.yml deleted file mode 100644 index 2c1afd7..0000000 --- a/.gitlab-ci/git/create_tag.yml +++ /dev/null @@ -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 diff --git a/.gitlab-ci/versioning/gitversion.yml b/.gitlab-ci/versioning/gitversion.yml deleted file mode 100644 index dbbc149..0000000 --- a/.gitlab-ci/versioning/gitversion.yml +++ /dev/null @@ -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 diff --git a/.woodpecker/woodpecker_ci.yml b/.woodpecker/woodpecker_ci.yml new file mode 100644 index 0000000..ba24276 --- /dev/null +++ b/.woodpecker/woodpecker_ci.yml @@ -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/* diff --git a/CHANGELOG.md b/CHANGELOG.md index c103ff4..a9b2781 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,213 @@ # 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. -## 0.7.x -### 0.7.0: Enhanced Preview +## 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 (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 (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 (25.02.12) +- Updated the changelog to include missing entries. + +### 0.14.0: Code refactor (by Mr. Finch) (25.02.11) +- Introduced constants and optimized the code. + +## 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 (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 (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 (25.02.10) +- The README file (project description) now includes updates description and screenshots. + +### 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 (25.02.10) +- Fixed text clipping issues when using the new theme options. + +### 0.12.1: Removed Unnecessary Debug Prints (25.02.09) +- Removed leftover debug statements. + +### 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:** + 1. Option to change the theme (with an optional dependency installation). + 2. Reset selectable EXIF data to default. + - The updater UI has been moved to the second tab. + - Added a link to the changelog for easier access to update details. + +- **Patches:** + - 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 (25.02.05) +### 0.11.1: Fixed pipeline +- Fixed pipeline publish error + +### 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 (25.02.04) +### 0.10.1: Fixed Updater +- Fixed an issue where the updater was permanently disabled. + +### 0.10.0: Multithreading for Preview Window +- The preview window now processes images in a separate thread, and live update preview is enabled by default. + - This improves UI responsiveness. + - The image now resizes dynamically to fit the window when the window size changes. +- Minor UI improvements. + +--- + +## 0.9.x +### 0.9.2: Enhanced updater +- Minor enhancments for the updater + +### 0.9.1: Patch for Unsuccessful Successful Update +- Addressed a rare issue where the package did not update correctly using the updater. + - Unable to reproduce, but it may have been related to an older version and the restart process. +- Added developer functions to test the updater without requiring a published release. + +### 0.9.0: UI Enhancements and Language Refinements +- Changed text, labels, buttons, and checkboxes for clearer understanding. +- Improved UI language to make the interface easier to navigate. +- Added tooltips for more helpful information and guidance. +- Updates applied across the main window (both tabs) and the preview window. + +--- + +## 0.8.x +### 0.8.5: Patch for New PyPiUpdater Version +- **PyPiUpdater 0.5** introduced breaking changes; adjusted code to ensure compatibility with the new version. + +### 0.8.4: Minor Enhancements & Cleanup +- Updated window titles. +- 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 +- 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 +- Updated to support **PyPiUpdater 0.4.0**. +- Now stores version information locally, preventing an "unknown" state on the first updater launch. + - Users still need to press the **Update** button to verify the latest version, ensuring an internet connection is available. + +### 0.8.1: Fix +- Fixed a misspelling of `PyPiUpdater` in the build file, which prevented v0.8.0 from being installed. + +### 0.8.0: Updater Feature +- Added an updater function utilizing my new package [PyPiUpdater](https://gitlab.com/CodeByMrFinchum/PyPiUpdater). +- New updater window displaying the local version and checking for updates online. +- Added an option to update and restart the app from the menu. + +--- + +## 0.7.0: Enhanced Preview - Images loaded into the preview window are now scaled while maintaining aspect ratio. - Added live updates: changes to brightness, contrast, or grayscale are applied immediately. - - ⚠ This may crush the system depending on image size and system specifications. + - This may crush the system depending on image size and system specifications. - Removed Settings from menuBar, and extended the about window. + --- ## 0.6.0: Initial Flatpak Support diff --git a/README.md b/README.md index f489d04..22efff4 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,17 @@ # **OptimaLab35** -_Last updated: 28 Jan 2025_ +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. --- ## **Current Status** -### **Alpha Stage** - -OptimaLab35 is built using **PySide6** and **Qt**, offering a modern and flexible interface for **OPTIMA35**. - -The program is under **active development**, and while versions released on PyPI should not contain major bugs, occasional issues may arise. - -For the most accurate and detailed update information, please refer to the well-maintained [**CHANGELOG**](https://gitlab.com/CodeByMrFinchum/OptimaLab35/-/blob/main/CHANGELOG.md), as this README may occasionally lag behind the latest updates. +The program has reached a stable release. All functions have been tested, and there should be *no* bugs. +While there is always room for additional features and optimizations, the core functionality is complete and reliable. --- @@ -28,8 +23,8 @@ For the most accurate and detailed update information, please refer to the well- - Adjust brightness and contrast - Add customizable text-based watermarks -### **Image preview** -- Load a single image and see how change in brightness and contrast changes the image +### **Image Preview** +- Load a single image and see how changes in brightness and contrast affect the image ### **EXIF Management** - Add EXIF data using a simple dictionary @@ -39,6 +34,10 @@ For the most accurate and detailed update information, please refer to the well- - Automatically adjust EXIF timestamps based on image file names - Add GPS coordinates to images +### **Settings** +- Option to use `PyQtDarkTheme` and select Dark, Light, or auto theme +- Checks for updates on PyPI, automatically downloads and installs the latest version + --- ## **Installation** @@ -50,31 +49,45 @@ pip install OptimaLab35 --- -## Preview GUI -**PREVIEW** might be out of date. +## GUI Preview +The layout remains consistent with v1.0.0. +The UI is OS-dependent, but a custom theme can be enabled in the settings. **Main tab** -{width=40%} - -**Preview window** - -{width=40%} +{width=40%} +{width=40%} **Exif tab** -{width=40%} +{width=40%} +{width=40%} -**Exif editor** +**Preview window** -{width=40%} +{width=40%} +{width=40%} + +**Settings** + +{width=40%} +{width=40%} + +**Updater** + +{width=40%} +{width=40%} --- -# Use of LLMs +# Contribution + +Thanks to developer [Mr Finch](https://gitlab.com/MrFinchMkV) for contributing to this project. + +## Use of LLMs In the interest of transparency, I disclose that Generative AI (GAI) large language models (LLMs), including OpenAI’s ChatGPT and Ollama models (e.g., OpenCoder and Qwen2.5-coder), have been used to assist in this project. -## Areas of Assistance: +### Areas of Assistance: - Project discussions and planning - Spelling and grammar corrections - Suggestions for suitable packages and libraries @@ -86,7 +99,7 @@ In cases where LLMs contribute directly to code or provide substantial optimizat - mradermacher gguf Q4K-M Instruct version of infly/OpenCoder-1.5B - unsloth gguf Q4K_M Instruct version of both Qwen/QWEN2 1.5B and 3B -### References +#### References 1. **Huang, Siming, et al.** *OpenCoder: The Open Cookbook for Top-Tier Code Large Language Models.* 2024. [PDF](https://arxiv.org/pdf/2411.04905) diff --git a/pyproject.toml b/flatpak/pyproject.toml similarity index 75% rename from pyproject.toml rename to flatpak/pyproject.toml index a9e3c18..4e3097a 100644 --- a/pyproject.toml +++ b/flatpak/pyproject.toml @@ -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", - "PyPyUpdater>=0.3.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" diff --git a/media/demo_v041.gif b/media/demo_v041.gif deleted file mode 100644 index d5398b2..0000000 Binary files a/media/demo_v041.gif and /dev/null differ diff --git a/media/exif_editor.png b/media/exif_editor.png deleted file mode 100644 index 81fa4b0..0000000 Binary files a/media/exif_editor.png and /dev/null differ diff --git a/media/exif_tab.png b/media/exif_tab.png deleted file mode 100644 index 723c814..0000000 Binary files a/media/exif_tab.png and /dev/null differ diff --git a/media/info_window.png b/media/info_window.png deleted file mode 100644 index dea48ac..0000000 Binary files a/media/info_window.png and /dev/null differ diff --git a/media/main_tab.png b/media/main_tab.png deleted file mode 100644 index 3c0ebf6..0000000 Binary files a/media/main_tab.png and /dev/null differ diff --git a/media/mainwindow_dark.png b/media/mainwindow_dark.png new file mode 100644 index 0000000..8ccda0d Binary files /dev/null and b/media/mainwindow_dark.png differ diff --git a/media/mainwindow_exif_dark.png b/media/mainwindow_exif_dark.png new file mode 100644 index 0000000..f759fe2 Binary files /dev/null and b/media/mainwindow_exif_dark.png differ diff --git a/media/mainwindow_exif_light.png b/media/mainwindow_exif_light.png new file mode 100644 index 0000000..2b3f1ab Binary files /dev/null and b/media/mainwindow_exif_light.png differ diff --git a/media/mainwindow_light.png b/media/mainwindow_light.png new file mode 100644 index 0000000..197874b Binary files /dev/null and b/media/mainwindow_light.png differ diff --git a/media/preview_window.png b/media/preview_window.png deleted file mode 100644 index 2057ce4..0000000 Binary files a/media/preview_window.png and /dev/null differ diff --git a/media/previewwindow_dark.png b/media/previewwindow_dark.png new file mode 100644 index 0000000..618340c Binary files /dev/null and b/media/previewwindow_dark.png differ diff --git a/media/previewwindow_light.png b/media/previewwindow_light.png new file mode 100644 index 0000000..aaf3d4d Binary files /dev/null and b/media/previewwindow_light.png differ diff --git a/media/settingswindow_dark.png b/media/settingswindow_dark.png new file mode 100644 index 0000000..9c791b8 Binary files /dev/null and b/media/settingswindow_dark.png differ diff --git a/media/settingswindow_light.png b/media/settingswindow_light.png new file mode 100644 index 0000000..67f5fb0 Binary files /dev/null and b/media/settingswindow_light.png differ diff --git a/media/settingswindow_updater_dark.png b/media/settingswindow_updater_dark.png new file mode 100644 index 0000000..fbe003c Binary files /dev/null and b/media/settingswindow_updater_dark.png differ diff --git a/media/settingswindow_updater_light.png b/media/settingswindow_updater_light.png new file mode 100644 index 0000000..6a3e124 Binary files /dev/null and b/media/settingswindow_updater_light.png differ diff --git a/pip_README.md b/pip_README.md index f36b255..576c8bf 100644 --- a/pip_README.md +++ b/pip_README.md @@ -1,4 +1,11 @@ -OptimaLab35 is in active development, and even *stable* versions may produce errors in unexpected situations. It is a GUI for optima35. -Please visit [OptimaLab35](https://gitlab.com/CodeByMrFinchum/OptimaLab35/-/blob/main/media/exif_editor.png?ref_type=heads) gitlab page for more information. +**[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. -Uses [optima35](https://gitlab.com/CodeByMrFinchum/optima35) to modify images. +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 +- Add customizable text-based watermarks +- Manage EXIF data: add, copy, remove, and adjust timestamps +- Preview image adjustments in real time +- Theme selection (light, dark, auto) +- Automatic updates via PyPI diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..b5901cc --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +optima35 +PyPiUpdater +pyside6 +PyYAML diff --git a/src/OptimaLab35/__main__.py b/src/OptimaLab35/__main__.py index 557cfbf..512c7b3 100644 --- a/src/OptimaLab35/__main__.py +++ b/src/OptimaLab35/__main__.py @@ -1,7 +1,30 @@ -from OptimaLab35 import gui, __version__ +import sys +from PySide6 import QtWidgets +from .utils.utility import Utilities +from .mainWindow import OptimaLab35 +from .const import ( + CONFIG_BASE_PATH +) def main(): - gui.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() diff --git a/src/OptimaLab35/const.py b/src/OptimaLab35/const.py new file mode 100644 index 0000000..2dcfd9c --- /dev/null +++ b/src/OptimaLab35/const.py @@ -0,0 +1,2 @@ +APPLICATION_NAME = "OptimaLab35" +CONFIG_BASE_PATH = "~/.config/OptimaLab35" diff --git a/src/OptimaLab35/gui.py b/src/OptimaLab35/mainWindow.py similarity index 64% rename from src/OptimaLab35/gui.py rename to src/OptimaLab35/mainWindow.py index e2d9384..c299689 100644 --- a/src/OptimaLab35/gui.py +++ b/src/OptimaLab35/mainWindow.py @@ -1,49 +1,54 @@ -import sys import os from datetime import datetime - -from PyPiUpdater import PyPiUpdater from optima35.core import OptimaManager -from OptimaLab35.utils.utility import Utilities -from OptimaLab35.ui.main_window import Ui_MainWindow -from OptimaLab35.ui.preview_window import Ui_Preview_Window -from OptimaLab35.ui.updater_window import Ui_Updater_Window -from OptimaLab35.ui.exif_handler_window import ExifEditor -from OptimaLab35.ui.simple_dialog import SimpleDialog # Import the SimpleDialog class + from OptimaLab35 import __version__ +from .const import ( + APPLICATION_NAME, + CONFIG_BASE_PATH +) -from PySide6.QtCore import QRunnable, QThreadPool, Signal, QObject, QRegularExpression, Qt +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 ( + QRunnable, + QThreadPool, + Signal, + QObject, + QRegularExpression, + Qt, + QDate +) -from PySide6 import QtWidgets from PySide6.QtWidgets import ( QMessageBox, QApplication, QMainWindow, - QWidget, - QVBoxLayout, - QLabel, - QLineEdit, - QPushButton, - QCheckBox, - QFileDialog, - QHBoxLayout, - QSpinBox, - QProgressBar, + QFileDialog ) -from PySide6.QtGui import QPixmap, QRegularExpressionValidator +from PySide6.QtGui import QRegularExpressionValidator, QIcon class OptimaLab35(QMainWindow, Ui_MainWindow): def __init__(self): super(OptimaLab35, self).__init__() - self.name = "OptimaLab35" + self.name = APPLICATION_NAME self.version = __version__ self.o = OptimaManager() - self.u = Utilities() - self.u.program_configs() + self.u = Utilities(os.path.expanduser(CONFIG_BASE_PATH)) + self.app_settings = self.u.load_settings() self.thread_pool = QThreadPool() # multi thread ChatGPT # Initiate internal object - self.exif_file = os.path.expanduser("~/.config/OptimaLab35/exif.yaml") + self.exif_file = os.path.expanduser(f"{CONFIG_BASE_PATH}/exif.yaml") self.available_exif_data = None self.settings = {} # UI elements @@ -52,10 +57,11 @@ class OptimaLab35(QMainWindow, Ui_MainWindow): self.sd = SimpleDialog() # Change UI elements - self.change_statusbar(f"Using {self.o.name} v{self.o.version}", 5000) - self.setWindowTitle(f"{self.name} v{self.version}") + self.change_statusbar(f"{self.name} v{self.version}", 10000) + self.set_title() self.default_ui_layout() self.define_gui_interaction() + self.setWindowIcon(QIcon(":app-icon.png")) # Init function def default_ui_layout(self): @@ -63,6 +69,13 @@ class OptimaLab35(QMainWindow, Ui_MainWindow): self.ui.png_quality_Slider.setVisible(False) self.ui.quality_label_2.setVisible(False) + def set_title(self): + if self.version == "0.0.1": + title = f"{self.name} DEV MODE" + else: + title = self.name + self.setWindowTitle(title) + def define_gui_interaction(self): self.ui.input_folder_button.clicked.connect(self.browse_input_folder) self.ui.output_folder_button.clicked.connect(self.browse_output_folder) @@ -78,15 +91,13 @@ class OptimaLab35(QMainWindow, Ui_MainWindow): self.ui.actionAbout.triggered.connect(self.info_window) self.ui.preview_Button.clicked.connect(self.open_preview_window) - self.ui.actionUpdate.triggered.connect(self.open_updater_window) + self.ui.actionSettings.triggered.connect(self.open_updater_window) regex = QRegularExpression(r"^\d{1,2}\.\d{1,6}$") 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() @@ -94,7 +105,7 @@ class OptimaLab35(QMainWindow, Ui_MainWindow): self.preview_window.showMaximized() def open_updater_window(self): - self.updater_window = UpdaterWindow(self.version, self.o.version) + self.updater_window = SettingsWindow(self.version, self.o.version) self.updater_window.show() def update_values(self, value1, value2, checkbox_state): @@ -108,7 +119,7 @@ class OptimaLab35(QMainWindow, Ui_MainWindow): info_text = f"""
(C) 2024-2025 Mr Finchum aka CodeByMrFinchum
-{self.name} is a GUI for {self.o.name} (v{self.o.version}), enhancing its functionality with a\nuser-friendly interface for efficient image and metadata management.
+{self.name} is a GUI for {self.o.name} (v{self.o.version}), enhancing its functionality with a user-friendly interface for efficient image and metadata management.
For more details, visit:
@@ -327,6 +339,14 @@ class OptimaLab35(QMainWindow, Ui_MainWindow): # Start worker in thread pool ChatGPT self.thread_pool.start(worker) + def control_ending(self, name_lst): + for item in name_lst: + try: + int(item[-5]) + except ValueError: + return False + return True + def insert_exif(self, image_files): input_folder = self.settings["input_folder"] @@ -358,6 +378,12 @@ 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) + return + self.insert_exif(image_list) self.toggle_buttons(True) @@ -391,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} (v{self.version}) with {self.o.name} (v{self.o.version})" + 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): @@ -404,7 +434,10 @@ class OptimaLab35(QMainWindow, Ui_MainWindow): if self.ui.add_date_checkBox.isChecked(): selected_exif["date_time_original"] = self.get_date() if self.ui.gps_checkBox.isChecked(): - self.settings["gps"] = [float(self.ui.lat_lineEdit.text()), float(self.ui.long_lineEdit.text())] + try: + self.settings["gps"] = [float(self.ui.lat_lineEdit.text()), float(self.ui.long_lineEdit.text())] + except ValueError as e: + self.settings["gps"] = "Wrong gps data" else: self.settings["gps"] = None return selected_exif @@ -444,6 +477,9 @@ class OptimaLab35(QMainWindow, Ui_MainWindow): self.settings["own_date"] = self.get_checkbox_value(self.ui.add_date_checkBox) if self.settings["own_exif"]: self.settings["user_selected_exif"] = self.get_selected_exif() + if self.settings["gps"] is not None: + if len(self.settings["gps"]) != 2: + return self.settings["gps"] else: self.settings["user_selected_exif"] = None self.settings["gps"] = None @@ -462,229 +498,9 @@ class OptimaLab35(QMainWindow, Ui_MainWindow): elif do == "write": self.u.write_yaml(self.exif_file, self.available_exif_data) -class UpdaterWindow(QMainWindow, Ui_Updater_Window): - # Mixture of code by me, code/functions refactored by ChatGPT and code directly from ChatGPT - def __init__(self, optimalab35_localversion, optima35_localversion): - super(UpdaterWindow, self).__init__() - self.ui = Ui_Updater_Window() - self.ui.setupUi(self) - from PyPiUpdater import PyPiUpdater - # Update log file location - self.update_log_file = os.path.expanduser("~/.config/OptimaLab35/update.log") - # 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.last_update = self.ppu_o35.last_update_date_string() - - # 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.""" - if self.optimalab35_localversion == "0.0.1": - self.dev_mode() - return - else: - self.ui.label_dev.setVisible(False) - self.ui.label_optimalab35_localversion.setText(self.optimalab35_localversion) - self.ui.label_optima35_localversion.setText(self.optima35_localversion) - 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_2.setText(self.last_update) - - def dev_mode(self): - self.ui.update_and_restart_Button.setEnabled(False) - self.ui.check_for_update_Button.setEnabled(False) - self.ui.label_dev.setStyleSheet("QLabel { background-color : red; color : black; }") - - 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 - is_newer_ol35, latest_version_ol35 = self.ppu_ol35.check_for_update(True) - if is_newer_ol35 is None: - self.ui.label_optimalab35_latestversion.setText("Error") - else: - self.ui.label_optimalab35_latestversion.setText(latest_version_ol35) - self.updates_available["OptimaLab35"] = is_newer_ol35 - - # Check optima35 update - is_newer_o35, latest_version_o35 = self.ppu_o35.check_for_update(True) - if is_newer_o35 is None: - self.ui.label_optima35_latestversion.setText("Error") - else: - self.ui.label_optima35_latestversion.setText(latest_version_o35) - self.updates_available["optima35"] = is_newer_o35 - - # Enable update button if any update is available - if any(self.updates_available.values()): - self.ui.update_and_restart_Button.setEnabled(True) - - self.ppu_o35.record_update_check() - self.ui.label_last_check_2.setText(self.ppu_o35.last_update_date_string()) - 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") - msg.setText(f"Updating: {', '.join(packages_to_update)}\nRestart after update?") - 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": - success, message = self.ppu_ol35.update_package() - elif package == "optima35": - success, message = self.ppu_o35.update_package() - - update_results.append(f"{package}: {'✔ Success' if success else '❌ Failed'}\n{message}") - - # 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" - self.ppu_ol35.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) - - def __init__(self): - super(PreviewWindow, self).__init__() - self.ui = Ui_Preview_Window() - self.ui.setupUi(self) - self.o = OptimaManager() - self.ui.QLabel.setAlignment(Qt.AlignCenter) - ## Ui interaction - 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.reset_brightness_Button.clicked.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.reset_contrast_Button.clicked.connect(self.on_ui_change) - - self.ui.grayscale_checkBox.stateChanged.connect(self.on_ui_change) - - 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() - - def process_image(self, path): - """Loads and processes the image with modifications.""" - # Refactored by ChatGPT - if not os.path.isfile(path): - return None - - try: - img = self.o.process_image_object( - image_input_file=path, # Example: resize percentage - watermark="PREVIEW", - resize = 100, - grayscale=self.ui.grayscale_checkBox.isChecked(), - brightness=int(self.ui.brightness_spinBox.text()), - contrast=int(self.ui.contrast_spinBox.text()) - ) - return QPixmap.fromImage(img) - except Exception as e: - QMessageBox.warning(self, "Warning", "Error loading image...") - print(f"Error loading image...\n{e}") - return None - - def display_image(self, pixmap): - """Adjusts the image to fit within the QLabel.""" - # ChatGPT - if pixmap is None: - return - - # Get max available size (QLabel size) - max_size = self.ui.QLabel.size() - max_width = max_size.width() - max_height = max_size.height() - - # Scale image to fit within the available space while maintaining aspect ratio - scaled_pixmap = pixmap.scaled( - max_width, max_height, - Qt.KeepAspectRatio, - Qt.SmoothTransformation - ) - - # Set the scaled image - self.ui.QLabel.setPixmap(scaled_pixmap) - - # Adjust QLabel size to match image - self.ui.QLabel.resize(scaled_pixmap.size()) - - def update_preview(self): - """Handles loading and displaying the image.""" - # ChatGPT - path = self.ui.image_path_lineEdit.text() - pixmap = self.process_image(path) - self.display_image(pixmap) - - def close_window(self): - # Emit the signal with the values from the spinboxes and checkbox - # chatgpt - 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() + def closeEvent(self, event): + QApplication.closeAllWindows() + event.accept() class WorkerSignals(QObject): # ChatGPT @@ -700,7 +516,7 @@ class ImageProcessorRunnable(QRunnable): self.signals = WorkerSignals() self.signals.progress.connect(progress_callback) self.o = OptimaManager() - self.u = Utilities() + self.u = Utilities(os.path.expanduser(CONFIG_BASE_PATH)) def run(self): input_folder = self.settings["input_folder"] @@ -734,13 +550,3 @@ class ImageProcessorRunnable(QRunnable): self.signals.progress.emit(int((i / len(self.image_files)) * 100)) self.signals.finished.emit() - - -def main(): - app = QtWidgets.QApplication(sys.argv) - window = OptimaLab35() - window.show() - app.exec() - -if __name__ == "__main__": - main() diff --git a/src/OptimaLab35/previewWindow.py b/src/OptimaLab35/previewWindow.py new file mode 100644 index 0000000..82161d2 --- /dev/null +++ b/src/OptimaLab35/previewWindow.py @@ -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) diff --git a/src/OptimaLab35/settingsWindow.py b/src/OptimaLab35/settingsWindow.py new file mode 100644 index 0000000..ffbd263 --- /dev/null +++ b/src/OptimaLab35/settingsWindow.py @@ -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('\x8aF\xc9b\xc1\xa6i\x93z\x10\xaf\x01\xfa\xb55\
+\x14=\xb8O\xa8U+\x00\x04\x87\x86##+\x17R\
+\x99\xfb\xb6\x85\x98N\xa7\xc3M*Cl\x5c\x22\xde}\
+\xff\x8f\xf0W\x7f\xfd\xbf\xe3\xc2\xa5\xb7\xecJ\x12\x04\x80\
+\xf2\xb2\x22\xfc\xed\x7f\xfd/\xf8\xedo\xfe\x19E\x85\xf7\
+1>6\x8a\xcd\xcd\x1f\xe6\xfd\xb0\x98\xcdx\xd4P\x87\
+\x07\xf9w\x09\x8d\x17K\xa4\xc8\xcc\xce\x85\xc6\xd7\xcf!\
+\xfb\x1e\xb8\xcb\x15HLLE|\xe2\xeeY\xf9\x06\x83\
+\x1e\xad\xadM\xe8\xeah\x87\xc5b\x7fQ5\x8f\xcf\x87\
+F\xe3\x87\xc0\xc0\xa0]\xc7.\xcc\xcfcdd\x08\xa6\
+\x8d\x0d\xea\xa3=B o\x0b\x80\xda\x0384\xb0\xd9\
+l\xb0X)\xd5\x86\xd7\xf1\x9c{{\xbbQYQF\
+\xf8\x98S\xa7\xcf#88\xec\xb9\x82\xdd\x8e\x1f-\x93\
+\x09OO/\x88\xc5\x12\x04\x06\x05#!)\x05wn\
+}c\xd7\xb6\x80\xc1\xa0\xc7\x9d[\xd7\xd1\xf3\xb8\x0b\xa9\
+\xa9\x99HNMGXx$\xa42\xd9k\xcd\x07\x19\
+\x1e\x1eBqa>f\xa6\xa7\x09\x8dO\xcb\xc8Bt\
+L\xbc\xc3\xeaR0\x99Lh\x83C\x11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