ooodev.adapter.frame.infobar_provider_partial module
- class ooodev.adapter.frame.infobar_provider_partial.InfobarProviderPartial(component, interface=com.sun.star.frame.XInfobarProvider)[source]
Bases:
object
Partial class for XInfobarProvider.
- Parameters:
component (XInfobarProvider) –
interface (UnoInterface | None) –
- __init__(component, interface=com.sun.star.frame.XInfobarProvider)[source]
Constructor
- Parameters:
component (XInfobarProvider) – UNO Component that implements
com.sun.star.frame.XInfobarProvider
interface.interface (UnoInterface, optional) – The interface to be validated. Defaults to
XInfobarProvider
.
- Return type:
None
- append_infobar(id, primary_message, secondary_message, infobar_type, action_buttons, show_close_button)[source]
Creates and displays a new Infobar.
The example below adds a new infobar named MyInfoBar with type INFO and close (x) button.
- Parameters:
id (str) – The unique identifier of the Infobar.
primary_message (str) – The (short) primary message. Will appear at the start of the infobar in bold letters. May be empty.
secondary_message (str) – The (longer) secondary message. Will appear in normal letters after the primaryMessage
infobar_type (int | InfobarTypeEnum) – The type of the Infobar.
action_buttons (Tuple[StringPair, ...]) – A sequence of action buttons. The buttons will be added from Right to Left at the right side of the info bar. Each button is represented by a
com.sun.star.beans.StringPair
. StringPair: First represents the button label, while StringPair: Second represents the button URL which will be called on button click. The URL can be any URL, either external (http://libreoffice.org), or internal (.uno:Save
), or from your extension (service:your.example.Extension?anyAction
).show_close_button (bool) – Whether the Close (x) button is shown at the end of the Infobar. Set to false, when you don’t want the user to close the Infobar.
- Raises:
com.sun.star.lang.IllegalArgumentException –
IllegalArgumentException
- Return type:
None
Hint
InfobarTypeEnum
can be imported fromooo.dyn.frame.infobar_type
.
Example
from ooo.dyn.frame.infobar_type import InfobarTypeEnum from ooodev.utils.props import Props def add_infobar(): # Create a new infobar buttons = ( Props.make_sting_pair("Close doc", ".uno:CloseDoc"), Props.make_sting_pair("Paste into doc", ".uno:Paste"), ) inst.append_infobar( id="MyInfoBar", primary_message="Hello world", secondary_message="Things happened. What now?", infobar_type=InfobarTypeEnum.INFO, action_buttons=buttons, show_close_button=True, )
- has_infobar(id)[source]
Check if Infobar exists.
since
LibreOffice 7.0
- Return type:
bool
- Parameters:
id (str) –
- remove_infobar(id)[source]
Removes an existing Infobar.
Remove MyInfoBar infobar
- Raises:
com.sun.star.container.NoSuchElementException –
NoSuchElementException
- Return type:
None
- Parameters:
id (str) –
- update_infobar(id, primary_message, secondary_message, infobar_type)[source]
Updates an existing Infobar.
Use if you want to update only small parts of the Infobar.
Update the infobar and change the type to WARNING
- Parameters:
id (str) – The unique identifier of the Infobar.
primary_message (str) – The (short) primary message. Will appear at the start of the infobar in bold letters. May be empty.
secondary_message (str) – The (longer) secondary message. Will appear in normal letters after the primaryMessage
infobar_type (int | InfobarTypeEnum) – The type of the Infobar.
- Raises:
com.sun.star.container.NoSuchElementException –
NoSuchElementException
- Return type:
None
Hint
InfobarTypeEnum
can be imported fromooo.dyn.frame.infobar_type
.