Class: Installation::URLDialog

Inherits:
UI::Dialog
  • Object
show all
Includes:
Yast::I18n, Yast::UIShortcuts
Defined in:
src/lib/installation/dialogs/url_dialog.rb

Overview

A subclass of UI::Dialog which provides a common dialog to edit an url. It is composed by two buttons to confirm and cancel the edition, a dialog heading and a help text.

Examples:

simple url location dialog


class ExampleURLDialog < UI::URLDialog
  def 
    "Example URL"
  end
end

Direct Known Subclasses

RegistrationURLDialog

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url) ⇒ URLDialog

Constructor

The dialog text entry will be filled with the url given

Parameters:

  • url (String)

46
47
48
49
# File 'src/lib/installation/dialogs/url_dialog.rb', line 46

def initialize(url)
  super()
  @url = url
end

Instance Attribute Details

#urlObject

Returns the value of attribute url.


39
40
41
# File 'src/lib/installation/dialogs/url_dialog.rb', line 39

def url
  @url
end

Instance Method Details

#cancel_handlerSymbol

Handler for the :cancel button wich finishes the dialog and returns :cancel

Returns:

  • (Symbol)

    :cancel


83
84
85
# File 'src/lib/installation/dialogs/url_dialog.rb', line 83

def cancel_handler
  finish_dialog(:cancel)
end

#cancel_labelObject


91
92
93
# File 'src/lib/installation/dialogs/url_dialog.rb', line 91

def cancel_label
  Yast::Label.CancelButton
end

#dialog_contentString

Shows a dialog when the given url is wrong

Returns:

  • (String)

    new value


54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'src/lib/installation/dialogs/url_dialog.rb', line 54

def dialog_content
  VBox(
    show_heading? ? Heading(dialog_title) : Empty(),
    show_help? ? RichText(help_text) : Empty(),
    VSpacing(1),
    VStretch(),
    MinWidth(60,
      Left(TextEntry(Id(:uri), , @url))),
    VSpacing(1),
    VStretch(),
    HBox(
      PushButton(Id(:ok), Opt(:default), ok_label),
      PushButton(Id(:cancel), cancel_label)
    )
  )
end

#dialog_titleString

Heading title for the dialog

Returns:

  • (String)

105
106
107
# File 'src/lib/installation/dialogs/url_dialog.rb', line 105

def dialog_title
  ""
end

#entry_labelString

Text label for the url entry

Returns:

  • (String)

112
113
114
# File 'src/lib/installation/dialogs/url_dialog.rb', line 112

def 
  ""
end

#help_textString

Help text that will be displayed above the url entry

Returns:

  • (String)

98
99
100
# File 'src/lib/installation/dialogs/url_dialog.rb', line 98

def help_text
  ""
end

#ok_handlerString

Handler for the :ok button which queries the value of the URL entry and finish the dialog returning the value of it

Returns:

  • (String)

    the value of the url text entry


75
76
77
78
# File 'src/lib/installation/dialogs/url_dialog.rb', line 75

def ok_handler
  @url = Yast::UI.QueryWidget(Id(:uri), :Value)
  finish_dialog(@url)
end

#ok_labelObject


87
88
89
# File 'src/lib/installation/dialogs/url_dialog.rb', line 87

def ok_label
  Yast::Label.OKButton
end