Yast UI
YPatternSelector Class Reference

High-level widget to select software patterns (selections)

PatternSelector()...
UI::RunPkgSelection();

. More...

Detailed Description

High-level widget to select software patterns (selections)

PatternSelector()...
UI::RunPkgSelection();

.

Following widget variants exist: PatternSelector Example:

# encoding: utf-8
# Simple example for PatternSelector
module Yast
class PatternSelectorSoloClient < Client
def main
Yast.import "Pkg"
Yast.import "UI"
if !UI.HasSpecialWidget(:PatternSelector)
UI.OpenDialog(
VBox(
Label("Error: This UI doesn't support the PatternSelector widget!"),
PushButton(Opt(:default), "&OK")
)
)
UI.UserInput
UI.CloseDialog
return
end
Pkg.TargetInit(
"/", # installed system
false
) # don't create a new RPM database
UI.OpenDialog(Opt(:defaultsize), PatternSelector(Id(:selector)))
@input = UI.RunPkgSelection(Id(:selector))
UI.CloseDialog
Builtins.y2milestone("Input: %1", @input)
nil
end
end
end
Yast::PatternSelectorSoloClient.new.main

Example:

# encoding: utf-8
# Full-fledged pattern selection
module Yast
class PatternSelectorWizardClient < Client
def main
Yast.import "UI"
Yast.import "Pkg"
# Pkg::SourceCreate( "http://dist.suse.de/install/SLP/SUSE-10.1-Beta3/i386/CD1/", "" );
Pkg.SourceCreate("file:/srv/sles-10-i386/CD1/", "")
if !UI.HasSpecialWidget(:PatternSelector)
detailedSelection # Fallback: Do detailed selection right away
return
end
UI.OpenDialog(
Opt(:defaultsize),
Wizard(:back, "", :cancel, "&Cancel", :ok, "&OK")
)
@help_text = _(
"<p>The available software for this system is shown by category in the left column. To view a description for an item, select it in the list.</p>"
) +
_(
"<p>Change the status of items by clicking on their status icon or right-click on any icon for a context menu. With the context menu you can also change the status of all items.</p>"
) +
_(
"<p><b>Details</b> opens the detailed software package selection where you can view and select individual software packages.</p>"
) +
_(
"<p>The <b>disk usage</b> display in the lower right corner shows the remaining disk space after all requested changes will have been performed. Please notice that hard disk partitions that are full or nearly full can degrade system performance and in some cases even cause serious problems. The system needs some available disk space to run properly.</p>"
)
UI.WizardCommand(
term(
:SetDialogIcon,
"/usr/share/YaST2/theme/current/icons/22x22/apps/YaST.png"
)
)
UI.WizardCommand(term(:SetDialogHeading, "Software Selection"))
UI.WizardCommand(term(:SetHelpText, @help_text))
Pkg.TargetInit(
"/", # installed system
false
) # don't create a new RPM database
UI.ReplaceWidget(Id(:contents), PatternSelector(Id(:patterns)))
@button = nil
begin
@button = Convert.to_symbol(UI.RunPkgSelection(Id(:patterns)))
Builtins.y2milestone("Pattern selector returned %1", @button)
detailedSelection if @button == :details
end until @button == :cancel || @button == :accept
UI.CloseDialog
nil
end
def detailedSelection
# Open empty dialog for instant feedback
UI.OpenDialog(
Opt(:defaultsize),
ReplacePoint(Id(:rep), Label("Reading package database..."))
)
# This will take a while: Detailed package data are retrieved
# while the package manager is initialized
UI.ReplaceWidget(:rep, PackageSelector(Id(:packages), "/dev/fd0"))
input = Convert.to_symbol(UI.RunPkgSelection(Id(:packages)))
Builtins.y2milestone("Package selector returned %1", input)
UI.CloseDialog
nil
end
end
end
Yast::PatternSelectorWizardClient.new.main

This widget is similar to the PackageSelector in its semantics: It is a very high-level widget that lets the user select software, but unlike the PackageSelector it works on software patterns (selections).


The documentation for this class was generated from the following file: