kivydk 0.0.3.dev2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- kivydk-0.0.3.dev2/LICENSE +21 -0
- kivydk-0.0.3.dev2/MANIFEST.in +1 -0
- kivydk-0.0.3.dev2/PKG-INFO +70 -0
- kivydk-0.0.3.dev2/README.md +5 -0
- kivydk-0.0.3.dev2/pyproject.toml +68 -0
- kivydk-0.0.3.dev2/setup.cfg +4 -0
- kivydk-0.0.3.dev2/src/kivydk/__init__.py +48 -0
- kivydk-0.0.3.dev2/src/kivydk/_version.py +31 -0
- kivydk-0.0.3.dev2/src/kivydk/core/__init__.py +19 -0
- kivydk-0.0.3.dev2/src/kivydk/core/mapping/__init__.py +19 -0
- kivydk-0.0.3.dev2/src/kivydk/core/mapping/cursors.py +121 -0
- kivydk-0.0.3.dev2/src/kivydk/core/mapping/icons.py +7328 -0
- kivydk-0.0.3.dev2/src/kivydk/core/resources/__init__.py +14 -0
- kivydk-0.0.3.dev2/src/kivydk/core/resources/fonts.py +99 -0
- kivydk-0.0.3.dev2/src/kivydk/data/fonts/JetBrainsMono/JetBrainsMono-Bold.otf +0 -0
- kivydk-0.0.3.dev2/src/kivydk/data/fonts/JetBrainsMono/JetBrainsMono-Bold.ttf +0 -0
- kivydk-0.0.3.dev2/src/kivydk/data/fonts/JetBrainsMono/JetBrainsMono-BoldItalic.otf +0 -0
- kivydk-0.0.3.dev2/src/kivydk/data/fonts/JetBrainsMono/JetBrainsMono-BoldItalic.ttf +0 -0
- kivydk-0.0.3.dev2/src/kivydk/data/fonts/JetBrainsMono/JetBrainsMono-Italic.otf +0 -0
- kivydk-0.0.3.dev2/src/kivydk/data/fonts/JetBrainsMono/JetBrainsMono-Italic.ttf +0 -0
- kivydk-0.0.3.dev2/src/kivydk/data/fonts/JetBrainsMono/JetBrainsMono-Regular.otf +0 -0
- kivydk-0.0.3.dev2/src/kivydk/data/fonts/JetBrainsMono/JetBrainsMono-Regular.ttf +0 -0
- kivydk-0.0.3.dev2/src/kivydk/data/fonts/JetBrainsMono/LICENSE.txt +93 -0
- kivydk-0.0.3.dev2/src/kivydk/data/fonts/MaterialIcons/LICENSE.txt +202 -0
- kivydk-0.0.3.dev2/src/kivydk/data/fonts/MaterialIcons/MaterialIcons-Filled.ttf +0 -0
- kivydk-0.0.3.dev2/src/kivydk/data/fonts/MaterialIcons/MaterialIcons-Outlined.otf +0 -0
- kivydk-0.0.3.dev2/src/kivydk/data/fonts/MaterialIcons/MaterialIcons-Round.otf +0 -0
- kivydk-0.0.3.dev2/src/kivydk/data/fonts/MaterialIcons/MaterialIcons-Sharp.otf +0 -0
- kivydk-0.0.3.dev2/src/kivydk/data/fonts/MaterialIcons/MaterialIcons-TwoTone.otf +0 -0
- kivydk-0.0.3.dev2/src/kivydk/data/fonts/materialdesignicons-webfont.ttf +0 -0
- kivydk-0.0.3.dev2/src/kivydk/logger.py +76 -0
- kivydk-0.0.3.dev2/src/kivydk/tools/monkey/event.py +37 -0
- kivydk-0.0.3.dev2/src/kivydk/tools/monkey/patch.py +12 -0
- kivydk-0.0.3.dev2/src/kivydk/uix/__init__.py +24 -0
- kivydk-0.0.3.dev2/src/kivydk/uix/behavior/__init__.py +40 -0
- kivydk-0.0.3.dev2/src/kivydk/uix/behavior/click.py +87 -0
- kivydk-0.0.3.dev2/src/kivydk/uix/behavior/hover.py +89 -0
- kivydk-0.0.3.dev2/src/kivydk/uix/manager/__init__.py +17 -0
- kivydk-0.0.3.dev2/src/kivydk/uix/manager/hover.py +79 -0
- kivydk-0.0.3.dev2/src/kivydk/uix/widgets/__init__.py +29 -0
- kivydk-0.0.3.dev2/src/kivydk/uix/widgets/line_number.py +346 -0
- kivydk-0.0.3.dev2/src/kivydk.egg-info/PKG-INFO +70 -0
- kivydk-0.0.3.dev2/src/kivydk.egg-info/SOURCES.txt +44 -0
- kivydk-0.0.3.dev2/src/kivydk.egg-info/dependency_links.txt +1 -0
- kivydk-0.0.3.dev2/src/kivydk.egg-info/requires.txt +10 -0
- kivydk-0.0.3.dev2/src/kivydk.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Afanase Ioan (ASI)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
recursive-include src/kivydk/data *
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: kivydk
|
|
3
|
+
Version: 0.0.3.dev2
|
|
4
|
+
Summary: Kivy Desktop Kit — A desktop-focused UI toolkit for Kivy
|
|
5
|
+
Author: ASI
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026 Afanase Ioan (ASI)
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
Project-URL: Source, https://github.com/kmcasi/KivyDK
|
|
28
|
+
Project-URL: Issues, https://github.com/kmcasi/KivyDK/issues
|
|
29
|
+
Keywords: kivy,kivydk,desktop,kit,ui,uix,material
|
|
30
|
+
Classifier: Development Status :: 4 - Beta
|
|
31
|
+
Classifier: Intended Audience :: Developers
|
|
32
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
33
|
+
Classifier: Intended Audience :: Information Technology
|
|
34
|
+
Classifier: Intended Audience :: Science/Research
|
|
35
|
+
Classifier: Natural Language :: English
|
|
36
|
+
Classifier: Operating System :: OS Independent
|
|
37
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
38
|
+
Classifier: Programming Language :: Python :: 3
|
|
39
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
40
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
41
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
42
|
+
Classifier: Topic :: Artistic Software
|
|
43
|
+
Classifier: Topic :: Games/Entertainment
|
|
44
|
+
Classifier: Topic :: Multimedia :: Graphics :: 3D Rendering
|
|
45
|
+
Classifier: Topic :: Multimedia :: Graphics :: Capture :: Digital Camera
|
|
46
|
+
Classifier: Topic :: Multimedia :: Graphics :: Presentation
|
|
47
|
+
Classifier: Topic :: Multimedia :: Graphics :: Viewers
|
|
48
|
+
Classifier: Topic :: Multimedia :: Sound/Audio :: Players :: MP3
|
|
49
|
+
Classifier: Topic :: Multimedia :: Video :: Display
|
|
50
|
+
Classifier: Topic :: Scientific/Engineering :: Human Machine Interfaces
|
|
51
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
52
|
+
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
53
|
+
Classifier: Topic :: Software Development :: User Interfaces
|
|
54
|
+
Requires-Python: >=3.12
|
|
55
|
+
Description-Content-Type: text/markdown
|
|
56
|
+
Requires-Dist: kivy>=2.3.1
|
|
57
|
+
Requires-Dist: Pygments>=2.19.2
|
|
58
|
+
Requires-Dist: pillow>=12.1.0
|
|
59
|
+
Provides-Extra: docs
|
|
60
|
+
Requires-Dist: sphinx; extra == "docs"
|
|
61
|
+
Requires-Dist: sphinx-copybutton; extra == "docs"
|
|
62
|
+
Requires-Dist: sphinx_design; extra == "docs"
|
|
63
|
+
Requires-Dist: sphinx_localtoc; extra == "docs"
|
|
64
|
+
Requires-Dist: furo; extra == "docs"
|
|
65
|
+
|
|
66
|
+
# KivyDK — Kivy Desktop Kit
|
|
67
|
+
# WIP - Work in progress
|
|
68
|
+
|
|
69
|
+
KivyDK is a desktop-focused UI toolkit for Kivy, designed to support multi-monitor workflows, editor-inspired widgets, and advanced behaviors like hover, click and bind.
|
|
70
|
+
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=82", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "kivydk"
|
|
7
|
+
version = "0.0.3.dev2"
|
|
8
|
+
description = "Kivy Desktop Kit — A desktop-focused UI toolkit for Kivy"
|
|
9
|
+
authors = [{ name = "ASI" }]
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
license = { file = "LICENSE" }
|
|
12
|
+
requires-python = ">=3.12"
|
|
13
|
+
keywords = ["kivy", "kivydk", "desktop", "kit", "ui", "uix", "material"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 4 - Beta",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
"Intended Audience :: End Users/Desktop",
|
|
18
|
+
"Intended Audience :: Information Technology",
|
|
19
|
+
"Intended Audience :: Science/Research",
|
|
20
|
+
"Natural Language :: English",
|
|
21
|
+
"Operating System :: OS Independent",
|
|
22
|
+
"Operating System :: Microsoft :: Windows",
|
|
23
|
+
"Programming Language :: Python :: 3",
|
|
24
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
25
|
+
"Programming Language :: Python :: 3.12",
|
|
26
|
+
"Programming Language :: Python :: Implementation :: CPython",
|
|
27
|
+
"Topic :: Artistic Software",
|
|
28
|
+
"Topic :: Games/Entertainment",
|
|
29
|
+
"Topic :: Multimedia :: Graphics :: 3D Rendering",
|
|
30
|
+
"Topic :: Multimedia :: Graphics :: Capture :: Digital Camera",
|
|
31
|
+
"Topic :: Multimedia :: Graphics :: Presentation",
|
|
32
|
+
"Topic :: Multimedia :: Graphics :: Viewers",
|
|
33
|
+
"Topic :: Multimedia :: Sound/Audio :: Players :: MP3",
|
|
34
|
+
"Topic :: Multimedia :: Video :: Display",
|
|
35
|
+
"Topic :: Scientific/Engineering :: Human Machine Interfaces",
|
|
36
|
+
"Topic :: Scientific/Engineering :: Visualization",
|
|
37
|
+
"Topic :: Software Development :: Libraries :: Application Frameworks",
|
|
38
|
+
"Topic :: Software Development :: User Interfaces",
|
|
39
|
+
]
|
|
40
|
+
dependencies = [
|
|
41
|
+
"kivy>=2.3.1",
|
|
42
|
+
"Pygments>=2.19.2",
|
|
43
|
+
"pillow>=12.1.0",
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
[project.urls]
|
|
47
|
+
Source = "https://github.com/kmcasi/KivyDK"
|
|
48
|
+
Issues = "https://github.com/kmcasi/KivyDK/issues"
|
|
49
|
+
|
|
50
|
+
[tool.setuptools]
|
|
51
|
+
package-dir = {"" = "src"}
|
|
52
|
+
license-files = []
|
|
53
|
+
include-package-data = true
|
|
54
|
+
|
|
55
|
+
[tool.setuptools.packages.find]
|
|
56
|
+
where = ["src"]
|
|
57
|
+
|
|
58
|
+
[tool.setuptools.package-data]
|
|
59
|
+
kivydk = ["data/**/*"]
|
|
60
|
+
|
|
61
|
+
[project.optional-dependencies]
|
|
62
|
+
docs = [
|
|
63
|
+
"sphinx",
|
|
64
|
+
"sphinx-copybutton",
|
|
65
|
+
"sphinx_design",
|
|
66
|
+
"sphinx_localtoc",
|
|
67
|
+
"furo",
|
|
68
|
+
]
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#//|>-----------------------------------------------------------------------------------------------------------------<|
|
|
2
|
+
#//| Copyright (c) 14 Jan 2026. All rights are reserved by ASI
|
|
3
|
+
#//|>-----------------------------------------------------------------------------------------------------------------<|
|
|
4
|
+
"""
|
|
5
|
+
The ``kivydk`` module provides the core infrastructure, global configuration and shared resources used throughout
|
|
6
|
+
the KivyDK framework. While most functionality is implemented in submodules, the top-level package exposes a small
|
|
7
|
+
set of global paths that define the runtime environment for all KivyDK components.
|
|
8
|
+
"""
|
|
9
|
+
__all__ = ("DIR_ROOT", "DIR_DATA", "DIR_FONTS")
|
|
10
|
+
|
|
11
|
+
#//|>-----------------------------------------------------------------------------------------------------------------<|
|
|
12
|
+
#//| KivyDK monkey-patch's
|
|
13
|
+
#//|>-----------------------------------------------------------------------------------------------------------------<|
|
|
14
|
+
# from kivydk.tools.monkey.patch import MonkeyPatchAll
|
|
15
|
+
|
|
16
|
+
# MonkeyPatchAll()
|
|
17
|
+
|
|
18
|
+
#//|>-----------------------------------------------------------------------------------------------------------------<|
|
|
19
|
+
#//| KivyDK directories
|
|
20
|
+
#//|>-----------------------------------------------------------------------------------------------------------------<|
|
|
21
|
+
from importlib.resources import files # noqa: E402
|
|
22
|
+
from importlib.resources.abc import Traversable # noqa: E402
|
|
23
|
+
|
|
24
|
+
#: The root directory of the KivyDK package.
|
|
25
|
+
DIR_ROOT: Traversable = files(__name__)
|
|
26
|
+
|
|
27
|
+
#: The base directory containing framework data files such as fonts, themes and other assets.
|
|
28
|
+
DIR_DATA: Traversable = DIR_ROOT / "data"
|
|
29
|
+
|
|
30
|
+
#: Directory containing all font resources automatically registered at startup.
|
|
31
|
+
DIR_FONTS: Traversable = DIR_DATA / "fonts"
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
#//|>-----------------------------------------------------------------------------------------------------------------<|
|
|
35
|
+
#//| KivyDK initialization helpers
|
|
36
|
+
#//|>-----------------------------------------------------------------------------------------------------------------<|
|
|
37
|
+
from kivydk.core.resources.fonts import _auto_register_fonts # noqa: E402
|
|
38
|
+
|
|
39
|
+
_auto_register_fonts(DIR_FONTS)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
#//|>-----------------------------------------------------------------------------------------------------------------<|
|
|
43
|
+
#//| KivyDK initialization log
|
|
44
|
+
#//|>-----------------------------------------------------------------------------------------------------------------<|
|
|
45
|
+
from kivydk._version import VERSION_STRING # noqa: E402
|
|
46
|
+
from kivydk.logger import Logger # noqa: E402
|
|
47
|
+
|
|
48
|
+
Logger.InfoS(version=VERSION_STRING, root_directory=DIR_ROOT)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#//|>-----------------------------------------------------------------------------------------------------------------<|
|
|
2
|
+
#//| Copyright (c) 21 Jan 2026. All rights are reserved by ASI
|
|
3
|
+
#//|>-----------------------------------------------------------------------------------------------------------------<|
|
|
4
|
+
__all__ = (
|
|
5
|
+
"MAJOR", "MINOR", "MICRO", "REVISION",
|
|
6
|
+
"RELEASE", "VERSION_STRING"
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
#//| Version variables
|
|
10
|
+
#//|>--------------------------------------------------------<|
|
|
11
|
+
MAJOR: int = 0
|
|
12
|
+
MINOR: int = 0
|
|
13
|
+
MICRO: int = 3
|
|
14
|
+
VERSION_STRING: str = f"{MAJOR}.{MINOR}.{MICRO}"
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
#//| Development | Revision variables
|
|
18
|
+
#//|>--------------------------------------------------------<|
|
|
19
|
+
REVISION: int = 0
|
|
20
|
+
RELEASE: bool = False
|
|
21
|
+
|
|
22
|
+
# If is not the stable release, update `VERSION_STRING` to reflect that
|
|
23
|
+
if not RELEASE:
|
|
24
|
+
VERSION_STRING.join(f".dev{max(1, REVISION)}")
|
|
25
|
+
elif REVISION:
|
|
26
|
+
VERSION_STRING.join(f".{REVISION}")
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
#//| exec'd from setup.py ?
|
|
30
|
+
#//|>--------------------------------------------------------<|
|
|
31
|
+
__version__: str = VERSION_STRING
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#//|>-----------------------------------------------------------------------------------------------------------------<|
|
|
2
|
+
#//| Copyright (c) 17 Apr 2026. All rights are reserved by ASI
|
|
3
|
+
#//|>-----------------------------------------------------------------------------------------------------------------<|
|
|
4
|
+
"""
|
|
5
|
+
This ``core`` package contains the low-level building blocks that power the entire KivyDK framework.
|
|
6
|
+
The module provide fundamental logic and system utilities that higher-level UI components rely on.
|
|
7
|
+
|
|
8
|
+
The purpose of ``core`` is to centralize functionality that must remain lightweight, reusable and independent of any
|
|
9
|
+
specific editor or widget. Most editors and UI components in KivyDK depend on these modules to provide
|
|
10
|
+
consistent behavior across the entire ecosystem.
|
|
11
|
+
|
|
12
|
+
.. caution::
|
|
13
|
+
Unlike the widgets found in :mod:`kivydk.uix`, the classes and functions in ``core`` are **not** intended to be
|
|
14
|
+
used directly as visual elements. They represent internal mechanisms that support the framework’s behavior.
|
|
15
|
+
|
|
16
|
+
.. important::
|
|
17
|
+
If a feature appears to be missing at the widget level, consider checking :mod:`kivydk.uix` first before
|
|
18
|
+
relying on ``core``.
|
|
19
|
+
"""
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#//|>-----------------------------------------------------------------------------------------------------------------<|
|
|
2
|
+
#//| Copyright (c) 12 Jan 2026. All rights are reserved by ASI
|
|
3
|
+
#//|>-----------------------------------------------------------------------------------------------------------------<|
|
|
4
|
+
"""
|
|
5
|
+
This package contains lightweight semantic mappings used throughout KivyDK to make common
|
|
6
|
+
framework constants easier to discover and work with. The goal of these mappings is not to
|
|
7
|
+
abstract platform behavior, but to provide clean, IDE‑friendly namespaces that group related
|
|
8
|
+
identifiers into readable structures.
|
|
9
|
+
|
|
10
|
+
They exist purely to make the KivyDK API more expressive, discoverable and pleasant to use.
|
|
11
|
+
"""
|
|
12
|
+
__all__ = (
|
|
13
|
+
"CursorDefault", "CursorWindows",
|
|
14
|
+
"Icon"
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
#// IMPORT
|
|
18
|
+
from .cursors import CursorDefault, CursorWindows
|
|
19
|
+
from .icons import Icon
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
#//|>-----------------------------------------------------------------------------------------------------------------<|
|
|
2
|
+
#//| Copyright (c) 21 May 2025. All rights are reserved by ASI
|
|
3
|
+
#//|>-----------------------------------------------------------------------------------------------------------------<|
|
|
4
|
+
"""
|
|
5
|
+
This module defines the cursor‑mapping layer used by KivyDK to provide a consistent and extensible way of
|
|
6
|
+
managing system cursors across different platforms. It abstracts Kivy’s low‑level cursor handling and exposes
|
|
7
|
+
a small, stable API for setting or resetting the active cursor within the application.
|
|
8
|
+
|
|
9
|
+
These mappings allow widgets, behaviors and higher‑level components to request semantic cursor types
|
|
10
|
+
(e.g., “resize horizontal”, “busy”, “text selection”) without needing to know the exact string identifiers
|
|
11
|
+
used by the underlying system.
|
|
12
|
+
"""
|
|
13
|
+
__all__ = ("CursorBase", "CursorDefault", "CursorWindows")
|
|
14
|
+
|
|
15
|
+
#// IMPORT
|
|
16
|
+
# TODO: Extend `kivydk.core.window_adapter.WindowAdapter` to implement cursor functionality in `panda3d` system.
|
|
17
|
+
from kivy.core.window import Window
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
#// LOGIC
|
|
21
|
+
class CursorBase:
|
|
22
|
+
"""
|
|
23
|
+
Lightweight base class for all cursor‑mapping groups in KivyDK.
|
|
24
|
+
|
|
25
|
+
This class provides the minimal functionality required to apply or restore a system
|
|
26
|
+
cursor using Kivy’s window provider. Subclasses define semantic cursor names, while
|
|
27
|
+
:class:`CursorBase` handles the actual call to :func:`Window.set_system_cursor`.
|
|
28
|
+
"""
|
|
29
|
+
# Private variables
|
|
30
|
+
__default_cursor: str | None = None
|
|
31
|
+
|
|
32
|
+
@staticmethod
|
|
33
|
+
def set(cursor: str | None) -> None:
|
|
34
|
+
"""
|
|
35
|
+
Applies the given cursor using Kivy’s window provider.
|
|
36
|
+
|
|
37
|
+
This method is a thin wrapper around :func:`Window.set_system_cursor` used by all
|
|
38
|
+
cursor mapping classes to activate a specific cursor. It accepts ``None`` as a safe no‑op,
|
|
39
|
+
allowing subclasses to call :meth:`reset` even if their default cursor value has not been initialized yet.
|
|
40
|
+
|
|
41
|
+
This function does not validate the cursor name; it assumes that subclasses provide
|
|
42
|
+
valid identifiers based on Kivy’s built‑in cursor strings.
|
|
43
|
+
"""
|
|
44
|
+
if cursor is not None:
|
|
45
|
+
Window.set_system_cursor(cursor)
|
|
46
|
+
|
|
47
|
+
@staticmethod
|
|
48
|
+
def reset() -> None:
|
|
49
|
+
"""
|
|
50
|
+
Restores the default cursor defined by the active cursor mapping class.
|
|
51
|
+
|
|
52
|
+
The default cursor is stored internally on :class:`CursorBase` and overridden by
|
|
53
|
+
subclasses. Calling this method ensures that the application returns to a predictable cursor state
|
|
54
|
+
after temporary cursor changes (e.g., during drag operations or hover interactions).
|
|
55
|
+
"""
|
|
56
|
+
CursorBase.set(CursorBase.__default_cursor)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class CursorDefault(CursorBase):
|
|
60
|
+
"""
|
|
61
|
+
Default cursor mapping used by KivyDK.
|
|
62
|
+
|
|
63
|
+
A nested :class:`Size` namespace contains the resize‑related cursor identifiers.
|
|
64
|
+
|
|
65
|
+
The default cursor for this mapping is :attr:`Arrow`, which is restored when calling
|
|
66
|
+
:meth:`CursorDefault.reset()`.
|
|
67
|
+
"""
|
|
68
|
+
Arrow = "arrow"
|
|
69
|
+
Crosshair = "crosshair"
|
|
70
|
+
Hand = "hand"
|
|
71
|
+
I_Beam = "ibeam"
|
|
72
|
+
No = "no"
|
|
73
|
+
Wait = "wait"
|
|
74
|
+
Wait_Arrow = "wait_arrow"
|
|
75
|
+
|
|
76
|
+
class Size:
|
|
77
|
+
NWSE = "size_nwse"
|
|
78
|
+
NESW = "size_nesw"
|
|
79
|
+
WE = "size_we"
|
|
80
|
+
NS = "size_ns"
|
|
81
|
+
All = "size_all"
|
|
82
|
+
|
|
83
|
+
# Set the default cursor what will be used on the `reset` function
|
|
84
|
+
CursorBase._CursorBase__default_cursor = Arrow
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
class CursorWindows(CursorBase):
|
|
88
|
+
"""
|
|
89
|
+
Windows‑style cursor mapping for developers who prefer familiar naming conventions.
|
|
90
|
+
|
|
91
|
+
This class provides semantic cursor names that resemble those commonly used on
|
|
92
|
+
Microsoft Windows (e.g., ``Busy``, ``Move``, ``Unavailable``). Internally, these
|
|
93
|
+
names still map to Kivy’s built‑in cursor identifiers; the goal is to improve
|
|
94
|
+
readability and autocompletion, not to emulate native Windows cursor behavior.
|
|
95
|
+
|
|
96
|
+
Two nested namespaces :class:`Select` and :class:`Resize` group related cursor types
|
|
97
|
+
for text selection and directional resizing.
|
|
98
|
+
|
|
99
|
+
The default cursor for this mapping is :attr:`Normal`, restored via
|
|
100
|
+
:meth:`CursorWindows.reset()`.
|
|
101
|
+
"""
|
|
102
|
+
Busy = "wait"
|
|
103
|
+
Move = "size_all"
|
|
104
|
+
Normal = "arrow"
|
|
105
|
+
Unavailable = "no"
|
|
106
|
+
Working_In_Background = Busy_In_Background = "wait_arrow"
|
|
107
|
+
|
|
108
|
+
class Select:
|
|
109
|
+
Link = "hand"
|
|
110
|
+
Normal = "arrow"
|
|
111
|
+
Precision = "crosshair"
|
|
112
|
+
Text = "ibeam"
|
|
113
|
+
|
|
114
|
+
class Resize:
|
|
115
|
+
Diagonal_Left = "size_nwse"
|
|
116
|
+
Diagonal_Right = "size_nesw"
|
|
117
|
+
Horizontal = "size_we"
|
|
118
|
+
Vertical = "size_ns"
|
|
119
|
+
|
|
120
|
+
# Set the default cursor what will be used on the `reset` function
|
|
121
|
+
CursorBase._CursorBase__default_cursor = Normal
|