Class: Yast::SlideShowClass
- Inherits:
-
Module
- Object
- Module
- Yast::SlideShowClass
- Defined in:
- ../../src/modules/SlideShow.rb
Instance Method Summary (collapse)
-
- (Object) AddProgressWidgets(page_id, page_contents)
Add widgets for progress bar etc.
-
- (Object) AppendMessageToInstLog(msg)
Append message to the installation log.
-
- (Object) ChangeSlideIfNecessary
Check if the current slide needs to be changed and do that if necessary.
-
- (Object) CheckForSlides
Check if the slide show is available.
-
- (Object) CloseDialog
Close the slide show dialog.
-
- (String) CurrentStageDescription
Return the description for the current stage.
-
- (Object) DetailsPageWidgets
Construct widgets for the “details” page.
- - (Object) DetailsTableWidget
-
- (Object) GenericHandleInput
Check for user button presses and handle them.
-
- (Hash <String, Hash{String => Object>}) GetSetup
Returns the current setup defined by Setup().
-
- (Boolean) GetUserAbort
Get the status of the flag that user requested abort of the installation.
-
- (Object) GlobalProgressStart(text)
Restart the global progress of the slideshow.
-
- (Object) HandleInput(button)
Process (slide show) input (button press).
-
- (Object) HaveSlideWidget
Check if the dialog is currently set up so the user could switch to the slide page.
-
- (Object) HelpText
Help text for the dialog.
- - (Object) HideTable
-
- (Object) LoadSlide(slide_no)
Load a slide image + text.
- - (Object) main
-
- (Object) MoveToStage(stage_name)
Move the global progress to the beginning of the given stage.
-
- (Object) OpenDialog
Open the slide show dialog.
-
- (Object) OpenSlideShowBaseDialog
Open the slide show base dialog with empty work area (placeholder for the image) and CD statistics.
-
- (Object) RebuildDetailsView
Rebuild the details page.
-
- (Object) RebuildDialog
Rebuild the dialog.
-
- (Object) RelNotesPageWidgets
Construct widgets for the “release notes” page.
-
- (Object) Reset
Initialize generic data to default values.
-
- (Object) ResetTimer
Reset the internal (global) timer.
-
- (String) SetGlobalProgressLabel(text)
Return the current global progress label.
-
- (Object) SetLanguage(new_language)
Set the curent language.
-
- (Object) SetSlideText(text)
Set the slide show text.
-
- (Object) Setup(stages)
Prepare the stages for the global progressbar.
-
- (Object) SetUserAbort(abort)
Set the flag that user requested abort of the installation.
-
- (Object) ShowingDetails
Check if currently the “Details” page is shown.
-
- (Object) ShowingRelNotes
Check if currently the “Release Notes” page is shown.
-
- (Object) ShowingSlide
Check if currently the “Slide Show” page is shown.
- - (Object) ShowTable
-
- (Object) SlidePageWidgets
Construct widgets describing a page with the real slide show (the RichText / HTML page).
-
- (Object) StageProgress(value, text)
Update the global progress according to the progress in the current stage.
-
- (Object) StartTimer
Start the internal (global) timer.
-
- (Object) StopTimer
Stop the internal (global) timer and account elapsed time.
-
- (Object) SubProgress(value, text)
Update status of subprogress of the slideshow.
-
- (Object) SubProgressStart(text)
Restart the subprogress of the slideshow.
-
- (Object) SwitchToDetailsView
Switch from the 'slide show' view to the 'details' view.
-
- (Object) SwitchToReleaseNotesView
Switch to the 'release notes' view.
-
- (Object) SwitchToSlideView
Switch from the 'details' view to the 'slide show' view.
-
- (Object) TableItem(id, col1, col2, col3, col4)
Create one single item for the CD statistics table.
-
- (Object) UpdateGlobalProgress(value, new_text)
Update status of global progress of the slideshow.
- - (Object) UpdateTable(items)
Instance Method Details
- (Object) AddProgressWidgets(page_id, page_contents)
Add widgets for progress bar etc. around a slide show page
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 |
# File '../../src/modules/SlideShow.rb', line 490 def AddProgressWidgets(page_id, page_contents) page_contents = deep_copy(page_contents) = HBox( Id(page_id), HSpacing(1), VBox( VWeight( 1, # lower layout priority page_contents ), # intentionally omitting `Label(`nextMedia) - # too much flicker upon update (UI::RecalcLayout() ) on NCurses # Progress bar for overall progress of software package installation ProgressBar( Id(:progressTotal), @total_progress_label, 100, @total_progress_value ) ), HSpacing(0.5) ) Builtins.y2debug("widget term: \n%1", ) deep_copy() end |
- (Object) AppendMessageToInstLog(msg)
Append message to the installation log.
379 380 381 382 383 384 385 386 387 388 389 390 |
# File '../../src/modules/SlideShow.rb', line 379 def AppendMessageToInstLog(msg) log_line = Ops.add(msg, "\n") @inst_log = Ops.add(@inst_log, log_line) if ShowingDetails() if UI.WidgetExists(:instLog) UI.ChangeWidget(:instLog, :LastLine, log_line) end end nil end |
- (Object) ChangeSlideIfNecessary
Check if the current slide needs to be changed and do that if necessary.
469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 |
# File '../../src/modules/SlideShow.rb', line 469 def ChangeSlideIfNecessary if Ops.less_than( Ops.add(@current_slide_no, 1), Builtins.size(Slides.) ) && Ops.greater_than( Builtins.time, Ops.add(@slide_start_time, @slide_interval) ) Builtins.y2debug("Loading slide #%1", Ops.add(@current_slide_no, 2)) LoadSlide(Ops.add(@current_slide_no, 1)) end nil end |
- (Object) CheckForSlides
Check if the slide show is available. This must be called before trying to access any slides; some late initialization is done here.
404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 |
# File '../../src/modules/SlideShow.rb', line 404 def CheckForSlides Slides.CheckBasePath if Stage.initial || Stage.cont if Slides.HaveSlideSupport Builtins.y2milestone("Display OK for slide show, loading") Slides.LoadSlides(@language) else Builtins.y2warning( "Disabling slide show - insufficient display capabilities" ) end end nil end |
- (Object) CloseDialog
Close the slide show dialog.
851 852 853 854 855 856 857 858 |
# File '../../src/modules/SlideShow.rb', line 851 def CloseDialog Wizard.CloseDialog if @opened_own_wizard # call SlideShowCallbacks::RemoveSlideShowCallbacks() WFM.call("wrapper_slideshow_callbacks", ["RemoveSlideShowCallbacks"]) nil end |
- (String) CurrentStageDescription
Return the description for the current stage.
310 311 312 |
# File '../../src/modules/SlideShow.rb', line 310 def CurrentStageDescription Ops.get_locale(@_current_stage, "description", _("Installing...")) end |
- (Object) DetailsPageWidgets
Construct widgets for the “details” page
553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 |
# File '../../src/modules/SlideShow.rb', line 553 def DetailsPageWidgets = AddProgressWidgets( :detailsPage, VBox( @_show_table ? DetailsTableWidget() : Empty(), VWeight(1, LogView(Id(:instLog), _("Actions performed:"), 6, 0)), ProgressBar( Id(:progressCurrentPackage), @sub_progress_label, 100, @sub_progress_value ) ) ) Builtins.y2debug("widget term: \n%1", ) deep_copy() end |
- (Object) DetailsTableWidget
528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 |
# File '../../src/modules/SlideShow.rb', line 528 def DetailsTableWidget VWeight( 1, Table( Id(:cdStatisticsTable), Opt(:keepSorting), Header( # Table headings for CD statistics during installation _("Media"), # Table headings for CD statistics during installation - keep as short as possible! Right(_("Installed Size")), # Table headings for CD statistics during installation Right(_("Packages")), # Table headings for CD statistics during installation Right(_("Time")) ), @table_items ) ) end |
- (Object) GenericHandleInput
Check for user button presses and handle them. Generic handling to be used in the progress handlers.
797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 |
# File '../../src/modules/SlideShow.rb', line 797 def GenericHandleInput # any button = SlideShow::debug ? UI::PollInput() : UI::TimeoutUserInput( 10 ); = UI.PollInput # in case of cancel ask user if he really wants to quit installation if == :abort || == :cancel if Mode.normal SetUserAbort( Popup.AnyQuestion( Popup.NoHeadline, # popup yes-no _("Do you really want\nto quit the installation?"), Label.YesButton, Label.NoButton, :focus_no ) ) elsif Stage.initial SetUserAbort(Popup.ConfirmAbort(:unusable)) # Mode::update (), Stage::cont () else SetUserAbort(Popup.ConfirmAbort(:incomplete)) end AppendMessageToInstLog(_("Aborted")) if GetUserAbort() else HandleInput() end nil end |
- (Hash <String, Hash{String => Object>}) GetSetup
Returns the current setup defined by Setup().
Structure:
993 994 995 |
# File '../../src/modules/SlideShow.rb', line 993 def GetSetup deep_copy(@_stages) end |
- (Boolean) GetUserAbort
Get the status of the flag that user requested abort of the installation
173 174 175 |
# File '../../src/modules/SlideShow.rb', line 173 def GetUserAbort @user_abort end |
- (Object) GlobalProgressStart(text)
Restart the global progress of the slideshow. This means the label will be set to \param text, value to 0.
273 274 275 276 277 278 279 280 281 282 283 284 |
# File '../../src/modules/SlideShow.rb', line 273 def GlobalProgressStart(text) @total_progress_label = text if UI.WidgetExists(:progressTotal) UI.ChangeWidget(:progressTotal, :Value, 0) UI.ChangeWidget(:progressTotal, :Label, text) end @total_progress_label = text @total_progress_value = 0 nil end |
- (Object) HandleInput(button)
Process (slide show) input (button press).
767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 |
# File '../../src/modules/SlideShow.rb', line 767 def HandleInput() = deep_copy() if == :showDetails && !ShowingDetails() Builtins.y2milestone("User asks to switch to details") @user_switched_to_details = true SwitchToDetailsView() elsif == :showSlide && !ShowingSlide() if Slides.HaveSlides @user_switched_to_details = false SwitchToSlideView() LoadSlide(@current_slide_no) else UI.ChangeWidget(:dumbTab, :CurrentItem, :showDetails) end elsif == :showRelNotes && !ShowingRelNotes() @user_switched_to_details = false SwitchToReleaseNotesView() elsif == :debugHotkey @debug = !@debug Builtins.y2milestone("Debug mode: %1", @debug) end # note: `abort is handled in SlideShowCallbacks::HandleInput() nil end |
- (Object) HaveSlideWidget
Check if the dialog is currently set up so the user could switch to the slide page.
396 397 398 |
# File '../../src/modules/SlideShow.rb', line 396 def HaveSlideWidget UI.WidgetExists(:dumbTab) end |
- (Object) HelpText
Help text for the dialog
640 641 642 643 644 645 646 647 648 |
# File '../../src/modules/SlideShow.rb', line 640 def HelpText # Help text while software packages are being installed (displayed only in rare cases) help_text = _("<p>Packages are being installed.</p>") + _( "<P><B>Aborting Installation</B> Package installation can be aborted using the <B>Abort</B> button. However, the system then can be in an inconsistent or unusable state or it may not boot if the basic system component is not installed.</P>" ) help_text end |
- (Object) HideTable
870 871 872 873 874 875 876 877 878 |
# File '../../src/modules/SlideShow.rb', line 870 def HideTable if ShowingDetails() && @_show_table @_show_table = false RebuildDetailsView() end @_show_table = false nil end |
- (Object) LoadSlide(slide_no)
Load a slide image + text.
452 453 454 455 456 457 458 459 460 461 462 463 |
# File '../../src/modules/SlideShow.rb', line 452 def LoadSlide() = 0 if Ops.greater_than(, Builtins.size(Slides.)) @current_slide_no = = Ops.get(Slides., , "") @slide_start_time = Builtins.time SetSlideText(Slides.LoadSlideFile()) nil end |
- (Object) main
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 |
# File '../../src/modules/SlideShow.rb', line 112 def main Yast.import "UI" textdomain "base" Yast.import "Label" Yast.import "Stage" Yast.import "Wizard" Yast.import "Mode" Yast.import "Popup" Yast.import "Slides" @total_time_elapsed = 0 @start_time = -1 @initial_recalc_delay = 60 # const - seconds before initially calculating remaining times @recalc_interval = 30 # const - seconds between "remaining time" recalculations @next_recalc_time = Builtins.time @current_slide_no = 0 @slide_start_time = 0 @slide_min_interval = 30 # const - minimum seconds between slide changes @slide_max_interval = 3 * 60 # const - maximum seconds between slide changes @slide_interval = @slide_min_interval @language = "en" @widgets_created = false @user_switched_to_details = false @opened_own_wizard = false @inst_log = "" @debug = false @user_abort = false # we need to remember the values for tab switching @total_progress_label = _("Installing...") @sub_progress_label = _("Installing...") @total_progress_value = 0 @sub_progress_value = 0 @table_items = [] @_show_table = false # properties of the current UI @textmode = false @display_width = 80 @relnotes = nil # forward declaration @_stages = {} # list of the configured stages @_current_stage = nil # current stage end |
- (Object) MoveToStage(stage_name)
Move the global progress to the beginning of the given stage.
316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 |
# File '../../src/modules/SlideShow.rb', line 316 def MoveToStage(stage_name) if !Builtins.haskey(@_stages, stage_name) Builtins.y2error("Unknown progress stage \"%1\"", stage_name) return end @_current_stage = Ops.get(@_stages, stage_name) Builtins.y2milestone( "Moving to stage %1 (%2)", stage_name, Ops.get_integer(@_stages, [stage_name, "start"], 0) ) # translators: default global progress bar label UpdateGlobalProgress( Ops.get_integer(@_stages, [stage_name, "start"], 0), Ops.get_locale(@_current_stage, "description", _("Installing...")) ) nil end |
- (Object) OpenDialog
Open the slide show dialog.
830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 |
# File '../../src/modules/SlideShow.rb', line 830 def OpenDialog # call SlideShowCallbacks::InstallSlideShowCallbacks() WFM.call("wrapper_slideshow_callbacks", ["InstallSlideShowCallbacks"]) # check for slides first, otherwise dialogs will be built without them CheckForSlides() OpenSlideShowBaseDialog() if Slides.HaveSlides LoadSlide(0) else SwitchToDetailsView() end nil end |
- (Object) OpenSlideShowBaseDialog
Open the slide show base dialog with empty work area (placeholder for the image) and CD statistics.
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 |
# File '../../src/modules/SlideShow.rb', line 718 def OpenSlideShowBaseDialog if !Wizard.IsWizardDialog # If there is no Wizard dialog open already, open one Wizard.OpenNextBackDialog @opened_own_wizard = true end UI.WizardCommand(term(:ProtectNextButton, false)) Wizard.RestoreBackButton Wizard.RestoreAbortButton Wizard.EnableAbortButton Wizard.RestoreNextButton Wizard.SetContents( # Dialog heading while software packages are being installed _("Package Installation"), Empty(), # Wait until InitPkgData() is called from outside HelpText(), false, false ) # has_back, has_next RebuildDialog() Wizard.SetTitleIcon("yast-sw_single") # reset abort status SetUserAbort(false) nil end |
- (Object) RebuildDetailsView
Rebuild the details page.
598 599 600 601 602 603 604 605 606 607 608 609 610 |
# File '../../src/modules/SlideShow.rb', line 598 def RebuildDetailsView if UI.WidgetExists(:tabContents) UI.ChangeWidget(:dumbTab, :CurrentItem, :showDetails) UI.ReplaceWidget(:tabContents, DetailsPageWidgets()) Builtins.y2milestone("Contents set to details") end if UI.WidgetExists(:instLog) && @inst_log != "" UI.ChangeWidget(:instLog, :Value, @inst_log) end nil end |
- (Object) RebuildDialog
Rebuild the dialog. Useful if slides become available post-creating the dialog.
652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 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 |
# File '../../src/modules/SlideShow.rb', line 652 def RebuildDialog contents = Empty() if UI.HasSpecialWidget(:DumbTab) && Slides.HaveSlideSupport && Slides.HaveSlides tabs = [ # tab Item(Id(:showSlide), _("Slide Sho&w")), # tab Item(Id(:showDetails), _("&Details")) ] if @relnotes != nil && @relnotes != "" # tab tabs = Builtins.add( tabs, Item(Id(:showRelNotes), _("Release &Notes")) ) end contents = DumbTab( Id(:dumbTab), tabs, VBox( VSpacing(0.4), VWeight( 1, # lower layout priority HBox( HSpacing(1), ReplacePoint(Id(:tabContents), SlidePageWidgets()), HSpacing(0.5) ) ), VSpacing(0.4) ) ) else # no tabs contents = DetailsPageWidgets() end Builtins.y2milestone("SlideShow contents: %1", contents) Wizard.SetContents( # Dialog heading while software packages are being installed _("Perform Installation"), contents, HelpText(), false, false ) # has_back, has_next @widgets_created = true # if no tabs, update the log RebuildDetailsView() if ShowingDetails() SwitchToDetailsView() if !Slides.HaveSlides && ShowingSlide() nil end |
- (Object) RelNotesPageWidgets
Construct widgets for the “release notes” page
576 577 578 579 580 |
# File '../../src/modules/SlideShow.rb', line 576 def RelNotesPageWidgets = AddProgressWidgets(:relNotesPage, RichText(@relnotes)) Builtins.y2debug("widget term: \n%1", ) deep_copy() end |
- (Object) Reset
Initialize generic data to default values
750 751 752 753 754 755 756 757 758 759 760 761 |
# File '../../src/modules/SlideShow.rb', line 750 def Reset @current_slide_no = 0 @slide_start_time = 0 @total_time_elapsed = 0 @start_time = -1 @next_recalc_time = -1 @textmode = Ops.get_boolean(UI.GetDisplayInfo, "TextMode", false) @display_width = Ops.get_integer(UI.GetDisplayInfo, "Width", 0) nil end |
- (Object) ResetTimer
Reset the internal (global) timer.
188 189 190 191 192 |
# File '../../src/modules/SlideShow.rb', line 188 def ResetTimer @start_time = Builtins.time nil end |
- (String) SetGlobalProgressLabel(text)
Return the current global progress label.
368 369 370 371 372 373 374 375 |
# File '../../src/modules/SlideShow.rb', line 368 def SetGlobalProgressLabel(text) @total_progress_label = text if UI.WidgetExists(:progressTotal) UI.ChangeWidget(:progressTotal, :Label, text) end nil end |
- (Object) SetLanguage(new_language)
Set the curent language. Must be called once during initialization.
434 435 436 437 438 439 |
# File '../../src/modules/SlideShow.rb', line 434 def SetLanguage(new_language) @language = new_language Builtins.y2milestone("New SlideShow language: %1", @language) nil end |
- (Object) SetSlideText(text)
Set the slide show text.
425 426 427 428 429 |
# File '../../src/modules/SlideShow.rb', line 425 def SetSlideText(text) UI.ChangeWidget(:slideText, :Value, text) if UI.WidgetExists(:slideText) nil end |
- (Object) Setup(stages)
Prepare the stages for the global progressbar. Will compute the total estimate of time and partition the global 100% to given stages based on their estimates. Can compute out of time and size to download.
The stages description list example:
[ $[ "name" :
"disk", "description" : "Prepare disk...",
"value" : 85, // disk speed can be guessed by the storage, thus
passing time "units" : sec ], $[ "name" :
"images"; "description" : "Deploying
images...", "value" : 204800, // amount of kb to be
downloaded/installed "units" :
kb ], ]
909 910 911 912 913 914 915 916 917 918 919 920 921 922 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 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 |
# File '../../src/modules/SlideShow.rb', line 909 def Setup(stages) stages = deep_copy(stages) # initiliaze the generic counters Reset() # gather total amount of time need total_time = 0 Builtins.foreach(stages) do |stage| if Ops.get_symbol(stage, "units", :sec) == :sec total_time = Ops.add(total_time, Ops.get_integer(stage, "value", 0)) # assume kilobytes else # assume 15 minutes for installation of openSUSE 11.0, giving 3495 as the constant for kb/s total_time = Ops.add( total_time, Ops.divide(Ops.get_integer(stage, "value", 0), 3495) ) end end # avoid division by zero, set at least 1 second total_time = 1 if total_time == 0 Builtins.y2milestone("Total estimated time: %1", total_time) start = 0 # value where the current stage starts @_stages = {} # prepare a new stages description # distribute the total time to stages as per cents Builtins.foreach(stages) do |stage| if Ops.get_symbol(stage, "units", :sec) == :sec Ops.set( stage, "size", Ops.divide( Ops.multiply(Ops.get_integer(stage, "value", 0), 100), total_time ) ) Ops.set(stage, "start", start) start = Ops.add(start, Ops.get_integer(stage, "size", 0)) # assume kilobytes else # assume 15 minutes for installation of openSUSE 11.0, giving 3495 as the constant Ops.set( stage, "size", Ops.divide( Ops.divide( Ops.multiply(Ops.get_integer(stage, "value", 0), 100), 3495 ), total_time ) ) Ops.set(stage, "start", start) if Ops.greater_than( Ops.add(Ops.get_integer(stage, "size", 0), start), 100 ) Ops.set(stage, "size", Ops.subtract(100, start)) end start = Ops.add(start, Ops.get_integer(stage, "size", 0)) end Ops.set(@_stages, Ops.get_string(stage, "name", ""), stage) # setup first stage @_current_stage = deep_copy(stage) if @_current_stage == nil end Builtins.y2milestone("Global progress bar: %1", @_stages) nil end |
- (Object) SetUserAbort(abort)
Set the flag that user requested abort of the installation
165 166 167 168 169 |
# File '../../src/modules/SlideShow.rb', line 165 def SetUserAbort(abort) @user_abort = abort nil end |
- (Object) ShowingDetails
Check if currently the “Details” page is shown
220 221 222 |
# File '../../src/modules/SlideShow.rb', line 220 def ShowingDetails @widgets_created && UI.WidgetExists(:detailsPage) end |
- (Object) ShowingRelNotes
Check if currently the “Release Notes” page is shown
235 236 237 |
# File '../../src/modules/SlideShow.rb', line 235 def ShowingRelNotes @widgets_created && UI.WidgetExists(:relNotesPage) end |
- (Object) ShowingSlide
Check if currently the “Slide Show” page is shown
228 229 230 |
# File '../../src/modules/SlideShow.rb', line 228 def ShowingSlide @widgets_created && UI.WidgetExists(:slideShowPage) end |
- (Object) ShowTable
860 861 862 863 864 865 866 867 868 |
# File '../../src/modules/SlideShow.rb', line 860 def ShowTable if ShowingDetails() && !@_show_table @_show_table = true RebuildDetailsView() end @_show_table = true nil end |
- (Object) SlidePageWidgets
Construct widgets describing a page with the real slide show (the RichText / HTML page)
522 523 524 525 526 |
# File '../../src/modules/SlideShow.rb', line 522 def SlidePageWidgets = AddProgressWidgets(:slideShowPage, RichText(Id(:slideText), "")) Builtins.y2debug("widget term: \n%1", ) deep_copy() end |
- (Object) StageProgress(value, text)
Update the global progress according to the progress in the current stage. The new value will be set to the per cent of the current stage according to \param value.The value must be lower that 100 (or it's corrected to 100). If the \text is not nil, the label will be updated to this text as well. Otherwise label will not change.
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 |
# File '../../src/modules/SlideShow.rb', line 346 def StageProgress(value, text) if Ops.greater_than(value, 100) Builtins.y2error("Stage progress value larger than expected: %1", value) value = 100 end UpdateGlobalProgress( Ops.add( Ops.get_integer(@_current_stage, "start", 0), Ops.divide( Ops.multiply(value, Ops.get_integer(@_current_stage, "size", 1)), 100 ) ), text ) nil end |
- (Object) StartTimer
Start the internal (global) timer.
179 180 181 182 183 |
# File '../../src/modules/SlideShow.rb', line 179 def StartTimer @start_time = Builtins.time nil end |
- (Object) StopTimer
Stop the internal (global) timer and account elapsed time.
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 |
# File '../../src/modules/SlideShow.rb', line 197 def StopTimer if Ops.less_than(@start_time, 0) Builtins.y2error("StopTimer(): No timer running.") return end elapsed = Ops.subtract(Builtins.time, @start_time) @start_time = -1 @total_time_elapsed = Ops.add(@total_time_elapsed, elapsed) Builtins.y2debug( "StopTimer(): Elapsed this time: %1 sec; total: %2 sec (%3:%4)", elapsed, @total_time_elapsed, Ops.divide(@total_time_elapsed, 60), Ops.modulo(@total_time_elapsed, 60) # min ) # sec nil end |
- (Object) SubProgress(value, text)
Update status of subprogress of the slideshow. The new value will be set to \param value, if the \text is not nil, the label will be updated to this text as well. Otherwise label will not change.
258 259 260 261 262 263 264 265 266 267 268 |
# File '../../src/modules/SlideShow.rb', line 258 def SubProgress(value, text) if UI.WidgetExists(:progressCurrentPackage) UI.ChangeWidget(:progressCurrentPackage, :Value, value) UI.ChangeWidget(:progressCurrentPackage, :Label, text) if text != nil end @sub_progress_value = value @sub_progress_label = text if text != nil nil end |
- (Object) SubProgressStart(text)
Restart the subprogress of the slideshow. This means the label will be set to \param text, value to 0.
242 243 244 245 246 247 248 249 250 251 |
# File '../../src/modules/SlideShow.rb', line 242 def SubProgressStart(text) if UI.WidgetExists(:progressCurrentPackage) UI.ChangeWidget(:progressCurrentPackage, :Value, 0) UI.ChangeWidget(:progressCurrentPackage, :Label, text) end @sub_progress_label = text nil end |
- (Object) SwitchToDetailsView
Switch from the 'slide show' view to the 'details' view.
614 615 616 617 618 619 620 621 622 |
# File '../../src/modules/SlideShow.rb', line 614 def SwitchToDetailsView if ShowingDetails() Builtins.y2milestone("Already showing details") return end RebuildDetailsView() nil end |
- (Object) SwitchToReleaseNotesView
Switch to the 'release notes' view.
626 627 628 629 630 631 632 633 634 635 636 |
# File '../../src/modules/SlideShow.rb', line 626 def SwitchToReleaseNotesView return if ShowingRelNotes() if UI.WidgetExists(:tabContents) UI.ChangeWidget(:dumbTab, :CurrentItem, :showRelNotes) UI.ReplaceWidget(:tabContents, RelNotesPageWidgets()) # UpdateTotalProgress(false); end nil end |
- (Object) SwitchToSlideView
Switch from the 'details' view to the 'slide show' view.
585 586 587 588 589 590 591 592 593 594 595 |
# File '../../src/modules/SlideShow.rb', line 585 def SwitchToSlideView return if ShowingSlide() if UI.WidgetExists(:tabContents) UI.ChangeWidget(:dumbTab, :CurrentItem, :showSlide) UI.ReplaceWidget(:tabContents, SlidePageWidgets()) # UpdateTotalProgress(false); // FIXME: this breaks other stages! end nil end |
- (Object) TableItem(id, col1, col2, col3, col4)
Create one single item for the CD statistics table
444 445 446 |
# File '../../src/modules/SlideShow.rb', line 444 def TableItem(id, col1, col2, col3, col4) Item(Id(id), col1, col2, col3, col4) end |
- (Object) UpdateGlobalProgress(value, new_text)
Update status of global progress of the slideshow. The new value will be set to \param value, if the \text is not nil, the label will be updated to this text as well. Otherwise label will not change.
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 |
# File '../../src/modules/SlideShow.rb', line 291 def UpdateGlobalProgress(value, new_text) @total_progress_label = new_text if new_text != nil @total_progress_value = value if UI.WidgetExists(:progressTotal) UI.ChangeWidget(:progressTotal, :Value, value) UI.ChangeWidget(:progressTotal, :Label, new_text) if new_text != nil else Builtins.y2milestone("progressTotal widget missing") end # update slide ChangeSlideIfNecessary() if ShowingSlide() nil end |
- (Object) UpdateTable(items)
880 881 882 883 884 885 886 887 888 |
# File '../../src/modules/SlideShow.rb', line 880 def UpdateTable(items) items = deep_copy(items) @table_items = deep_copy(items) if ShowingDetails() && @_show_table UI.ChangeWidget(Id(:cdStatisticsTable), :Items, items) end nil end |