The View¶
-
class
gtkmvc.view.View(glade=None, top=None, parent=None, builder=None)¶ Only the first three may be given as positional arguments. If an argument is empty a class attribute of the same name is used. This does not work for parent.
glade is a path to an XML file defining widgets in libglade format.
Deprecated since version 1.99.1.
builder is a path to an XML file defining widgets in GtkBuilder format.
New in version 1.99.1.
top is a string or a list of strings containing the names of our top level widgets. When using libglade only their children are loaded.
parent is used to call
set_parent_view().The last two only work if glade or builder are used, not if you intend to create widgets later from code.
Deprecated since version 1.99.1: In future versions the functionality will be split into the new class
ManualViewand its childBuilderView.-
__getitem__(key)¶ Return the widget named key, or
None.Note
In future versions this will likely change to raise
KeyError.
-
__setitem__(key, wid)¶ Add a widget. This overrides widgets of the same name that were loaded fom XML. It does not affect GTK container/child relations.
If no top widget is known, this sets it.
-
__iter__()¶ Return an iterator over widgets added with
__setitem__()and those loaded from XML.Note
In case of name conflicts this yields widgets that are not accessible via
__getitem__().
-
get_top_widget()¶ Return a widget or list of widgets.
-
hide()¶ Call hide_all() on all known top widgets.
-
set_parent_view(parent_view)¶ Set
self.get_top_widget()transient forparent_view.get_top_widget().
-
set_transient(transient_view)¶ Set
transient_view.get_top_widget()transient forself.get_top_widget().
-
show()¶ Call show() on each top widget or show_all() if only one is known. Otherwise does nothing.
-