Class: LibyuiClient::Widgets::Menubutton

Inherits:
Base
  • Object
show all
Defined in:
lib/libyui_client/widgets/menubutton.rb

Overview

Class representing a menubutton in UI. It can be YMenuButton.

Instance Method Summary collapse

Methods inherited from Base

#action, #collect_all, #debug_label, #enabled?, #exists?, #initialize, #property

Methods included from LibyuiClient::Waitable

#wait_until, #wait_while

Constructor Details

This class inherits a constructor from LibyuiClient::Widgets::Base

Instance Method Details

#click(item) ⇒ Object

Sends action to click on one of the items of the menubutton in UI.

Examples:

Click button with label ‘test_button’ for menubutton with id ‘test_id’.

app.menubutton(id: 'test_id').click('test_button')

Parameters:

  • item (String)

    value to select from items.



12
13
14
# File 'lib/libyui_client/widgets/menubutton.rb', line 12

def click(item)
  action(action: Actions::PRESS, value: item)
end

#itemsArray<String>

Returns the list of items available to select from widget.

Examples:

Get items from widget with id “test_id”

{
  "class": "YMenuButton",
  "debug_label": "test",
  "icon_base_path": "",
  "id": "test_id",
  "items": [
    {
      "label": "button1"
    },
    {
      "label": "button2"
    },
    {
      "label": "button3"
    }
  ],
  "items_count": 3,
  "label": "button group"
}
app.menubutton(id: 'test').items
# button1
# button2
# button3

Returns:

  • (Array<String>)

    array of strings.



43
44
45
# File 'lib/libyui_client/widgets/menubutton.rb', line 43

def items
  property(:items).map { |x| x[:label] }
end