-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #83 from wojtryb/development
Deploy 1.5.2
- Loading branch information
Showing
10 changed files
with
67 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
# SPDX-FileCopyrightText: © 2022-2024 Wojciech Trybus <[email protected]> | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
import re | ||
from typing import Callable, Protocol, Any | ||
|
||
from krita import Krita as Api, Extension, qApp | ||
|
@@ -147,19 +148,23 @@ def is_light_theme_active(self) -> bool: | |
@property | ||
def version(self) -> Version: | ||
"""Get version of krita.""" | ||
try: | ||
raw_string: str = self.instance.version() | ||
version, *additional_info = raw_string.split("-") | ||
raw: str = self.instance.version() | ||
|
||
major, minor, fix = version.split(".") | ||
num = r"(0|[1-9]\d*)" | ||
dot = r"\." | ||
delimiter = r"[ -]?" | ||
info = r"(.*)" | ||
|
||
version = Version(int(major), int(minor), int(fix)) | ||
if additional_info: | ||
version.additional_info = additional_info[0] | ||
return version | ||
except Exception: | ||
regex = "^" + num + dot + num + dot + num + delimiter + info + "$" | ||
result = re.search(regex, raw) | ||
|
||
if result is None or len(result.groups()) != 4: | ||
return UnknownVersion() | ||
|
||
major, minor, fix, additional_info = result.groups() | ||
|
||
return Version(int(major), int(minor), int(fix), additional_info) | ||
|
||
|
||
class KritaWindow(Protocol): | ||
"""Krita window received in createActions() of main extension file.""" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters