Toolbar¶
Widget description¶
A toolbar is a widget that displays a list of items inside a box. It can be scrollable, show a menu with items that don’t fit to toolbar size or even crop them.
Only one item can be selected at a time.
Items can have multiple states, or show menus when selected by the user.
Emitted signals¶
clicked
- when the user clicks on a toolbar item and becomes selected.longpressed
- when the toolbar is pressed for a certain amount of time.item,focused
- When the toolbar item has received focus. (since 1.10)item,unfocused
- When the toolbar item has lost focus. (since 1.10)
Available styles¶
default
transparent
- no background or shadow, just show the content
Layout text parts¶
default
- label of the toolbar item
Scrollable Interface¶
This widget supports the scrollable interface.
If you wish to control the scrolling behaviour using these functions,
inherit both the widget class and the
Scrollable
class
using multiple inheritance, for example:
class ScrollableGenlist(Genlist, Scrollable):
def __init__(self, canvas, *args, **kwargs):
Genlist.__init__(self, canvas)
Enumerations¶
Toolbar shrink modes¶
- efl.elementary.ELM_TOOLBAR_SHRINK_NONE¶
Set toolbar minimum size to fit all the items
- efl.elementary.ELM_TOOLBAR_SHRINK_HIDE¶
Hide exceeding items
- efl.elementary.ELM_TOOLBAR_SHRINK_SCROLL¶
Allow accessing exceeding items through a scroller
- efl.elementary.ELM_TOOLBAR_SHRINK_MENU¶
Inserts a button to pop up a menu with exceeding items
- efl.elementary.ELM_TOOLBAR_SHRINK_EXPAND¶
Expand all items according the size of the toolbar.
Toolbar item scrollto types¶
Where to position the item in the toolbar.
- efl.elementary.ELM_TOOLBAR_ITEM_SCROLLTO_NONE¶
No scrollto
- efl.elementary.ELM_TOOLBAR_ITEM_SCROLLTO_IN¶
To the nearest viewport
- efl.elementary.ELM_TOOLBAR_ITEM_SCROLLTO_FIRST¶
To the first of viewport
- efl.elementary.ELM_TOOLBAR_ITEM_SCROLLTO_MIDDLE¶
To the middle of viewport
- efl.elementary.ELM_TOOLBAR_ITEM_SCROLLTO_LAST¶
To the last of viewport
Inheritance diagram¶
- class efl.elementary.Toolbar(Object parent, *args, **kwargs)¶
Bases:
efl.elementary.__init__.LayoutClass
This is the class that actually implements the widget.
Changed in version 1.8: Inherits from LayoutClass.
- Parameters
parent (
efl.evas.Object
) – The parent object**kwargs – All the remaining keyword arguments are interpreted as properties of the instance
- align¶
The alignment of the items.
Alignment of toolbar items, from
0.0
to indicates to align left, to1.0
, to align to right.0.5
centralize items.Centered items by default.
- Type
float
- align_get()¶
- align_set(align)¶
- bounce¶
Deprecated since version 1.8: You should combine with Scrollable class instead.
- bounce_get()¶
Deprecated since version 1.8: You should combine with Scrollable class instead.
- bounce_set(h, v)¶
Deprecated since version 1.8: You should combine with Scrollable class instead.
- callback_clicked_add(func, *args, **kwargs)¶
When the user clicks on a toolbar item and becomes selected.
- callback_clicked_del(func)¶
- callback_item_focused_add(func, *args, **kwargs)¶
When the toolbar item has received focus.
New in version 1.10.
- callback_item_focused_del(func)¶
- callback_item_unfocused_add(func, *args, **kwargs)¶
When the toolbar item has lost focus.
New in version 1.10.
- callback_item_unfocused_del(func)¶
- callback_longpressed_add(func, *args, **kwargs)¶
When the toolbar is pressed for a certain amount of time.
- callback_longpressed_del(func)¶
- callback_selected_add(func, *args, **kwargs)¶
When the toolbar item is selected.
New in version 1.11.
- callback_selected_del(func)¶
- callback_unselected_add(func, *args, **kwargs)¶
When the toolbar item is unselected.
New in version 1.11.
- callback_unselected_del(func)¶
- first_item¶
Get the first item in the given toolbar widget’s list of items.
See also
- Type
- first_item_get()¶
- homogeneous¶
Homogeneous mode.
This will enable the homogeneous mode where items are of the same size.
- Type
bool
- homogeneous_get()¶
- homogeneous_set(homogeneous)¶
- horizontal¶
A toolbar’s orientation
By default, a toolbar will be horizontal. Change this property to create a vertical toolbar.
- Type
bool
- horizontal_get()¶
- horizontal_set(horizontal)¶
- icon_order_lookup¶
Icon lookup order, for toolbar items’ icons.
Icons added before calling this function will not be affected. The default lookup order is
ELM_ICON_LOOKUP_THEME_FDO
.- Type
- icon_order_lookup_get()¶
- icon_order_lookup_set(order)¶
- icon_size¶
The icon size, in pixels, to be used by toolbar items.
Note
Default value is
32
. It reads value from elm config.- Type
int
- icon_size_get()¶
- icon_size_set(icon_size)¶
- item_append(icon, label, callback=None, *args, **kargs)¶
- item_find_by_label(label)¶
Returns a toolbar item by its label.
- Parameters
label (string) – The label of the item to find.
- Returns
The toolbar item matching
label
orNone
on failure.- Return type
- items_count()¶
Get the number of items in a toolbar
- Returns
The number of items in toolbar
- Return type
int
- last_item¶
Get the last item in the given toolbar widget’s list of items.
See also
- Type
- last_item_get()¶
The parent object of the toolbar items’ menus.
Each item can be set as item menu, with
ToolbarItem.menu
.For more details about setting the parent for toolbar menus, see
parent
.- Type
Object
- more_item¶
Get the more item.
The more item can be changed with
text
andcontent
.- Type
- more_item_get()¶
- reorder_mode¶
Reorder mode
- Type
bool
New in version 1.8.
- reorder_mode_get()¶
- reorder_mode_set(reorder_mode)¶
- scroller_policy¶
Deprecated since version 1.8: You should combine with Scrollable class instead.
- scroller_policy_get()¶
Deprecated since version 1.8: You should combine with Scrollable class instead.
- scroller_policy_set(policy_h, policy_v)¶
Deprecated since version 1.8: You should combine with Scrollable class instead.
- select_mode¶
The toolbar select mode.
- Type
- select_mode_get()¶
- select_mode_set(mode)¶
- selected_item¶
The selected item.
The selected item can be unselected with
ToolbarItem.selected
.The selected item always will be highlighted on toolbar.
See also
selected_items
- Type
- selected_item_get()¶
- shrink_mode¶
The shrink state of toolbar.
The toolbar won’t scroll if
ELM_TOOLBAR_SHRINK_NONE
, but will enforce a minimum size so all the items will fit, won’t scroll and won’t show the items that don’t fit ifELM_TOOLBAR_SHRINK_HIDE
, will scroll ifELM_TOOLBAR_SHRINK_SCROLL
, and will create a button to pop up excess elements withELM_TOOLBAR_SHRINK_MENU
.- Type
- shrink_mode_get()¶
- shrink_mode_set(mode)¶
- standard_priority¶
The standard priority of visible items in a toolbar
If the priority of the item is up to standard priority, it is shown in basic panel. The other items are located in more menu or panel. The more menu or panel can be shown when the more item is clicked.
- Type
int
- transverse_expanded¶
Item’s transverse expansion.
- Type
bool
This will expand the transverse length of the item according the transverse length of the toolbar. The default is what the transverse length of the item is set according its min value (this property is False).
New in version 1.8.
- transverse_expanded_get()¶
- transverse_expanded_set(transverse_expanded)¶
- class efl.elementary.ToolbarItem(icon=None, label=None, callback=None, cb_data=None, *args, **kwargs)¶
Bases:
efl.elementary.__init__.ObjectItem
An item for the toolbar.
If a function is passed as argument, it will be called every time this item is selected, i.e., the user clicks over an unselected item. If such function isn’t needed, just passing
None
asfunc
is enough. The same should be done fordata
.Toolbar will load icon image from fdo or current theme. This behavior can be set by
Toolbar.icon_order_lookup
function. If an absolute path is provided it will load it direct from a file.- Parameters
icon (string) – A string with icon name or the absolute path of an image file.
label (string) – The label of the item.
callback (function) – The function to call when the item is clicked.
- append_to(toolbar)¶
Append item to the toolbar.
A new item will be created and appended to the toolbar, i.e., will be set as last item.
Items created with this method can be deleted with
delete()
- Seealso
- Parameters
toolbar (
Toolbar
) – The toolbar this item should be appended to- Returns
The created item or
None
upon failure.- Return type
- bring_in(scrollto_type)¶
Show this item with scroll animation, when the toolbar can be scrolled.
- See
New in version 1.8.
- icon¶
The icon associated with the item.
Toolbar will load icon image from fdo or current theme. This behavior can be set by
Toolbar.icon_order_lookup
function. If an absolute path is provided it will load it direct from a file.See also
- Type
string
- icon_file¶
Set the icon associated with item to an image in a binary buffer.
Note
The icon image set by this function can be changed by
icon
.- Type
string or tuple of strings
- icon_file_set(file_name, key)¶
- icon_get()¶
- icon_object¶
Get the icon object of item.
- Type
Icon
- icon_object_get()¶
- icon_set(ic)¶
- insert_after(after)¶
Insert a new item into the toolbar object after item
after
.A new item will be created and added to the toolbar. Its position in this toolbar will be just after item
after
.Items created with this method can be deleted with
delete()
- Parameters
after (
ToolbarItem
) – The toolbar item to insert after.- Returns
The created item or
None
upon failure.- Return type
- insert_before(before)¶
Insert a new item into the toolbar object before item
before
.A new item will be created and added to the toolbar. Its position in this toolbar will be just before item
before
.Items created with this method can be deleted with
delete()
- Parameters
before (
ToolbarItem
) – The toolbar item to insert before.- Returns
The created item or
None
upon failure.- Return type
This property has two diffent functionalities. The object you get from it is the
Menu
object used by this toolbar item, and setting it to True or False controls whether this item is a menu or not.If item wasn’t set as menu item, getting the value of this property sets it to be that.
Once it is set to be a menu, it can be manipulated through
Toolbar.menu_parent
and theMenu
functions and properties.So, items to be displayed in this item’s menu should be added with
efl.elementary.menu.Menu.item_add()
.The following code exemplifies the most basic usage:
tb = Toolbar(win) item = tb.item_append("refresh", "Menu") item.menu = True tb.menu_parent = win menu = item.menu menu.item_add(None, "edit-cut", "Cut") menu_item = menu.item_add(None, "edit-copy", "Copy")
- Type
bool
- next¶
Get the item after
item
in toolbar.Note
If it is the last item,
None
will be returned.See also
- Type
- next_get()¶
- object_get()¶
- prepend_to(toolbar)¶
Prepend item to the toolbar.
A new item will be created and prepended to the toolbar, i.e., will be set as first item.
Items created with this method can be deleted with
delete()
- Parameters
toolbar (
Toolbar
) – The toolbar this item should be prepended to- Returns
The created item or
None
upon failure.- Return type
- prev¶
Get the item before
item
in toolbar.Note
If it is the first item,
None
will be returned.See also
- Type
- prev_get()¶
- priority¶
The priority of a toolbar item.
This is used only when the toolbar shrink mode is set to
ELM_TOOLBAR_SHRINK_MENU
orELM_TOOLBAR_SHRINK_HIDE
. When space is less than required, items with low priority will be removed from the toolbar and added to a dynamically-created menu, while items with higher priority will remain on the toolbar, with the same order they were added.- Type
int
- priority_get()¶
- priority_set(priority)¶
- selected¶
The selected state of an item.
This reflects the selected state of the given item.
True
for selected,False
for not selected.If a new item is selected the previously selected will be unselected. Previously selected item can be get with function
Toolbar.selected_item
.Selected items will be highlighted.
See also
- Type
bool
- selected_get()¶
- selected_set(selected)¶
- separator¶
Whether item is a separator or not.
Items aren’t set as separator by default.
If set as separator it will display separator theme, so won’t display icons or label.
- Type
bool
- separator_get()¶
- separator_set(separator)¶
- show(scrollto_type)¶
Show this item, when the toolbar can be scrolled.
- See
New in version 1.8.
- state¶
An item state.
- state_add(icon=None, label=None, func=None, *args, **kwargs)¶
- state_del(state)¶
- state_get()¶
- state_next()¶
- state_prev()¶
- state_set(state)¶
- state_unset()¶
- class efl.elementary.ToolbarItemState(ToolbarItem it, icon=None, label=None, callback=None, *args, **kwargs)¶
Bases:
object
A state for a
ToolbarItem
.- delete()¶