Skip to content

Commit 6153da9

Browse files
authored
basic aliasing (#16)
* basic aliasing * formatting * Documentation * fix * Fix docs * fix * Bumpy python
1 parent 5e948d7 commit 6153da9

File tree

15 files changed

+127
-17
lines changed

15 files changed

+127
-17
lines changed

.readthedocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ build:
1212
apt_packages:
1313
- inkscape
1414
tools:
15-
python: "3.8"
15+
python: "3.9"
1616
jobs:
1717
pre_build:
1818
- pip install .[docs]

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Installation
1717
----------------------
1818
TkClassWizard can be installed though command prompt/terminal using the bottom commands.
1919

20-
Pre-requirement: `Python (minimum v3.8) <https://www.python.org/downloads/>`_
20+
Pre-requirement: `Python (minimum v3.9) <https://www.python.org/downloads/>`_
2121

2222

2323
.. code-block:: bash

docs/source/changelog.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ Releases
2727
v1.2
2828
================
2929
- Generic types support (Parametric types)
30+
- :ref:`Type aliasing`
31+
- |BREAK_CH| Minimal Python version bumped to Python 3.9
3032

3133
v1.1.1
3234
================

docs/source/conf.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929

3030

3131
# -- General configuration ---------------------------------------------------
32-
root_doc = 'index'
33-
3432
numfig = True
3533

3634
# Add any Sphinx extension module names here, as strings. They can be

docs/source/guide/aliasing.rst

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
========================
2+
Type aliasing
3+
========================
4+
5+
TkClassWizard allows types to be aliased.
6+
Alias is an alternative name or nickname for a specific type.
7+
8+
Type aliasing can be done within the :func:`tkclasswiz.aliasing.register_alias` function.
9+
An alias can be obtained through :func:`tkclasswiz.aliasing.get_aliased_name` function.
10+
11+
For example, we can give the :class:`~datetime.timedelta` type an alternative name:
12+
13+
.. code-block:: python
14+
15+
from datetime import timedelta
16+
import tkclasswiz as wiz
17+
18+
wiz.register_alias(timedelta, "Duration")
19+
20+
21+
If we define a type alias like in the above example, then the timedelta class will look like shown in the following 2 images:
22+
23+
24+
.. figure:: ./images/type_alias_one_frame_param.png
25+
:width: 15cm
26+
27+
:class:`~datetime.timedelta` type alias display after definition of parameters.
28+
29+
|
30+
31+
.. figure:: ./images/new_define_frame_struct_alias_new_timedelta.png
32+
:width: 15cm
33+
34+
:class:`~datetime.timedelta` type alias display inside the New object menu.

docs/source/guide/defining.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ This is how our example from the previous page looks inside a GUI:
99
:width: 15cm
1010

1111

12-
1312
Defining structured data (objects)
1413
=======================================
1514

32 KB
Loading
4.82 KB
Loading

docs/source/guide/index.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ Index:
1515
conversion
1616
polymorphism
1717
abstractclasses
18-
generics
18+
aliasing
19+
generics

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ authors = [
1313
]
1414
description = "Library for graphically defining objects based on class annotations. Works with Tkinter / TTKBootstrap"
1515
readme = "README.rst"
16-
requires-python = ">=3.8"
16+
requires-python = ">=3.9"
1717
keywords = ["Tkinter", "TTKBootstrap", "Python3", "ObjectDef", "ClassWiz", "ClassWiz", "GUI"]
1818
classifiers = [
1919
"Programming Language :: Python :: 3",

0 commit comments

Comments
 (0)