diff --git a/.gitignore b/.gitignore index e8383c6..7a56971 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,3 @@ dist/ __pycache__/ .flatpak-builder/ flatpak-build-dir/ -*.jpg diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..12386d8 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,69 @@ +--- +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 new file mode 100644 index 0000000..2c1afd7 --- /dev/null +++ b/.gitlab-ci/git/create_tag.yml @@ -0,0 +1,15 @@ +--- + +.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 new file mode 100644 index 0000000..dbbc149 --- /dev/null +++ b/.gitlab-ci/versioning/gitversion.yml @@ -0,0 +1,31 @@ +--- +.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 deleted file mode 100644 index ba24276..0000000 --- a/.woodpecker/woodpecker_ci.yml +++ /dev/null @@ -1,92 +0,0 @@ -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 a9b2781..50ef93c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,167 +1,6 @@ # 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.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. @@ -184,7 +23,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 diff --git a/README.md b/README.md index 22efff4..722f656 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,21 @@ # **OptimaLab35** -Developed on my [forgejo instance](https://code.boxyfoxy.net/CodeByMrFinchum), [GitLab](https://gitlab.com/CodeByMrFinchum) is used as backup. +_Last updated: 02 Feb 2025 (v.0.9.0)_ ## **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://code.boxyfoxy.net/CodeByMrFinchum/optima35), providing an intuitive way to interact with the core functionalities. +It serves as a GUI for the [OPTIMA35 library](https://gitlab.com/CodeByMrFinchum/optima35), providing an intuitive way to interact with the core functionalities. --- ## **Current Status** -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. +### **Early Development** +OptimaLab35 is actively developed using **PySide6** and **Qt**, providing a modern interface for **OPTIMA35**. + +The program is still in its early stages, and features may change drastically over time. Some features might be added but later removed if they don't prove useful. Expect significant changes to the UI and functionality between updates. + +For the most accurate and detailed update information, please refer to the [**CHANGELOG**](https://gitlab.com/CodeByMrFinchum/OptimaLab35/-/blob/main/CHANGELOG.md) as the readme might lack behind. --- @@ -34,9 +38,9 @@ While there is always room for additional features and optimizations, the core f - 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 +### **Updater** - Checks for updates on PyPI, automatically downloads and installs the latest version +- Restarts the program after update --- @@ -49,45 +53,39 @@ pip install OptimaLab35 --- -## 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. +## Preview GUI **0.9.0** +**PREVIEW** might be out of date. **Main tab** -{width=40%} -{width=40%} +{width=40%} **Exif tab** -{width=40%} -{width=40%} +{width=40%} + +**Exif editor** + +{width=40%} **Preview window** -{width=40%} -{width=40%} +{width=40%} -**Settings** +**About** -{width=40%} -{width=40%} +{width=40%} **Updater** -{width=40%} -{width=40%} +{width=40%} --- -# Contribution - -Thanks to developer [Mr Finch](https://gitlab.com/MrFinchMkV) for contributing to this project. - -## Use of LLMs +# 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 @@ -99,7 +97,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/media/about_window.png b/media/about_window.png new file mode 100644 index 0000000..f97c061 Binary files /dev/null and b/media/about_window.png differ diff --git a/media/exif_editor.png b/media/exif_editor.png new file mode 100644 index 0000000..8457cb8 Binary files /dev/null and b/media/exif_editor.png differ diff --git a/media/exif_tab.png b/media/exif_tab.png new file mode 100644 index 0000000..7d62403 Binary files /dev/null and b/media/exif_tab.png differ diff --git a/media/main_tab.png b/media/main_tab.png new file mode 100644 index 0000000..bf9d2f0 Binary files /dev/null and b/media/main_tab.png differ diff --git a/media/mainwindow_dark.png b/media/mainwindow_dark.png deleted file mode 100644 index 8ccda0d..0000000 Binary files a/media/mainwindow_dark.png and /dev/null differ diff --git a/media/mainwindow_exif_dark.png b/media/mainwindow_exif_dark.png deleted file mode 100644 index f759fe2..0000000 Binary files a/media/mainwindow_exif_dark.png and /dev/null differ diff --git a/media/mainwindow_exif_light.png b/media/mainwindow_exif_light.png deleted file mode 100644 index 2b3f1ab..0000000 Binary files a/media/mainwindow_exif_light.png and /dev/null differ diff --git a/media/mainwindow_light.png b/media/mainwindow_light.png deleted file mode 100644 index 197874b..0000000 Binary files a/media/mainwindow_light.png and /dev/null differ diff --git a/media/preview_window.png b/media/preview_window.png new file mode 100644 index 0000000..5fcc363 Binary files /dev/null and b/media/preview_window.png differ diff --git a/media/previewwindow_dark.png b/media/previewwindow_dark.png deleted file mode 100644 index 618340c..0000000 Binary files a/media/previewwindow_dark.png and /dev/null differ diff --git a/media/previewwindow_light.png b/media/previewwindow_light.png deleted file mode 100644 index aaf3d4d..0000000 Binary files a/media/previewwindow_light.png and /dev/null differ diff --git a/media/settingswindow_dark.png b/media/settingswindow_dark.png deleted file mode 100644 index 9c791b8..0000000 Binary files a/media/settingswindow_dark.png and /dev/null differ diff --git a/media/settingswindow_light.png b/media/settingswindow_light.png deleted file mode 100644 index 67f5fb0..0000000 Binary files a/media/settingswindow_light.png and /dev/null differ diff --git a/media/settingswindow_updater_dark.png b/media/settingswindow_updater_dark.png deleted file mode 100644 index fbe003c..0000000 Binary files a/media/settingswindow_updater_dark.png and /dev/null differ diff --git a/media/settingswindow_updater_light.png b/media/settingswindow_updater_light.png deleted file mode 100644 index 6a3e124..0000000 Binary files a/media/settingswindow_updater_light.png and /dev/null differ diff --git a/media/updater_window.png b/media/updater_window.png new file mode 100644 index 0000000..506a184 Binary files /dev/null and b/media/updater_window.png differ diff --git a/pip_README.md b/pip_README.md index 576c8bf..f36b255 100644 --- a/pip_README.md +++ b/pip_README.md @@ -1,11 +1,4 @@ -**[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. +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. -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 +Uses [optima35](https://gitlab.com/CodeByMrFinchum/optima35) to modify images. diff --git a/flatpak/pyproject.toml b/pyproject.toml similarity index 75% rename from flatpak/pyproject.toml rename to pyproject.toml index 4e3097a..57042c5 100644 --- a/flatpak/pyproject.toml +++ b/pyproject.toml @@ -7,8 +7,14 @@ name = "OptimaLab35" dynamic = ["version"] authors = [{ name = "Mr Finchum" }] description = "User interface for optima35." +readme = "pip_README.md" requires-python = ">=3.8" -dependencies = ["optima35>=1.0.0, <2.0.0", "PyYAML", "PyPyUpdater"] +dependencies = [ + "optima35>=1.0.0, <2.0.0", + "PyPiUpdater>=0.6.0, <1.0.0", + "pyside6", + "PyYAML", +] classifiers = [ "Programming Language :: Python :: 3", "License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)", @@ -22,7 +28,7 @@ Source = "https://gitlab.com/CodeByMrFinchum/OptimaLab35" OptimaLab35 = "OptimaLab35.__main__:main" [tool.hatch.build.targets.wheel] -packages = ["OptimaLab35"] +packages = ["src/OptimaLab35"] [tool.hatch.version] -path = "OptimaLab35/__init__.py" +path = "src/OptimaLab35/__init__.py" diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index b5901cc..0000000 --- a/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -optima35 -PyPiUpdater -pyside6 -PyYAML diff --git a/src/OptimaLab35/__main__.py b/src/OptimaLab35/__main__.py index 512c7b3..557cfbf 100644 --- a/src/OptimaLab35/__main__.py +++ b/src/OptimaLab35/__main__.py @@ -1,30 +1,7 @@ -import sys -from PySide6 import QtWidgets -from .utils.utility import Utilities -from .mainWindow import OptimaLab35 -from .const import ( - CONFIG_BASE_PATH -) +from OptimaLab35 import gui, __version__ 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() + gui.main() if __name__ == "__main__": main() diff --git a/src/OptimaLab35/const.py b/src/OptimaLab35/const.py deleted file mode 100644 index 2dcfd9c..0000000 --- a/src/OptimaLab35/const.py +++ /dev/null @@ -1,2 +0,0 @@ -APPLICATION_NAME = "OptimaLab35" -CONFIG_BASE_PATH = "~/.config/OptimaLab35" diff --git a/src/OptimaLab35/mainWindow.py b/src/OptimaLab35/gui.py similarity index 56% rename from src/OptimaLab35/mainWindow.py rename to src/OptimaLab35/gui.py index c299689..22fdafb 100644 --- a/src/OptimaLab35/mainWindow.py +++ b/src/OptimaLab35/gui.py @@ -1,54 +1,49 @@ +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 .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.QtCore import QRunnable, QThreadPool, Signal, QObject, QRegularExpression, Qt, QTimer +from PySide6 import QtWidgets from PySide6.QtWidgets import ( QMessageBox, QApplication, QMainWindow, - QFileDialog + QWidget, + QVBoxLayout, + QLabel, + QLineEdit, + QPushButton, + QCheckBox, + QFileDialog, + QHBoxLayout, + QSpinBox, + QProgressBar, ) -from PySide6.QtGui import QRegularExpressionValidator, QIcon +from PySide6.QtGui import QPixmap, QRegularExpressionValidator class OptimaLab35(QMainWindow, Ui_MainWindow): def __init__(self): super(OptimaLab35, self).__init__() - self.name = APPLICATION_NAME + self.name = "OptimaLab35" self.version = __version__ self.o = OptimaManager() - self.u = Utilities(os.path.expanduser(CONFIG_BASE_PATH)) - self.app_settings = self.u.load_settings() + self.u = Utilities() + self.u.program_configs() self.thread_pool = QThreadPool() # multi thread ChatGPT # Initiate internal object - self.exif_file = os.path.expanduser(f"{CONFIG_BASE_PATH}/exif.yaml") + self.exif_file = os.path.expanduser("~/.config/OptimaLab35/exif.yaml") self.available_exif_data = None self.settings = {} # UI elements @@ -57,11 +52,10 @@ class OptimaLab35(QMainWindow, Ui_MainWindow): self.sd = SimpleDialog() # Change UI elements - self.change_statusbar(f"{self.name} v{self.version}", 10000) + self.change_statusbar(f"Using {self.o.name} v{self.o.version}", 5000) self.set_title() self.default_ui_layout() self.define_gui_interaction() - self.setWindowIcon(QIcon(":app-icon.png")) # Init function def default_ui_layout(self): @@ -91,13 +85,15 @@ 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.actionSettings.triggered.connect(self.open_updater_window) + self.ui.actionUpdate.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) - self.ui.dateEdit.setDate(QDate.currentDate()) + #layout.addWidget(self.ui.lat_lineEdit) + #layout.addWidget(self.ui.long_lineEdit) + # UI related function, changing parts, open, etc. def open_preview_window(self): self.preview_window = PreviewWindow() @@ -105,7 +101,7 @@ class OptimaLab35(QMainWindow, Ui_MainWindow): self.preview_window.showMaximized() def open_updater_window(self): - self.updater_window = SettingsWindow(self.version, self.o.version) + self.updater_window = UpdaterWindow(self.version, self.o.version) self.updater_window.show() def update_values(self, value1, value2, checkbox_state): @@ -131,7 +127,6 @@ class OptimaLab35(QMainWindow, Ui_MainWindow):
For more details, visit:
@@ -339,14 +334,6 @@ 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"] @@ -378,12 +365,6 @@ 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) @@ -417,14 +398,10 @@ 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() - + user_data["software"] = f"{self.name} (v{self.version}) with {self.o.name} (v{self.o.version})" return user_data def get_selected_exif(self): @@ -434,10 +411,7 @@ 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(): - 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" + self.settings["gps"] = [float(self.ui.lat_lineEdit.text()), float(self.ui.long_lineEdit.text())] else: self.settings["gps"] = None return selected_exif @@ -477,9 +451,6 @@ 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 @@ -502,6 +473,335 @@ class OptimaLab35(QMainWindow, Ui_MainWindow): QApplication.closeAllWindows() event.accept() +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) + self.dev_mode = True #True if optimalab35_localversion == "0.0.1" else False + #self.set_dev_ui() + 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 start_long_press(self): + """Start the timer when button is pressed.""" + self.timer.start(1000) # 1-second long press + + def cancel_long_press(self): + """Cancel long press if released early.""" + 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 define_gui_interaction(self): + """Setup UI interactions.""" + 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.ol35_last_state[1]) + self.ui.label_optima35_latestversion.setText(self.o35_last_state[1]) + + 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.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) + + def local_check_for_updates(self): + dist_folder = os.path.expanduser("~/git/gitlab_public/OptimaLab35/dist/") + self.ui.check_local_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_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("~/git/gitlab_public/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): + dt_obj = datetime.fromtimestamp(time_time) + date_string = dt_obj.strftime("%d %h %H:%M") + return date_string + + 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_2.setText(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) + + 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() + class WorkerSignals(QObject): # ChatGPT progress = Signal(int) @@ -516,7 +816,7 @@ class ImageProcessorRunnable(QRunnable): self.signals = WorkerSignals() self.signals.progress.connect(progress_callback) self.o = OptimaManager() - self.u = Utilities(os.path.expanduser(CONFIG_BASE_PATH)) + self.u = Utilities() def run(self): input_folder = self.settings["input_folder"] @@ -550,3 +850,13 @@ 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 deleted file mode 100644 index 82161d2..0000000 --- a/src/OptimaLab35/previewWindow.py +++ /dev/null @@ -1,166 +0,0 @@ -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 deleted file mode 100644 index ffbd263..0000000 --- a/src/OptimaLab35/settingsWindow.py +++ /dev/null @@ -1,357 +0,0 @@ -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\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