|
67 | 67 | no_gui_parser.add_argument('--external-auth', action='store_true') |
68 | 68 | no_gui_args = no_gui_parser.parse_known_args()[0] |
69 | 69 | if not no_gui_args.no_gui: |
70 | | - import pkg_resources # from setuptools - used to check package versions and choose compatible methods |
| 70 | + # noinspection PyDeprecation |
| 71 | + import pkg_resources # from setuptools - to be changed to importlib.metadata and packaging.version once 3.8 is min. |
71 | 72 | import pystray # the menu bar/taskbar GUI |
72 | 73 | import timeago # the last authenticated activity hint |
73 | 74 | from PIL import Image, ImageDraw, ImageFont # draw the menu bar icon from the TTF font stored in APP_ICON |
@@ -2295,6 +2296,7 @@ def get_icon_size(text, font_size): |
2295 | 2296 | font = ImageFont.truetype(io.BytesIO(zlib.decompress(base64.b64decode(APP_ICON))), size=font_size) |
2296 | 2297 |
|
2297 | 2298 | # pillow's getsize method was deprecated in 9.2.0 (see docs for PIL.ImageFont.ImageFont.getsize) |
| 2299 | + # noinspection PyDeprecation |
2298 | 2300 | if pkg_resources.parse_version( |
2299 | 2301 | pkg_resources.get_distribution('pillow').version) < pkg_resources.parse_version('9.2.0'): |
2300 | 2302 | font_width, font_height = font.getsize(text) |
@@ -2439,6 +2441,7 @@ def create_authorisation_window(self, request): |
2439 | 2441 | setattr(authorisation_window, 'get_title', lambda window: window.title) # add missing get_title method |
2440 | 2442 |
|
2441 | 2443 | # pywebview 3.6+ moved window events to a separate namespace in a non-backwards-compatible way |
| 2444 | + # noinspection PyDeprecation |
2442 | 2445 | if pkg_resources.parse_version( |
2443 | 2446 | pkg_resources.get_distribution('pywebview').version) < pkg_resources.parse_version('3.6'): |
2444 | 2447 | authorisation_window.loaded += self.authorisation_window_loaded |
|
0 commit comments