Functions¶
-
Aduct.add_to_notebook(element, notebook, position=-1)¶ Adds an element to the notebook at given position.
When the given
elementis already a child of some container, the function removes it from the parent and adds thenotebookto parent. Then the orphanelementis added tonotebookatposition.Parameters: Raises:
-
Aduct.add_to_paned(child1, child2, paned, position)¶ Adds the children to given paned determined by position.
The main child
child1is added at first panel ifpositionis 1 or second panel ifpositionis 2. With respect to position ofchild1,child2is added at the complement panel. Whenpositionis neither 1 nor 2, nothing is done. Ifchild1is already a child of parent, it is removed from the parent andpanedis added back in its position. Then, the orphanschild1andchild2are added at requred places.Parameters: - child1 (
Gtk.Widget) – The main child which has to be added at givenposition. - child2 (
Gtk.Widget) – The other child which has to be added at the complement of givenposition. It has to be an orphan. - paned (
Paned) – The paned to which the children has to be added. - position (
int) – An integer value that is either 1 or 2. The complement of 1 is 2 and vice-versa.
- child1 (
-
Aduct.add_to_view(child, view)¶ Adds a child to the view.
If
childis not an orphan, it is removed from its parent andviewis added back in its place. Thenchildis added toview.Parameters: - child (
Gtk.Widgetor Aduct.Element.Element) – The child that has to be added toview. It has to be an orphan. - view (
View) – The view to whichchildhas to be added.
Warning
This function is given as a fall-back case and should never be used blindly without knowing the properties of
childandview. When theviewalready has a child or requires more information about adding it, exceptions are raised. Still, theviewmay try its best to add thechildat the possible place, only when it can.Incase of
viewbeing aNotebook, it appends thechildto the last position. But it requireschildto be aElement. So at either case, you still have limitations that may end up in a weird result. For the same reasons,childhas to be an orphan.- child (
-
Aduct.change_child_at_element(element, provider, child_name)¶ Changes the child at given element with a child of given name provided by provider.
The previous child at
elementis cleared, after which the new child is added.Parameters:
-
Aduct.get_interface(top_level)¶ Gets the interface starting from the given top level.
Parameters: top_level ( View) – A view which acts as the root widget.Returns: A dictionary with properties to build interface. Return type: dict
-
Aduct.remove_element(element, view)¶ Removes the given element from view.
When
viewis aBin, it clearselement. For other types of views, it removeselement. Then, if the number of children inviewis one, it replacesviewwith the other child ofview.Parameters:
-
Aduct.replace_child(view, child1, child2)¶ Replaces the given child of a view with another child.
Parameters: - view (
View) – The view whose child has to be replaced. - child1 (
Gtk.Widget) – The child of given view which has to be replaced. - child2 (
Gtk.Widget) – The child which replaces child1 inview.
Raises: - view (
-
Aduct.set_interface(interface_dict, top_level, creator_maps, init_maps)¶ Sets the interface starting from given the top level.
Parameters: - interface_dict (
dict) – A dictionary that can be used to set interface. - top_level (
View) – The root widget from which the interface has to be set. - creator_maps (
dict) – A dictionary of format{key: (func, args, kwargs)}, that is used to create the required object. The object is then created usingfunc(*args, **kwargs)and is substitued as value ininterface_dictwhich has keykey. - init_maps (
dict) – A dictionary of format{key: object}already initialized objects. The occurences ofkeyininerface_dictis then replaced withobject.
Returns: The widget that was previous child of
top_level,Noneiftop_levelhas no child.Return type: - interface_dict (