Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: adapt dependencies for windows, update for Python 3.12 #374

Draft
wants to merge 3 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ dependencies = [
"IPTCInfo3",
"numpy",
"ninepatch@git+https://github.com/vindolin/ninepatch",
"pi_heif>=0.8.0"
"pi_heif>=0.8.0",
'pysdl2-dll ; platform_system == "Windows"',
'pygame ; platform_system == "Windows"'
]

[project.urls]
Expand Down
4 changes: 2 additions & 2 deletions src/picframe/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self, model, viewer):
self.__paused = False
self.__force_navigate = False
self.__next_tm = 0
self.__date_from = make_date('1901/12/15') # TODO This seems to be the minimum date to be handled by date functions # noqa: E501
self.__date_from = make_date('1970/1/2') # TODO This seems to be the minimum date to be handled by date functions # noqa: E501
self.__date_to = make_date('2038/1/1')
self.__location_filter = ""
self.__where_clauses = {}
Expand Down Expand Up @@ -132,7 +132,7 @@ def date_from(self, val):
try:
self.__date_from = float(val)
except ValueError:
self.__date_from = make_date(val if len(val) > 0 else '1901/12/15')
self.__date_from = make_date(val if len(val) > 0 else '1970/1/2')
if len(val) > 0:
self.__model.set_where_clause('date_from', "exif_datetime > {:.0f}".format(self.__date_from))
else:
Expand Down
11 changes: 8 additions & 3 deletions src/picframe/start.py → src/start.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import logging
import argparse
import ctypes
import os
import locale
import sys
from distutils.dir_util import copy_tree
from shutil import copytree

from picframe import model, viewer_display, controller, __version__

Expand All @@ -15,7 +16,7 @@ def copy_files(pkgdir, dest, target):
fullpath = os.path.join(pkgdir, target)
destination = os.path.join(dest, PICFRAME_DATA_DIR)
destination = os.path.join(destination, target)
copy_tree(fullpath, destination)
copytree(fullpath, destination)
except Exception:
raise

Expand Down Expand Up @@ -97,7 +98,11 @@ def main():
group.add_argument("configfile", nargs='?', help="/path/to/configuration.yaml")
args = parser.parse_args()
if args.initialize:
if os.geteuid() == 0:
try:
is_admin = os.getuid() == 0
except AttributeError:
is_admin = ctypes.windll.shell32.IsUserAnAdmin() != 0
if is_admin:
print("Don't run the initialize step with sudo. It might put the files in the wrong place!")
return
pkgdir = sys.modules['picframe'].__path__[0]
Expand Down