Added windows compatibility #5

Code

Clone this repository

Checkout

From your project repository, check out a new branch and test the changes.

git fetch -u origin "CT-66/windows-compatibility:CT-66/windows-compatibility"
git switch "CT-66/windows-compatibility"
Open
sahin/binary-clock-wallpaper
CT-66 wants to merge 3 commits into main from CT-66/windows-compatibility
CT-66 commented 2022-04-10 09:35:11 +03:00 (Migrated from github.com)

I have added a few lines that adds support for windows too.

I have added a few lines that adds support for windows too.
sahinakkaya (Migrated from github.com) requested changes 2022-04-10 10:05:18 +03:00
@@ -82,1 +82,4 @@
canvas.save(result_image_path, quality=95)
# windows compatibility
from sys import platform
sahinakkaya (Migrated from github.com) commented 2022-04-10 09:59:39 +03:00

I try to follow PEP8 standards in this project. So the import line should be at top of the file.

I try to follow PEP8 standards in this project. So the import line should be at top of the file.
@@ -83,0 +88,4 @@
import ctypes
SPI_SETDESKWALLPAPER = 20
img_path_win = os.path.join(os.getcwd(), "img", "result.png")
sahinakkaya (Migrated from github.com) commented 2022-04-10 09:57:43 +03:00

os.getcwd returns the directory where the script is being run. If you run the script from another directory this will fail.

`os.getcwd` returns the directory where the script is being run. If you run the script from another directory this will fail.
sahinakkaya (Migrated from github.com) commented 2022-04-10 09:58:31 +03:00

Also, result_image_path should contain the correct path. Why did you create the same thing again?

Also, `result_image_path` should contain the correct path. Why did you create the same thing again?
@@ -83,0 +92,4 @@
png = Image.open(img_path_win).convert("RGB")
png.save(os.path.join(os.getcwd(), "img", "result.jpg"))
jpg = os.path.join(os.getcwd(), "img", "result.jpg")
ctypes.windll.user32.SystemParametersInfoW(SPI_SETDESKWALLPAPER, 0, jpg, 0)
sahinakkaya (Migrated from github.com) commented 2022-04-10 10:04:38 +03:00

The task of this script is only creating an image. Setting the wallpaper is another task and it should be handled outside of this script. You can look at set_binary_wallpaper.sh and write something similar to it for windows. Maybe a .bat file, I don't know much about windows.

The task of this script is only creating an image. Setting the wallpaper is another task and it should be handled outside of this script. You can look at `set_binary_wallpaper.sh` and write something similar to it for windows. Maybe a `.bat` file, I don't know much about windows.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'CT-66/windows-compatibility:CT-66/windows-compatibility'
git switch 'CT-66/windows-compatibility'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'CT-66/windows-compatibility'
git switch 'CT-66/windows-compatibility'
git rebase 'main'
git switch 'main'
git merge --ff-only 'CT-66/windows-compatibility'
git switch 'CT-66/windows-compatibility'
git rebase 'main'
git switch 'main'
git merge --no-ff 'CT-66/windows-compatibility'
git switch 'main'
git merge --squash 'CT-66/windows-compatibility'
git switch 'main'
git merge --ff-only 'CT-66/windows-compatibility'
git switch 'main'
git merge 'CT-66/windows-compatibility'
git push origin 'main'
Sign in to join this conversation.
No description provided.