config-cli-gui 0.2.8__tar.gz → 0.2.10__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.
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/HISTORY.md +10 -2
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/PKG-INFO +47 -27
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/config.yaml +7 -1
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/docs/index.md +46 -26
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/docs/usage/config.md +9 -6
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/src/config_cli_gui/_version.py +3 -3
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/src/config_cli_gui/configtypes/font.py +9 -3
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/src/config_cli_gui/gui.py +25 -11
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/src/config_cli_gui.egg-info/PKG-INFO +47 -27
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/tests/example_project/config/config_example.py +18 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/.github/FUNDING.yml +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/.github/actions/setup-environment/action.yml +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/.github/dependabot.yml +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/.github/init.sh +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/.github/release_message.sh +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/.github/update_funding.py +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/.github/workflows/main.yml +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/.github/workflows/release.yml +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/.github/workflows/update_readme.yml +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/.gitignore +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/.idea/runConfigurations/config_generate.xml +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/.idea/runConfigurations/example_project_cli.xml +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/.idea/runConfigurations/example_project_gui.xml +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/.pre-commit-config.yaml +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/.readthedocs.yaml +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/LICENSE +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/Makefile +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/README.md +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/docs/.nav.yml +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/docs/_static/img/favicon.png +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/docs/_static/img/logo.png +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/docs/css/custom.css +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/docs/develop/contributing.md +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/docs/develop/make_windows.md +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/docs/develop/naming_convention.md +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/docs/funding/funding.md +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/docs/getting-started/install.md +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/docs/getting-started/virtual-environment.md +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/docs/usage/cli.md +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/mkdocs.yml +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/pyproject.toml +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/scripts/show_filelist.ps1 +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/scripts/show_tree.ps1 +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/scripts/show_tree.py +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/scripts/update_readme.py +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/setup.cfg +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/src/__init__.py +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/src/config_cli_gui/__init__.py +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/src/config_cli_gui/cli.py +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/src/config_cli_gui/config.py +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/src/config_cli_gui/configtypes/__init__.py +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/src/config_cli_gui/configtypes/color.py +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/src/config_cli_gui/configtypes/vector.py +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/src/config_cli_gui/docs.py +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/src/config_cli_gui.egg-info/SOURCES.txt +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/src/config_cli_gui.egg-info/dependency_links.txt +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/src/config_cli_gui.egg-info/entry_points.txt +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/src/config_cli_gui.egg-info/requires.txt +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/src/config_cli_gui.egg-info/top_level.txt +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/template.yml.url +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/tests/__init__.py +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/tests/example_project/__init__.py +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/tests/example_project/__main__.py +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/tests/example_project/cli/__init__.py +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/tests/example_project/cli/__main__.py +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/tests/example_project/cli/cli_example.py +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/tests/example_project/config/__init__.py +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/tests/example_project/core/__init__.py +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/tests/example_project/core/base.py +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/tests/example_project/core/logging.py +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/tests/example_project/example.gpx +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/tests/example_project/gui/__init__.py +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/tests/example_project/gui/__main__.py +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/tests/example_project/gui/config.yaml +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/tests/example_project/gui/gui_example.py +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/tests/test_cli.py +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/tests/test_config_manager.py +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/tests/test_docs.py +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/tests/test_generic_cli.py +0 -0
- {config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/uv.lock +0 -0
|
@@ -2,8 +2,16 @@ Changelog
|
|
|
2
2
|
=========
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
(
|
|
6
|
-
|
|
5
|
+
0.2.9 (2025-12-03)
|
|
6
|
+
------------------
|
|
7
|
+
- Docs: Update HISTORY.md for release 0.2.9. [Paul Magister]
|
|
8
|
+
- Spinbox for vector. [Paul Magister]
|
|
9
|
+
- Better example, make get_image_font sensitive to dpi, [Paul Magister]
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
0.2.8 (2025-12-02)
|
|
13
|
+
------------------
|
|
14
|
+
- Docs: Update HISTORY.md for release 0.2.8. [Paul Magister]
|
|
7
15
|
- Refactoring: get_image_font will look for the actual font path in the
|
|
8
16
|
system. [Paul Magister]
|
|
9
17
|
- Font preview. [Paul Magister]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: config-cli-gui
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.10
|
|
4
4
|
Summary: Feature-rich Python project template for config-cli-gui.
|
|
5
5
|
Author: pamagister
|
|
6
6
|
Requires-Python: <3.12,>=3.10
|
|
@@ -81,40 +81,58 @@ Start by defining your application's configuration parameters in a central `conf
|
|
|
81
81
|
```python
|
|
82
82
|
# my_project/config_example.py
|
|
83
83
|
|
|
84
|
+
from datetime import datetime
|
|
85
|
+
from pathlib import Path
|
|
86
|
+
|
|
84
87
|
from config_cli_gui.config import (
|
|
85
88
|
ConfigCategory,
|
|
86
89
|
ConfigManager,
|
|
87
90
|
ConfigParameter,
|
|
88
91
|
)
|
|
92
|
+
from config_cli_gui.configtypes.color import Color
|
|
93
|
+
from config_cli_gui.configtypes.font import Font
|
|
94
|
+
from config_cli_gui.configtypes.vector import Vector
|
|
89
95
|
|
|
90
96
|
|
|
91
|
-
class
|
|
92
|
-
"""CLI-specific configuration parameters."""
|
|
93
|
-
|
|
97
|
+
class MiscConfig(ConfigCategory):
|
|
94
98
|
def get_category_name(self) -> str:
|
|
95
|
-
return "
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
help="Path to input (file or folder)",
|
|
102
|
-
required=True,
|
|
99
|
+
return "misc"
|
|
100
|
+
|
|
101
|
+
some_numeric: ConfigParameter = ConfigParameter(
|
|
102
|
+
name="some_numeric",
|
|
103
|
+
value=int(42),
|
|
104
|
+
help="Example integer",
|
|
103
105
|
is_cli=True,
|
|
104
106
|
)
|
|
105
107
|
|
|
106
|
-
|
|
107
|
-
name="
|
|
108
|
-
|
|
109
|
-
help="
|
|
110
|
-
is_cli=True,
|
|
108
|
+
some_vector: ConfigParameter = ConfigParameter(
|
|
109
|
+
name="some_vector",
|
|
110
|
+
value=Vector(1, 2, 3),
|
|
111
|
+
help="Example vector",
|
|
111
112
|
)
|
|
112
113
|
|
|
113
|
-
|
|
114
|
-
name="
|
|
115
|
-
|
|
116
|
-
help="
|
|
117
|
-
|
|
114
|
+
some_file: ConfigParameter = ConfigParameter(
|
|
115
|
+
name="some_file",
|
|
116
|
+
value=Path("some_file.txt"),
|
|
117
|
+
help="Path to the file to use",
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
some_color: ConfigParameter = ConfigParameter(
|
|
121
|
+
name="some_color",
|
|
122
|
+
value=Color(255, 0, 0),
|
|
123
|
+
help="Color setting for the application",
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
some_date: ConfigParameter = ConfigParameter(
|
|
127
|
+
name="some_date",
|
|
128
|
+
value=datetime.fromisoformat("2025-12-31 10:30:45"),
|
|
129
|
+
help="Date setting for the application",
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
some_font: ConfigParameter = ConfigParameter(
|
|
133
|
+
name="some_font",
|
|
134
|
+
value=Font("DejaVuSans.ttf", size=12, color=Color(0, 0, 255)),
|
|
135
|
+
help="Font setting for the application",
|
|
118
136
|
)
|
|
119
137
|
|
|
120
138
|
|
|
@@ -126,14 +144,14 @@ class AppConfig(ConfigCategory):
|
|
|
126
144
|
|
|
127
145
|
log_level: ConfigParameter = ConfigParameter(
|
|
128
146
|
name="log_level",
|
|
129
|
-
|
|
147
|
+
value="INFO",
|
|
130
148
|
choices=["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"],
|
|
131
149
|
help="Logging level for the application",
|
|
132
150
|
)
|
|
133
151
|
|
|
134
152
|
log_file_max_size: ConfigParameter = ConfigParameter(
|
|
135
153
|
name="log_file_max_size",
|
|
136
|
-
|
|
154
|
+
value=10,
|
|
137
155
|
help="Maximum log file size in MB before rotation",
|
|
138
156
|
)
|
|
139
157
|
|
|
@@ -141,11 +159,13 @@ class AppConfig(ConfigCategory):
|
|
|
141
159
|
class ProjectConfigManager(ConfigManager): # Inherit from ConfigManager
|
|
142
160
|
"""Main configuration manager that handles all parameter categories."""
|
|
143
161
|
|
|
144
|
-
|
|
145
|
-
|
|
162
|
+
app: AppConfig
|
|
163
|
+
misc: MiscConfig
|
|
164
|
+
|
|
146
165
|
def __init__(self, config_file: str | None = None, **kwargs):
|
|
147
166
|
"""Initialize the configuration manager with all parameter categories."""
|
|
148
|
-
|
|
167
|
+
categories = (MiscConfig(), AppConfig())
|
|
168
|
+
super().__init__(categories, config_file, **kwargs)
|
|
149
169
|
|
|
150
170
|
|
|
151
171
|
```
|
|
@@ -54,4 +54,10 @@ misc:
|
|
|
54
54
|
some_font:
|
|
55
55
|
- DejaVuSans.ttf
|
|
56
56
|
- 12
|
|
57
|
-
- '#0000ff'
|
|
57
|
+
- '#0000ff'
|
|
58
|
+
# Example integer | type=int
|
|
59
|
+
some_numeric: 42
|
|
60
|
+
# Example vector 2D | type=Vector
|
|
61
|
+
some_vector2d: (1, 2)
|
|
62
|
+
# Example vector 3D | type=Vector
|
|
63
|
+
some_vector3d: (1.1, 2.2, 3.3)
|
|
@@ -51,40 +51,58 @@ Start by defining your application's configuration parameters in a central `conf
|
|
|
51
51
|
```python
|
|
52
52
|
# my_project/config_example.py
|
|
53
53
|
|
|
54
|
+
from datetime import datetime
|
|
55
|
+
from pathlib import Path
|
|
56
|
+
|
|
54
57
|
from config_cli_gui.config import (
|
|
55
58
|
ConfigCategory,
|
|
56
59
|
ConfigManager,
|
|
57
60
|
ConfigParameter,
|
|
58
61
|
)
|
|
62
|
+
from config_cli_gui.configtypes.color import Color
|
|
63
|
+
from config_cli_gui.configtypes.font import Font
|
|
64
|
+
from config_cli_gui.configtypes.vector import Vector
|
|
59
65
|
|
|
60
66
|
|
|
61
|
-
class
|
|
62
|
-
"""CLI-specific configuration parameters."""
|
|
63
|
-
|
|
67
|
+
class MiscConfig(ConfigCategory):
|
|
64
68
|
def get_category_name(self) -> str:
|
|
65
|
-
return "
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
help="Path to input (file or folder)",
|
|
72
|
-
required=True,
|
|
69
|
+
return "misc"
|
|
70
|
+
|
|
71
|
+
some_numeric: ConfigParameter = ConfigParameter(
|
|
72
|
+
name="some_numeric",
|
|
73
|
+
value=int(42),
|
|
74
|
+
help="Example integer",
|
|
73
75
|
is_cli=True,
|
|
74
76
|
)
|
|
75
77
|
|
|
76
|
-
|
|
77
|
-
name="
|
|
78
|
-
|
|
79
|
-
help="
|
|
80
|
-
is_cli=True,
|
|
78
|
+
some_vector: ConfigParameter = ConfigParameter(
|
|
79
|
+
name="some_vector",
|
|
80
|
+
value=Vector(1, 2, 3),
|
|
81
|
+
help="Example vector",
|
|
81
82
|
)
|
|
82
83
|
|
|
83
|
-
|
|
84
|
-
name="
|
|
85
|
-
|
|
86
|
-
help="
|
|
87
|
-
|
|
84
|
+
some_file: ConfigParameter = ConfigParameter(
|
|
85
|
+
name="some_file",
|
|
86
|
+
value=Path("some_file.txt"),
|
|
87
|
+
help="Path to the file to use",
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
some_color: ConfigParameter = ConfigParameter(
|
|
91
|
+
name="some_color",
|
|
92
|
+
value=Color(255, 0, 0),
|
|
93
|
+
help="Color setting for the application",
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
some_date: ConfigParameter = ConfigParameter(
|
|
97
|
+
name="some_date",
|
|
98
|
+
value=datetime.fromisoformat("2025-12-31 10:30:45"),
|
|
99
|
+
help="Date setting for the application",
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
some_font: ConfigParameter = ConfigParameter(
|
|
103
|
+
name="some_font",
|
|
104
|
+
value=Font("DejaVuSans.ttf", size=12, color=Color(0, 0, 255)),
|
|
105
|
+
help="Font setting for the application",
|
|
88
106
|
)
|
|
89
107
|
|
|
90
108
|
|
|
@@ -96,14 +114,14 @@ class AppConfig(ConfigCategory):
|
|
|
96
114
|
|
|
97
115
|
log_level: ConfigParameter = ConfigParameter(
|
|
98
116
|
name="log_level",
|
|
99
|
-
|
|
117
|
+
value="INFO",
|
|
100
118
|
choices=["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"],
|
|
101
119
|
help="Logging level for the application",
|
|
102
120
|
)
|
|
103
121
|
|
|
104
122
|
log_file_max_size: ConfigParameter = ConfigParameter(
|
|
105
123
|
name="log_file_max_size",
|
|
106
|
-
|
|
124
|
+
value=10,
|
|
107
125
|
help="Maximum log file size in MB before rotation",
|
|
108
126
|
)
|
|
109
127
|
|
|
@@ -111,11 +129,13 @@ class AppConfig(ConfigCategory):
|
|
|
111
129
|
class ProjectConfigManager(ConfigManager): # Inherit from ConfigManager
|
|
112
130
|
"""Main configuration manager that handles all parameter categories."""
|
|
113
131
|
|
|
114
|
-
|
|
115
|
-
|
|
132
|
+
app: AppConfig
|
|
133
|
+
misc: MiscConfig
|
|
134
|
+
|
|
116
135
|
def __init__(self, config_file: str | None = None, **kwargs):
|
|
117
136
|
"""Initialize the configuration manager with all parameter categories."""
|
|
118
|
-
|
|
137
|
+
categories = (MiscConfig(), AppConfig())
|
|
138
|
+
super().__init__(categories, config_file, **kwargs)
|
|
119
139
|
|
|
120
140
|
|
|
121
141
|
```
|
|
@@ -41,10 +41,13 @@ The parameters in the cli category can be accessed via the command line interfac
|
|
|
41
41
|
|
|
42
42
|
## Category "misc"
|
|
43
43
|
|
|
44
|
-
| Name
|
|
45
|
-
|
|
46
|
-
|
|
|
47
|
-
|
|
|
48
|
-
|
|
|
49
|
-
|
|
|
44
|
+
| Name | Type | Description | Default | Choices |
|
|
45
|
+
|---------------|-----------|-----------------------------------|--------------------------------------------------------------|---------|
|
|
46
|
+
| some_numeric | int | Example integer | 42 | - |
|
|
47
|
+
| some_vector2d | Vector | Example vector 2D | Vector(1, 2) | - |
|
|
48
|
+
| some_vector3d | Vector | Example vector 3D | Vector(1.1, 2.2, 3.3) | - |
|
|
49
|
+
| some_file | PosixPath | Path to the file to use | PosixPath('some_file.txt') | - |
|
|
50
|
+
| some_color | Color | Color setting for the application | Color(255, 0, 0) | - |
|
|
51
|
+
| some_date | datetime | Date setting for the application | datetime.datetime(2025, 12, 31, 10, 30, 45) | - |
|
|
52
|
+
| some_font | Font | Font setting for the application | Font(type='DejaVuSans.ttf', size=12, color=Color(0, 0, 255)) | - |
|
|
50
53
|
|
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '0.2.
|
|
32
|
-
__version_tuple__ = version_tuple = (0, 2,
|
|
31
|
+
__version__ = version = '0.2.10'
|
|
32
|
+
__version_tuple__ = version_tuple = (0, 2, 10)
|
|
33
33
|
|
|
34
|
-
__commit_id__ = commit_id = '
|
|
34
|
+
__commit_id__ = commit_id = 'g50c7157ad'
|
|
@@ -54,13 +54,19 @@ class Font:
|
|
|
54
54
|
)
|
|
55
55
|
return cls(str(font_type), float(size), color)
|
|
56
56
|
|
|
57
|
-
def get_image_font(self) -> ImageFont.FreeTypeFont:
|
|
58
|
-
"""
|
|
57
|
+
def get_image_font(self, dpi=25.4) -> ImageFont.FreeTypeFont:
|
|
58
|
+
"""
|
|
59
|
+
Return a PIL FreeTypeFont, with fallback to default.
|
|
60
|
+
|
|
61
|
+
:param dpi: if dpi is provided, the font size is re-calculated on base of the dpi
|
|
62
|
+
:return:
|
|
63
|
+
"""
|
|
59
64
|
try:
|
|
60
65
|
if self.name in self.font_names:
|
|
61
66
|
idx = self.font_names.index(self.name)
|
|
62
67
|
path = self.font_files_sorted[idx]
|
|
63
|
-
|
|
68
|
+
size = self.size * dpi / 25.4
|
|
69
|
+
return ImageFont.truetype(path, size)
|
|
64
70
|
except Exception as e:
|
|
65
71
|
print(f"Fehler beim Laden der Schrift '{self.name}': {e}")
|
|
66
72
|
|
|
@@ -526,13 +526,27 @@ class GenericSettingsDialog:
|
|
|
526
526
|
"""Create vector editor widget."""
|
|
527
527
|
frame = ttk.Frame(parent)
|
|
528
528
|
|
|
529
|
-
vector_value = param.value if isinstance(param.value, Vector) else Vector()
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
529
|
+
vector_value = param.value if isinstance(param.value, Vector) else Vector(0, 0)
|
|
530
|
+
|
|
531
|
+
components = vector_value.to_list()
|
|
532
|
+
|
|
533
|
+
frame.vars = []
|
|
534
|
+
for value in components:
|
|
535
|
+
var = tk.DoubleVar(value=value)
|
|
536
|
+
spinbox = ttk.Spinbox(
|
|
537
|
+
frame,
|
|
538
|
+
from_=-999999.0,
|
|
539
|
+
to=999999.0,
|
|
540
|
+
increment=1.0,
|
|
541
|
+
textvariable=var,
|
|
542
|
+
width=8,
|
|
543
|
+
)
|
|
544
|
+
spinbox.pack(side=tk.LEFT, padx=(0, 5))
|
|
545
|
+
frame.vars.append(var)
|
|
546
|
+
|
|
547
|
+
if frame.winfo_children():
|
|
548
|
+
frame.entry_widget = frame.winfo_children()[0]
|
|
533
549
|
|
|
534
|
-
frame.var = var
|
|
535
|
-
frame.entry_widget = entry
|
|
536
550
|
return frame
|
|
537
551
|
|
|
538
552
|
def _create_datetime_widget(self, parent, param: ConfigParameter):
|
|
@@ -613,14 +627,16 @@ class GenericSettingsDialog:
|
|
|
613
627
|
if isinstance(param_value, Font):
|
|
614
628
|
selected_font_name = widget.font_type_var.get()
|
|
615
629
|
font_type = selected_font_name
|
|
616
|
-
if selected_font_name in widget.font_names:
|
|
617
|
-
font_type = widget.font_files[widget.font_names.index(selected_font_name)]
|
|
618
|
-
|
|
619
630
|
font_size = widget.font_size_var.get()
|
|
620
631
|
font_color = Color.from_hex(widget.color_var.get())
|
|
621
632
|
overrides[key] = Font(font_type, font_size, font_color)
|
|
622
633
|
continue
|
|
623
634
|
|
|
635
|
+
if isinstance(param_value, Vector):
|
|
636
|
+
components = [v.get() for v in widget.vars]
|
|
637
|
+
overrides[key] = Vector.from_list(components)
|
|
638
|
+
continue
|
|
639
|
+
|
|
624
640
|
value = widget.var.get()
|
|
625
641
|
|
|
626
642
|
# Convert value to appropriate type
|
|
@@ -641,8 +657,6 @@ class GenericSettingsDialog:
|
|
|
641
657
|
import json
|
|
642
658
|
|
|
643
659
|
overrides[key] = json.loads(value)
|
|
644
|
-
elif type(param_value) == Vector:
|
|
645
|
-
overrides[key] = Vector.from_str(value)
|
|
646
660
|
elif type(param_value) == int:
|
|
647
661
|
overrides[key] = int(value)
|
|
648
662
|
elif type(param_value) == float:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: config-cli-gui
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.10
|
|
4
4
|
Summary: Feature-rich Python project template for config-cli-gui.
|
|
5
5
|
Author: pamagister
|
|
6
6
|
Requires-Python: <3.12,>=3.10
|
|
@@ -81,40 +81,58 @@ Start by defining your application's configuration parameters in a central `conf
|
|
|
81
81
|
```python
|
|
82
82
|
# my_project/config_example.py
|
|
83
83
|
|
|
84
|
+
from datetime import datetime
|
|
85
|
+
from pathlib import Path
|
|
86
|
+
|
|
84
87
|
from config_cli_gui.config import (
|
|
85
88
|
ConfigCategory,
|
|
86
89
|
ConfigManager,
|
|
87
90
|
ConfigParameter,
|
|
88
91
|
)
|
|
92
|
+
from config_cli_gui.configtypes.color import Color
|
|
93
|
+
from config_cli_gui.configtypes.font import Font
|
|
94
|
+
from config_cli_gui.configtypes.vector import Vector
|
|
89
95
|
|
|
90
96
|
|
|
91
|
-
class
|
|
92
|
-
"""CLI-specific configuration parameters."""
|
|
93
|
-
|
|
97
|
+
class MiscConfig(ConfigCategory):
|
|
94
98
|
def get_category_name(self) -> str:
|
|
95
|
-
return "
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
help="Path to input (file or folder)",
|
|
102
|
-
required=True,
|
|
99
|
+
return "misc"
|
|
100
|
+
|
|
101
|
+
some_numeric: ConfigParameter = ConfigParameter(
|
|
102
|
+
name="some_numeric",
|
|
103
|
+
value=int(42),
|
|
104
|
+
help="Example integer",
|
|
103
105
|
is_cli=True,
|
|
104
106
|
)
|
|
105
107
|
|
|
106
|
-
|
|
107
|
-
name="
|
|
108
|
-
|
|
109
|
-
help="
|
|
110
|
-
is_cli=True,
|
|
108
|
+
some_vector: ConfigParameter = ConfigParameter(
|
|
109
|
+
name="some_vector",
|
|
110
|
+
value=Vector(1, 2, 3),
|
|
111
|
+
help="Example vector",
|
|
111
112
|
)
|
|
112
113
|
|
|
113
|
-
|
|
114
|
-
name="
|
|
115
|
-
|
|
116
|
-
help="
|
|
117
|
-
|
|
114
|
+
some_file: ConfigParameter = ConfigParameter(
|
|
115
|
+
name="some_file",
|
|
116
|
+
value=Path("some_file.txt"),
|
|
117
|
+
help="Path to the file to use",
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
some_color: ConfigParameter = ConfigParameter(
|
|
121
|
+
name="some_color",
|
|
122
|
+
value=Color(255, 0, 0),
|
|
123
|
+
help="Color setting for the application",
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
some_date: ConfigParameter = ConfigParameter(
|
|
127
|
+
name="some_date",
|
|
128
|
+
value=datetime.fromisoformat("2025-12-31 10:30:45"),
|
|
129
|
+
help="Date setting for the application",
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
some_font: ConfigParameter = ConfigParameter(
|
|
133
|
+
name="some_font",
|
|
134
|
+
value=Font("DejaVuSans.ttf", size=12, color=Color(0, 0, 255)),
|
|
135
|
+
help="Font setting for the application",
|
|
118
136
|
)
|
|
119
137
|
|
|
120
138
|
|
|
@@ -126,14 +144,14 @@ class AppConfig(ConfigCategory):
|
|
|
126
144
|
|
|
127
145
|
log_level: ConfigParameter = ConfigParameter(
|
|
128
146
|
name="log_level",
|
|
129
|
-
|
|
147
|
+
value="INFO",
|
|
130
148
|
choices=["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"],
|
|
131
149
|
help="Logging level for the application",
|
|
132
150
|
)
|
|
133
151
|
|
|
134
152
|
log_file_max_size: ConfigParameter = ConfigParameter(
|
|
135
153
|
name="log_file_max_size",
|
|
136
|
-
|
|
154
|
+
value=10,
|
|
137
155
|
help="Maximum log file size in MB before rotation",
|
|
138
156
|
)
|
|
139
157
|
|
|
@@ -141,11 +159,13 @@ class AppConfig(ConfigCategory):
|
|
|
141
159
|
class ProjectConfigManager(ConfigManager): # Inherit from ConfigManager
|
|
142
160
|
"""Main configuration manager that handles all parameter categories."""
|
|
143
161
|
|
|
144
|
-
|
|
145
|
-
|
|
162
|
+
app: AppConfig
|
|
163
|
+
misc: MiscConfig
|
|
164
|
+
|
|
146
165
|
def __init__(self, config_file: str | None = None, **kwargs):
|
|
147
166
|
"""Initialize the configuration manager with all parameter categories."""
|
|
148
|
-
|
|
167
|
+
categories = (MiscConfig(), AppConfig())
|
|
168
|
+
super().__init__(categories, config_file, **kwargs)
|
|
149
169
|
|
|
150
170
|
|
|
151
171
|
```
|
{config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/tests/example_project/config/config_example.py
RENAMED
|
@@ -181,6 +181,24 @@ class MiscConfig(ConfigCategory):
|
|
|
181
181
|
def get_category_name(self) -> str:
|
|
182
182
|
return "misc"
|
|
183
183
|
|
|
184
|
+
some_numeric: ConfigParameter = ConfigParameter(
|
|
185
|
+
name="some_numeric",
|
|
186
|
+
value=42,
|
|
187
|
+
help="Example integer",
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
some_vector2d: ConfigParameter = ConfigParameter(
|
|
191
|
+
name="some_vector2d",
|
|
192
|
+
value=Vector(1, 2),
|
|
193
|
+
help="Example vector 2D",
|
|
194
|
+
)
|
|
195
|
+
|
|
196
|
+
some_vector3d: ConfigParameter = ConfigParameter(
|
|
197
|
+
name="some_vector3d",
|
|
198
|
+
value=Vector(1.1, 2.2, 3.3),
|
|
199
|
+
help="Example vector 3D",
|
|
200
|
+
)
|
|
201
|
+
|
|
184
202
|
some_file: ConfigParameter = ConfigParameter(
|
|
185
203
|
name="some_file",
|
|
186
204
|
value=Path("some_file.txt"),
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/.idea/runConfigurations/example_project_cli.xml
RENAMED
|
File without changes
|
{config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/.idea/runConfigurations/example_project_gui.xml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{config_cli_gui-0.2.8 → config_cli_gui-0.2.10}/src/config_cli_gui.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|