YaST2 Developers Documentation: SlideShow.ycp Purpose: Slide show during installation

SlideShow.ycp Purpose: Slide show during installation

  • Stefan Hundhammer
  • Stanislav Visnovsky

This module has an unstable interface.

Usage: This is a generic module for handling global progress bar with optional slideshow/release notes etc. Global progress =============== The basic idea is that the progress consists of "stages" - during a new install, there are 3: disk preparation, image deployment and package installation. Before the first client using the unified progress, the stages need to be set up, e.g. : list< map > stages = [ $[ "name" : "disk", "description": _("Preparing disks..."), "value" : Mode::update() ? 0 : 120, // 2 minutes, who needs more? ;-) "units" : `sec, ], $[ "name" : "images", "description": _("Deploying Images..."), "value" : ImageInstallation::TotalSize() / 1024, // kilobytes "units" : `kb, ], $[ "name" : "packages", "description": _("Installing Packages..."), // here, we do a hack, because until images are deployed, we cannot determine how many // packages will be really installed additionally "value" : (PackageSlideShow::total_size_to_install - ImageInstallation::TotalSize()) / 1024 , // kilobytes "units" : `kb, ], ]; SlideShow::Setup( stages ); The function will calculate the partitioning of the unified progress based on estimate of a needed time. A stage can provide the estimate of time or an amount of data to be transferred (the constants used are based on assumption of 15 min install time and that the data are downloaded and written to disk). The logic is no rocket science as the only goal for a progress bar is to have it move somewhat regularly. Also, the function resets timers and other progress status information, including which parts are shown. See \ref SlideShow::Reset. A client using the new unified progress will do basically 2 things: 1) calls SlideShow::MoveToStage( stage-id ) - this will move the global progress to a proper position for start of the stage and updates also the label ("description" entry in the map) 2) calls regularly SlideShow::StageProgress( new_percent, new_label ) - new_percent is the progress inside of the current stage, the library will recompute this to get a global progress percents. - if new_label is nil, label is not updated. SlideShow dialogs ================= // SlideShow language must be set before opening the dialog SlideShow::SetLanguage( Language::language ); SlideShow::OpenDialog (); ... ... SlideShow::CloseDialog (); More functionality ================== The SlideShow dialog contains the following functionality: - global progress (see above) - subprogress for the current action (e.g. download a package, format disk, ...) - installation log - slide show support - optional package table - release notes viewer

Imports

  • Label
  • Mode
  • Popup
  • Slides
  • Stage
  • Wizard

Structures

Global Functions

Local Functions

global SetUserAbort (boolean abort) -> void

Set the flag that user requested abort of the installation

Parameters:
abort new state of the abort requested flag (true = abort requested)
global GetUserAbort () -> boolean

Get the status of the flag that user requested abort of the installation

Return value:
state of the abort requested flag (true = abort requested)
global StartTimer () -> void

Start the internal (global) timer.

global ResetTimer () -> void

Reset the internal (global) timer.

global StopTimer () -> void

Stop the internal (global) timer and account elapsed time.

global ShowingDetails () -> boolean

Check if currently the "Details" page is shown

Return value:
true if showing details, false otherwise
global ShowingSlide () -> boolean

Check if currently the "Slide Show" page is shown

Return value:
true if showing details, false otherwise
global ShowingRelNotes () -> boolean

Check if currently the "Release Notes" page is shown

Return value:
true if showing details, false otherwise
global SubProgressStart (string text) -> void

Restart the subprogress of the slideshow. This means the label will be set to \param text, value to 0.

Parameters:
text new label for the subprogress
global SubProgress (integer value, string text) -> void

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.

Parameters:
value new value for the subprogress
text new label for the subprogress
global GlobalProgressStart (string text) -> void

Restart the global progress of the slideshow. This means the label will be set to \param text, value to 0.

Parameters:
text new label for the global progress
local UpdateGlobalProgress (integer value, string new_text) -> void

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.

Parameters:
value new value for the global progress
new_text
global CurrentStageDescription () -> string

Return the description for the current stage.

Return value:
localized string description
global MoveToStage (string stage_name) -> void

Move the global progress to the beginning of the given stage.

Parameters:
stage_name id of the stage to move to
global StageProgress (integer value, string text) -> void

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.

Parameters:
value new value for the stage progress in per cents
text new label for the global progress
global SetGlobalProgressLabel (string text) -> void

Return the current global progress label.

Parameters:
text
Return value:
current label
global AppendMessageToInstLog (string msg) -> void

Append message to the installation log.

Parameters:
msg message to be added, without trailing eoln
global HaveSlideWidget () -> boolean

Check if the dialog is currently set up so the user could switch to the slide page.

global CheckForSlides () -> void

Check if the slide show is available. This must be called before trying to access any slides; some late initialization is done here.

local SetSlideText (string text) -> void

Set the slide show text.

Parameters:
text
global SetLanguage (string new_language) -> void

Set the curent language. Must be called once during initialization.

Parameters:
new_language
global TableItem (string id, string col1, string col2, string col3, string col4) -> term

Create one single item for the CD statistics table

Parameters:
id
col1
col2
col3
col4
local LoadSlide (integer slide_no) -> void

Load a slide image + text.

Parameters:
slide_no number of slide to load
global ChangeSlideIfNecessary () -> void

Check if the current slide needs to be changed and do that if necessary.

local AddProgressWidgets (symbol page_id, term page_contents) -> term

Add widgets for progress bar etc. around a slide show page

Parameters:
page_id ID to use for this page (for checking with UI::WidgetExists() )
page_contents The inner widgets (the page contents)
Return value:
A term describing the widgets
local SlidePageWidgets () -> term

Construct widgets describing a page with the real slide show (the RichText / HTML page)

Return value:
A term describing the widgets
local DetailsPageWidgets () -> term

Construct widgets for the "details" page

Return value:
A term describing the widgets
local RelNotesPageWidgets () -> term

Construct widgets for the "release notes" page

Return value:
A term describing the widgets
global SwitchToSlideView () -> void

Switch from the 'details' view to the 'slide show' view.

local RebuildDetailsView () -> void

Rebuild the details page.

global SwitchToDetailsView () -> void

Switch from the 'slide show' view to the 'details' view.

global SwitchToReleaseNotesView () -> void

Switch to the 'release notes' view.

local HelpText () -> string

Help text for the dialog

global RebuildDialog () -> void

Rebuild the dialog. Useful if slides become available post-creating the dialog.

local OpenSlideShowBaseDialog () -> void

Open the slide show base dialog with empty work area (placeholder for the image) and CD statistics.

global Reset () -> void

Initialize generic data to default values

global HandleInput (any button) -> void

Process (slide show) input (button press).

Parameters:
button
global GenericHandleInput () -> void

Check for user button presses and handle them. Generic handling to be used in the progress handlers.

global OpenDialog () -> void

Open the slide show dialog.

global CloseDialog () -> void

Close the slide show dialog.

global Setup (list< map<string,any> > stages) -> void

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.

Parameters:
stages
global GetSetup () -> map <string, map <string,any> >

Returns the current setup defined by Setup().

Structure $[ stage_name : $[ stage_setup ], ... ]


   
Return value:
stages
See
Setup()