GLXCurses.Dialog module

class GLXCurses.Dialog.Dialog[source]

Bases: GLXCurses.Window.Window, GLXCurses.libs.Movable.Movable

action_aera_border

The default border width used around the action area of the dialog, as returned by Dialog.get_action_area(), unless GLXCurses.Container.set_border_width() was called on that widget directly.

Returns:the action_aera_border property value
Return type:int
button_spacing

Spacing between buttons in Chars

Returns:the button_spacing property value
Return type:int
content_area_border

The default border width used around the content area of the dialog, as returned by dialog_get_content_area(), unless container_set_border_width() was called on that widget directly.

Returns:the content_area_border property value
Return type:int
content_area_spacing

The default spacing used between elements of the content area of the dialog, as returned by dialog_get_content_area(), unless box_set_spacing() was called on that widget directly.

Returns:the content_area_spacing property value
Return type:int
new_with_buttons(title, parent, *flags)[source]
Parameters:
  • title (str or None) – Title of the dialog, or None
  • parent (GLXCurses Parent or None) – Transient parent of the dialog, or None
  • flags (argv) –
run()[source]

Inform Application about the GLXCurses.Dialog is active.

Cause Application to forward event only inside the GLXCurses.Dialog.

The GLXCurses.Mainloop and GLXCurses.Application will work with the dialog like a normal GLXCurses.Window because dialog is a subclass of GLXCurses.Window.

response(response_id=None)[source]

Emits the “response” signal with the given response ID.

Used to indicate that the user has responded to the dialog in some way; typically either you or Dialog().run() will be monitoring the ::response signal and take appropriate action.

Parameters:response_id (str) – response ID
Raises:TypeError – when response_id is not a str type
add_button(button_text=None, response_id=None)[source]

Adds a button with the given text and sets things up so that clicking the button will emit the “response” signal with the given response_id .

The button is appended to the end of the dialog’s action area.

The button widget is returned, but usually you don’t need it.

Parameters:
  • button_text (str) – text of button
  • response_id (str) – response ID for the button
Returns:

the GLXCurses.Button widget that was added.

Return type:

GLXCurses.Button

Raises:
  • TypeError – when button_text is not a str type
  • TypeError – when response_id is not a int type
add_buttons(*args)[source]

Adds more buttons, same as calling Dialog.add_button() repeatedly.

The data in arguments (args) must form a couple button_text, response_id.

Example: Dialog.add_buttons(‘Hello.42’, 42, ‘Hello.43’, 43, ‘Hello.44’, 44)

Each button must have both text and response ID.

Parameters:args – couple button_text, response_id
add_action_widget(child=None, response_id=None)[source]

Adds an activatable widget to the action area of a GLXCurses.Dialog, connecting a signal handler that will emit the “response” signal on the dialog when the widget is activated.

The widget is appended to the end of the dialog’s action area.

If you want to add a non-activatable widget, simply pack it into the action_area field of the GLXCurses.Dialog struct.

Parameters:
  • child (GLXCurses.Widget) – an activatable widget
  • response_id (str) – response ID for child
Raises:
  • TypeError – when child is not a GLXCurses.Widget instance
  • TypeError – when response_id is not a str type
set_default_response(response_id=None)[source]

Sets the last widget in the dialog’s action area with the given response_id as the default widget for the dialog.

Pressing “Enter” normally activates the default widget.

Parameters:response_id (str) – a response ID
Raises:TypeError – when response_id is not a dtr type
set_response_sensitive(response_id=None, setting=None)[source]

Calls gtk_widget_set_sensitive (widget, @setting) for each widget in the dialog’s action area with the given response_id .

A convenient way to sensitize/desensitize dialog buttons.

Parameters:
  • response_id (str) – a response ID
  • setting (bool) – True for sensitive
Raises:
  • TypeError – when response_id is not a str type
  • TypeError – when setting is not a bool type
get_response_for_widget(widget=None)[source]

Gets the response id of a GLXCurses.Widget in the action area of a GLXCurses.Dialog.

Note: That the return None if the widget is not found in action area.

Parameters:widget (GLXCurses.Widget) – a widget in the action area of dialog
Returns:the response id of GLXCurses.Widget , or GLXC.RESPONSE_NONE if doesnt have a response id.
Return type:int or GLXC.RESPONSE_NONE or None
get_widget_for_response(response_id=None)[source]

Gets the widget button that uses the given response ID in the action area of a dialog.

Parameters:response_id (str) – the response ID used by the dialog widget
Returns:the widget button that uses the given response_id , or None.
get_action_area()[source]

has been deprecated since version GTK3.12, GLXCurses return the internal _action_area.

Here the structure:

``` [

{
‘widget’: button_widget, ‘response_id’: response_id, ‘default_response’: False

}, {

‘widget’: button_widget, ‘response_id’: response_id, ‘default_response’: False

}

Returns the action area of dialog .

Returns:the action area.
Return type:list
get_content_area()[source]

Returns the content area of dialog .

Returns:the content area GLXCurses Box.
Return type:GLXCurses.VBox
close()[source]

Signal emitted when the user uses a keybinding to close the dialog.

update_preferred_sizes()[source]
draw_widget_in_area()[source]

Be here for be overwrite by every widget