Class: Yast::PopupClass
- Inherits:
-
Module
- Object
- Module
- Yast::PopupClass
- Defined in:
- ../../library/general/src/modules/Popup.rb
Instance Method Summary (collapse)
-
- (Object) AnyMessage(headline, message)
Generic message popup.
-
- (Object) anyMessageDetailsInternal(headline, message, details, icon_name)
Internal function - wrapper for anyMessageDetailsInternalType call.
-
- (Object) anyMessageDetailsInternalType(headline, message, details, icon_name, richtext, width, height)
Generic message popup with Details button - internal.
-
- (Object) anyMessageInternal(headline, message, icon_name)
Internal function - wrapper for anyMessageInternal call.
-
- (Object) anyMessageInternalRich(headline, message, icon_name, width, height)
Internal function - wrapper for anyMessageInternal call.
-
- (Object) anyMessageInternalType(headline, message, icon_name, richtext, width, height)
Generic message popup - internal.
-
- (Object) AnyQuestion(headline, message, yes_button_message, no_button_message, focus)
Generic question popup with two buttons.
-
- (Object) AnyQuestion3(headline, message, yes_button_message, no_button_message, retry_button_message, focus)
Generic question popup with three buttons.
-
- (Yast::Term) AnyQuestionButtonBox(yes_button_message, no_button_message, focus)
Button box for the AnyQuestion Dialog (internal function).
-
- (Object) AnyQuestionRichText(headline, richtext, hdim, vdim, yes_button_message, no_button_message, focus)
Show a question that might need scrolling.
-
- (Object) anyRichMessageInternal(headline, message, icon_name, width, height)
Generic message popup - internal.
-
- (void) AnyTimedMessage(headline, message, timeout)
Generic message popup.
-
- (Object) anyTimedMessageInternal(headline, message, icon_name, timeout)
Internal function - wrapper for anyTimedMessageTypeInternal call.
-
- (void) anyTimedMessageTypeInternal(headline, message, icon_name, timeout, richtext, width, height)
Internal version of AnyTimedMessage.
- - (Object) AnyTimedRichMessage(headline, message, timeout)
-
- (Object) anyTimedRichMessageInternal(headline, message, icon_name, timeout, width, height)
Internal function - wrapper for anyTimedMessageTypeInternal call.
-
- (void) ClearFeedback
Clear feedback message.
-
- (Boolean) ConfirmAbort(severity)
Confirmation for “Abort” button during installation.
-
- (Boolean) ContinueCancel(message)
Dialog which displays the “message” and has a Continue and a Cancel button.
-
- (Boolean) ContinueCancelHeadline(headline, message)
Dialog which displays the “message” and has a Continue and a Cancel button.
-
- (Object) Error(message)
Show an error message and wait until user clicked “OK”.
-
- (Object) ErrorAnyQuestion(headline, message, yes_button_message, no_button_message, focus)
Generic error question popup with two buttons.
-
- (Object) ErrorDetails(message, details)
Show an error message with Details button and wait until user clicked “OK”.
-
- (Object) Feedback(headline, message, &block)
Run the block with a feeback popup The popup is automatically closed at the end (even when an exception is raised).
-
- (Object) LongError(message)
Show a long error and wait until user clicked “OK”.
-
- (Object) LongErrorGeometry(message, width, height)
Show a long error message and wait until user clicked “OK”.
-
- (Object) LongMessage(message)
Show a long message and wait until user clicked “OK”.
-
- (Object) LongMessageGeometry(message, width, height)
Show a long message and wait until user clicked “OK”.
-
- (Object) LongNotify(message)
Show a long notify message and wait until user clicked “OK”.
-
- (Object) LongNotifyGeometry(message, width, height)
Show a long notify message and wait until user clicked “OK”.
-
- (Object) LongText(headline, richtext, hdim, vdim)
Show a long text that might need scrolling.
-
- (Object) LongWarning(message)
Show a long warning and wait until user clicked “OK”.
-
- (Object) LongWarningGeometry(message, width, height)
Show a long warning and wait until user clicked “OK”.
- - (Object) main
-
- (Object) Message(message)
Show a simple message and wait until user clicked “OK”.
-
- (Object) MessageDetails(message, details)
Show a message with Details button and wait until user clicked “OK”.
-
- (Symbol) ModuleError(text)
Special error popup for YCP modules that don't work.
-
- (Object) NoHeadline
Indicator for empty headline for popups that can optionally have one.
-
- (Object) NoIcon
Indicator for empty icon for popups that can have one - for code readability.
-
- (Object) Notify(message)
Show a notification message and wait until user clicked “OK”.
-
- (Object) NotifyDetails(message, details)
Show a notify message with Details button and wait until user clicked “OK”.
-
- (Object) popupLayoutInternal(headline, message, icon_name, button_box)
Internal function - wrapper for popupLayoutInternalTypeWithLabel call.
-
- (Object) popupLayoutInternalRich(headline, message, icon_name, button_box, width, height)
Internal function - wrapper for popupLayoutInternalTypeWithLabel call.
-
- (Yast::Term) popupLayoutInternalTypeWithLabel(headline, message, icon_name, button_box, label, richtext, width, height)
Internal function that returns a popup dialog with an additional label.
-
- (Object) ReallyAbort(have_changes)
Confirmation popup when user clicked “Abort”.
-
- (void) ShowFeedback(headline, message)
Show popup with a headline and a message for feedback.
-
- (Object) ShowFile(headline, filename)
Show the contents of an entire file in a popup.
-
- (Object) ShowText(headline, text)
Show the contents of an entire file in a popup.
-
- (Object) ShowTextTimed(headline, text, timeout)
Show the contents of an entire file in a popup.
-
- (Boolean) TimedAnyQuestion(headline, message, yes_button_message, no_button_message, focus, timeout_seconds)
Timed question popup with two buttons and time display.
-
- (void) TimedError(message, timeout_seconds)
Show an error message and wait specified amount of time or until user clicked “OK”.
-
- (Boolean) TimedErrorAnyQuestion(headline, message, yes_button_message, no_button_message, focus, timeout_seconds)
Timed error question popup with two buttons and time display.
-
- (Object) TimedLongError(message, timeout_seconds)
Show a long error message and wait until user clicked “OK” or time is out.
-
- (Object) TimedLongErrorGeometry(message, timeout_seconds, width, height)
Show a long error message and wait until user clicked “OK” or time is out.
-
- (Object) TimedLongMessage(message, timeout_seconds)
Show a long message and wait until user clicked “OK” or time is out.
-
- (Object) TimedLongMessageGeometry(message, timeout_seconds, width, height)
Show a long message and wait until user clicked “OK” or time is out.
-
- (Object) TimedLongNotify(message, timeout_seconds)
Show a long error message and wait until user clicked “OK” or time is out.
-
- (Object) TimedLongNotifyGeometry(message, timeout_seconds, width, height)
Show a long notify message and wait until user clicked “OK” or time is out.
-
- (Object) TimedLongWarning(message, timeout_seconds)
Show a long warning message and wait until user clicked “OK” or time is out.
-
- (Object) TimedLongWarningGeometry(message, timeout_seconds, width, height)
Show a long warning and wait until user clicked “OK” or time is out.
-
- (Object) TimedMessage(message, timeout_seconds)
Show a message and wait until user clicked “OK” or time is out.
-
- (Object) TimedNotify(message, timeout_seconds)
Show a long notify message and wait until user clicked “OK” or the time is out.
-
- (Object) TimedOKCancel(message, timeout_seconds)
Display a message with a timeout.
-
- (void) TimedWarning(message, timeout_seconds)
Show a warning message and wait specified amount of time or until user clicked “OK”.
-
- (Object) Warning(message)
Show a warning message and wait until user clicked “OK”.
-
- (Object) WarningDetails(message, details)
Show a warning with Details button and wait until user clicked “OK”.
-
- (Boolean) YesNo(message)
Display a yes/no question and wait for answer.
-
- (Boolean) YesNoHeadline(headline, message)
This dialog displays “message” (a question) and has a Yes and a No button.
Instance Method Details
- (Object) AnyMessage(headline, message)
Generic message popup
Show a message with optional headline above and wait until user clicked “OK”.
1136 1137 1138 1139 1140 |
# File '../../library/general/src/modules/Popup.rb', line 1136 def AnyMessage(headline, ) anyMessageInternal(headline, , Icon.IconPath("info")) nil end |
- (Object) anyMessageDetailsInternal(headline, message, details, icon_name)
Internal function - wrapper for anyMessageDetailsInternalType call
1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 |
# File '../../library/general/src/modules/Popup.rb', line 1079 def anyMessageDetailsInternal(headline, , details, icon_name) anyMessageDetailsInternalType( headline, , details, icon_name, false, 0, 0 ) nil end |
- (Object) anyMessageDetailsInternalType(headline, message, details, icon_name, richtext, width, height)
Generic message popup with Details button - internal
Show a message with optional headline above and wait until user clicked “OK” or “Details”. On “Details”, show window with detailed information.
961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 |
# File '../../library/general/src/modules/Popup.rb', line 961 def anyMessageDetailsInternalType(headline, , details, icon_name, richtext, width, height) = ButtonBox( PushButton(Id(:ok_msg), Opt(:default, :okButton), Label.OKButton), # FIXME: BNC #422612, Use `opt(`noSanityCheck) later # button label PushButton(Id(:details), Opt(:cancelButton), _("&Details...")) ) success = UI.OpenDialog( Opt(:decorated), richtext ? popupLayoutInternalRich( headline, , icon_name, , width, height ) : popupLayoutInternal(headline, , icon_name, ) ) UI.SetFocus(Id(:ok_msg)) while true ret = UI.UserInput if ret == :details success2 = UI.OpenDialog( Opt(:decorated), HBox( VSpacing(@default_height), VBox( HSpacing(@default_width), VSpacing(0.5), RichText( Builtins.mergestring( Builtins.splitstring(String.EscapeTags(details), "\n"), "<br>" ) ), VSpacing(), ButtonBox( PushButton( Id(:ok), Opt(:default, :key_F10, :okButton), Label.OKButton ) ) ) ) ) if success2 == true UI.UserInput UI.CloseDialog end else break end end UI.CloseDialog if success == true nil end |
- (Object) anyMessageInternal(headline, message, icon_name)
Internal function - wrapper for anyMessageInternal call
1065 1066 1067 1068 1069 |
# File '../../library/general/src/modules/Popup.rb', line 1065 def anyMessageInternal(headline, , icon_name) anyMessageInternalType(headline, , icon_name, false, 0, 0) nil end |
- (Object) anyMessageInternalRich(headline, message, icon_name, width, height)
Internal function - wrapper for anyMessageInternal call
1072 1073 1074 1075 1076 |
# File '../../library/general/src/modules/Popup.rb', line 1072 def anyMessageInternalRich(headline, , icon_name, width, height) anyMessageInternalType(headline, , icon_name, true, width, height) nil end |
- (Object) anyMessageInternalType(headline, message, icon_name, richtext, width, height)
Generic message popup - internal
Show a message with optional headline above and wait until user clicked “OK”.
1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 |
# File '../../library/general/src/modules/Popup.rb', line 1032 def anyMessageInternalType(headline, , icon_name, richtext, width, height) = ButtonBox( PushButton( Id(:ok_msg), Opt(:default, :key_F10, :okButton), Label.OKButton ) ) success = UI.OpenDialog( Opt(:decorated), richtext ? popupLayoutInternalRich( headline, , icon_name, , width, height ) : popupLayoutInternal(headline, , icon_name, ) ) if success == true UI.SetFocus(Id(:ok_msg)) UI.UserInput UI.CloseDialog end nil end |
- (Object) AnyQuestion(headline, message, yes_button_message, no_button_message, focus)
Generic question popup with two buttons.
Style guide hint: The first button has to have the semantics of “yes”, “OK”, “continue” etc., the second its opposite (“no”, “cancel”, …). NEVER use this generic question popup to simply exchange the order of yes/no, continue/cancel or ok/cancel buttons!
369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 |
# File '../../library/general/src/modules/Popup.rb', line 369 def AnyQuestion(headline, , , , focus) = AnyQuestionButtonBox( , , focus ) success = UI.OpenDialog( Opt(:decorated), popupLayoutInternal( headline, , Icon.IconPath("question"), ) ) ret = nil if success == true ret = UI.UserInput UI.CloseDialog end ret == :yes end |
- (Object) AnyQuestion3(headline, message, yes_button_message, no_button_message, retry_button_message, focus)
Generic question popup with three buttons.
1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 |
# File '../../library/general/src/modules/Popup.rb', line 1778 def AnyQuestion3(headline, , , , , focus) = Empty() = Empty() = Empty() if focus == :focus_no = PushButton( Id(:yes), Opt(:key_F10, :okButton), ) = PushButton( Id(:no), Opt(:default, :key_F9, :cancelButton), ) = PushButton( Id(:retry), Opt(:key_F6, :customButton), ) elsif focus == :focus_yes = PushButton( Id(:yes), Opt(:default, :key_F10, :okButton), ) = PushButton( Id(:no), Opt(:key_F9, :cancelButton), ) = PushButton( Id(:retry), Opt(:key_F6, :customButton), ) else = PushButton( Id(:yes), Opt(:key_F10, :okButton), ) = PushButton( Id(:no), Opt(:key_F9, :cancelButton), ) = PushButton( Id(:retry), Opt(:default, :key_F6, :customButton), ) end = ButtonBox(, , ) success = UI.OpenDialog( Opt(:decorated), popupLayoutInternal( headline, , Icon.IconPath("question"), ) ) ret = nil if success == true ret = Convert.to_symbol(UI.UserInput) UI.CloseDialog end ret end |
- (Yast::Term) AnyQuestionButtonBox(yes_button_message, no_button_message, focus)
Button box for the AnyQuestion Dialog (internal function).
315 316 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 |
# File '../../library/general/src/modules/Popup.rb', line 315 def AnyQuestionButtonBox(, , focus) = Empty() = Empty() if focus == :focus_no = PushButton(Id(:yes), Opt(:okButton), ) = PushButton( Id(:no_button), Opt(:default, :cancelButton), ) else = PushButton( Id(:yes), Opt(:default, :okButton), ) = PushButton( Id(:no_button), Opt(:cancelButton), ) end = ButtonBox(, ) deep_copy() end |
- (Object) AnyQuestionRichText(headline, richtext, hdim, vdim, yes_button_message, no_button_message, focus)
Show a question that might need scrolling.
777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 |
# File '../../library/general/src/modules/Popup.rb', line 777 def AnyQuestionRichText(headline, richtext, hdim, vdim, , , focus) = PushButton( Id(:ok), focus == :focus_yes ? Opt(:default, :key_F10, :okButton) : Opt(:key_F10, :okButton), ) = PushButton( Id(:cancel), focus == :focus_no ? Opt(:default, :key_F9) : Opt(:key_F9), ) d = HBox( VSpacing(vdim), VBox( HSpacing(hdim), Ops.greater_than(Builtins.size(headline), 0) ? Left(Heading(headline)) : Empty(), VSpacing(0.2), RichText(richtext), ButtonBox(, ) ) ) success = UI.OpenDialog(Opt(:decorated), d) ui = nil if success == true ui = UI.UserInput UI.CloseDialog end ui == :ok end |
- (Object) anyRichMessageInternal(headline, message, icon_name, width, height)
Generic message popup - internal
Show a message with optional headline above and wait until user clicked “OK”.
1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 |
# File '../../library/general/src/modules/Popup.rb', line 1101 def anyRichMessageInternal(headline, , icon_name, width, height) = ButtonBox( PushButton(Id(:ok_msg), Opt(:default, :key_F10), Label.OKButton) ) success = UI.OpenDialog( Opt(:decorated), popupLayoutInternalRich( headline, , icon_name, , width, height ) ) if success == true UI.SetFocus(Id(:ok_msg)) UI.UserInput UI.CloseDialog end nil end |
- (void) AnyTimedMessage(headline, message, timeout)
This method returns an undefined value.
Generic message popup
Show a message with optional headline above and wait until user clicked “OK” or until a timeout runs out.
1923 1924 1925 1926 1927 |
# File '../../library/general/src/modules/Popup.rb', line 1923 def AnyTimedMessage(headline, , timeout) anyTimedMessageInternal(headline, , nil, timeout) nil end |
- (Object) anyTimedMessageInternal(headline, message, icon_name, timeout)
Internal function - wrapper for anyTimedMessageTypeInternal call
254 255 256 257 258 259 260 261 262 263 264 265 266 |
# File '../../library/general/src/modules/Popup.rb', line 254 def anyTimedMessageInternal(headline, , icon_name, timeout) anyTimedMessageTypeInternal( headline, , icon_name, timeout, false, 0, 0 ) nil end |
- (void) anyTimedMessageTypeInternal(headline, message, icon_name, timeout, richtext, width, height)
This method returns an undefined value.
Internal version of AnyTimedMessage
Show a message with optional headline above and wait until user clicked “OK” or until a timeout runs out.
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 |
# File '../../library/general/src/modules/Popup.rb', line 203 def anyTimedMessageTypeInternal(headline, , icon_name, timeout, richtext, width, height) = ButtonBox( # FIXME: BNC #422612, Use `opt(`noSanityCheck) later PushButton(Id(:stop), Opt(:cancelButton), Label.StopButton), PushButton(Id(:ok_msg), Opt(:default, :okButton), Label.OKButton) ) success = UI.OpenDialog( Opt(:decorated), popupLayoutInternalTypeWithLabel( headline, , icon_name, , Builtins.sformat("%1", timeout), richtext, width, height ) ) UI.SetFocus(Id(:ok_msg)) if success == true = nil while Ops.greater_than(timeout, 0) && != :ok_msg = Convert.to_symbol(UI.TimeoutUserInput(1000)) if == :stop while UI.UserInput != :ok_msg end break end timeout = Ops.subtract(timeout, 1) if success == true UI.ChangeWidget(Id(:label), :Value, Builtins.sformat("%1", timeout)) end end UI.CloseDialog if success == true nil end |
- (Object) AnyTimedRichMessage(headline, message, timeout)
1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 |
# File '../../library/general/src/modules/Popup.rb', line 1929 def AnyTimedRichMessage(headline, , timeout) anyTimedRichMessageInternal( headline, , nil, timeout, @default_width, @default_height ) nil end |
- (Object) anyTimedRichMessageInternal(headline, message, icon_name, timeout, width, height)
Internal function - wrapper for anyTimedMessageTypeInternal call
274 275 276 277 278 279 280 281 282 283 284 285 286 |
# File '../../library/general/src/modules/Popup.rb', line 274 def anyTimedRichMessageInternal(headline, , icon_name, timeout, width, height) anyTimedMessageTypeInternal( headline, , icon_name, timeout, true, width, height ) nil end |
- (void) ClearFeedback
This method returns an undefined value.
Clear feedback message
1145 1146 1147 1148 1149 1150 |
# File '../../library/general/src/modules/Popup.rb', line 1145 def ClearFeedback UI.CloseDialog if @feedback_open @feedback_open = false nil end |
- (Boolean) ConfirmAbort(severity)
Confirmation for “Abort” button during installation.
According to the “severity” parameter an appropriate text will be displayed indicating what the user has to expect when he really aborts now.
829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 |
# File '../../library/general/src/modules/Popup.rb', line 829 def ConfirmAbort(severity) what_will_happen = "" # Confirm user request to abort installation abort_label = _("Really abort the installation?") # Button that will really abort the installation = _("&Abort Installation") # Button that will continue with the installation = _("&Continue Installation") # Dialog icon icon_name = "warning" if severity == :painless if Mode.repair # Confirm user request to abort System Repair abort_label = _("Really abort YaST System Repair?") # Button that will really abort the repair = _("Abort System Repair") # Button that will continue with the repair = _("&Continue System Repair") else # Warning text for aborting an installation before anything is installed what_will_happen = _( "If you abort the installation now,\n" + "Linux will not be installed.\n" + "Your hard disk will remain untouched." ) end # icon_name = "info"; elsif severity == :incomplete # Warning text for aborting an installation during the install process # - After some installation steps have been performed - e.g. # disks formatted / some packages already installed what_will_happen = _( "If you abort the installation now, you will\n" + "have an incomplete Linux system\n" + "that might or might not be usable.\n" + "You might need to reinstall.\n" ) elsif severity == :unusable # Warning text for aborting an installation during the install process # right in the middle of some critical process (e.g. formatting) what_will_happen = _( "If you abort the installation now,\n" + "Linux will be unusable.\n" + "You will need to reinstall." ) else Builtins.y2error("Unknown symbol for ConfirmAbort") end = Ops.add(Ops.add(abort_label, "\n\n"), what_will_happen) = AnyQuestionButtonBox( , , :focus_no ) success = UI.OpenDialog( Opt(:decorated), popupLayoutInternal( NoHeadline(), , Icon.IconPath(icon_name), ) ) user_ret = nil if success == true user_ret = UI.UserInput UI.CloseDialog end ret = user_ret == :yes Builtins.y2debug("ConfirmAbort returned: %1", ret) ret end |
- (Boolean) ContinueCancel(message)
Dialog which displays the “message” and has a Continue and a Cancel button.
This popup should be used to confirm possibly dangerous actions. The default button is Continue. Returns true if Continue is clicked.
645 646 647 648 649 650 |
# File '../../library/general/src/modules/Popup.rb', line 645 def ContinueCancel() ret = ContinueCancelHeadline(NoHeadline(), ) Builtins.y2debug("ContinueCancel returned: %1", ret) ret end |
- (Boolean) ContinueCancelHeadline(headline, message)
Dialog which displays the “message” and has a Continue and a Cancel button.
This popup should be used to confirm possibly dangerous actions and if it's useful to display a short headline (without headline Popup::ContinueCancel() can be used). The default button is Continue.
Returns true if Continue is clicked.
615 616 617 618 619 620 621 622 623 624 625 626 627 |
# File '../../library/general/src/modules/Popup.rb', line 615 def ContinueCancelHeadline(headline, ) ret = AnyQuestion( headline, , Label.ContinueButton, Label.CancelButton, :focus_yes ) Builtins.y2debug("ContinueCancelHeadline returned: %1", ret) ret end |
- (Object) Error(message)
Show an error message and wait until user clicked “OK”.
1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 |
# File '../../library/general/src/modules/Popup.rb', line 1445 def Error() lines = Builtins.splitstring(, "\n") if @switch_to_richtext && Ops.greater_than(Builtins.size(lines), @too_many_lines) anyMessageInternalRich( Label.ErrorMsg, , Icon.IconPath("error"), @default_width, @default_height ) else anyMessageInternal(Label.ErrorMsg, , Icon.IconPath("error")) end nil end |
- (Object) ErrorAnyQuestion(headline, message, yes_button_message, no_button_message, focus)
Generic error question popup with two buttons.
Style guide hint: The first button has to have the semantics of “yes”, “OK”, “continue” etc., the second its opposite (“no”, “cancel”, …). NEVER use this generic question popup to simply exchange the order of yes/no, continue/cancel or ok/cancel buttons!
421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 |
# File '../../library/general/src/modules/Popup.rb', line 421 def ErrorAnyQuestion(headline, , , , focus) = AnyQuestionButtonBox( , , focus ) success = UI.OpenDialog( Opt(:decorated), popupLayoutInternal( headline, , Icon.IconPath("error"), ) ) ret = nil if success == true ret = UI.UserInput UI.CloseDialog end ret == :yes end |
- (Object) ErrorDetails(message, details)
Show an error message with Details button and wait until user clicked “OK”.
1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 |
# File '../../library/general/src/modules/Popup.rb', line 1559 def ErrorDetails(, details) anyMessageDetailsInternal( Label.ErrorMsg, , details, Icon.IconPath("error") ) nil end |
- (Object) Feedback(headline, message, &block)
Run the block with a feeback popup The popup is automatically closed at the end (even when an exception is raised)
1183 1184 1185 1186 1187 1188 |
# File '../../library/general/src/modules/Popup.rb', line 1183 def Feedback(headline, , &block) ShowFeedback(headline, ) yield ensure ClearFeedback() end |
- (Object) LongError(message)
Show a long error and wait until user clicked “OK”.
1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 |
# File '../../library/general/src/modules/Popup.rb', line 1466 def LongError() anyMessageInternalRich( Label.ErrorMsg, , Icon.IconPath("error"), @default_width, @default_height ) nil end |
- (Object) LongErrorGeometry(message, width, height)
Show a long error message and wait until user clicked “OK”. Size of the popup window is adjustable.
1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 |
# File '../../library/general/src/modules/Popup.rb', line 1483 def LongErrorGeometry(, width, height) anyMessageInternalRich( Label.ErrorMsg, , Icon.IconPath("error"), width, height ) nil end |
- (Object) LongMessage(message)
Show a long message and wait until user clicked “OK”.
1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 |
# File '../../library/general/src/modules/Popup.rb', line 1211 def LongMessage() anyMessageInternalRich( NoHeadline(), , Icon.IconPath("info"), @default_width, @default_height ) nil end |
- (Object) LongMessageGeometry(message, width, height)
Show a long message and wait until user clicked “OK”. Size of the popup window is adjustable.
1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 |
# File '../../library/general/src/modules/Popup.rb', line 1228 def LongMessageGeometry(, width, height) anyMessageInternalRich( NoHeadline(), , Icon.IconPath("info"), width, height ) nil end |
- (Object) LongNotify(message)
Show a long notify message and wait until user clicked “OK”.
1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 |
# File '../../library/general/src/modules/Popup.rb', line 1590 def LongNotify() anyMessageInternalRich( NoHeadline(), , Icon.IconPath("info"), @default_width, @default_height ) nil end |
- (Object) LongNotifyGeometry(message, width, height)
Show a long notify message and wait until user clicked “OK”. Size of the popup window is adjustable.
1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 |
# File '../../library/general/src/modules/Popup.rb', line 1607 def LongNotifyGeometry(, width, height) anyMessageInternalRich( NoHeadline(), , Icon.IconPath("info"), width, height ) nil end |
- (Object) LongText(headline, richtext, hdim, vdim)
Show a long text that might need scrolling.
Pass a RichText widget with the parameters appropriate for your text - i.e.
without special parameters for HTML-like text or with
opt(
plainText) for plain ASCII text without HTML tags.
730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 |
# File '../../library/general/src/modules/Popup.rb', line 730 def LongText(headline, richtext, hdim, vdim) richtext = deep_copy(richtext) success = UI.OpenDialog( Opt(:decorated), HBox( VSpacing(vdim), VBox( HSpacing(hdim), Left(Heading(headline)), VSpacing(0.2), richtext, # scrolled text ButtonBox( PushButton( Id(:ok), Opt(:default, :key_F10, :okButton), Label.OKButton ) ) ) ) ) if success == true UI.SetFocus(Id(:ok)) UI.UserInput UI.CloseDialog end nil end |
- (Object) LongWarning(message)
Show a long warning and wait until user clicked “OK”.
1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 |
# File '../../library/general/src/modules/Popup.rb', line 1330 def LongWarning() anyMessageInternalRich( Label.WarningMsg, , Icon.IconPath("warning"), @default_width, @default_height ) nil end |
- (Object) LongWarningGeometry(message, width, height)
Show a long warning and wait until user clicked “OK”. Size of the popup window is adjustable
1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 |
# File '../../library/general/src/modules/Popup.rb', line 1347 def LongWarningGeometry(, width, height) anyMessageInternalRich( Label.WarningMsg, , Icon.IconPath("warning"), width, height ) nil end |
- (Object) main
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File '../../library/general/src/modules/Popup.rb', line 42 def main Yast.import "UI" textdomain "base" Yast.import "Label" Yast.import "Mode" Yast.import "Directory" Yast.import "String" Yast.import "Icon" @feedback_open = false # default size of the richtext widget in richtext popups @default_width = 60 @default_height = 10 # if error message is too long, show LongError instead of Error Popup @switch_to_richtext = true # lines of message text which force usage of RichText @too_many_lines = 20 end |
- (Object) Message(message)
Show a simple message and wait until user clicked “OK”.
1202 1203 1204 1205 1206 |
# File '../../library/general/src/modules/Popup.rb', line 1202 def Message() anyMessageInternal(NoHeadline(), , Icon.IconPath("info")) nil end |
- (Object) MessageDetails(message, details)
Show a message with Details button and wait until user clicked “OK”.
1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 |
# File '../../library/general/src/modules/Popup.rb', line 1298 def MessageDetails(, details) anyMessageDetailsInternal( NoHeadline(), , details, Icon.IconPath("info") ) nil end |
- (Symbol) ModuleError(text)
Special error popup for YCP modules that don't work.
The user can choose one of: - “back” - go back to the previous module - “next” - skip this faulty module and directly go to the next one - “again” - try it again (after fixing something in the code, of course) - “cancel” - exit program
1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 |
# File '../../library/general/src/modules/Popup.rb', line 1870 def ModuleError(text) success = UI.OpenDialog( Opt(:decorated, :warncolor), HBox( HSpacing(1), VBox( VSpacing(0.2), Heading(text), ButtonBox( PushButton( Id(:back), Opt(:key_F8, :customButton), Label.BackButton ), PushButton( Id(:again), Opt(:key_F6, :customButton), Label.RetryButton ), PushButton( Id(:cancel), Opt(:key_F9, :cancelButton), Label.QuitButton ), PushButton(Id(:next), Opt(:key_F10, :okButton), Label.NextButton) ), VSpacing(0.2) ), HSpacing(1) ) ) ret = nil if success == true ret = Convert.to_symbol(UI.UserInput) UI.CloseDialog end ret end |
- (Object) NoHeadline
Indicator for empty headline for popups that can optionally have one
This is really just an alias for the empty string “”, but it is slightly better readable.
294 295 296 |
# File '../../library/general/src/modules/Popup.rb', line 294 def NoHeadline "" end |
- (Object) NoIcon
Indicator for empty icon for popups that can have one - for code readability.
301 302 303 |
# File '../../library/general/src/modules/Popup.rb', line 301 def NoIcon "" end |
- (Object) Notify(message)
Show a notification message and wait until user clicked “OK”.
1581 1582 1583 1584 1585 |
# File '../../library/general/src/modules/Popup.rb', line 1581 def Notify() anyMessageInternal("", , Icon.IconPath("info")) nil end |
- (Object) NotifyDetails(message, details)
Show a notify message with Details button and wait until user clicked “OK”.
1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 |
# File '../../library/general/src/modules/Popup.rb', line 1677 def NotifyDetails(, details) anyMessageDetailsInternal( NoHeadline(), , details, Icon.IconPath("info") ) nil end |
- (Object) popupLayoutInternal(headline, message, icon_name, button_box)
Internal function - wrapper for popupLayoutInternalTypeWithLabel call
155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File '../../library/general/src/modules/Popup.rb', line 155 def popupLayoutInternal(headline, , icon_name, ) = deep_copy() popupLayoutInternalTypeWithLabel( headline, , icon_name, , nil, false, 0, 0 ) end |
- (Object) popupLayoutInternalRich(headline, message, icon_name, button_box, width, height)
Internal function - wrapper for popupLayoutInternalTypeWithLabel call
170 171 172 173 174 175 176 177 178 179 180 181 182 |
# File '../../library/general/src/modules/Popup.rb', line 170 def popupLayoutInternalRich(headline, , icon_name, , width, height) = deep_copy() popupLayoutInternalTypeWithLabel( headline, , icon_name, , nil, true, width, height ) end |
- (Yast::Term) popupLayoutInternalTypeWithLabel(headline, message, icon_name, button_box, label, richtext, width, height)
Internal function that returns a popup dialog with an additional label.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 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 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
# File '../../library/general/src/modules/Popup.rb', line 75 def popupLayoutInternalTypeWithLabel(headline, , icon_name, , label, richtext, width, height) = deep_copy() content = Empty() heading = VSpacing(0.2) icon = Empty() if Ops.greater_than(Builtins.size(icon_name), 0) ui_capabilities = UI.GetDisplayInfo if Ops.get_boolean(ui_capabilities, "HasImageSupport", false) icon = Image(icon_name, "") end end rt = VWeight( 1, VBox( HSpacing(width), HBox( VSpacing(height), # display the message in the widget "as is": # escape all tags, replace new lines by <br> tag RichText( Builtins.mergestring( Builtins.splitstring(String.EscapeTags(), "\n"), "<br>" ) ) ) ) ) if Ops.greater_than(Builtins.size(headline), 0) content = VBox( VSpacing(0.4), HBox( Top(icon), HSpacing(1), VBox( Left(Heading(headline)), VSpacing(0.2), richtext ? rt : Left(Label()), VSpacing(0.2), label != nil && label != "" ? Label(Id(:label), label) : Empty() ) ) ) # no headline else content = VBox( VSpacing(0.4), HBox( Top(icon), HSpacing(1), VBox( richtext ? rt : VCenter(Label()), VSpacing(0.2), label != nil && label != "" ? Label(Id(:label), label) : Empty() ) ) ) end dialog = HBox( HSpacing(1), VBox( VSpacing(0.2), content, richtext ? Empty() : VStretch(), , richtext ? Empty() : VStretch(), VSpacing(0.2) ), HSpacing(1) ) deep_copy(dialog) end |
- (Object) ReallyAbort(have_changes)
Confirmation popup when user clicked “Abort”.
Set “have changes” to “true” when there are changes that will be lost. Note: If there are none, it is good policy to ask for confirmation anyway, but of course with “have_changes” set to “false” so the user isn't warned about changes that might be lost.
923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 |
# File '../../library/general/src/modules/Popup.rb', line 923 def ReallyAbort(have_changes) focus = :focus_yes # Confirm aborting the program = _("Really abort?") if have_changes focus = :focus_no # Additional hint when trying to abort program in spite of changes = Ops.add( Ops.add(, "\n"), _("All changes will be lost!") ) end ret = AnyQuestion( NoHeadline(), , Label.YesButton, Label.NoButton, focus ) Builtins.y2debug("ReallyAbort returned: %1", ret) ret end |
- (void) ShowFeedback(headline, message)
This method returns an undefined value.
Show popup with a headline and a message for feedback
1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 |
# File '../../library/general/src/modules/Popup.rb', line 1157 def ShowFeedback(headline, ) UI.CloseDialog if @feedback_open = Empty() UI.BusyCursor UI.OpenDialog( Opt(:decorated), popupLayoutInternal( headline, , Icon.IconPath("warning"), ) ) @feedback_open = true nil end |
- (Object) ShowFile(headline, filename)
Show the contents of an entire file in a popup.
Notice: This is a WFM function, NOT an UI function!
2059 2060 2061 2062 2063 2064 2065 |
# File '../../library/general/src/modules/Popup.rb', line 2059 def ShowFile(headline, filename) text = Convert.to_string(SCR.Read(path(".target.string"), filename)) ShowText(headline, text) nil end |
- (Object) ShowText(headline, text)
Show the contents of an entire file in a popup.
2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 |
# File '../../library/general/src/modules/Popup.rb', line 2012 def ShowText(headline, text) heading = Empty() if Builtins.size(headline) == 0 heading = VSpacing(0.2) else heading = Heading(headline) end success = UI.OpenDialog( Opt(:decorated), VBox( HSpacing(70), # force width heading, VWeight( 1, HBox( VSpacing(18), # force height HSpacing(0.7), RichText(Id(:text), Opt(:plainText), text), HSpacing(0.7) ) ), VSpacing(0.3), ButtonBox( PushButton(Opt(:default, :key_F10, :okButton), Label.OKButton) ), VSpacing(0.3) ) ) if success == true UI.UserInput UI.CloseDialog end nil end |
- (Object) ShowTextTimed(headline, text, timeout)
Show the contents of an entire file in a popup.
1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 |
# File '../../library/general/src/modules/Popup.rb', line 1954 def ShowTextTimed(headline, text, timeout) heading = Empty() if Builtins.size(headline) == 0 heading = VSpacing(0.2) else heading = Heading(headline) end success = UI.OpenDialog( Opt(:decorated), VBox( HSpacing(70), # force width heading, VWeight( 1, HBox( VSpacing(18), # force height HSpacing(0.7), RichText(Id(:text), Opt(:plainText), text), HSpacing(0.7) ) ), VSpacing(0.3), Label(Id(:label), Builtins.sformat("%1", timeout)), VSpacing(0.2), ButtonBox( PushButton( Id(:ok_msg), Opt(:default, :key_F10, :okButton), Label.OKButton ) ), VSpacing(0.3) ) ) = nil while Ops.greater_than(timeout, 0) && != :ok_msg = Convert.to_symbol(UI.TimeoutUserInput(1000)) timeout = Ops.subtract(timeout, 1) UI.ChangeWidget(Id(:label), :Value, Builtins.sformat("%1", timeout)) end UI.CloseDialog if success == true nil end |
- (Boolean) TimedAnyQuestion(headline, message, yes_button_message, no_button_message, focus, timeout_seconds)
Timed question popup with two buttons and time display
463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 |
# File '../../library/general/src/modules/Popup.rb', line 463 def TimedAnyQuestion(headline, , , , focus, timeout_seconds) = AnyQuestionButtonBox( , , focus ) timed = ReplacePoint( Id(:replace_buttons), VBox( HCenter(Label(Id(:remaining_time), Ops.add("", timeout_seconds))), ButtonBox( # FIXME: BNC #422612, Use `opt(`noSanityCheck) later PushButton(Id(:timed_stop), Opt(:cancelButton), Label.StopButton), PushButton( Id(:timed_ok), Opt(:default, :key_F10, :okButton), Label.OKButton ) ), VSpacing(0.2) ) ) success = UI.OpenDialog( Opt(:decorated), popupLayoutInternal(headline, , Icon.IconPath("question"), timed) ) which_input = nil while Ops.greater_than(timeout_seconds, 0) which_input = UI.TimeoutUserInput(1000) break if which_input == :timed_ok if which_input == :timed_stop UI.ReplaceWidget(Id(:replace_buttons), ) while which_input == :timed_stop which_input = UI.UserInput end break end timeout_seconds = Ops.subtract(timeout_seconds, 1) if success == true UI.ChangeWidget( Id(:remaining_time), :Value, Ops.add("", timeout_seconds) ) end end UI.CloseDialog if success == true which_input == :yes end |
- (void) TimedError(message, timeout_seconds)
This method returns an undefined value.
Show an error message and wait specified amount of time or until user clicked “OK”.
1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 |
# File '../../library/general/src/modules/Popup.rb', line 1505 def TimedError(, timeout_seconds) anyTimedMessageInternal( Label.ErrorMsg, , Icon.IconPath("error"), timeout_seconds ) nil end |
- (Boolean) TimedErrorAnyQuestion(headline, message, yes_button_message, no_button_message, focus, timeout_seconds)
Timed error question popup with two buttons and time display
536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 |
# File '../../library/general/src/modules/Popup.rb', line 536 def TimedErrorAnyQuestion(headline, , , , focus, timeout_seconds) = AnyQuestionButtonBox( , , focus ) timed = ReplacePoint( Id(:replace_buttons), VBox( HCenter(Label(Id(:remaining_time), Ops.add("", timeout_seconds))), ButtonBox( # FIXME: BNC #422612, Use `opt(`noSanityCheck) later PushButton(Id(:timed_stop), Opt(:cancelButton), Label.StopButton), PushButton( Id(:timed_ok), Opt(:default, :key_F10, :okButton), Label.OKButton ) ), VSpacing(0.2) ) ) success = UI.OpenDialog( Opt(:decorated), popupLayoutInternal(headline, , Icon.IconPath("error"), timed) ) which_input = nil while Ops.greater_than(timeout_seconds, 0) which_input = UI.TimeoutUserInput(1000) break if which_input == :timed_ok if which_input == :timed_stop UI.ReplaceWidget(Id(:replace_buttons), ) while which_input == :timed_stop which_input = UI.UserInput end break end timeout_seconds = Ops.subtract(timeout_seconds, 1) if success == true UI.ChangeWidget( Id(:remaining_time), :Value, Ops.add("", timeout_seconds) ) end end UI.CloseDialog if success == true which_input == :yes end |
- (Object) TimedLongError(message, timeout_seconds)
Show a long error message and wait until user clicked “OK” or time is out.
1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 |
# File '../../library/general/src/modules/Popup.rb', line 1520 def TimedLongError(, timeout_seconds) anyTimedRichMessageInternal( Label.ErrorMsg, , Icon.IconPath("error"), timeout_seconds, @default_width, @default_height ) nil end |
- (Object) TimedLongErrorGeometry(message, timeout_seconds, width, height)
Show a long error message and wait until user clicked “OK” or time is out. Size of the popup window is adjustable.
1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 |
# File '../../library/general/src/modules/Popup.rb', line 1539 def TimedLongErrorGeometry(, timeout_seconds, width, height) anyTimedRichMessageInternal( Label.ErrorMsg, , Icon.IconPath("error"), timeout_seconds, width, height ) nil end |
- (Object) TimedLongMessage(message, timeout_seconds)
Show a long message and wait until user clicked “OK” or time is out.
1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 |
# File '../../library/general/src/modules/Popup.rb', line 1259 def TimedLongMessage(, timeout_seconds) anyTimedRichMessageInternal( NoHeadline(), , Icon.IconPath("info"), timeout_seconds, @default_width, @default_height ) nil end |
- (Object) TimedLongMessageGeometry(message, timeout_seconds, width, height)
Show a long message and wait until user clicked “OK” or time is out. Size of the popup window is adjustable.
1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 |
# File '../../library/general/src/modules/Popup.rb', line 1278 def TimedLongMessageGeometry(, timeout_seconds, width, height) anyTimedRichMessageInternal( NoHeadline(), , Icon.IconPath("info"), timeout_seconds, width, height ) nil end |
- (Object) TimedLongNotify(message, timeout_seconds)
Show a long error message and wait until user clicked “OK” or time is out.
1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 |
# File '../../library/general/src/modules/Popup.rb', line 1638 def TimedLongNotify(, timeout_seconds) anyTimedRichMessageInternal( NoHeadline(), , Icon.IconPath("info"), timeout_seconds, @default_width, @default_height ) nil end |
- (Object) TimedLongNotifyGeometry(message, timeout_seconds, width, height)
Show a long notify message and wait until user clicked “OK” or time is out. Size of the popup window is adjustable.
1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 |
# File '../../library/general/src/modules/Popup.rb', line 1657 def TimedLongNotifyGeometry(, timeout_seconds, width, height) anyTimedRichMessageInternal( NoHeadline(), , Icon.IconPath("info"), timeout_seconds, width, height ) nil end |
- (Object) TimedLongWarning(message, timeout_seconds)
Show a long warning message and wait until user clicked “OK” or time is out.
1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 |
# File '../../library/general/src/modules/Popup.rb', line 1384 def TimedLongWarning(, timeout_seconds) anyTimedRichMessageInternal( Label.WarningMsg, , Icon.IconPath("warning"), timeout_seconds, @default_width, @default_height ) nil end |
- (Object) TimedLongWarningGeometry(message, timeout_seconds, width, height)
Show a long warning and wait until user clicked “OK” or time is out. Size of the popup window is adjustable.
1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 |
# File '../../library/general/src/modules/Popup.rb', line 1403 def TimedLongWarningGeometry(, timeout_seconds, width, height) anyTimedRichMessageInternal( Label.WarningMsg, , Icon.IconPath("warning"), timeout_seconds, width, height ) nil end |
- (Object) TimedMessage(message, timeout_seconds)
Show a message and wait until user clicked “OK” or time is out
1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 |
# File '../../library/general/src/modules/Popup.rb', line 1244 def TimedMessage(, timeout_seconds) anyTimedMessageInternal( NoHeadline(), , Icon.IconPath("info"), timeout_seconds ) nil end |
- (Object) TimedNotify(message, timeout_seconds)
Show a long notify message and wait until user clicked “OK” or the time is out.
1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 |
# File '../../library/general/src/modules/Popup.rb', line 1623 def TimedNotify(, timeout_seconds) anyTimedMessageInternal( NoHeadline(), , Icon.IconPath("info"), timeout_seconds ) nil end |
- (Object) TimedOKCancel(message, timeout_seconds)
Display a message with a timeout
Display a message with a timeout and return when the user clicks “OK”, “Cancel” or when the timeout expires (“OK” is assumed then).
There is also a “stop” button that will stop the countdown. If the user clicks that, the popup will wait forever (or until “OK” or “Cancel” is clicked, of course).
1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 |
# File '../../library/general/src/modules/Popup.rb', line 1704 def TimedOKCancel(, timeout_seconds) success = UI.OpenDialog( Opt(:decorated), HBox( HSpacing(1), VBox( VSpacing(0.2), Label(), HCenter(Label(Id(:remaining_time), Ops.add("", timeout_seconds))), ButtonBox( PushButton(Id(:timed_stop), Opt(:customButton), Label.StopButton), PushButton( Id(:timed_ok), Opt(:default, :key_F10, :okButton), Label.OKButton ), PushButton( Id(:timed_cancel), Opt(:key_F9, :cancelButton), Label.CancelButton ) ), VSpacing(0.2) ) ) ) which_input = nil while Ops.greater_than(timeout_seconds, 0) which_input = UI.TimeoutUserInput(1000) break if which_input == :timed_ok break if which_input == :timed_cancel if which_input == :timed_stop while which_input == :timed_stop which_input = UI.UserInput end break end timeout_seconds = Ops.subtract(timeout_seconds, 1) UI.ChangeWidget( Id(:remaining_time), :Value, Ops.add("", timeout_seconds) ) end UI.CloseDialog if success == true which_input != :timed_cancel end |
- (void) TimedWarning(message, timeout_seconds)
This method returns an undefined value.
Show a warning message and wait specified amount of time or until user clicked “OK”.
1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 |
# File '../../library/general/src/modules/Popup.rb', line 1369 def TimedWarning(, timeout_seconds) anyTimedMessageInternal( Label.WarningMsg, , Icon.IconPath("warning"), timeout_seconds ) nil end |
- (Object) Warning(message)
Show a warning message and wait until user clicked “OK”.
1321 1322 1323 1324 1325 |
# File '../../library/general/src/modules/Popup.rb', line 1321 def Warning() anyMessageInternal(Label.WarningMsg, , Icon.IconPath("warning")) nil end |
- (Object) WarningDetails(message, details)
Show a warning with Details button and wait until user clicked “OK”.
1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 |
# File '../../library/general/src/modules/Popup.rb', line 1423 def WarningDetails(, details) anyMessageDetailsInternal( Label.WarningMsg, , details, Icon.IconPath("warning") ) nil end |
- (Boolean) YesNo(message)
Display a yes/no question and wait for answer.
Should be used for decisions about two about equivalent paths, not for simple confirmation - use “Popup::ContinueCancel()” for those. The default button is Yes. Returns true if Yes is clicked.
706 707 708 709 710 711 712 |
# File '../../library/general/src/modules/Popup.rb', line 706 def YesNo() ret = YesNoHeadline(NoHeadline(), ) Builtins.y2debug("YesNo returned: %1", ret) ret end |
- (Boolean) YesNoHeadline(headline, message)
This dialog displays “message” (a question) and has a Yes and a No button.
It should be used for decisions about two about equivalent paths, not for simple confirmation - use “Popup::ContinueCancel()” for those. A short headline can be displayed (without headline you can use Popup::YesNo()).
The default button is Yes.
Returns true if Yes is clicked.
674 675 676 677 678 679 680 681 682 683 684 685 686 |
# File '../../library/general/src/modules/Popup.rb', line 674 def YesNoHeadline(headline, ) ret = AnyQuestion( headline, , Label.YesButton, Label.NoButton, :focus_yes ) Builtins.y2debug("YesNoHeadline returned: %1", ret) ret end |