Class: Yast::WizardClass
- Inherits:
-
Module
- Object
- Module
- Yast::WizardClass
- Defined in:
- library/wizard/src/modules/Wizard.rb
Constant Summary collapse
- DEFAULT_ICON_NAME =
"yast".freeze
Instance Method Summary collapse
-
#AbortAcceptButtonBox ⇒ Object
Returns a button box with buttons "Abort", "Accept".
-
#AbortApplyFinishButtonBox ⇒ Object
Returns a button box with buttons "Abort", "Apply", "Finish".
-
#AbortInstallationAcceptButtonBox ⇒ Object
Returns a button box with buttons "Abort Installation", "Accept".
-
#AcceptDialog ⇒ Yast::Term
Returns a standard wizard dialog with buttons "Cancel", "Accept".
-
#AddMenu(menu, title, id) ⇒ Array<Hash>
Add Menu.
-
#AddMenuEntry(menu, parent_id, title, id) ⇒ Array<Hash>
Add Menu Entry.
-
#AddSubMenu(menu, parent_id, title, id) ⇒ Array<Hash>
Add Sub Menu.
-
#AddTreeItem(tree, parent, title, id) ⇒ Array<Hash>
Add Tree Item to tree enabled Wizard.
-
#BackAbortInstallationNextButtonBox ⇒ Object
Returns a button box with buttons "Back", "Abort Installation", "Next".
-
#BackAbortNextButtonBox ⇒ Object
Returns a button box with buttons "Back", "Abort", "Next".
-
#BackNextButtonBox ⇒ Object
Returns a button box with buttons "Back", "Next".
-
#CancelAcceptButtonBox ⇒ Object
Returns a button box with buttons "Cancel", "Accept".
-
#CancelOKButtonBox ⇒ Object
Returns a button box with buttons "Cancel", "OK".
-
#ClearContents ⇒ Object
Clear the wizard contents.
-
#ClearTitleIcon ⇒ Object
Clear the wizard 'title' icon, i.e.
-
#CloseDialog ⇒ Object
Close a wizard dialog.
-
#CreateDialog ⇒ Object
Create and open a typical installation wizard dialog.
-
#CreateMenu(menu) ⇒ void
Create the menu in the dialog.
-
#CreateMenuInternal(menu, parent) ⇒ Array
Create the Menu Items.
-
#CreateTree(tree, title) ⇒ Object
Create the tree in the dialog, replaces helpspace with new tree widget.
-
#CreateTreeDialog ⇒ Object
Create and open a Tree wizard dialog.
-
#CreateTreeInternal(tree, parent) ⇒ Array
Create the Tree Items.
-
#DeleteMenus ⇒ Object
Delete Menu items.
-
#DeleteTreeItems ⇒ Object
Delete Tree items.
-
#DisableAbortButton ⇒ Object
Disable the wizard's "Abort" button.
-
#DisableBackButton ⇒ Object
Disable the wizard's "Back" button.
-
#DisableCancelButton ⇒ Object
Disable the wizard's "Cancel" button.
-
#DisableNextButton ⇒ Object
Disable the wizard's "Next" (or "Accept") button.
-
#EnableAbortButton ⇒ Object
Enable the wizard's "Abort" button.
-
#EnableBackButton ⇒ Object
Enable the wizard's "Back" button.
-
#EnableCancelButton ⇒ Object
Enable the wizard's "Cancel" button.
-
#EnableNextButton ⇒ Object
Enable the wizard's "Next" (or "Accept") button.
-
#GenericDialog(button_box) ⇒ Yast::Term
Create a Generic Dialog.
-
#GenericTreeDialog(button_box) ⇒ Yast::Term
Create a Generic Tree Dialog.
-
#HasWidgetWizard ⇒ Boolean
Returns whether the `Wizard widget is available.
- #haveFancyUI ⇒ Object
-
#HideAbortButton ⇒ Object
Hide the Wizard's "Abort" button.
-
#HideBackButton ⇒ Object
Hide the Wizard's "Back" button.
-
#HideNextButton ⇒ Object
Hide the Wizard's "Next" button.
-
#HideReleaseNotesButton ⇒ Object
Hide the "Release Notes" button, if there is any.
-
#IsWizardDialog ⇒ Boolean
Check if the topmost dialog is a wizard dialog (i.e. has a widget with
id(
WizardDialog) ). - #main ⇒ Object
-
#NextBackDialog ⇒ Yast::Term
Returns a standard wizard dialog with buttons "Next", "Back", "Abort".
-
#OKDialog ⇒ Yast::Term
Returns a standard wizard dialog with buttons "Cancel", "OK".
-
#open_wizard_dialog(*args) ⇒ Object
protected
Sets the icon and opens a wizard dialog with the content specified as arguments.
-
#OpenAbortApplyFinishDialog ⇒ Object
Open a dialog with "Accept", "Cancel" and set the keyboard focus to "Accept".
-
#OpenAcceptAbortStepsDialog ⇒ Object
Open a dialog with "Accept", "Cancel" that will also accept workflow steps.
-
#OpenAcceptDialog ⇒ Object
Open a dialog with "Accept", "Cancel" and set the keyboard focus to "Accept".
-
#OpenAcceptStepsDialog ⇒ Object
Open a dialog with "Accept", "Cancel" that will also accept workflow steps.
-
#OpenCancelOKDialog ⇒ Object
Overview Dialog http://en.opensuse.org/YaST/Style_Guide#Single_Configuration.2FOverview.2FEdit_Dialog dialog with Cancel and OK buttons (cancel has function as abort).
-
#OpenCustomDialog(help_space_contents, button_box) ⇒ void
Open a wizard dialog with simple layout.
-
#OpenDialog(dialog) ⇒ Object
Open any wizard dialog.
-
#OpenLeftTitleNextBackDialog ⇒ Object
Open a dialog with "Back", "Next", "Abort" that has the title on the left, as wanted by the installation visual design.
-
#OpenNextBackDialog ⇒ Object
Open a dialog with buttons "Next", "Back", "Abort" and set the keyboard focus to "Next".
-
#OpenNextBackStepsDialog ⇒ Object
Open a dialog with "Back", "Next", "Abort" that will also accept workflow steps.
-
#OpenOKDialog ⇒ Object
Open a dialog with "OK", "Cancel" and set the keyboard focus to "OK".
-
#OpenTreeNextBackDialog ⇒ Object
Open a Tree dialog with buttons "Next", "Back", "Abort" and set the keyboard focus to "Next".
-
#OpenWithLayout(layout) ⇒ Object
Open a new wizard according to the layout configuration.
-
#QueryTreeItem ⇒ Object
Query Tree Item.
-
#ReplaceButtonBox(button_box) ⇒ void
PRIVATE - Replace the entire Wizard button box with a new one.
-
#ReplaceCustomHelp(contents) ⇒ Object
Replace the help widget for dialogs opened with Wizard::OpenCustomDialog().
- #ReplaceHelp(contents) ⇒ Object deprecated Deprecated.
-
#RestoreAbortButton ⇒ Object
Restore the wizard 'abort' button.
-
#RestoreBackButton ⇒ Object
Restore the wizard 'back' button.
-
#RestoreHelp(help_text) ⇒ Object
Restore the wizard help subwindow.
-
#RestoreNextButton ⇒ Object
Restore the wizard 'next' button.
-
#RestoreScreenShotName ⇒ Object
Restore the screenshot name.
-
#RetranslateButtons ⇒ Object
Retranslate the wizard buttons.
-
#SelectTreeItem(tree_item) ⇒ Object
Select Tree item.
-
#set_icon ⇒ Boolean
protected
Sets the application icon according to the value of @icon_name.
-
#SetAbortButton(id, label) ⇒ Object
Set the dialog's "Abort" button with a new label and a new ID.
-
#SetBackButton(id, label) ⇒ Object
Set the dialog's "Back" button with a new label and a new ID.
-
#SetContents(title, contents, help_text, has_back, has_next) ⇒ Object
Set the contents of a wizard dialog.
-
#SetContentsButtons(title, contents, help_text, back_label, next_label) ⇒ Object
Set contents and Buttons of wizard dialog.
-
#SetContentsFocus(title, contents, help_text, has_back, has_next, set_focus) ⇒ Object
Set the contents of a wizard dialog and define if to move focus to next button.
-
#SetDesktopIcon(file) ⇒ Boolean
Sets the icon specified in a .desktop file got as parameter.
-
#SetDesktopTitle(file) ⇒ Boolean
Sets the window title according to the name specified in a .desktop file got as parameter.
-
#SetDesktopTitleAndIcon(file) ⇒ Boolean
Convenience function to avoid 2 calls if application needs to set both dialog title and icon from desktop file specified as parameter.
-
#SetDialogTitle(title_text) ⇒ Object
Sets the dialog title shown in the window manager's title bar.
-
#SetFocusToBackButton ⇒ Object
Set the keyboard focus to the wizard's "Back" (or "Cancel") button.
-
#SetFocusToNextButton ⇒ Object
Set the keyboard focus to the wizard's "Next" (or "Accept") button.
-
#SetHelpText(help_text) ⇒ Object
Set a new help text.
-
#SetNextButton(id, label) ⇒ Object
Set the dialog's "Next" button with a new label and a new ID.
-
#SetProductName(name) ⇒ void
Set the product name for UI.
-
#SetScreenShotName(name) ⇒ Object
Set a name for the current dialog:.
-
#SetTitleIcon(_icon_name) ⇒ Object
Sets the wizard 'title' icon to the specified icon from the standard icon directory.
-
#ShowHelp(help_text) ⇒ Object
Open a popup dialog that displays a help text (rich text format).
-
#ShowReleaseNotesButton(label, id) ⇒ Object
Show a "Release Notes" button with the specified label and ID if there is a "steps" panel.
-
#TimeoutUserInput(timeout_millisec) ⇒ Object
Substitute for UI::TimeoutUserInput.
-
#TimeoutWaitForEvent(timeout_millisec) ⇒ Object
Substitute for UI::WaitForEvent with timeout.
-
#UserInput ⇒ maybe normalized
Substitute for UI::UserInput.
-
#WaitForEvent ⇒ Object
Substitute for UI::WaitForEvent.
Instance Method Details
#AbortAcceptButtonBox ⇒ Object
Returns a button box with buttons "Abort", "Accept"
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
# File 'library/wizard/src/modules/Wizard.rb', line 214 def AbortAcceptButtonBox HBox( HWeight(1, ReplacePoint(Id(:back_rep), Empty())), # Layout trick to make sure the center button is centered HStretch(), HWeight( 1, ReplacePoint( Id(:rep_abort), # Make sure HideAbortButton() works (bnc #444176) PushButton(Id(:abort), Opt(:key_F9), Label.AbortButton) ) ), HStretch(), HWeight( 1, PushButton(Id(:accept), Opt(:key_F10, :default), Label.AcceptButton) ) ) end |
#AbortApplyFinishButtonBox ⇒ Object
Returns a button box with buttons "Abort", "Apply", "Finish"
254 255 256 257 258 259 260 261 |
# File 'library/wizard/src/modules/Wizard.rb', line 254 def AbortApplyFinishButtonBox ButtonBox( PushButton(Id(:abort, :cancelButton, :key_F9), Label.AbortButton), # button text PushButton(Id(:apply, :applyButton), _("&Apply")), PushButton(Id(:finish, :okButton, :key_F10), Label.FinishButton) ) end |
#AbortInstallationAcceptButtonBox ⇒ Object
Returns a button box with buttons "Abort Installation", "Accept"
236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
# File 'library/wizard/src/modules/Wizard.rb', line 236 def AbortInstallationAcceptButtonBox ButtonBox( PushButton( Id(:abort), Opt(:key_F9, :cancelButton), Label.AbortInstallationButton ), PushButton( Id(:accept), Opt(:key_F10, :okButton, :default), Label.AcceptButton ) ) end |
#AcceptDialog ⇒ Yast::Term
This is a stable API function
Returns a standard wizard dialog with buttons "Cancel", "Accept"
402 403 404 |
# File 'library/wizard/src/modules/Wizard.rb', line 402 def AcceptDialog GenericDialog(CancelAcceptButtonBox()) end |
#AddMenu(menu, title, id) ⇒ Array<Hash>
Add Menu
1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 |
# File 'library/wizard/src/modules/Wizard.rb', line 1629 def AddMenu(, title, id) = deep_copy() if haveFancyUI UI.WizardCommand(term(:AddMenu, title, id)) else = Builtins.add( , "type" => "Menu", "title" => title, "id" => id ) end deep_copy() end |
#AddMenuEntry(menu, parent_id, title, id) ⇒ Array<Hash>
Add Menu Entry
1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 |
# File 'library/wizard/src/modules/Wizard.rb', line 1672 def AddMenuEntry(, parent_id, title, id) = deep_copy() if haveFancyUI UI.WizardCommand(term(:AddMenuEntry, parent_id, title, id)) else = Builtins.add( , "type" => "MenuEntry", "parent" => parent_id, "title" => title, "id" => id ) end deep_copy() end |
#AddSubMenu(menu, parent_id, title, id) ⇒ Array<Hash>
Add Sub Menu
1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 |
# File 'library/wizard/src/modules/Wizard.rb', line 1649 def AddSubMenu(, parent_id, title, id) = deep_copy() if haveFancyUI UI.WizardCommand(term(:AddSubMenu, parent_id, title, id)) else = Builtins.add( , "type" => "SubMenu", "parent" => parent_id, "title" => title, "id" => id ) end deep_copy() end |
#AddTreeItem(tree, parent, title, id) ⇒ Array<Hash>
Add Tree Item to tree enabled Wizard
1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 |
# File 'library/wizard/src/modules/Wizard.rb', line 1500 def AddTreeItem(tree, parent, title, id) tree = deep_copy(tree) if haveFancyUI UI.WizardCommand(term(:AddTreeItem, parent, title, id)) else tree = Builtins.add( tree, "parent" => parent, "title" => title, "id" => id ) end deep_copy(tree) end |
#BackAbortInstallationNextButtonBox ⇒ Object
Returns a button box with buttons "Back", "Abort Installation", "Next"
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'library/wizard/src/modules/Wizard.rb', line 131 def BackAbortInstallationNextButtonBox HBox( HWeight( 1, ReplacePoint( Id(:rep_help), PushButton(Id(:help), Opt(:key_F1, :helpButton), Label.HelpButton) ) ), HStretch(), HWeight( 1, ReplacePoint( Id(:rep_back), PushButton(Id(:back), Opt(:key_F8), Label.BackButton) ) ), HStretch(), ReplacePoint( Id(:rep_abort), PushButton(Id(:abort), Opt(:key_F9), Label.AbortInstallationButton) ), HStretch(), HWeight( 1, ReplacePoint( Id(:rep_next), PushButton(Id(:next), Opt(:key_F10, :default), Label.NextButton) ) ) ) end |
#BackAbortNextButtonBox ⇒ Object
Returns a button box with buttons "Back", "Abort", "Next"
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'library/wizard/src/modules/Wizard.rb', line 95 def BackAbortNextButtonBox HBox( HWeight( 1, ReplacePoint( Id(:rep_help), PushButton(Id(:help), Opt(:key_F1, :helpButton), Label.HelpButton) ) ), HStretch(), HWeight( 1, ReplacePoint( Id(:rep_back), PushButton(Id(:back), Opt(:key_F8), Label.BackButton) ) ), HStretch(), ReplacePoint( Id(:rep_abort), PushButton(Id(:abort), Opt(:key_F9), Label.AbortButton) ), HStretch(), HWeight( 1, ReplacePoint( Id(:rep_next), PushButton(Id(:next), Opt(:key_F10, :default), Label.NextButton) ) ) ) end |
#BackNextButtonBox ⇒ Object
Returns a button box with buttons "Back", "Next"
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
# File 'library/wizard/src/modules/Wizard.rb', line 167 def BackNextButtonBox HBox( HWeight( 1, ReplacePoint( Id(:rep_back), PushButton(Id(:back), Opt(:key_F8), Label.BackButton) ) ), HStretch(), HWeight( 1, ReplacePoint( Id(:rep_next), PushButton(Id(:next), Opt(:key_F10, :default), Label.NextButton) ) ) ) end |
#CancelAcceptButtonBox ⇒ Object
Returns a button box with buttons "Cancel", "Accept"
190 191 192 193 194 195 196 197 198 199 |
# File 'library/wizard/src/modules/Wizard.rb', line 190 def CancelAcceptButtonBox ButtonBox( PushButton(Id(:cancel), Opt(:key_F9, :cancelButton), Label.CancelButton), PushButton( Id(:accept), Opt(:key_F10, :default, :okButton), Label.AcceptButton ) ) end |
#CancelOKButtonBox ⇒ Object
Returns a button box with buttons "Cancel", "OK"
204 205 206 207 208 209 |
# File 'library/wizard/src/modules/Wizard.rb', line 204 def CancelOKButtonBox ButtonBox( PushButton(Id(:cancel), Opt(:key_F9, :cancelButton), Label.CancelButton), PushButton(Id(:ok), Opt(:key_F10, :default, :okButton), Label.OKButton) ) end |
#ClearContents ⇒ Object
This is a stable API function
Clear the wizard contents.
This may sound silly, but it gives much faster feedback to the user if used properly: Whenever the user clicks "Next" or "Back", call ClearContents() prior to any lengthy operation -> the user notices instant response, even though he may in fact still have to wait.
874 875 876 877 878 |
# File 'library/wizard/src/modules/Wizard.rb', line 874 def ClearContents SetContents("", Empty(), "", false, false) nil end |
#ClearTitleIcon ⇒ Object
Deprecated. Do nothing.
Clear the wizard 'title' icon, i.e. replace it with nothing
1115 1116 1117 |
# File 'library/wizard/src/modules/Wizard.rb', line 1115 def ClearTitleIcon nil end |
#CloseDialog ⇒ Object
This is a stable API function
Close a wizard dialog.
679 680 681 682 683 684 685 686 687 688 689 |
# File 'library/wizard/src/modules/Wizard.rb', line 679 def CloseDialog if IsWizardDialog() UI.CloseDialog else Builtins.y2error( "Wizard::CloseDialog(): Topmost dialog is not a wizard dialog!" ) end nil end |
#CreateDialog ⇒ Object
Create and open a typical installation wizard dialog.
For backwards compatibility only - don't use this any more in new modules.
794 795 796 797 798 799 800 801 802 |
# File 'library/wizard/src/modules/Wizard.rb', line 794 def CreateDialog # Set productname for help text @product_name = OSRelease.ReleaseName if @product_name == "" UI.SetProductName(@product_name) OpenNextBackDialog() nil end |
#CreateMenu(menu) ⇒ void
This method returns an undefined value.
Create the menu in the dialog
1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 |
# File 'library/wizard/src/modules/Wizard.rb', line 1721 def CreateMenu() = deep_copy() if !haveFancyUI = HBox() Builtins.foreach() do |m| if Ops.get_string(m, "type", "") == "Menu" = CreateMenuInternal(, Ops.get_string(m, "id", "")) Builtins.y2debug("menu_items: %1", ) = Builtins.add( , MenuButton(Ops.get_string(m, "title", ""), ) ) end end Builtins.y2milestone("menu: %1", ) UI.ReplaceWidget(Id(:topmenu), Left()) end nil end |
#CreateMenuInternal(menu, parent) ⇒ Array
Create the Menu Items
1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 |
# File 'library/wizard/src/modules/Wizard.rb', line 1693 def CreateMenuInternal(, parent) = deep_copy() m = Builtins.filter() do |c| Ops.get_string(c, "parent", "") == parent end mm = Builtins.maplist(m) do |cc| case Ops.get_string(cc, "type", "") when "MenuEntry" = Ops.get_string(cc, "id", "") next Item(Id(), Ops.get_string(cc, "title", "")) when "SubMenu" = Ops.get_string(cc, "id", "") next term( :menu, Ops.get_string(cc, "title", ""), CreateMenuInternal(, ) ) end end Builtins.y2debug("items: %1", mm) deep_copy(mm) end |
#CreateTree(tree, title) ⇒ Object
Create the tree in the dialog, replaces helpspace with new tree widget
1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 |
# File 'library/wizard/src/modules/Wizard.rb', line 1560 def CreateTree(tree, title) tree = deep_copy(tree) if !haveFancyUI items = [] Builtins.foreach(tree) do |i| if Ops.get_string(i, "parent", "") == "" items = Builtins.add( items, Item( Id(Ops.get_string(i, "id", "")), Ops.get_string(i, "title", ""), CreateTreeInternal(tree, Ops.get_string(i, "id", "")) ) ) end end Builtins.y2debug("tree items: %1", items) ReplaceCustomHelp( VBox( term(:Tree, Id(:wizardTree), Opt(:notify, :vstretch), title, items), VSpacing(1) ) ) end nil end |
#CreateTreeDialog ⇒ Object
Create and open a Tree wizard dialog.
For backwards compatibility only - don't use this any more in new modules.
1488 1489 1490 1491 |
# File 'library/wizard/src/modules/Wizard.rb', line 1488 def CreateTreeDialog OpenTreeNextBackDialog() nil end |
#CreateTreeInternal(tree, parent) ⇒ Array
Create the Tree Items
1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 |
# File 'library/wizard/src/modules/Wizard.rb', line 1518 def CreateTreeInternal(tree, parent) tree = deep_copy(tree) m = Builtins.filter(tree) do |c| Ops.get_string(c, "parent", "") == parent end ccbak = nil # #38596, broken recursion for iterators mm = Builtins.maplist(m) do |cc| tree_entry = Ops.get_string(cc, "id", "") ccbak = deep_copy(cc) items = CreateTreeInternal(tree, tree_entry) cc = deep_copy(ccbak) if Ops.greater_than(Builtins.size(items), 0) next Item( Id(Ops.get_string(cc, "id", "")), Ops.get_string(cc, "title", ""), items ) else next Item( Id(Ops.get_string(cc, "id", "")), Ops.get_string(cc, "title", "") ) end end Builtins.y2debug("items: %1", mm) deep_copy(mm) end |
#DeleteMenus ⇒ Object
Delete Menu items
1613 1614 1615 1616 1617 1618 1619 1620 1621 |
# File 'library/wizard/src/modules/Wizard.rb', line 1613 def DeleteMenus if haveFancyUI UI.WizardCommand(term(:DeleteMenus)) else UI.ReplaceWidget(Id(:topmenu), Empty()) end nil end |
#DeleteTreeItems ⇒ Object
Delete Tree items
1602 1603 1604 1605 1606 1607 1608 1609 1610 |
# File 'library/wizard/src/modules/Wizard.rb', line 1602 def DeleteTreeItems if haveFancyUI UI.WizardCommand(term(:DeleteTreeItems)) else ReplaceCustomHelp(Empty()) end nil end |
#DisableAbortButton ⇒ Object
This is a stable API function
Disable the wizard's "Abort" button.
1221 1222 1223 1224 1225 |
# File 'library/wizard/src/modules/Wizard.rb', line 1221 def DisableAbortButton UI.ChangeWidget(Id(:abort), :Enabled, false) if UI.WizardCommand(term(:EnableAbortButton, false)) == false nil end |
#DisableBackButton ⇒ Object
This is a stable API function
Disable the wizard's "Back" button.
1268 1269 1270 1271 1272 |
# File 'library/wizard/src/modules/Wizard.rb', line 1268 def DisableBackButton UI.ChangeWidget(Id(:back), :Enabled, false) if UI.WizardCommand(term(:EnableBackButton, false)) == false nil end |
#DisableCancelButton ⇒ Object
This is a stable API function
Disable the wizard's "Cancel" button.
1290 1291 1292 1293 1294 |
# File 'library/wizard/src/modules/Wizard.rb', line 1290 def DisableCancelButton UI.ChangeWidget(Id(:cancel), :Enabled, false) if UI.WizardCommand(term(:EnableCancelButton, false)) == false nil end |
#DisableNextButton ⇒ Object
This is a stable API function
Disable the wizard's "Next" (or "Accept") button.
1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 |
# File 'library/wizard/src/modules/Wizard.rb', line 1232 def DisableNextButton if UI.WizardCommand(term(:EnableNextButton, false)) == false if UI.WidgetExists(Id(:next)) UI.ChangeWidget(Id(:next), :Enabled, false) elsif UI.WidgetExists(Id(:accept)) UI.ChangeWidget(Id(:accept), :Enabled, false) else Builtins.y2error(-1, "Neither `next nor `accept widgets exist") end end nil end |
#EnableAbortButton ⇒ Object
This is a stable API function
Enable the wizard's "Abort" button.
1210 1211 1212 1213 1214 |
# File 'library/wizard/src/modules/Wizard.rb', line 1210 def EnableAbortButton UI.ChangeWidget(Id(:abort), :Enabled, true) if UI.WizardCommand(term(:EnableAbortButton, true)) == false nil end |
#EnableBackButton ⇒ Object
This is a stable API function
Enable the wizard's "Back" button.
1279 1280 1281 1282 1283 |
# File 'library/wizard/src/modules/Wizard.rb', line 1279 def EnableBackButton UI.ChangeWidget(Id(:back), :Enabled, true) if UI.WizardCommand(term(:EnableBackButton, true)) == false nil end |
#EnableCancelButton ⇒ Object
This is a stable API function
Enable the wizard's "Cancel" button.
1301 1302 1303 1304 1305 |
# File 'library/wizard/src/modules/Wizard.rb', line 1301 def EnableCancelButton UI.ChangeWidget(Id(:cancel), :Enabled, true) if UI.WizardCommand(term(:EnableCancelButton, true)) == false nil end |
#EnableNextButton ⇒ Object
This is a stable API function
Enable the wizard's "Next" (or "Accept") button.
1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 |
# File 'library/wizard/src/modules/Wizard.rb', line 1251 def EnableNextButton if UI.WizardCommand(term(:EnableNextButton, true)) == false if UI.WidgetExists(Id(:next)) UI.ChangeWidget(Id(:next), :Enabled, true) else UI.ChangeWidget(Id(:accept), :Enabled, true) end end nil end |
#GenericDialog(button_box) ⇒ Yast::Term
This is a stable API function
Create a Generic Dialog
Returns a term describing a generic wizard dialog with a configurable button box.
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 |
# File 'library/wizard/src/modules/Wizard.rb', line 274 def GenericDialog() = deep_copy() VBox( Id(:WizardDialog), ReplacePoint(Id(:topmenu), Empty()), VWeight( 1, # Layout trick: Lower layout priority with weight HBox( HSpacing(1), VBox( VSpacing(0.2), HBox( # translators: dialog title to appear before any content is initialized Heading(Id(:title), Opt(:hstretch), _("Initializing ...")), HStretch(), ReplacePoint(Id(:relnotes_rp), Empty()) ), VWeight( 1, # Layout trick: Lower layout priority with weight HVCenter(Opt(:hvstretch), ReplacePoint(Id(:contents), Empty())) ) ), HSpacing(1) ) ), ReplacePoint(Id(:rep_button_box), ), VSpacing(0.2) ) end |
#GenericTreeDialog(button_box) ⇒ Yast::Term
This is a stable API function
Create a Generic Tree Dialog
Returns a term describing a wizard dialog with left menu tree, right contents and a configurable button box.
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 |
# File 'library/wizard/src/modules/Wizard.rb', line 317 def GenericTreeDialog() = deep_copy() VBox( Id(:WizardDialog), ReplacePoint(Id(:topmenu), Empty()), HBox( HSpacing(1), HWeight( 30, ReplacePoint( Id(:helpSpace), # `RichText(`id(`HelpText), "") Empty() ) ), HSpacing(1), HWeight( 70, VBox( VSpacing(0.2), HBox( # translators: dialog title to appear before any content is initialized Heading( Id(:title), Opt(:hstretch), _("YaST\nInitializing ...\n") ), HStretch() ), VWeight( 1, # Layout trick: Lower layout priority with weight HVCenter(Opt(:hvstretch), ReplacePoint(Id(:contents), Empty())) ) ) ), HSpacing(1) ), ReplacePoint(Id(:rep_button_box), ), VSpacing(0.2) ) end |
#HasWidgetWizard ⇒ Boolean
Returns whether the `Wizard widget is available.
1311 1312 1313 1314 1315 1316 1317 1318 |
# File 'library/wizard/src/modules/Wizard.rb', line 1311 def HasWidgetWizard if !UI.HasSpecialWidget(:Wizard) Builtins.y2milestone("no Wizard available") return false end true end |
#haveFancyUI ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'library/wizard/src/modules/Wizard.rb', line 71 def haveFancyUI if @have_fancy_ui_cache.nil? ui_info = UI.GetDisplayInfo @have_fancy_ui_cache = UI.HasSpecialWidget(:Wizard) == true && Ops.greater_or_equal(Ops.get_integer(ui_info, "Depth", 0), 15) && Ops.greater_or_equal(Ops.get_integer(ui_info, "DefaultWidth", 0), 800) && # some netbooks use such a strange resolution (fate#306298) Ops.greater_or_equal( Ops.get_integer(ui_info, "DefaultHeight", 0), 576 ) # have_fancy_ui_cache = false; UI.SetFunctionKeys(Label.DefaultFunctionKeyMap) end @have_fancy_ui_cache end |
#HideAbortButton ⇒ Object
This is a stable API function
Hide the Wizard's "Abort" button. Restore it later with RestoreAbortButton():
997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 |
# File 'library/wizard/src/modules/Wizard.rb', line 997 def HideAbortButton if UI.WizardCommand(term(:SetAbortButtonLabel, "")) == false if UI.WidgetExists(Id(:rep_abort)) UI.ReplaceWidget(Id(:rep_abort), Empty()) elsif UI.WidgetExists(Id(:cancel)) UI.ReplaceWidget(Id(:cancel), Empty()) end end nil end |
#HideBackButton ⇒ Object
This is a stable API function
Hide the Wizard's "Back" button. Restore it later with RestoreBackButton():
962 963 964 965 966 |
# File 'library/wizard/src/modules/Wizard.rb', line 962 def HideBackButton UI.ReplaceWidget(Id(:rep_back), Empty()) if UI.WizardCommand(term(:SetBackButtonLabel, "")) == false && UI.WidgetExists(Id(:rep_back)) nil end |
#HideNextButton ⇒ Object
This is a stable API function
Hide the Wizard's "Next" button. Restore it later with RestoreNextButton():
950 951 952 953 954 |
# File 'library/wizard/src/modules/Wizard.rb', line 950 def HideNextButton UI.ReplaceWidget(Id(:rep_next), Empty()) if UI.WizardCommand(term(:SetNextButtonLabel, "")) == false && UI.WidgetExists(Id(:rep_next)) nil end |
#HideReleaseNotesButton ⇒ Object
Hide the "Release Notes" button, if there is any
1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 |
# File 'library/wizard/src/modules/Wizard.rb', line 1347 def HideReleaseNotesButton # has wizard? continue # otherwise use dedicated ReplacePoint or reuse the back button # hide-releasenotes-button failed? continue # reuse use dedicated ReplacePoint or the back button if HasWidgetWizard() == false || UI.WizardCommand(term(:HideReleaseNotesButton)) == false @relnotes_button_label = "" @relnotes_button_id = "" if UI.WidgetExists(Id(:relnotes_rp)) UI.ReplaceWidget(Id(:relnotes_rp), Empty()) elsif UI.WidgetExists(Id(:back_rep)) UI.ReplaceWidget(Id(:back_rep), Empty()) end end nil end |
#IsWizardDialog ⇒ Boolean
Check if the topmost dialog is a wizard dialog
(i.e. has a widget with id(
WizardDialog) )
363 364 365 366 |
# File 'library/wizard/src/modules/Wizard.rb', line 363 def IsWizardDialog UI.WidgetExists(Id(:WizardDialog)) == true || UI.WidgetExists(:wizard) == true end |
#main ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'library/wizard/src/modules/Wizard.rb', line 35 def main Yast.import "UI" textdomain "base" Yast.import "Desktop" Yast.import "Label" Yast.import "Popup" Yast.import "Directory" Yast.import "OSRelease" @have_fancy_ui_cache = nil # this variable is set from Product:: constructor # to setup correct &product; macro in UI @product_name = "" # # Screenshot Functions # # Currently used screenshot name. # Initially, it must match the UI default, "yast2" @screenshot_name = "yast2" # Screenshot names overriden by nested SetScreenShotName calls @screenshot_name_stack = [] # Handling of relnotes button when creating a wizard over existing one # Cannot be handled by libyui for NCurses @relnotes_button_label = "" @relnotes_button_id = "" # Current icon name to set. @icon_name = DEFAULT_ICON_NAME end |
#NextBackDialog ⇒ Yast::Term
This is a stable API function
Returns a standard wizard dialog with buttons "Next", "Back", "Abort".
392 393 394 |
# File 'library/wizard/src/modules/Wizard.rb', line 392 def NextBackDialog GenericDialog(BackAbortNextButtonBox()) end |
#OKDialog ⇒ Yast::Term
This is a stable API function
Returns a standard wizard dialog with buttons "Cancel", "OK"
412 413 414 |
# File 'library/wizard/src/modules/Wizard.rb', line 412 def OKDialog GenericDialog(CancelOKButtonBox()) end |
#open_wizard_dialog(*args) ⇒ Object (protected)
Sets the icon and opens a wizard dialog with the content specified as arguments
1841 1842 1843 1844 1845 1846 1847 |
# File 'library/wizard/src/modules/Wizard.rb', line 1841 def open_wizard_dialog(*args) set_icon UI.OpenDialog( Opt(:wizardDialog), Wizard(*args) ) end |
#OpenAbortApplyFinishDialog ⇒ Object
Open a dialog with "Accept", "Cancel" and set the keyboard focus to "Accept".
504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 |
# File 'library/wizard/src/modules/Wizard.rb', line 504 def OpenAbortApplyFinishDialog if haveFancyUI open_wizard_dialog( :apply, _("&Apply"), :abort, Label.AbortButton, :finish, Label.FinishButton ) else OpenDialog(GenericDialog(AbortApplyFinishButtonBox())) UI.SetFocus(Id(:finish)) end nil end |
#OpenAcceptAbortStepsDialog ⇒ Object
Open a dialog with "Accept", "Cancel" that will also accept workflow steps.
547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 |
# File 'library/wizard/src/modules/Wizard.rb', line 547 def OpenAcceptAbortStepsDialog if haveFancyUI open_wizard_dialog( Opt(:stepsEnabled), :no_back_button, "", :abort, Label.AbortButton, :accept, Label.AcceptButton ) # Don't let sloppy calls to Wizard::SetContents() disable this button by accident UI.WizardCommand(term(:ProtectNextButton, true)) else OpenDialog(GenericDialog(AbortAcceptButtonBox())) end nil end |
#OpenAcceptDialog ⇒ Object
Open a dialog with "Accept", "Cancel" and set the keyboard focus to "Accept".
456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 |
# File 'library/wizard/src/modules/Wizard.rb', line 456 def OpenAcceptDialog if haveFancyUI open_wizard_dialog( :no_back_button, "", :cancel, Label.CancelButton, :accept, Label.AcceptButton ) # Don't let sloppy calls to Wizard::SetContents() disable this button by accident UI.WizardCommand(term(:ProtectNextButton, true)) else OpenDialog(AcceptDialog()) UI.SetFocus(Id(:accept)) end nil end |
#OpenAcceptStepsDialog ⇒ Object
Open a dialog with "Accept", "Cancel" that will also accept workflow steps.
524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 |
# File 'library/wizard/src/modules/Wizard.rb', line 524 def OpenAcceptStepsDialog if haveFancyUI open_wizard_dialog( Opt(:stepsEnabled), :no_back_button, "", :cancel, Label.CancelButton, :accept, Label.AcceptButton ) # Don't let sloppy calls to Wizard::SetContents() disable this button by accident UI.WizardCommand(term(:ProtectNextButton, true)) else OpenAcceptDialog() end nil end |
#OpenCancelOKDialog ⇒ Object
Overview Dialog http://en.opensuse.org/YaST/Style_Guide#Single_Configuration.2FOverview.2FEdit_Dialog dialog with Cancel and OK buttons (cancel has function as abort)
972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 |
# File 'library/wizard/src/modules/Wizard.rb', line 972 def OpenCancelOKDialog if haveFancyUI open_wizard_dialog( :back, Label.BackButton, :abort, Label.CancelButton, :next, Label.OKButton ) HideBackButton() else OpenDialog(NextBackDialog()) UI.SetFocus(Id(:next)) end nil end |
#OpenCustomDialog(help_space_contents, button_box) ⇒ void
This method returns an undefined value.
Open a wizard dialog with simple layout
no graphics, no steps, only a help widget buttons (by default "Back", "Abort", "Next").
This is the only type of wizard dialog which still allows replacing the help space - either already upon opening it or later with Wizard::ReplaceCustomHelp().
If help_space_contents is 'nil', the normal help widget will remain. If button_box is 'nil', Wizard::BackAbortNextButtonBox() is used.
646 647 648 649 650 651 652 653 654 655 656 657 |
# File 'library/wizard/src/modules/Wizard.rb', line 646 def OpenCustomDialog(help_space_contents, ) help_space_contents = deep_copy(help_space_contents) = deep_copy() = BackAbortNextButtonBox() if .nil? set_icon UI.OpenDialog(Opt(:wizardDialog), GenericDialog()) UI.ReplaceWidget(Id(:helpSpace), help_space_contents) if !help_space_contents.nil? nil end |
#OpenDialog(dialog) ⇒ Object
This is a stable API function
Open any wizard dialog.
422 423 424 425 426 427 428 429 430 |
# File 'library/wizard/src/modules/Wizard.rb', line 422 def OpenDialog(dialog) dialog = deep_copy(dialog) set_icon UI.OpenDialog(Opt(:wizardDialog), dialog) ShowReleaseNotesButton(@relnotes_button_label, @relnotes_button_id) if !@relnotes_button_id.empty? nil end |
#OpenLeftTitleNextBackDialog ⇒ Object
Open a dialog with "Back", "Next", "Abort" that has the title on the left, as wanted by the installation visual design
591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 |
# File 'library/wizard/src/modules/Wizard.rb', line 591 def OpenLeftTitleNextBackDialog if haveFancyUI open_wizard_dialog( Opt(:titleOnLeft), :back, Label.BackButton, :abort, Label.AbortButton, :next, Label.NextButton ) else OpenNextBackDialog() end nil end |
#OpenNextBackDialog ⇒ Object
Open a dialog with buttons "Next", "Back", "Abort" and set the keyboard focus to "Next".
435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 |
# File 'library/wizard/src/modules/Wizard.rb', line 435 def OpenNextBackDialog if haveFancyUI open_wizard_dialog( :back, Label.BackButton, :abort, Label.AbortButton, :next, Label.NextButton ) else OpenDialog(NextBackDialog()) UI.SetFocus(Id(:next)) end nil end |
#OpenNextBackStepsDialog ⇒ Object
Open a dialog with "Back", "Next", "Abort" that will also accept workflow steps.
570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 |
# File 'library/wizard/src/modules/Wizard.rb', line 570 def OpenNextBackStepsDialog if haveFancyUI open_wizard_dialog( Opt(:stepsEnabled), :back, Label.BackButton, :abort, Label.AbortButton, :next, Label.NextButton ) else OpenNextBackDialog() end nil end |
#OpenOKDialog ⇒ Object
Open a dialog with "OK", "Cancel" and set the keyboard focus to "OK".
480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 |
# File 'library/wizard/src/modules/Wizard.rb', line 480 def OpenOKDialog if haveFancyUI open_wizard_dialog( :no_back_button, "", :cancel, Label.CancelButton, :ok, Label.OKButton ) # Don't let sloppy calls to Wizard::SetContents() disable this button by accident UI.WizardCommand(term(:ProtectNextButton, true)) else OpenDialog(OKDialog()) UI.SetFocus(Id(:ok)) end nil end |
#OpenTreeNextBackDialog ⇒ Object
Open a Tree dialog with buttons "Next", "Back", "Abort" and set the keyboard focus to "Next".
1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 |
# File 'library/wizard/src/modules/Wizard.rb', line 1465 def OpenTreeNextBackDialog if haveFancyUI open_wizard_dialog( Opt(:treeEnabled), :back, Label.BackButton, :abort, Label.AbortButton, :next, Label.NextButton ) else OpenDialog(GenericTreeDialog(BackAbortNextButtonBox())) UI.SetFocus(Id(:next)) end nil end |
#OpenWithLayout(layout) ⇒ Object
Open a new wizard according to the layout configuration
612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 |
# File 'library/wizard/src/modules/Wizard.rb', line 612 def OpenWithLayout(layout) UI.SetProductLogo(layout.) if layout.mode.steps? self.OpenNextBackStepsDialog elsif layout.mode.tree? self.OpenTreeNextBackDialog elsif layout.mode.title_on_left? self.OpenLeftTitleNextBackDialog elsif layout.mode.title_on_top? self.OpenNextBackDialog else raise "Unknown layout mode: #{layout}" end end |
#QueryTreeItem ⇒ Object
Query Tree Item
1548 1549 1550 1551 1552 1553 1554 |
# File 'library/wizard/src/modules/Wizard.rb', line 1548 def QueryTreeItem if haveFancyUI Convert.to_string(UI.QueryWidget(Id(:wizard), :CurrentItem)) else Convert.to_string(UI.QueryWidget(Id(:wizardTree), :CurrentItem)) end end |
#ReplaceButtonBox(button_box) ⇒ void
This method returns an undefined value.
PRIVATE - Replace the entire Wizard button box with a new one.
1198 1199 1200 1201 1202 1203 |
# File 'library/wizard/src/modules/Wizard.rb', line 1198 def ReplaceButtonBox() = deep_copy() UI.ReplaceWidget(Id(:rep_button_box), ) nil end |
#ReplaceCustomHelp(contents) ⇒ Object
Replace the help widget for dialogs opened with Wizard::OpenCustomDialog().
662 663 664 665 666 667 668 669 670 671 672 673 |
# File 'library/wizard/src/modules/Wizard.rb', line 662 def ReplaceCustomHelp(contents) contents = deep_copy(contents) if UI.WidgetExists(Id(:helpSpace)) UI.ReplaceWidget(Id(:helpSpace), contents) else Builtins.y2error( "Wizard::ReplaceHelpSpace() works only for dialogs opened with Wizard::OpenSimpleDialog() !" ) end nil end |
#ReplaceHelp(contents) ⇒ Object
Replace the wizard help subwindow with a custom widget.
767 768 769 770 771 772 773 774 775 776 777 778 779 |
# File 'library/wizard/src/modules/Wizard.rb', line 767 def ReplaceHelp(contents) contents = deep_copy(contents) if UI.WidgetExists(Id(:helpSpace)) Builtins.y2warning("Wizard::ReplaceHelp() is deprecated!") UI.ReplaceWidget(Id(:helpSpace), contents) else Builtins.y2error( "Wizard::ReplaceHelp() is not supported by the new Qt wizard!" ) end nil end |
#RestoreAbortButton ⇒ Object
This is a stable API function
Restore the wizard 'abort' button.
1036 1037 1038 1039 1040 |
# File 'library/wizard/src/modules/Wizard.rb', line 1036 def RestoreAbortButton SetAbortButton(:abort, Label.AbortButton) nil end |
#RestoreBackButton ⇒ Object
This is a stable API function
Restore the wizard 'back' button.
1014 1015 1016 1017 1018 |
# File 'library/wizard/src/modules/Wizard.rb', line 1014 def RestoreBackButton SetBackButton(:back, Label.BackButton) nil end |
#RestoreHelp(help_text) ⇒ Object
Restore the wizard help subwindow.
784 785 786 787 788 |
# File 'library/wizard/src/modules/Wizard.rb', line 784 def RestoreHelp(help_text) SetHelpText(help_text) nil end |
#RestoreNextButton ⇒ Object
This is a stable API function
Restore the wizard 'next' button.
1025 1026 1027 1028 1029 |
# File 'library/wizard/src/modules/Wizard.rb', line 1025 def RestoreNextButton SetNextButton(:next, Label.NextButton) nil end |
#RestoreScreenShotName ⇒ Object
Restore the screenshot name.
If it does not match a SetScreenShotName, "yast2" is used and a y2error logged.
1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 |
# File 'library/wizard/src/modules/Wizard.rb', line 1446 def RestoreScreenShotName @screenshot_name = Ops.get(@screenshot_name_stack, 0) if @screenshot_name.nil? @screenshot_name = "yast2" Builtins.y2error(1, "No screenshot name to restore!") else @screenshot_name_stack = Builtins.remove(@screenshot_name_stack, 0) end nil end |
#RetranslateButtons ⇒ Object
Retranslate the wizard buttons.
This will revert button labels and IDs to the defaults that were used upon Wizard::CreateDialog(), Wizard::OpenNextBackDialog(), or Wizard::OpenAcceptDialog().
1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 |
# File 'library/wizard/src/modules/Wizard.rb', line 1372 def RetranslateButtons textdomain "base" # Reload translations if UI.WidgetExists(Id(:WizardDialog)) == true # NCurses wizard UI.ChangeWidget(Id(:help), :Label, Label.HelpButton) if UI.WidgetExists(Id(:help)) ReplaceButtonBox( if UI.WidgetExists(Id(:accept)) AbortAcceptButtonBox() else BackAbortNextButtonBox() end ) else # Qt wizard UI.WizardCommand(term(:RetranslateInternalButtons)) if UI.WidgetExists(:accept) UI.WizardCommand(term(:SetBackButtonLabel, "")) UI.WizardCommand(term(:SetAbortButtonLabel, Label.AbortButton)) UI.WizardCommand(term(:SetNextButtonLabel, Label.AcceptButton)) else UI.WizardCommand(term(:SetBackButtonLabel, Label.BackButton)) UI.WizardCommand(term(:SetAbortButtonLabel, Label.AbortButton)) UI.WizardCommand(term(:SetNextButtonLabel, Label.NextButton)) end end nil end |
#SelectTreeItem(tree_item) ⇒ Object
Select Tree item
1591 1592 1593 1594 1595 1596 1597 1598 1599 |
# File 'library/wizard/src/modules/Wizard.rb', line 1591 def SelectTreeItem(tree_item) if haveFancyUI UI.WizardCommand(term(:SelectTreeItem, tree_item)) else UI.ChangeWidget(Id(:wizardTree), :CurrentItem, tree_item) end nil end |
#set_icon ⇒ Boolean (protected)
Sets the application icon according to the value of @icon_name
This should be called only immediately before opening a dialog; premature UI calls can interfere with the CommandLine mode.
1855 1856 1857 1858 |
# File 'library/wizard/src/modules/Wizard.rb', line 1855 def set_icon UI.SetApplicationIcon(@icon_name) true end |
#SetAbortButton(id, label) ⇒ Object
This is a stable API function
Set the dialog's "Abort" button with a new label and a new ID
929 930 931 932 933 934 935 936 937 938 939 940 941 942 |
# File 'library/wizard/src/modules/Wizard.rb', line 929 def SetAbortButton(id, label) id = deep_copy(id) if UI.WizardCommand(term(:SetAbortButtonLabel, label)) == true UI.WizardCommand(term(:SetAbortButtonID, id)) elsif UI.WidgetExists(Id(:rep_abort)) UI.ReplaceWidget( Id(:rep_abort), PushButton(Id(id), Opt(:key_F9), label) ) end nil end |
#SetBackButton(id, label) ⇒ Object
This is a stable API function
Set the dialog's "Back" button with a new label and a new ID
908 909 910 911 912 913 914 915 916 917 918 919 920 |
# File 'library/wizard/src/modules/Wizard.rb', line 908 def SetBackButton(id, label) id = deep_copy(id) if UI.WizardCommand(term(:SetBackButtonLabel, label)) == true UI.WizardCommand(term(:SetBackButtonID, id)) elsif UI.WidgetExists(Id(:rep_back)) UI.ReplaceWidget( Id(:rep_back), PushButton(Id(id), Opt(:key_F8), label) ) end nil end |
#SetContents(title, contents, help_text, has_back, has_next) ⇒ Object
This is a stable API function
Set the contents of a wizard dialog
How the general framework for the installation wizard should look like. This function creates and shows a dialog.
857 858 859 860 861 862 |
# File 'library/wizard/src/modules/Wizard.rb', line 857 def SetContents(title, contents, help_text, has_back, has_next) contents = deep_copy(contents) SetContentsFocus(title, contents, help_text, has_back, has_next, true) nil end |
#SetContentsButtons(title, contents, help_text, back_label, next_label) ⇒ Object
Set contents and Buttons of wizard dialog
Additionally set its title, help_text and buttons labels. Enables both back and next button.
1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 |
# File 'library/wizard/src/modules/Wizard.rb', line 1054 def SetContentsButtons(title, contents, help_text, back_label, next_label) contents = deep_copy(contents) UI.PostponeShortcutCheck RestoreBackButton() RestoreNextButton() if UI.WizardCommand(term(:SetBackButtonLabel, back_label)) == true UI.WizardCommand(term(:SetNextButtonLabel, next_label)) else # Set button labels first to avoid geometry problems: SetContents() # calls ReplaceWidget() wich triggers a re-layout. UI.ChangeWidget(Id(:back), :Label, back_label) if UI.WidgetExists(Id(:back)) UI.ChangeWidget(Id(:next), :Label, next_label) if UI.WidgetExists(Id(:next)) end SetContents(title, contents, help_text, true, true) SetHelpText(help_text) UI.CheckShortcuts nil end |
#SetContentsFocus(title, contents, help_text, has_back, has_next, set_focus) ⇒ Object
Set the contents of a wizard dialog and define if to move focus to next button
How the general framework for the installation wizard should look like. This function creates and shows a dialog.
816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 |
# File 'library/wizard/src/modules/Wizard.rb', line 816 def SetContentsFocus(title, contents, help_text, has_back, has_next, set_focus) contents = deep_copy(contents) if UI.WizardCommand(term(:SetDialogHeading, title)) == true UI.WizardCommand(term(:SetHelpText, help_text)) UI.WizardCommand(term(:EnableNextButton, has_next)) UI.WizardCommand(term(:EnableBackButton, has_back)) UI.WizardCommand(term(:SetFocusToNextButton)) if set_focus else if UI.WidgetExists(Id(:next)) UI.ChangeWidget(Id(:next), :Enabled, has_next) UI.SetFocus(Id(:next)) end UI.ChangeWidget(Id(:back), :Enabled, has_back) if UI.WidgetExists(Id(:back)) UI.ChangeWidget(Id(:abort), :Enabled, true) if UI.WidgetExists(Id(:abort)) UI.ChangeWidget(Id(:title), :Value, title) if UI.WidgetExists(Id(:title)) UI.SetFocus(Id(:accept)) if set_focus && UI.WidgetExists(Id(:accept)) end SetHelpText(help_text) UI.ReplaceWidget(Id(:contents), contents) nil end |
#SetDesktopIcon(file) ⇒ Boolean
Sets the icon specified in a .desktop file got as parameter. Desktop file is placed in a special directory (/usr/share/applications/YaST2). Parameter file is realative to that directory without ".desktop" suffix. Warning: There are no desktop files in inst-sys. Use "SetTitleIcon" instead.
1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 |
# File 'library/wizard/src/modules/Wizard.rb', line 1156 def SetDesktopIcon(file) description = Desktop.ParseSingleDesktopFile(file) return false unless description icon = description["Icon"].to_s return false if icon.empty? @icon_name = icon set_icon end |
#SetDesktopTitle(file) ⇒ Boolean
Sets the window title according to the name specified in a .desktop file got as parameter. Desktop file is placed in a special directory (/usr/share/applications/YaST2). Parameter file is realative to that directory without ".desktop" suffix.
1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 |
# File 'library/wizard/src/modules/Wizard.rb', line 1131 def SetDesktopTitle(file) description = Desktop.ParseSingleDesktopFile(file) # fallback name for the dialog title name = Ops.get(description, "Name", _("Module")) Builtins.y2debug("Set dialog title: %1", name) SetDialogTitle(name) Builtins.haskey(description, "Name") end |
#SetDesktopTitleAndIcon(file) ⇒ Boolean
Convenience function to avoid 2 calls if application needs to set both dialog title and icon from desktop file specified as parameter. Desktop file is placed in a special directory (/usr/share/applications/YaST2). Parameter file is realative to that directory without ".desktop" suffix. Warning: There are no desktop files in inst-sys.
1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 |
# File 'library/wizard/src/modules/Wizard.rb', line 1181 def SetDesktopTitleAndIcon(file) description = Desktop.ParseSingleDesktopFile(file) # fallback name for the dialog title name = Ops.get(description, "Name", _("Module")) Builtins.y2debug("Set dialog title: %1", name) SetDialogTitle(name) SetDesktopIcon(file) Builtins.haskey(description, "Name") end |
#SetDialogTitle(title_text) ⇒ Object
Sets the dialog title shown in the window manager's title bar.
1085 1086 1087 1088 1089 1090 1091 1092 1093 |
# File 'library/wizard/src/modules/Wizard.rb', line 1085 def SetDialogTitle(title_text) # backward compatibility with showing just YaST2 in qt # see bsc#1033161 comment#4 UI.SetApplicationTitle("YaST2") if haveFancyUI UI.WizardCommand(term(:SetDialogTitle, title_text)) nil end |
#SetFocusToBackButton ⇒ Object
This is a stable API function
Set the keyboard focus to the wizard's "Back" (or "Cancel") button.
1416 1417 1418 1419 1420 1421 1422 |
# File 'library/wizard/src/modules/Wizard.rb', line 1416 def SetFocusToBackButton if UI.WizardCommand(term(:SetFocusToBackButton)) == false UI.SetFocus(UI.WidgetExists(Id(:back)) ? Id(:back) : Id(:cancel)) end nil end |
#SetFocusToNextButton ⇒ Object
This is a stable API function
Set the keyboard focus to the wizard's "Next" (or "Accept") button.
1404 1405 1406 1407 1408 1409 1410 |
# File 'library/wizard/src/modules/Wizard.rb', line 1404 def SetFocusToNextButton if UI.WizardCommand(term(:SetFocusToNextButton)) == false UI.SetFocus(UI.WidgetExists(Id(:next)) ? Id(:next) : Id(:accept)) end nil end |
#SetHelpText(help_text) ⇒ Object
Set a new help text.
756 757 758 759 760 |
# File 'library/wizard/src/modules/Wizard.rb', line 756 def SetHelpText(help_text) UI.ChangeWidget(Id(:WizardDialog), :HelpText, help_text) if UI.WizardCommand(term(:SetHelpText, help_text)) == false nil end |
#SetNextButton(id, label) ⇒ Object
This is a stable API function
Set the dialog's "Next" button with a new label and a new ID
887 888 889 890 891 892 893 894 895 896 897 898 899 |
# File 'library/wizard/src/modules/Wizard.rb', line 887 def SetNextButton(id, label) id = deep_copy(id) if UI.WizardCommand(term(:SetNextButtonLabel, label)) == true UI.WizardCommand(term(:SetNextButtonID, id)) elsif UI.WidgetExists(Id(:rep_next)) UI.ReplaceWidget( Id(:rep_next), PushButton(Id(id), Opt(:key_F10, :default), label) ) end nil end |
#SetProductName(name) ⇒ void
This method returns an undefined value.
Set the product name for UI
1745 1746 1747 1748 1749 1750 1751 |
# File 'library/wizard/src/modules/Wizard.rb', line 1745 def SetProductName(name) Builtins.y2milestone("Setting product name to '%1'", name) @product_name = name UI.SetProductName(@product_name) nil end |
#SetScreenShotName(name) ⇒ Object
Set a name for the current dialog:
Declare a name for the current dialog to ease making screenshots.
By convention, the name is
{rpm-name-without-yast2}-{sorting-prefix}-{description}
The calls may be nested.
1432 1433 1434 1435 1436 1437 1438 1439 1440 |
# File 'library/wizard/src/modules/Wizard.rb', line 1432 def SetScreenShotName(name) @screenshot_name_stack = Builtins.prepend( @screenshot_name_stack, @screenshot_name ) @screenshot_name = name nil end |
#SetTitleIcon(_icon_name) ⇒ Object
Deprecated. Do nothing.
Sets the wizard 'title' icon to the specified icon from the standard icon directory.
1106 1107 1108 |
# File 'library/wizard/src/modules/Wizard.rb', line 1106 def SetTitleIcon(_icon_name) nil end |
#ShowHelp(help_text) ⇒ Object
This is a stable API function
Open a popup dialog that displays a help text (rich text format).
374 375 376 377 378 379 380 381 382 383 384 |
# File 'library/wizard/src/modules/Wizard.rb', line 374 def ShowHelp(help_text) Popup.LongText( # Heading for help popup window _("Help"), RichText(help_text), 50, 20 ) nil end |
#ShowReleaseNotesButton(label, id) ⇒ Object
Show a "Release Notes" button with the specified label and ID if there is a "steps" panel
1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 |
# File 'library/wizard/src/modules/Wizard.rb', line 1322 def ShowReleaseNotesButton(label, id) # has wizard? continue # otherwise use dedicated ReplacePoint or reuse the back button # show-releasenotes-button failed? continue # use dedicated ReplacePoint or reuse the back button if HasWidgetWizard() == false || UI.WizardCommand(term(:ShowReleaseNotesButton, label, id)) == false @relnotes_button_label = label @relnotes_button_id = id if UI.WidgetExists(Id(:relnotes_rp)) UI.ReplaceWidget(Id(:relnotes_rp), PushButton(Id(id), Opt(:relNotesButton), label)) # Reuse Back button # TODO: can this situation happen elsif UI.WidgetExists(Id(:back_rep)) UI.ReplaceWidget(Id(:back_rep), PushButton(Id(id), label)) else Builtins.y2warning("Widget `back_rep does not exist") end end nil end |
#TimeoutUserInput(timeout_millisec) ⇒ Object
Substitute for UI::TimeoutUserInput
Analogical to Wizard::UserInput.
717 718 719 720 721 722 723 724 |
# File 'library/wizard/src/modules/Wizard.rb', line 717 def TimeoutUserInput(timeout_millisec) input = UI.TimeoutUserInput(timeout_millisec) return :next if input == :accept return :back if input == :cancel deep_copy(input) end |
#TimeoutWaitForEvent(timeout_millisec) ⇒ Object
Substitute for UI::WaitForEvent with timeout
Analog to Wizard::UserInput.
743 744 745 746 747 748 749 750 |
# File 'library/wizard/src/modules/Wizard.rb', line 743 def TimeoutWaitForEvent(timeout_millisec) input = UI.WaitForEvent(timeout_millisec) Ops.set(input, "ID", :next) if Ops.get(input, "ID") == :accept Ops.set(input, "ID", :back) if Ops.get(input, "ID") == :cancel deep_copy(input) end |
#UserInput ⇒ maybe normalized
Substitute for UI::UserInput
This function transparently handles different variations of the wizard
layout. Returns next if
next or accept were clicked,
back if back
or
cancel were clicked. Simply replace
ret = UI::UserInput()
with
ret = Wizard::UserInput()
702 703 704 705 706 707 708 709 |
# File 'library/wizard/src/modules/Wizard.rb', line 702 def UserInput input = UI.UserInput return :next if input == :accept return :back if input == :cancel deep_copy(input) end |
#WaitForEvent ⇒ Object
Substitute for UI::WaitForEvent
Analog to Wizard::UserInput.
730 731 732 733 734 735 736 737 |
# File 'library/wizard/src/modules/Wizard.rb', line 730 def WaitForEvent input = UI.WaitForEvent Ops.set(input, "ID", :next) if Ops.get(input, "ID") == :accept Ops.set(input, "ID", :back) if Ops.get(input, "ID") == :cancel deep_copy(input) end |