From 1fe672fdb0a9ddf6e5ac027cdac5de2143f45491 Mon Sep 17 00:00:00 2001 From: Jim Easterbrook Date: Fri, 21 Oct 2022 08:33:28 +0100 Subject: [PATCH] Fix WindowState error in PySide6 v6.4 PySide6 converts QEnum to a Python enum, but it's not recognised by 'isinstance'. --- src/photini/__init__.py | 4 ++-- src/photini/pyqt.py | 5 ++--- utils/update_version.py | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/photini/__init__.py b/src/photini/__init__.py index 6e6088a0..5e00b417 100644 --- a/src/photini/__init__.py +++ b/src/photini/__init__.py @@ -1,4 +1,4 @@ """Full documentation is at https://photini.readthedocs.io/""" -__version__ = '2022.10.0.1' -build = '2277 (6da9860)' +__version__ = '2022.10.0.2' +build = '2278 (08b9228)' diff --git a/src/photini/pyqt.py b/src/photini/pyqt.py index 0557fd2a..683c9875 100644 --- a/src/photini/pyqt.py +++ b/src/photini/pyqt.py @@ -18,7 +18,6 @@ from collections import namedtuple from contextlib import contextmanager -import enum from functools import wraps import importlib import logging @@ -280,8 +279,8 @@ def execute(widget, *arg, **kwds): return widget.exec(*arg, **kwds) def flag_to_int(flags): - if isinstance(flags, enum.Enum): - # PySide6 started using Python enum for QFlags in v6.4 + if hasattr(flags, 'value'): + # recent versions of PyQt6 and PySide6 convert QEnum to Python enum return flags.value return int(flags) diff --git a/utils/update_version.py b/utils/update_version.py index ccce3a52..87e693f4 100644 --- a/utils/update_version.py +++ b/utils/update_version.py @@ -48,10 +48,10 @@ def main(argv=None): for tag in repo.tags: if tag.commit.committed_date > latest: tag_name = str(tag) - if re.match(r'\d{4}\.\d{1,2}\.\d$', tag_name): + if re.match(r'\d{4}\.\d{1,2}\.\d', tag_name): latest = tag.commit.committed_date last_release = tag_name - # set current version number (calendar based) + # set current version number last_release = [int(x) for x in last_release.split('.')] major, minor, micro = last_release[:3] version = [int(x) for x in __version__.split('.')]