Module: Yast::PackagesCommonInclude
- Defined in:
- library/packages/src/include/packages/common.rb
Instance Method Summary collapse
- #AskPackages(packs, install) ⇒ Object
- #initialize_packages_common(_include_target) ⇒ Object
- #Install(package) ⇒ Object
- #InstallAll(packages) ⇒ Object
-
#InstallAllMsg(packages, message) ⇒ Object
Install list of packages with a custom text message.
-
#InstallMsg(package, message) ⇒ Object
Install a package with a custom text message.
-
#LastOperationCanceled ⇒ Object
Return result of the last operation Use immediately after calling any Package*:: function.
-
#PackageDialog(packages, install, message) ⇒ Object
Main package installatio|removal dialog.
-
#Remove(package) ⇒ Object
FIXME.
- #RemoveAll(packages) ⇒ Object
-
#RemoveAllMsg(packages, message) ⇒ Object
Remove a list of packages with a custom text message.
-
#RemoveMsg(package, message) ⇒ Object
Remove a package with a custom text message.
Instance Method Details
#AskPackages(packs, install) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'library/packages/src/include/packages/common.rb', line 45 def AskPackages(packs, install) packs = deep_copy(packs) pkgs = Builtins.mergestring(packs, ", ") text = if install # the message is followed by list of required packages _("These packages need to be installed:") else # the message is followed by list of required packages _("These packages need to be removed:") end text += " " + pkgs CommandLine.Print(text) CommandLine.YesNo end |
#initialize_packages_common(_include_target) ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'library/packages/src/include/packages/common.rb', line 35 def initialize_packages_common(_include_target) textdomain "base" Yast.import "Label" Yast.import "Popup" Yast.import "Wizard" Yast.import "Mode" Yast.import "CommandLine" end |
#Install(package) ⇒ Object
152 153 154 |
# File 'library/packages/src/include/packages/common.rb', line 152 def Install(package) InstallMsg(package, nil) end |
#InstallAll(packages) ⇒ Object
156 157 158 159 |
# File 'library/packages/src/include/packages/common.rb', line 156 def InstallAll(packages) packages = deep_copy(packages) InstallAllMsg(packages, nil) end |
#InstallAllMsg(packages, message) ⇒ Object
Install list of packages with a custom text message
129 130 131 132 |
# File 'library/packages/src/include/packages/common.rb', line 129 def InstallAllMsg(packages, ) packages = deep_copy(packages) PackageDialog(packages, true, ) end |
#InstallMsg(package, message) ⇒ Object
Install a package with a custom text message
121 122 123 |
# File 'library/packages/src/include/packages/common.rb', line 121 def InstallMsg(package, ) PackageDialog([package], true, ) end |
#LastOperationCanceled ⇒ Object
Return result of the last operation Use immediately after calling any Package*:: function
174 175 176 |
# File 'library/packages/src/include/packages/common.rb', line 174 def LastOperationCanceled @last_op_canceled end |
#PackageDialog(packages, install, message) ⇒ Object
Main package installatio|removal dialog
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'library/packages/src/include/packages/common.rb', line 68 def PackageDialog(packages, install, ) packages = deep_copy(packages) Builtins.y2debug("Asking for packages: %1", packages) packs = Builtins.filter(packages) do |package| install ? !Installed(package) : Installed(package) end Builtins.y2debug("Remaining packages: %1", packs) return true if Ops.less_than(Builtins.size(packs), 1) # Popup Text text = _("These packages need to be installed:") + "<p>" # Popup Text text = _("These packages need to be removed:") + "<p>" if install == false Builtins.foreach(packs) do |p| text = Ops.add(text, Builtins.sformat("%1<br>", p)) end text = Builtins.sformat(, Builtins.mergestring(packs, ", ")) if !.nil? doit = if Mode.commandline CommandLine.Interactive ? AskPackages(packs, install) : true else Popup.AnyQuestionRichText( "", text, 40, 10, # labels changed for bug #215195 # Label::ContinueButton (), Label::CancelButton (), # push button label install ? Label.InstallButton : _("&Uninstall"), Label.CancelButton, :focus_yes ) end if doit @last_op_canceled = false return DoRemove(packs) if install == false return DoInstall(packs) end @last_op_canceled = true false end |
#Remove(package) ⇒ Object
FIXME
162 163 164 |
# File 'library/packages/src/include/packages/common.rb', line 162 def Remove(package) RemoveMsg(package, nil) end |
#RemoveAll(packages) ⇒ Object
166 167 168 169 |
# File 'library/packages/src/include/packages/common.rb', line 166 def RemoveAll(packages) packages = deep_copy(packages) RemoveAllMsg(packages, nil) end |
#RemoveAllMsg(packages, message) ⇒ Object
Remove a list of packages with a custom text message
147 148 149 150 |
# File 'library/packages/src/include/packages/common.rb', line 147 def RemoveAllMsg(packages, ) packages = deep_copy(packages) PackageDialog(packages, false, ) end |
#RemoveMsg(package, message) ⇒ Object
Remove a package with a custom text message
139 140 141 |
# File 'library/packages/src/include/packages/common.rb', line 139 def RemoveMsg(package, ) PackageDialog([package], false, ) end |