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)


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

def initialize(url)
  @url = url
end

Instance Attribute Details

#urlObject

Returns the value of attribute url



41
42
43
# File 'src/lib/installation/dialogs/url_dialog.rb', line 41

def url
  @url
end

Instance Method Details

#cancel_handlerSymbol

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

Returns:

  • (Symbol)

    :cancel



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

def cancel_handler
  finish_dialog(:cancel)
end

#cancel_labelObject



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

def cancel_label
  Yast::Label.CancelButton
end

#dialog_contentString

Shows a dialog when the given url is wrong

Returns:

  • (String)

    new value



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

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)


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

def dialog_title
  ""
end

#entry_labelString

Text label for the url entry

Returns:

  • (String)


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

def 
  ""
end

#help_textString

Help text that will be displayed above the url entry

Returns:

  • (String)


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

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



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

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

#ok_labelObject



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

def ok_label
  Yast::Label.OKButton
end