diff --git a/examples/PackageSelector-10.1-stable.rb b/examples/PackageSelector-10.1-stable.rb deleted file mode 100644 index ddeba77..0000000 --- a/examples/PackageSelector-10.1-stable.rb +++ /dev/null @@ -1,37 +0,0 @@ -# encoding: utf-8 - -# Package Selector example -module Yast - class PackageSelector101StableClient < Client - def main - Yast.import "UI" - Yast.import "Pkg" - Pkg.SourceCreate( - "file:/mounts/machcd2/CDs/SUSE-Linux-10.1-RC5-DVD-Retail-i386/DVD1", - "" - ) - - - if false - Pkg.TargetInit( - "/", # installed system - false - ) # don't create a new RPM database - end - - UI.OpenDialog( - Opt(:defaultsize), - PackageSelector(Id(:selector), "/dev/fd0") - ) - - @input = UI.RunPkgSelection(Id(:selector)) - UI.CloseDialog - - Builtins.y2milestone("Input: %1", @input) - - nil - end - end -end - -Yast::PackageSelector101StableClient.new.main diff --git a/examples/PackageSelector-10.2.rb b/examples/PackageSelector-10.2.rb deleted file mode 100644 index 05607da..0000000 --- a/examples/PackageSelector-10.2.rb +++ /dev/null @@ -1,30 +0,0 @@ -# encoding: utf-8 - -# Package Selector example -module Yast - class PackageSelector102Client < Client - def main - Yast.import "UI" - Yast.import "Pkg" - @use_installed_system = true - - Pkg.SourceCreate("file:/mounts/dist/full/full-10.2-i386/", "") - - - Pkg.TargetInit("/", false) if @use_installed_system - - UI.OpenDialog( - Opt(:defaultsize), - PackageSelector(Id(:selector), "/dev/fd0") - ) - @button = UI.RunPkgSelection(Id(:selector)) - UI.CloseDialog - - Builtins.y2milestone("Button: %1", @button) - - nil - end - end -end - -Yast::PackageSelector102Client.new.main diff --git a/examples/PackageSelector-YOU.rb b/examples/PackageSelector-YOU.rb index a5f66ed..6fe770e 100644 --- a/examples/PackageSelector-YOU.rb +++ b/examples/PackageSelector-YOU.rb @@ -1,31 +1,31 @@ # encoding: utf-8 - -# YOU mode +# +# PackageSelector in YOU (YaST Online Update) mode example +# +# This will load the configured repos and their content. +# No root permissions are needed. +# module Yast class PackageSelectorYOUClient < Client def main Yast.import "UI" Yast.import "Pkg" - Pkg.SourceCreate( - "http://armstrong.suse.de/download/Code/10/update/i386.ro/", - "/" - ) - if true - Pkg.TargetInit( - "/", # installed system - false - ) # don't create a new RPM database - end + Pkg.TargetInitialize("/") + Pkg.TargetLoad + Pkg.SourceRestore + Pkg.SourceLoad UI.OpenDialog( Opt(:defaultsize), PackageSelector(Id(:selector), Opt(:testMode, :youMode)) ) - # `opt(`testMode ) ) ); + UI.RunPkgSelection(Id(:selector)) UI.CloseDialog + Builtins.y2milestone("Input: %1", @input) + nil end end diff --git a/examples/PackageSelector-empty.rb b/examples/PackageSelector-empty.rb index 00d6ba3..9932d70 100644 --- a/examples/PackageSelector-empty.rb +++ b/examples/PackageSelector-empty.rb @@ -1,9 +1,15 @@ # encoding: utf-8 - +# +# Empty PackageSelector example +# +# This will NOT load the configured repos and their content, +# it just shows the bare widget. +# module Yast class PackageSelectorEmptyClient < Client def main Yast.import "UI" + UI.OpenDialog( Opt(:defaultsize), PackageSelector(Id(:selector), Opt(:testMode)) diff --git a/examples/PackageSelector-multi-src.rb b/examples/PackageSelector-multi-src.rb deleted file mode 100644 index 1fa38e7..0000000 --- a/examples/PackageSelector-multi-src.rb +++ /dev/null @@ -1,34 +0,0 @@ -# encoding: utf-8 - -# Package Selector example -module Yast - class PackageSelectorMultiSrcClient < Client - def main - Yast.import "UI" - Yast.import "Pkg" - Pkg.SourceCreate("file:/srv/sles-10-i386/CD1/", "") - Pkg.SourceCreate("file:/srv/10.1-i386/CD1/", "") - # Pkg::SourceCreate( "http://ftp.uni-erlangen.de/pub/mirrors/packman/suse/10.0/", "" ); - # Pkg::SourceCreate( "ftp://ftp.gwdg.de/pub/linux/misc/packman/suse/10.0/", "" ); - Pkg.TargetInit("/", false) # installed system - - UI.OpenDialog( - Opt(:defaultsize), - PackageSelector( - Id(:selector), - Opt(:repoMode), - # `opt(`testMode), - "/dev/fd0" - ) - ) - @input = UI.RunPkgSelection(Id(:selector)) - UI.CloseDialog - - Builtins.y2milestone("Input: %1", @input) - - nil - end - end -end - -Yast::PackageSelectorMultiSrcClient.new.main diff --git a/examples/PackageSelector-stable.rb b/examples/PackageSelector-stable.rb deleted file mode 100644 index 7457098..0000000 --- a/examples/PackageSelector-stable.rb +++ /dev/null @@ -1,34 +0,0 @@ -# encoding: utf-8 - -# Package Selector example -module Yast - class PackageSelectorStableClient < Client - def main - Yast.import "UI" - Yast.import "Pkg" - Pkg.SourceCreate("file:/mounts/machcd/CDs/openSUSE-10.2-RC5-FTP-OSS", "") - @useInstalledSystem = true - - if @useInstalledSystem - Pkg.TargetInit( - "/", # installed system - false - ) # don't create a new RPM database - end - - UI.OpenDialog( - Opt(:defaultsize), - PackageSelector(Id(:selector), "/dev/fd0") - ) - - @input = UI.RunPkgSelection(Id(:selector)) - UI.CloseDialog - - Builtins.y2milestone("Input: %1", @input) - - nil - end - end -end - -Yast::PackageSelectorStableClient.new.main diff --git a/examples/PackageSelector-update.rb b/examples/PackageSelector-update.rb index d4a384a..673adad 100644 --- a/examples/PackageSelector-update.rb +++ b/examples/PackageSelector-update.rb @@ -1,14 +1,21 @@ # encoding: utf-8 - +# +# PackageSelector in system update mode example +# +# This will load the configured repos and their content. +# No root permissions are needed. +# module Yast class PackageSelectorUpdateClient < Client def main Yast.import "UI" Yast.import "Pkg" - Pkg.TargetInit( - "/", # installed system - false - ) # don't create a new RPM database + + Pkg.TargetInitialize("/") + Pkg.TargetLoad + Pkg.SourceRestore + Pkg.SourceLoad + UI.OpenDialog( Opt(:defaultsize), PackageSelector(Id(:selector), Opt(:testMode, :updateMode)) diff --git a/examples/PackageSelector.rb b/examples/PackageSelector.rb index adf16ca..a64e19e 100644 --- a/examples/PackageSelector.rb +++ b/examples/PackageSelector.rb @@ -1,28 +1,26 @@ # encoding: utf-8 - -# Package Selector example +# +# PackageSelector in standard mode example +# +# This will load the configured repos and their content. +# No root permissions are needed. +# module Yast class PackageSelectorClient < Client def main Yast.import "UI" Yast.import "Pkg" - # Pkg::SourceCreate( "http://dist.suse.de/install/SLP/SUSE-10.1-Beta7/i386/CD1/", "" ); - # Pkg::SourceCreate( "http://dist.suse.de/install/SLP/SUSE-10.0-RC4/i386/CD1/", "" ); - # Pkg::SourceCreate( "file:/srv/10.1-i386/CD1/", "" ); - Pkg.SourceCreate("file:/srv/10.1-i386/DVD1/", "") - # Pkg::SourceCreate( "file:/srv/sles-10-i386/CD1/", "" ); - if true - Pkg.TargetInit( - "/", # installed system - false - ) # don't create a new RPM database - end + Pkg.TargetInitialize("/") + Pkg.TargetLoad + Pkg.SourceRestore + Pkg.SourceLoad UI.OpenDialog( Opt(:defaultsize), - PackageSelector(Id(:selector), "/dev/fd0") + PackageSelector(Id(:selector)) ) + @input = UI.RunPkgSelection(Id(:selector)) UI.CloseDialog diff --git a/examples/PatternSelector-empty.rb b/examples/PatternSelector-empty.rb index a9f8e33..720b99f 100644 --- a/examples/PatternSelector-empty.rb +++ b/examples/PatternSelector-empty.rb @@ -1,6 +1,7 @@ # encoding: utf-8 -# Simple example for PatternSelector +# Simple example for empty PatternSelector +# This will not load any content. module Yast class PatternSelectorEmptyClient < Client def main diff --git a/examples/PatternSelector-solo.rb b/examples/PatternSelector-solo.rb index 31d397c..b70b940 100644 --- a/examples/PatternSelector-solo.rb +++ b/examples/PatternSelector-solo.rb @@ -1,29 +1,25 @@ # encoding: utf-8 - +# # Simple example for PatternSelector +# +# This will load the configured repos and their content. +# No root permissions are needed. +# 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 + if !UI.HasSpecialWidget(:PatternSelector) + not_supported_warning return end - - Pkg.TargetInit( - "/", # installed system - false - ) # don't create a new RPM database + Pkg.TargetInitialize("/") + Pkg.TargetLoad + Pkg.SourceRestore + Pkg.SourceLoad UI.OpenDialog(Opt(:defaultsize), PatternSelector(Id(:selector))) @input = UI.RunPkgSelection(Id(:selector)) @@ -33,6 +29,17 @@ def main nil end + + def not_supported_warning + UI.OpenDialog( + VBox( + Label("Error: This UI doesn't support the PatternSelector widget!"), + PushButton(Opt(:default), "&OK") + ) + ) + UI.UserInput + UI.CloseDialog + end end end diff --git a/examples/PatternSelector-wizard-with-packages.rb b/examples/PatternSelector-wizard-with-packages.rb deleted file mode 100644 index fdabf39..0000000 --- a/examples/PatternSelector-wizard-with-packages.rb +++ /dev/null @@ -1,86 +0,0 @@ -# encoding: utf-8 - -# Full-fledged pattern selection -module Yast - class PatternSelectorWizardWithPackagesClient < 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/", "" ); - Pkg.SourceStartManager(true) - Pkg.TargetInit("/", false) - - - - 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 = - "

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.

" + - "

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.

" + - "

Details opens the detailed software package selection where you can view and select individual software packages.

" + - "

The disk usage 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.

" - - 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::PatternSelectorWizardWithPackagesClient.new.main diff --git a/examples/PatternSelector-wizard.rb b/examples/PatternSelector-wizard.rb index e7c2cf8..7a416e0 100644 --- a/examples/PatternSelector-wizard.rb +++ b/examples/PatternSelector-wizard.rb @@ -48,14 +48,13 @@ def main UI.WizardCommand(term(:SetDialogHeading, "Software Selection")) UI.WizardCommand(term(:SetHelpText, @help_text)) - Pkg.TargetInit( - "/", # installed system - false - ) # don't create a new RPM database + Pkg.TargetInitialize("/") + Pkg.TargetLoad + Pkg.SourceRestore + Pkg.SourceLoad UI.ReplaceWidget(Id(:contents), PatternSelector(Id(:patterns))) - @button = nil begin @button = Convert.to_symbol(UI.RunPkgSelection(Id(:patterns))) diff --git a/package/yast2-ycp-ui-bindings.changes b/package/yast2-ycp-ui-bindings.changes index f262278..458acb8 100644 --- a/package/yast2-ycp-ui-bindings.changes +++ b/package/yast2-ycp-ui-bindings.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Sun Nov 17 12:56:31 UTC 2024 - Stefan Hundhammer + +- Fixed package / pattern examples (bsc#1233415) +- 5.0.1 + ------------------------------------------------------------------- Wed Aug 30 20:16:10 UTC 2023 - Josef Reidinger diff --git a/package/yast2-ycp-ui-bindings.spec b/package/yast2-ycp-ui-bindings.spec index 95a56e3..11d5ced 100644 --- a/package/yast2-ycp-ui-bindings.spec +++ b/package/yast2-ycp-ui-bindings.spec @@ -20,7 +20,7 @@ %define yui_so 16 Name: yast2-ycp-ui-bindings -Version: 5.0.0 +Version: 5.0.1 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build