Class: Yast::ReportClass
- Inherits:
-
Module
- Object
- Module
- Yast::ReportClass
- Defined in:
- ../../library/general/src/modules/Report.rb
Instance Method Summary (collapse)
-
- (Boolean) AnyQuestion(headline, message, yes_button_message, no_button_message, focus)
Question with headline and Yes/No Buttons.
-
- (void) ClearAll
Clear all stored messages (errors, messages and warnings).
-
- (void) ClearErrors
Clear stored errors.
-
- (void) ClearMessages
Clear stored messages.
-
- (void) ClearWarnings
Clear stored warnings.
-
- (void) ClearYesNoMessages
Clear stored yes/no messages.
-
- (void) DisplayErrors(display, timeout)
Error popup dialog can displayed immediately when new error is stored.
-
- (void) DisplayMessages(display, timeout)
Message popup dialog can be displayed immediately when a new message is stored.
-
- (void) DisplayWarnings(display, timeout)
Warning popup dialog can displayed immediately when new warningr is stored.
-
- (void) DisplayYesNoMessages(display, timeout)
Yes/No Message popup dialog can be displayed immediately when a new message is stored.
-
- (void) Error(error_string)
Store new error text.
-
- (Boolean) ErrorAnyQuestion(headline, message, yes_button_message, no_button_message, focus)
Question with headline and Yes/No Buttons.
-
- (Hash) Export
Dump the Report settings to a map, for autoinstallation use.
-
- (String) GetMessages(w, e, m, ynm)
Create rich text string from stored warning, message or error messages.
-
- (Boolean) GetModified
Functions which returns if the settings were modified.
-
- (Object) Import(settings)
Get all the Report configuration from a map.
-
- (void) LogErrors(log)
Set warnings logging to .y2log file.
-
- (void) LogMessages(log)
Set messages logging to .y2log file.
-
- (void) LogWarnings(log)
Set warnings logging to .y2log file.
-
- (void) LogYesNoMessages(log)
Set yes/no messages logging to .y2log file.
-
- (void) LongError(error_string)
Store new error text, the text is displayed in a richtext widget - long lines are automatically wrapped.
-
- (void) LongMessage(message_string)
Store new message text, the text is displayed in a richtext widget - long lines are automatically wrapped.
-
- (void) LongWarning(warning_string)
Store new warning text, the text is displayed in a richtext widget - long lines are automatically wrapped.
- - (Object) main
-
- (void) Message(message_string)
Store new message text.
-
- (Fixnum) NumErrors
Return number of stored errors.
-
- (Fixnum) NumMessages
Return number of stored messages.
-
- (Fixnum) NumWarnings
Return number of stored warnings.
-
- (Fixnum) NumYesNoMessages
Return number of stored yes/no messages.
-
- (Object) SetModified
Function sets internal variable, which indicates, that any settings were modified, to “true”.
-
- (void) ShowText(headline_string, message_string)
Store new message text.
-
- (Object) Summary
Summary of current settings.
-
- (void) Warning(warning_string)
Store new warning text.
Instance Method Details
- (Boolean) AnyQuestion(headline, message, yes_button_message, no_button_message, focus)
Question with headline and Yes/No Buttons
377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 |
# File '../../library/general/src/modules/Report.rb', line 377 def AnyQuestion(headline, , , , focus) Builtins.y2milestone(1, "%1", ) if @log_yesno_messages ret = false if @display_yesno_messages if Ops.greater_than(@timeout_yesno_messages, 0) ret = Popup.TimedAnyQuestion( headline, , , , focus, @timeout_yesno_messages ) else ret = Popup.AnyQuestion( headline, , , , focus ) end end @yesno_messages = Builtins.add(@yesno_messages, ) ret end |
- (void) ClearAll
This method returns an undefined value.
Clear all stored messages (errors, messages and warnings)
332 333 334 335 336 337 338 339 |
# File '../../library/general/src/modules/Report.rb', line 332 def ClearAll ClearErrors() ClearWarnings() ClearMessages() ClearYesNoMessages() nil end |
- (void) ClearErrors
This method returns an undefined value.
Clear stored errors
314 315 316 317 318 |
# File '../../library/general/src/modules/Report.rb', line 314 def ClearErrors @errors = [] nil end |
- (void) ClearMessages
This method returns an undefined value.
Clear stored messages
306 307 308 309 310 |
# File '../../library/general/src/modules/Report.rb', line 306 def ClearMessages @messages = [] nil end |
- (void) ClearWarnings
This method returns an undefined value.
Clear stored warnings
323 324 325 326 327 |
# File '../../library/general/src/modules/Report.rb', line 323 def ClearWarnings @warnings = [] nil end |
- (void) ClearYesNoMessages
This method returns an undefined value.
Clear stored yes/no messages
298 299 300 301 302 |
# File '../../library/general/src/modules/Report.rb', line 298 def ClearYesNoMessages @yesno_messages = [] nil end |
- (void) DisplayErrors(display, timeout)
This method returns an undefined value.
Error popup dialog can displayed immediately when new error is stored.
This function enables or diables popuping of dialogs.
591 592 593 594 595 |
# File '../../library/general/src/modules/Report.rb', line 591 def DisplayErrors(display, timeout) @display_errors = display @timeout_errors = timeout nil end |
- (void) DisplayMessages(display, timeout)
This method returns an undefined value.
Message popup dialog can be displayed immediately when a new message is stored.
This function enables or diables popuping of dialogs.
621 622 623 624 625 |
# File '../../library/general/src/modules/Report.rb', line 621 def DisplayMessages(display, timeout) @display_messages = display @timeout_messages = timeout nil end |
- (void) DisplayWarnings(display, timeout)
This method returns an undefined value.
Warning popup dialog can displayed immediately when new warningr is stored.
This function enables or diables popuping of dialogs.
605 606 607 608 609 |
# File '../../library/general/src/modules/Report.rb', line 605 def DisplayWarnings(display, timeout) @display_warnings = display @timeout_warnings = timeout nil end |
- (void) DisplayYesNoMessages(display, timeout)
This method returns an undefined value.
Yes/No Message popup dialog can be displayed immediately when a new message is stored.
This function enables or diables popuping of dialogs.
635 636 637 638 639 |
# File '../../library/general/src/modules/Report.rb', line 635 def DisplayYesNoMessages(display, timeout) @display_yesno_messages = display @timeout_yesno_messages = timeout nil end |
- (void) Error(error_string)
This method returns an undefined value.
Store new error text
548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 |
# File '../../library/general/src/modules/Report.rb', line 548 def Error(error_string) Builtins.y2error(1, "%1", error_string) if @log_errors if @display_errors if Ops.greater_than(@timeout_errors, 0) Popup.TimedError(error_string, @timeout_errors) else Popup.Error(error_string) end end @errors = Builtins.add(@errors, error_string) nil end |
- (Boolean) ErrorAnyQuestion(headline, message, yes_button_message, no_button_message, focus)
Question with headline and Yes/No Buttons
418 419 420 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/Report.rb', line 418 def ErrorAnyQuestion(headline, , , , focus) Builtins.y2milestone(1, "%1", ) if @log_yesno_messages ret = false if @display_yesno_messages if Ops.greater_than(@timeout_yesno_messages, 0) ret = Popup.TimedErrorAnyQuestion( headline, , , , focus, @timeout_yesno_messages ) else ret = Popup.ErrorAnyQuestion( headline, , , , focus ) end end @yesno_messages = Builtins.add(@yesno_messages, ) ret end |
- (Hash) Export
Dump the Report settings to a map, for autoinstallation use.
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 |
# File '../../library/general/src/modules/Report.rb', line 272 def Export { "messages" => { "log" => @log_messages, "timeout" => @timeout_messages, "show" => @display_messages }, "errors" => { "log" => @log_errors, "timeout" => @timeout_errors, "show" => @display_errors }, "warnings" => { "log" => @log_warnings, "timeout" => @timeout_warnings, "show" => @display_warnings }, "yesno_messages" => { "log" => @log_yesno_messages, "timeout" => @timeout_yesno_messages, "show" => @display_yesno_messages } } end |
- (String) GetMessages(w, e, m, ynm)
Create rich text string from stored warning, message or error messages.
Every new line character “n” is replaced by string “[BR]”.
687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 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 760 761 762 |
# File '../../library/general/src/modules/Report.rb', line 687 def GetMessages(w, e, m, ynm) richtext = "" if w # translators: warnings summary header richtext = Ops.add( Ops.add(Ops.add(richtext, "<P><B>"), _("Warning:")), "</B><BR>" ) Builtins.foreach(@warnings) do |s| strs = Builtins.splitstring(s, "\n") Builtins.foreach(strs) do |line| richtext = Ops.add(Ops.add(richtext, line), "<BR>") end end richtext = Ops.add(richtext, "</P>") end if e # translators: errors summary header richtext = Ops.add( Ops.add(Ops.add(richtext, "<P><B>"), _("Error:")), "</B><BR>" ) Builtins.foreach(@errors) do |s| strs = Builtins.splitstring(s, "\n") Builtins.foreach(strs) do |line| richtext = Ops.add(Ops.add(richtext, line), "<BR>") end end richtext = Ops.add(richtext, "</P>") end if m # translators: message summary header richtext = Ops.add( Ops.add(Ops.add(richtext, "<P><B>"), _("Message:")), "</B><BR>" ) Builtins.foreach(@messages) do |s| strs = Builtins.splitstring(s, "\n") Builtins.foreach(strs) do |line| richtext = Ops.add(Ops.add(richtext, line), "<BR>") end end richtext = Ops.add(richtext, "</P>") end if ynm # translators: message summary header richtext = Ops.add( Ops.add(Ops.add(richtext, "<P><B>"), _("Message:")), "</B><BR>" ) Builtins.foreach(@yesno_messages) do |s| strs = Builtins.splitstring(s, "\n") Builtins.foreach(strs) do |line| richtext = Ops.add(Ops.add(richtext, line), "<BR>") end end richtext = Ops.add(richtext, "</P>") end richtext end |
- (Boolean) GetModified
Functions which returns if the settings were modified
89 90 91 |
# File '../../library/general/src/modules/Report.rb', line 89 def GetModified @modified end |
- (Object) Import(settings)
Get all the Report configuration from a map.
the map may be empty.
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 |
# File '../../library/general/src/modules/Report.rb', line 229 def Import(settings) settings = deep_copy(settings) @message_settings = Ops.get_map(settings, "messages", {}) @error_settings = Ops.get_map(settings, "errors", {}) @warning_settings = Ops.get_map(settings, "warnings", {}) @yesno_message_settings = Ops.get_map(settings, "yesno_messages", {}) # display flags @display_errors = Ops.get_boolean(@error_settings, "show", true) @display_warnings = Ops.get_boolean(@warning_settings, "show", true) @display_messages = Ops.get_boolean(@message_settings, "show", true) @display_yesno_messages = Ops.get_boolean( @yesno_message_settings, "show", true ) # timeouts @timeout_errors = Ops.get_integer(@error_settings, "timeout", 0) @timeout_warnings = Ops.get_integer(@warning_settings, "timeout", 0) @timeout_messages = Ops.get_integer(@message_settings, "timeout", 0) @timeout_yesno_messages = Ops.get_integer( @yesno_message_settings, "timeout", 0 ) # logging flags @log_errors = Ops.get_boolean(@error_settings, "log", true) @log_warnings = Ops.get_boolean(@warning_settings, "log", true) @log_messages = Ops.get_boolean(@message_settings, "log", true) @log_yesno_messages = Ops.get_boolean( @yesno_message_settings, "log", true ) true end |
- (void) LogErrors(log)
This method returns an undefined value.
Set warnings logging to .y2log file
671 672 673 674 675 |
# File '../../library/general/src/modules/Report.rb', line 671 def LogErrors(log) @log_errors = log nil end |
- (void) LogMessages(log)
This method returns an undefined value.
Set messages logging to .y2log file
662 663 664 665 666 |
# File '../../library/general/src/modules/Report.rb', line 662 def LogMessages(log) @log_messages = log nil end |
- (void) LogWarnings(log)
This method returns an undefined value.
Set warnings logging to .y2log file
645 646 647 648 649 |
# File '../../library/general/src/modules/Report.rb', line 645 def LogWarnings(log) @log_warnings = log nil end |
- (void) LogYesNoMessages(log)
This method returns an undefined value.
Set yes/no messages logging to .y2log file
654 655 656 657 658 |
# File '../../library/general/src/modules/Report.rb', line 654 def LogYesNoMessages(log) @log_yesno_messages = log nil end |
- (void) LongError(error_string)
This method returns an undefined value.
Store new error text, the text is displayed in a richtext widget - long lines are automatically wrapped
567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 |
# File '../../library/general/src/modules/Report.rb', line 567 def LongError(error_string) Builtins.y2error(1, "%1", error_string) if @log_errors if @display_errors if Ops.greater_than(@timeout_errors, 0) Popup.TimedLongError(error_string, @timeout_errors) else Popup.LongError(error_string) end end @errors = Builtins.add(@errors, error_string) nil end |
- (void) LongMessage(message_string)
This method returns an undefined value.
Store new message text, the text is displayed in a richtext widget - long lines are automatically wrapped
470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 |
# File '../../library/general/src/modules/Report.rb', line 470 def LongMessage() Builtins.y2milestone(1, "%1", ) if @log_messages if @display_messages if Ops.greater_than(@timeout_messages, 0) Popup.TimedLongMessage(, @timeout_messages) else Popup.LongMessage() end end @messages = Builtins.add(@messages, ) nil end |
- (void) LongWarning(warning_string)
This method returns an undefined value.
Store new warning text, the text is displayed in a richtext widget - long lines are automatically wrapped
528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 |
# File '../../library/general/src/modules/Report.rb', line 528 def LongWarning(warning_string) Builtins.y2warning(1, "%1", warning_string) if @log_warnings if @display_warnings if Ops.greater_than(@timeout_warnings, 0) Popup.TimedLongWarning(warning_string, @timeout_warnings) else Popup.LongWarning(warning_string) end end @warnings = Builtins.add(@warnings, warning_string) nil end |
- (Object) main
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 70 71 72 73 74 75 76 77 |
# File '../../library/general/src/modules/Report.rb', line 39 def main textdomain "base" Yast.import "Popup" Yast.import "Summary" # stored messages @errors = [] @warnings = [] @messages = [] @yesno_messages = [] # display flags @display_errors = true @display_warnings = true @display_messages = true @display_yesno_messages = true # timeouts @timeout_errors = 0 @timeout_warnings = 0 @timeout_messages = 0 @timeout_yesno_messages = 0 # logging flags @log_errors = true @log_warnings = true @log_messages = true @log_yesno_messages = true @message_settings = {} @error_settings = {} @warning_settings = {} @yesno_message_settings = {} # default value of settings modified @modified = false end |
- (void) Message(message_string)
This method returns an undefined value.
Store new message text
451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 |
# File '../../library/general/src/modules/Report.rb', line 451 def Message() Builtins.y2milestone(1, "%1", ) if @log_messages if @display_messages if Ops.greater_than(@timeout_messages, 0) Popup.TimedMessage(, @timeout_messages) else Popup.Message() end end @messages = Builtins.add(@messages, ) nil end |
- (Fixnum) NumErrors
Return number of stored errors
362 363 364 |
# File '../../library/general/src/modules/Report.rb', line 362 def NumErrors Builtins.size(@errors) end |
- (Fixnum) NumMessages
Return number of stored messages
349 350 351 |
# File '../../library/general/src/modules/Report.rb', line 349 def NumMessages Builtins.size(@messages) end |
- (Fixnum) NumWarnings
Return number of stored warnings
355 356 357 |
# File '../../library/general/src/modules/Report.rb', line 355 def NumWarnings Builtins.size(@warnings) end |
- (Fixnum) NumYesNoMessages
Return number of stored yes/no messages
343 344 345 |
# File '../../library/general/src/modules/Report.rb', line 343 def NumYesNoMessages Builtins.size(@yesno_messages) end |
- (Object) SetModified
Function sets internal variable, which indicates, that any settings were modified, to "true"
81 82 83 84 85 |
# File '../../library/general/src/modules/Report.rb', line 81 def SetModified @modified = true nil end |
- (void) ShowText(headline_string, message_string)
This method returns an undefined value.
Store new message text
490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 |
# File '../../library/general/src/modules/Report.rb', line 490 def ShowText(headline_string, ) Builtins.y2milestone(1, "%1", ) if @log_errors if @display_errors if Ops.greater_than(@timeout_errors, 0) Popup.ShowTextTimed(headline_string, , @timeout_errors) else Popup.ShowText(headline_string, ) end end @messages = Builtins.add(@messages, ) nil end |
- (Object) Summary
Summary of current settings
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 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
# File '../../library/general/src/modules/Report.rb', line 98 def Summary summary = "" # translators: summary header for messages generated through autoinstallation summary = Summary.AddHeader(summary, _("Messages")) summary = Summary.OpenList(summary) # Report configuration - will be normal messages displayed? # '%1' will be replaced by translated string "Yes" or "No" summary = Summary.AddListItem( summary, Builtins.sformat( _("Display Messages: %1"), @display_messages ? # translators: summary if the messages should be displayed _("Yes") : _("No") ) ) # Report configuration - will have normal messages timeout? # '%1' will be replaced by number of seconds summary = Summary.AddListItem( summary, Builtins.sformat(_("Time-out Messages: %1"), @timeout_messages) ) # Report configuration - will be normal messages logged to file? # '%1' will be replaced by translated string "Yes" or "No" summary = Summary.AddListItem( summary, Builtins.sformat( _("Log Messages: %1"), @log_messages ? # translators: summary if the messages should be written to log file _("Yes") : _("No") ) ) summary = Summary.CloseList(summary) # translators: summary header for warnings generated through autoinstallation summary = Summary.AddHeader(summary, _("Warnings")) summary = Summary.OpenList(summary) # Report configuration - will be warning messages displayed? # '%1' will be replaced by translated string "Yes" or "No" summary = Summary.AddListItem( summary, Builtins.sformat( _("Display Warnings: %1"), @display_warnings ? # translators: summary if the warnings should be displayed _("Yes") : _("No") ) ) # Report configuration - will have warning messages timeout? # '%1' will be replaced by number of seconds summary = Summary.AddListItem( summary, Builtins.sformat(_("Time-out Warnings: %1"), @timeout_warnings) ) # Report configuration - will be warning messages logged to file? # '%1' will be replaced by translated string "Yes" or "No" summary = Summary.AddListItem( summary, Builtins.sformat( _("Log Warnings: %1"), @log_warnings ? # translators: summary if the warnings should be written to log file _("Yes") : _("No") ) ) summary = Summary.CloseList(summary) # translators: summary header for errors generated through autoinstallation summary = Summary.AddHeader(summary, _("Errors")) summary = Summary.OpenList(summary) # Report configuration - will be error messages displayed? # '%1' will be replaced by translated string "Yes" or "No" summary = Summary.AddListItem( summary, Builtins.sformat( _("Display Errors: %1"), @display_errors ? # translators: summary if the errors should be displayed _("Yes") : _("No") ) ) # Report configuration - will have error messages timeout? # '%1' will be replaced by number of seconds summary = Summary.AddListItem( summary, Builtins.sformat(_("Time-out Errors: %1"), @timeout_errors) ) # Report configuration - will be error messages logged to file? # '%1' will be replaced by translated string "Yes" or "No" summary = Summary.AddListItem( summary, Builtins.sformat( _("Log Errors: %1"), @log_errors ? # translators: summary if the errors should be written to log file _("Yes") : # translators: summary if the errors should be written to log file _("No") ) ) summary = Summary.CloseList(summary) # summary = Summary::AddHeader(summary, _("Yes or No Messages (Critical Messages)")); # summary = Summary::OpenList(summary); # // Report configuration - will be error messages displayed? # // '%1' will be replaced by translated string "Yes" or "No" # summary = Summary::AddListItem(summary, sformat(_("Display Yes or No Messages: %1"), (display_yesno_messages) ? # _("Yes") : _("No"))); # // Report configuration - will have error messages timeout? # // '%1' will be replaced by number of seconds # summary = Summary::AddListItem(summary, sformat(_("Time-out Yes or No Messages: %1"), timeout_yesno_messages)); # // Report configuration - will be error messages logged to file? # // '%1' will be replaced by translated string "Yes" or "No" # summary = Summary::AddListItem(summary, sformat(_("Log Yes or No Messages: %1"), (log_yesno_messages) ? # _("Yes") : _("No"))); # summary = Summary::CloseList(summary); summary end |
- (void) Warning(warning_string)
This method returns an undefined value.
Store new warning text
509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 |
# File '../../library/general/src/modules/Report.rb', line 509 def Warning(warning_string) Builtins.y2warning(1, "%1", warning_string) if @log_warnings if @display_warnings if Ops.greater_than(@timeout_warnings, 0) Popup.TimedWarning(warning_string, @timeout_warnings) else Popup.Warning(warning_string) end end @warnings = Builtins.add(@warnings, warning_string) nil end |