Skip to content

Commit e9fdea2

Browse files
authored
Object nicknaming (#12)
* Nickname objects * Better display * Fix convert * docs * Documentation * index
1 parent 6153da9 commit e9fdea2

24 files changed

+248
-16
lines changed

docs/source/changelog.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,16 @@ Glossary
2424
Releases
2525
---------------------
2626

27-
v1.2
27+
v1.2.0
2828
================
29+
- Added the ability of nicknaming structured objects.
2930
- Generic types support (Parametric types)
3031
- :ref:`Type aliasing`
32+
- Object nicknaming
33+
- Tooltip when hovering over fields, which shows the full value.
3134
- |BREAK_CH| Minimal Python version bumped to Python 3.9
3235

36+
3337
v1.1.1
3438
================
3539
- Fixed template export on view-only mode, where the template exported wrong type.

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878

7979
# Intersphinx
8080
intersphinx_mapping = {
81-
"Python" : ("https://docs.python.org/3/", None)
81+
"python" : ("https://docs.python.org/3/", None)
8282
}
8383

8484
# ----------- HTML ----------- #

docs/source/guide/defining.rst

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,22 @@ load them from a JSON file back into the GUI.
4444
For verification purposes, the JSON file contains the full path to the defining class.
4545
Changing the class path requires users to update the corresponding path within the JSON files as well.
4646

47-
Going down further we can see multiple rows, each one of the corresponding to a parameter.
47+
Below the "Template" button, an entry labeled "Object nickname" is located.
48+
This entry can be used to give an object a nickname.
49+
The nickname will be displayed before the class's name,
50+
allowing the object to be easily recognized at a glance.
51+
52+
.. image:: ./images/new_define_frame_struct_nickname.png
53+
:width: 15cm
54+
55+
This is how the object will look inside a Combobox, if it is given the name "David's car"
56+
(notice the parentheses at the beginning):
57+
58+
.. image:: ./images/example_gui_view_defined_nickname_car.png
59+
:width: 15cm
60+
61+
62+
Going down further we can see multiple rows, each one of them corresponding to a parameter.
4863

4964
.. image:: ./images/new_define_frame_struct_parameters.png
5065
:width: 15cm
@@ -55,7 +70,32 @@ The next item on the right is a Combobox (:class:`~tkclasswiz.storage.ComboBoxOb
5570
which is a dropdown menu used for storing the value of each defined parameter.
5671
This dropdown menu can contain multiple values while we are still editing,
5772
which we can access through the down arrow-like symbol located on the rightmost side of the Combobox.
58-
When the definition frame is closed all the other values that were not selected inside the Combobox get discarded.
73+
When the definition frame is closed, all the other (not selected) values get discarded.
74+
75+
76+
.. note::
77+
78+
While the dropdown menu (Combobox) can contains values manually defined through the GUI,
79+
it will sometimes have some predefined values. These values can be:
80+
81+
- None: Parameter was annotated with :class:`typing.Optional` (``Optional[<type>]``) or
82+
with :class:`typing.Union` (``Union[None, ...]``)
83+
- ``True`` and ``False``: Parameter is a boolean parameter
84+
- Literal string values: Parameter is a literal string, meaning it is annotated with
85+
:class:`typing.Literal`. E. g, ``Literal['value1', 'value2', ...]`` annotation will produce the values 'value1' and
86+
'value2' inside the Combobox.
87+
88+
89+
.. code-block:: python
90+
91+
class Person:
92+
def __init__(self, name: str, job_type: Literal["Science", "Technology", "Engineering", "Math"]):
93+
...
94+
95+
.. image:: ./images/new_define_frame_struct_literal_values.png
96+
:width: 15cm
97+
98+
5999
The dropdown menu is followed by 3 buttons:
60100

61101
- "New": is a dropdown menu button, which allows to define multiple data types that the parameter accepts. It can
17.1 KB
Loading
-2.42 KB
Loading
-5.68 KB
Loading
274 Bytes
Loading
1.3 KB
Loading
-598 Bytes
Loading
1.26 KB
Loading

0 commit comments

Comments
 (0)