Object frames#
NewObjectFrameBase#
- class tkclasswiz.object_frame.frame_base.NewObjectFrameBase(class_: Any, return_widget: ComboBoxObjects | ListBoxObjects | None, parent=None, old_data: Any | None = None, check_parameters: bool = True, allow_save=True)#
Base Frame for inside the
ObjectEditWindowthat allows object definition.- Parameters:
class (Any) – The class we are defining for.
return_widget (Any) – The widget to insert the ObjectInfo into after saving.
parent (TopLevel) – The parent window.
old_data (Any) – The old_data gui data.
check_parameters (bool) – Check parameters (by creating the real object) upon saving. This is ignored if editing a function instead of a class.
allow_save (bool) – If False, will open in read-only mode.
- class_#
The type (class) of object being creating
- return_widget#
The widget where the abstract object (ObjectInfo) will be stored
- check_parameters#
Check for parameters on save
- allow_save#
Saving is allowed
- old_gui_data#
If editing, the value being edited
- editing_index#
The index of object being edited
- static get_cls_name(cls: T) str | T#
Returns the name of the class
clsor the original class when the name cannot be obtained. If alias exists, alias is returned instead.
- classmethod cast_type(value: Any, types: Iterable)#
Tries to convert value into one of the types inside types (first successful).
- Raises:
TypeError – Could not convert into any type.
- classmethod convert_types(types_in)#
Type preprocessing method, that extends the list of types with inherited members (polymorphism) and removes classes that are wrapped by some other class, if the wrapper class also appears in the annotations.
- update_window_title()#
Set’s the window title according to edit context.
- new_object_frame(class_, widget, *args, **kwargs)#
Opens up a new object frame on top of the current one. Parameters are the same as in
NewObjectFrame(current class).
- to_object()#
Creates an object from the GUI data.
- load(old_data: Any)#
Loads the old object info data into the GUI.
- Parameters:
old_data (Any) – The old gui data to load.
- save()#
Save the current object into the return widget and then close this frame.
- remember_gui_data()#
Remembers GUI data for change checking.
NewObjectFrameIterable#
- class tkclasswiz.object_frame.frame_iterable.NewObjectFrameIterable(*args, **kwargs)#
Frame for use inside the ObjectEditWindow that allows definition of lists / iterables. The list annotations should be annotated similarly to the following example:
list[Union[int, float]]orIterable[Union[int, float]]orIterable[SomeClass]- Parameters:
class (Any) – The class we are defining for.
return_widget (Any) – The widget to insert the ObjectInfo into after saving.
parent (TopLevel) – The parent window.
old_data (Any) – The old_data gui data.
check_parameters (bool) – Check parameters (by creating the real object) upon saving. This is ignored if editing a function instead of a class.
allow_save (bool) – If False, will open in read-only mode.
- load(old_data: List[Any])#
Loads the old object info data into the GUI.
- Parameters:
old_data (Any) – The old gui data to load.
- to_object()#
Creates an object from the GUI data.
NewObjectFrameString#
- class tkclasswiz.object_frame.frame_string.NewObjectFrameString(class_: Any, return_widget: Any, parent=None, old_data: str | None = None, check_parameters: bool = True, allow_save=True)#
- load(old_data: Any)#
Loads the old object info data into the GUI.
- Parameters:
old_data (Any) – The old gui data to load.
- to_object()#
Creates an object from the GUI data.
NewObjectFrameStruct#
- class tkclasswiz.object_frame.frame_struct.NewObjectFrameStruct(*args, **kwargs)#
Frame for inside the
ObjectEditWindowthat allows object definition.- Parameters:
class (Any) – The class we are defining for.
return_widget (ComboBoxObjects | ListBoxScrolled) – The widget to insert the ObjectInfo into after saving.
parent (TopLevel) – The parent window.
old_data (ObjectInfo) – The old_data ObjectInfo object to edit.
check_parameters (bool) – Check parameters (by creating the real object) upon saving. This is ignored if editing a function instead of a class.
allow_save (bool) – If False, will open in read-only mode.
additional_values (Dict[str, Any]) – A mapping of additional values to be inserted into corresponding field.
- load(old_data: ObjectInfo)#
Loads the old object info data into the GUI.
- Parameters:
old_data (Any) – The old gui data to load.
- to_object(*, ignore_checks=False) ObjectInfo#
Converts GUI data into an ObjectInfo abstraction object.
- Parameters:
ignore_checks (bool) – Don’t check the correctness of given parameters.