Yast UI
YSimplePatchSelector Class Reference

Simplified approach to patch selection

SimplePatchSelector()...
UI::RunPkgSelection();

. More...

Detailed Description

Simplified approach to patch selection

SimplePatchSelector()...
UI::RunPkgSelection();

.

Following widget variants exist: SimplePatchSelector Example:

# encoding: utf-8
# Simple example for SimplePatchSelector
module Yast
class SimplePatchSelectorEmptyClient < Client
def main
Yast.import "UI"
if !UI.HasSpecialWidget(:SimplePatchSelector)
UI.OpenDialog(
VBox(
Label(
"Error: This UI doesn't support the SimplePatchSelector widget!"
),
PushButton(Opt(:default), "&OK")
)
)
UI.UserInput
UI.CloseDialog
return
end
UI.OpenDialog(
Opt(:defaultsize),
term(:SimplePatchSelector, Id(:selector))
)
@input = UI.RunPkgSelection(Id(:selector))
UI.CloseDialog
Builtins.y2milestone("Input: %1", @input)
nil
end
end
end
Yast::SimplePatchSelectorEmptyClient.new.main

Example:

# encoding: utf-8
# Full-fledged simple patch selection
module Yast
class SimplePatchSelectorStableClient < Client
def main
Yast.import "UI"
Yast.import "Pkg"
# Initialize RPM DB as pkg src
Pkg.TargetInit(
"/", # installed system
false
) # don't create a new RPM database
# Pkg::SourceCreate( "file:/mounts/dist/install/stable-x86/", "" );
Pkg.SourceCreate("ftp://ftp.gwdg.de/pub/suse/update/10.2", "")
if !UI.HasSpecialWidget(:SimplePatchSelector)
detailedSelection # Fallback: Do detailed selection right away
return
end
UI.OpenDialog(
Opt(:defaultsize),
term(:SimplePatchSelector, Id(:selector))
)
@button = nil
begin
@button = Convert.to_symbol(UI.RunPkgSelection(Id(:selector)))
Builtins.y2milestone(
"SimplePatchSelector 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), Opt(:youMode), "/dev/fd0")
)
input = Convert.to_symbol(UI.RunPkgSelection(Id(:packages)))
Builtins.y2milestone("Package selector returned %1", input)
UI.CloseDialog
nil
end
end
end
Yast::SimplePatchSelectorStableClient.new.main

This is a stripped-down version of the PackageSelector widget in "online update" ("patches") mode. It provides a very simplistic view on patches. It does not give access to handling packages by itself, but it contains a "Details..." button that lets the application open a full-fledged PackageSelector (in "online update" / "patches" mode).

Be advised that only this widget alone without access to the full PackageSelector might easily lead the user to a dead end: If dependency problems arise that cannot easily be solved from within the dependency problems dialog or by deselecting one or several patches, it might be necessary for the user to solve the problem on the package level. If he cannot do that, he might be unable to continue his update task.

This widget is similar in many ways to the PatternSelector widget: It gives a higher-level, more abstract access to package management at the cost of omitting details and fine control that more advanced users will want or need. The SimplePatchSelector should be used in ways similarl to the PatternSelector widget.


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