Class: Yast::PackageCallbacksClass
- Inherits:
-
Module
- Object
- Module
- Yast::PackageCallbacksClass
- Includes:
- Logger
- Defined in:
- library/packages/src/modules/PackageCallbacks.rb
Overview
Provides the default Callbacks for Pkg::
Constant Summary collapse
- CLEAR_PROGRESS_TEXT =
text to clean progress bar in command line
("\b" * 10) + (" " * 10) + ("\b" * 10)
- MAX_POPUP_TEXT_SIZE =
max. length of the text in the repository popup window
60
- RETRY_TIMEOUT =
base in seconds for automatic retry after a timeout, it will be logarithmic increased upto RETRY_MAX_TIMEOUT
30
- RETRY_ATTEMPTS =
number of automatic retries
100
- RETRY_MAX_TIMEOUT =
max. retry timeout (15 minutes)
15 * 60
- TICK_LABELS =
symbols for ticking in cmd line
["/", "-", "\\", "|"].freeze
Class Method Summary collapse
-
.method_added(name) ⇒ Object
Debugging: log the called callbacks when Y2DEBUG_CALLBACKS is set to 1.
Instance Method Summary collapse
- #AskAbortRefresh ⇒ Object
- #Authentication(url, msg, username, password) ⇒ Object
- #ClearDownloadCallbacks ⇒ Object
- #ClearScriptCallbacks ⇒ Object
- #CloseDownloadProgressPopup ⇒ Object
- #CloseSourcePopup ⇒ Object
- #DestDownload ⇒ Object
-
#DoneDownload(error_value, error_text) ⇒ Object
just log the status, errors are handled in MediaChange callback.
-
#DonePackage(error, reason) ⇒ Object
After package install.
-
#DoneProvide(error, reason, name) ⇒ Object
during file providal * // return "I" for ignore // return "R" for retry // return "C" for abort.
-
#DoneScanDb(error, description) ⇒ Object
Callback for finish RPM DB scan event.
-
#EnableAsterixPackage(value) ⇒ Object
Enable or disable StartPackage, ProgressPackage and DonePackage callbacks, but only the progress bar and not the final error message.
-
#ErrorScanDb(error, description) ⇒ Object
Callback for error handling during RPM DB scan.
- #FinishDeltaProvide ⇒ Object
- #FormatPatchName(patch_name, patch_version, patch_arch) ⇒ Object
- #InitDownload(task) ⇒ Object
-
#InitPackageCallbacks ⇒ Object
Register package manager callbacks.
- #IsDownloadProgressPopup ⇒ Object
-
#IsProgressPopup ⇒ Object
is the top level progress popup?.
-
#IsSourcePopup ⇒ Object
is the top level window source popup?.
- #main ⇒ Object
-
#MediaChange(error_code, error, url, product, current, current_label, wanted, wanted_label, double_sided, devices, current_device) ⇒ Object
-------------------------------------------------------------------------.
- #Message(patch_name, patch_version, patch_arch, message) ⇒ Object
- #NextTick ⇒ Object
- #NotifyConvertDB ⇒ Object
- #NotifyRebuildDB ⇒ Object
- #OpenSourcePopup ⇒ Object
-
#pkg_gpg_check(data) ⇒ String
Handle GPG check result (pkgGpgCheck).
- #ProblemDeltaApply(descr) ⇒ Object
- #ProblemDeltaDownload(descr) ⇒ Object
-
#ProcessDone ⇒ Object
Hander for ProcessDone callback - the process has been finished.
-
#ProcessNextStage ⇒ Object
Hander for ProcessNextStage callback - the current stage has been finished.
-
#ProcessProgress(percent) ⇒ Object
Hander for ProcessProgress callback - report total progress.
-
#ProcessStart(task, stages, help) ⇒ Object
Hanler for ProcessStart callback - handle start of a package manager process.
- #ProgressConvertDB(percent, _file) ⇒ Object
-
#ProgressDeltaApply(percent) ⇒ Object
redirect ProgressDeltaApply callback (a different signature is required).
- #ProgressDownload(percent, bps_avg, bps_current) ⇒ Object
- #ProgressEnd(id) ⇒ Object
-
#ProgressPackage(percent) ⇒ Object
During package install.
- #ProgressProgress(id, val_raw, val_percent) ⇒ Object
-
#ProgressProvide(percent) ⇒ Object
during file providal.
- #ProgressRebuildDB(percent) ⇒ Object
-
#ProgressScanDb(value) ⇒ Object
Callback for RPM DB scan progress.
- #ProgressStart(id, task, in_percent, is_alive, _min, _max, _val_raw, val_percent) ⇒ Object
- #RefreshDone ⇒ Object
- #RefreshStarted ⇒ Object
-
#RegisterEmptyProgressCallbacks ⇒ Object
============================================================================= constructor and callback init =============================================================================.
- #ResetDownloadCallbacks ⇒ Object
- #ResetScanDBCallbacks ⇒ Object
- #RestorePatchCallbacks ⇒ Object
- #RestorePreviousProgressCallbacks ⇒ Object
- #RestoreProcessCallbacks ⇒ Object
- #RestoreProgressReportCallbacks ⇒ Object
- #RestoreProvideCallbacks ⇒ Object
- #RestoreSourceCreateCallbacks ⇒ Object
- #RestoreSourceReportCallbacks ⇒ Object
- #ScriptFinish ⇒ Object
- #ScriptProblem(description) ⇒ Object
- #ScriptProgress(ping, output) ⇒ Object
- #ScriptStart(patch_name, patch_version, patch_arch, script_path) ⇒ Object
- #SetConvertDBCallbacks ⇒ Object
- #SetDownloadCallbacks ⇒ Object
- #SetFileConflictCallbacks ⇒ Object
- #SetHeaderSourcePopup(text) ⇒ Object
- #SetLabelSourcePopup(text) ⇒ Object
-
#SetMediaCallbacks ⇒ Object
Register callbacks for media change.
- #SetPatchCallbacks ⇒ Object
- #SetProcessCallbacks ⇒ Object
- #SetProgressReportCallbacks ⇒ Object
- #SetProvideCallbacks ⇒ Object
- #SetRebuildDBCallbacks ⇒ Object
- #SetScanDBCallbacks ⇒ Object
- #SetScriptCallbacks ⇒ Object
- #SetSourceCreateCallbacks ⇒ Object
- #SetSourceProbeCallbacks ⇒ Object
- #SetSourceReportCallbacks ⇒ Object
-
#SourceChange(source, medianr) ⇒ Object
dummy repository change callback, see SlideShowCallbacks for the real one.
- #SourceCreateDestroy ⇒ Object
- #SourceCreateEnd(url, error, description) ⇒ Object
- #SourceCreateError(url, error, description) ⇒ Object
- #SourceCreateInit ⇒ Object
- #SourceCreateProgress(percent) ⇒ Object
- #SourceCreateStart(url) ⇒ Object
- #SourcePopupSetProgress(value) ⇒ Object
- #SourceProbeEnd(url, error, description) ⇒ Object
- #SourceProbeError(url, error, description) ⇒ Object
- #SourceProbeFailed(url, type) ⇒ Object
- #SourceProbeProgress(_url, value) ⇒ Object
- #SourceProbeStart(url) ⇒ Object
- #SourceProbeSucceeded(url, type) ⇒ Object
- #SourceReportDestroy ⇒ Object
- #SourceReportEnd(src_id, url, task, error, description) ⇒ Object
- #SourceReportError(source_id, url, error, description) ⇒ Object
- #SourceReportInit ⇒ Object
- #SourceReportProgress(value) ⇒ Object
- #SourceReportStart(source_id, url, task) ⇒ Object
- #StartConvertDB(_unused1) ⇒ Object
-
#StartDeltaApply(name) ⇒ Object
at start of delta application.
-
#StartDeltaProvide(name, archivesize) ⇒ Object
at start of delta providal.
- #StartDownload(url, localfile) ⇒ Object
-
#StartPackage(name, _location, _summary, installsize, is_delete) ⇒ Object
At start of package install.
-
#StartProvide(name, archivesize, remote) ⇒ Object
at start of file providal.
- #StartRebuildDB ⇒ Object
-
#StartScanDb ⇒ Object
Callback for start RPM DB scan event.
- #StopConvertDB(error_value, error_text) ⇒ Object
- #StopRebuildDB(error_value, error_text) ⇒ Object
Class Method Details
.method_added(name) ⇒ Object
Debugging: log the called callbacks when Y2DEBUG_CALLBACKS is set to 1
This uses some Ruby meta programming, the "method_added" is called whenever a new method is added into this class, i.e. when each of the following "def" is processed.
54 55 56 57 58 59 60 61 62 63 64 65 66 67 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 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 54 def self.method_added(name) super # log the callbacks only when requested, it's quite verbose return if ENV["Y2DEBUG_CALLBACKS"] != "1" name_str = name.to_s # do not add a hook for a hook itself otherwise it would result # in an endless recursive loop adding a hook for a hook for a hook for... if name_str.end_with?("_hook") || # ignore dynamically added helper methods for the published variables name_str.start_with?("_") || # ignore lowercase methods, they are just some helper methods name_str.match(/^[[:lower:]]/) || # already present method_defined?("#{name}_hook") return end # add a new *_hook method as a wrapper for the original method, # log the name of the called method hook = <<-HOOK def #{name}_hook(*params) log.info("Starting callback #{self}::#{name}") result = #{name}_without_hook(*params) log.info("Callback #{self}::#{name} returned: \#{result.inspect}") result end HOOK # __FILE__ and __LINE__ are used in a backtrace class_eval(hook, __FILE__, __LINE__) # rename the original method class_eval("alias #{name}_without_hook #{name}", __FILE__, __LINE__) # alias m_without_hook m # replace the original method with the hook class_eval("alias #{name} #{name}_hook", __FILE__, __LINE__) # alias m m_hook end |
Instance Method Details
#AskAbortRefresh ⇒ Object
1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1700 def AskAbortRefresh UI.OpenDialog( MarginBox( 1, 0.5, VBox( # a popup question with "Continue", "Skip" and "Abort" buttons Label( _( "The repositories are being refreshed.\n" \ "Continue with refreshing?\n" \ "\n" \ "Note: If the refresh is skipped some packages\n" \ "might be missing or out of date." ) ), ButtonBox( PushButton( Id(:continue), Opt(:default, :okButton), Label.ContinueButton ), # push button label PushButton(Id(:skip), Opt(:cancelButton), _("&Skip Refresh")) ) ) ) ) UI.SetFocus(Id(:continue)) ui = Convert.to_symbol(UI.UserInput) UI.CloseDialog ui = :continue if ui == :close Builtins.y2milestone("User request: %1", ui) ui end |
#Authentication(url, msg, username, password) ⇒ Object
2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 2258 def Authentication(url, msg, username, password) # FIXME: after SLE12 release # The following 'if' block is a workaround for bnc#895719 that should be # extracted to a proper private method (not sure if it will work as # expected being a callback) and adapted to use normal _() instead of # dgettext() url_query = URI(url).query if url_query url_params = URI.decode_www_form(url_query).to_h if url_params.key?("credentials") # Seems to be the url of a registration server, so add the tip to msg tip = Builtins.dgettext("registration", "Check that this system is known to the registration server.") msg = "#{tip}\n#{msg}" end end popup = VBox( HSpacing(50), # enforce width VSpacing(0.1), # heading in a popup window Heading(_("User Authentication")), VSpacing(0.1), HBox( HSpacing(0.1), RichText( Opt(:plainText), Builtins.sformat(_("URL: %1\n\n%2"), url, msg) ), HSpacing(0.1) ), VSpacing(0.1), HBox( HSpacing(1), VBox( # textentry label InputField(Id(:username), Opt(:hstretch), _("&User Name"), username), VSpacing(0.1), # textentry label Password(Id(:password), Opt(:hstretch), _("&Password"), password) ), HSpacing(1) ), VSpacing(0.5), ButtonBox( PushButton(Id(:cont), Opt(:default, :okButton), Label.ContinueButton), PushButton(Id(:cancel), Opt(:cancelButton), Label.CancelButton) ), VSpacing(0.5) ) UI.OpenDialog(Opt(:decorated), popup) ui = Convert.to_symbol(UI.UserInput) username = Convert.to_string(UI.QueryWidget(Id(:username), :Value)) password = Convert.to_string(UI.QueryWidget(Id(:password), :Value)) UI.CloseDialog { "username" => username, "password" => password, "continue" => ui == :cont } end |
#ClearDownloadCallbacks ⇒ Object
1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1933 def ClearDownloadCallbacks Pkg.CallbackInitDownload(nil) Pkg.CallbackStartDownload(nil) Pkg.CallbackProgressDownload(nil) Pkg.CallbackDoneDownload(nil) Pkg.CallbackDestDownload(nil) Pkg.CallbackStartRefresh(nil) Pkg.CallbackDoneRefresh(nil) nil end |
#ClearScriptCallbacks ⇒ Object
2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 2569 def ClearScriptCallbacks Pkg.CallbackScriptStart(nil) Pkg.CallbackScriptProgress(nil) Pkg.CallbackScriptProblem(nil) Pkg.CallbackScriptFinish(nil) Pkg.CallbackMessage(nil) nil end |
#CloseDownloadProgressPopup ⇒ Object
1747 1748 1749 1750 1751 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1747 def CloseDownloadProgressPopup UI.CloseDialog if IsDownloadProgressPopup() nil end |
#CloseSourcePopup ⇒ Object
1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1079 def CloseSourcePopup if !IsSourcePopup() Builtins.y2error( "The toplevel dialog is not a repository popup dialog!" ) return end @_source_open = Ops.subtract(@_source_open, 1) if @_source_open == 0 Builtins.y2milestone("Closing repository progress popup") UI.CloseDialog end Builtins.y2milestone("CloseSourcePopup: _source_open: %1", @_source_open) nil end |
#DestDownload ⇒ Object
1783 1784 1785 1786 1787 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1783 def DestDownload CloseDownloadProgressPopup() if !full_screen nil end |
#DoneDownload(error_value, error_text) ⇒ Object
just log the status, errors are handled in MediaChange callback
1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1889 def DoneDownload(error_value, error_text) if error_value == 0 Builtins.y2milestone("Download finished") elsif @autorefreshing && @autorefreshing_aborted Builtins.y2milestone("Refresh aborted") else Builtins.y2warning( "Download failed: error %1: %2", error_value, error_text ) end nil end |
#DonePackage(error, reason) ⇒ Object
After package install.
return "I" for ignore return "R" for retry return "C" for abort (not implemented !)
489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 489 def DonePackage(error, reason) # remove invalid characters (bnc#876459) if !reason.valid_encoding? reason.encode!("UTF-16", undef: :replace, invalid: :replace, replace: "?") reason.encode!("UTF-8") log.warn "Invalid byte sequence found, fixed text: #{reason}" end UI.CloseDialog if @_package_popup @_package_popup = false if error == 0 # no error, there is additional info (rpm output), see bnc#456446 Builtins.y2milestone("Additional RPM otput: %1", reason) CommandLine.Print(reason) if Mode.commandline else Builtins.y2milestone( "DonePackage(error: %1, reason: '%2')", error, reason ) = Builtins.sformat( if @_deleting_package # error popup during package installation, %1 is the name of the package _("Removal of package %1 failed.") else # error popup during package installation, %1 is the name of the package _("Installation of package %1 failed.") end, @_package_name ) if Mode.commandline CommandLine.Print() CommandLine.Print(reason) # ask user in the interactive mode if CommandLine.Interactive CommandLine.Print("") # command line mode - ask user whether installation of the failed package should be retried CommandLine.Print(_("Retry installation of the package?")) if CommandLine.YesNo # return Retry return "R" end # command line mode - ask user whether the installation should be aborted CommandLine.Print(_("Abort the installation?")) if CommandLine.YesNo # return Abort return "C" end # otherwise return Ignore (default) return "I" end else = ButtonBox( PushButton(Id(:abort), Opt(:cancelButton), Label.AbortButton), PushButton(Id(:retry), Opt(:customButton), Label.RetryButton), PushButton(Id(:ignore), Opt(:okButton), Label.IgnoreButton) ) if @showLongInfo UI.OpenDialog( Opt(:decorated), layout_popup(, , true) ) UI.ReplaceWidget(Id(:info), RichText(Opt(:plainText), reason)) else UI.OpenDialog( Opt(:decorated), layout_popup(, , false) ) UI.ReplaceWidget(Id(:info), Empty()) end r = nil loop do r = UI.UserInput if r == :show @showLongInfo = show_log_info(, ) if @showLongInfo UI.ReplaceWidget(Id(:info), RichText(Opt(:plainText), reason)) else UI.ReplaceWidget(Id(:info), Empty()) end end break if [:abort, :retry, :ignore].include?(r) end Builtins.y2milestone("DonePackage %1", r) UI.CloseDialog if r == :ignore # TODO: add "Don't show again" checkbox # a warning popup displayed after pressing [Ignore] after a package installation error Popup.Warning( _( "Ignoring a package failure may result in a broken system.\nThe system should be later verified by running the Software Management module." ) ) end return "C" if r == :abort return "R" if r == :retry end # default: ignore end "I" end |
#DoneProvide(error, reason, name) ⇒ Object
during file providal * // return "I" for ignore // return "R" for retry // return "C" for abort
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 246 def DoneProvide(error, reason, name) Builtins.y2milestone("DoneProvide: %1, %2, %3", error, reason, name) if @_provide_popup UI.CloseDialog @_provide_popup = false end if Mode.commandline # remove the progress CommandLine.PrintVerboseNoCR(CLEAR_PROGRESS_TEXT) end if @provide_aborted @provide_aborted = false return "C" end # https://github.com/openSUSE/libzypp/blob/8dda46306f06440e1acaefb36fb60f6ce909fd42/zypp/ZYppCallbacks.h#L106 = case error when 1 # NOT_FOUND (error = 1) is handled via MediaChange callback. nil when 2 Builtins.sformat(_("Package %1 could not be downloaded (input/output error)."), name) when 3 Builtins.sformat(_("Package %1 is broken, integrity check has failed."), name) else log.warn "DoneProvide: unknown error '#{error}'" end # IO/INVALID if # error message, %1 is a package name if Mode.commandline CommandLine.Print() # ask user in the interactive mode if CommandLine.Interactive CommandLine.Print("") # command line mode - ask user whether installation of the failed package should be retried CommandLine.Print(_("Retry installation of the package?")) if CommandLine.YesNo # return Retry return "R" end # command line mode - ask user whether the installation should be aborted CommandLine.Print(_("Abort the installation?")) if CommandLine.YesNo # return Abort return "C" end # otherwise return Ignore (default) return "I" end return "I" end = ButtonBox( PushButton(Id(:abort), Opt(:cancelButton, :key_F9), Label.AbortButton), PushButton(Id(:retry), Opt(:customButton), Label.RetryButton), PushButton(Id(:ignore), Opt(:okButton), Label.IgnoreButton) ) if @showLongInfo UI.OpenDialog( Opt(:decorated), layout_popup(, , true) ) UI.ReplaceWidget( Id(:info), RichText( Opt(:plainText), Ops.add(Builtins.sformat(_("Error: %1:"), error), reason) ) ) else UI.OpenDialog( Opt(:decorated), layout_popup(, , false) ) UI.ReplaceWidget(Id(:info), Empty()) end r = nil loop do r = UI.UserInput if r == :show @showLongInfo = show_log_info(, ) if @showLongInfo error_symbol = "ERROR" # https://github.com/openSUSE/libzypp/blob/8dda46306f06440e1acaefb36fb60f6ce909fd42/zypp/ZYppCallbacks.h#L106 case error when 2 error_symbol = "IO" when 3 error_symbol = "INVALID" end UI.ReplaceWidget( Id(:info), RichText( Opt(:plainText), Ops.add( # error message, %1 is code of the error, # detail string is appended to the end Builtins.sformat(_("Error: %1:"), error_symbol), reason ) ) ) else UI.ReplaceWidget(Id(:info), Empty()) end end break if [:abort, :retry, :ignore].include?(r) end Builtins.y2milestone("DoneProvide %1", r) UI.CloseDialog return "C" if r == :abort return "R" if r == :retry if r == :ignore # don't show the warning when a refresh fails or for signature errors (error 3) if !@autorefreshing && error != 3 # TODO: add "Don't show again" checkbox # a warning popup displayed after pressing [Ignore] after a download error Popup.Warning( _( "Ignoring a download failure may result in a broken system.\nVerify the system later by running the Software Management module.\n" ) ) end return "I" end Builtins.y2error("Unknown user input: %1", r) end "I" end |
#DoneScanDb(error, description) ⇒ Object
Callback for finish RPM DB scan event
2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 2238 def DoneScanDb(error, description) Builtins.y2milestone( "RPM DB scan finished: error: %1, reason: '%2'", error, description ) if Mode.commandline # status message (command line mode) CommandLine.PrintVerbose(_("RPM database read")) elsif @_scan_popup && UI.WidgetExists(Id(:label_scanDB_popup)) UI.CloseDialog @_scan_popup = false elsif !full_screen Builtins.y2error("The toplevel dialog is not a scan DB popup!") end nil end |
#EnableAsterixPackage(value) ⇒ Object
nasty hack for inst_do_net_test client. Remove it when client disappear
Enable or disable StartPackage, ProgressPackage and DonePackage callbacks, but only the progress bar and not the final error message. Returns old value.
404 405 406 407 408 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 404 def EnableAsterixPackage(value) ret = @enable_asterix_package @enable_asterix_package = value ret end |
#ErrorScanDb(error, description) ⇒ Object
Callback for error handling during RPM DB scan
2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 2146 def ErrorScanDb(error, description) Builtins.y2error( "ErrorScanDb callback: error: %1, description: %2", error, description ) # error message, could not read RPM database = _("Initialization of the target failed.") if Mode.commandline CommandLine.Print() CommandLine.Print(description) # ask user in the interactive mode if CommandLine.Interactive CommandLine.Print("") # command line mode - ask user whether target initializatin can be restarted CommandLine.Print(_("Retry?")) if CommandLine.YesNo # return Retry return "R" end end # return Cancel return "C" end show_details = false = ButtonBox( PushButton(Id(:abort), Opt(:cancelButton), Label.AbortButton), PushButton(Id(:retry), Opt(:customButton), Label.RetryButton), PushButton(Id(:ignore), Opt(:okButton), Label.IgnoreButton) ) UI.OpenDialog( Opt(:decorated), layout_popup(, , false) ) r = nil loop do r = UI.UserInput if r == :show show_details = show_log_info(, ) if show_details error_symbol = "UNKNOWN" case error when 0 error_symbol = "NO_ERROR" when 1 error_symbol = "FAILED" end UI.ReplaceWidget( Id(:info), RichText( Opt(:plainText), Ops.add( # error message, %1 is code of the error, # detail string is appended to the end Builtins.sformat(_("Error: %1:"), error_symbol), description ) ) ) else UI.ReplaceWidget(Id(:info), Empty()) end end break if [:abort, :retry, :ignore].include?(r) end Builtins.y2milestone("ErrorScanDb: user input: %1", r) UI.CloseDialog return "C" if r == :abort return "R" if r == :retry return "I" if r == :ignore Builtins.y2error("Unknown user input: %1", r) "C" end |
#FinishDeltaProvide ⇒ Object
1521 1522 1523 1524 1525 1526 1527 1528 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1521 def FinishDeltaProvide if @_provide_popup UI.CloseDialog @_provide_popup = false end nil end |
#FormatPatchName(patch_name, patch_version, patch_arch) ⇒ Object
1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1544 def FormatPatchName(patch_name, patch_version, patch_arch) patch_full_name = (!patch_name.nil? && patch_name != "") ? patch_name : "" if patch_full_name != "" if !patch_version.nil? && patch_version != "" patch_full_name = Ops.add( Ops.add(patch_full_name, "-"), patch_version ) end patch_full_name = Ops.add(Ops.add(patch_full_name, "."), patch_arch) if !patch_arch.nil? && patch_arch != "" end patch_full_name end |
#InitDownload(task) ⇒ Object
1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1753 def InitDownload(task) if !Mode.commandline && (!full_screen && !IsDownloadProgressPopup()) # heading of popup heading = _("Downloading") UI.OpenDialog( Opt(:decorated), VBox( Heading(Id(:download_progress_popup_window), heading), VBox( HSpacing(60), HBox( HSpacing(1), ProgressBar(Id(:progress), task, 100), HSpacing(1) ), VSpacing(0.5), ButtonBox( PushButton(Id(:abort), Opt(:cancelButton), Label.AbortButton) ), VSpacing(0.5) ) ) ) UI.ChangeWidget(Id(:progress), :Value, 0) end nil end |
#InitPackageCallbacks ⇒ Object
Register package manager callbacks
2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 2834 def InitPackageCallbacks SetProcessCallbacks() SetProvideCallbacks() SetPatchCallbacks() SetSourceCreateCallbacks() SetSourceProbeCallbacks() SetSourceReportCallbacks() SetProgressReportCallbacks() SetFileConflictCallbacks() # authentication callback Pkg.CallbackAuthentication( fun_ref( method(:Authentication), "map <string, any> (string, string, string, string)" ) ) # @see bugzilla #183821 # Do not register these callbacks in case of AutoInstallation # And for AutoUpgrade neither (bnc#820166) if !(Mode.autoinst || Mode.autoupgrade) # Signature-related callbacks Pkg.CallbackAcceptUnsignedFile( fun_ref( SignatureCheckCallbacks.method(:AcceptUnsignedFile), "boolean (string, integer)" ) ) Pkg.CallbackAcceptUnknownGpgKey( fun_ref( SignatureCheckCallbacks.method(:AcceptUnknownGpgKey), "boolean (string, string, integer)" ) ) # During installation untrusted repositories are disabled to avoid # asking again gpg_callback = Stage.initial ? :import_gpg_key_or_disable : :ImportGpgKey Pkg.CallbackImportGpgKey( fun_ref( SignatureCheckCallbacks.method(gpg_callback), "boolean (map <string, any>, integer)" ) ) Pkg.CallbackAcceptVerificationFailed( fun_ref( SignatureCheckCallbacks.method(:AcceptVerificationFailed), "boolean (string, map <string, any>, integer)" ) ) Pkg.CallbackTrustedKeyAdded( fun_ref( SignatureCheckCallbacks.method(:TrustedKeyAdded), "void (map <string, any>)" ) ) Pkg.CallbackTrustedKeyRemoved( fun_ref( SignatureCheckCallbacks.method(:TrustedKeyRemoved), "void (map <string, any>)" ) ) Pkg.CallbackAcceptFileWithoutChecksum( fun_ref( SignatureCheckCallbacks.method(:AcceptFileWithoutChecksum), "boolean (string)" ) ) Pkg.CallbackAcceptWrongDigest( fun_ref( SignatureCheckCallbacks.method(:AcceptWrongDigest), "boolean (string, string, string)" ) ) Pkg.CallbackAcceptUnknownDigest( fun_ref( SignatureCheckCallbacks.method(:AcceptUnknownDigest), "boolean (string, string)" ) ) end SetMediaCallbacks() SetScriptCallbacks() SetScanDBCallbacks() SetDownloadCallbacks() nil end |
#IsDownloadProgressPopup ⇒ Object
1742 1743 1744 1745 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1742 def IsDownloadProgressPopup !Mode.commandline && UI.WidgetExists(Id(:download_progress_popup_window)) && UI.WidgetExists(Id(:progress)) end |
#IsProgressPopup ⇒ Object
is the top level progress popup?
2332 2333 2334 2335 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 2332 def IsProgressPopup UI.WidgetExists(Id(:progress_widget)) && UI.WidgetExists(Id(:callback_progress_popup)) end |
#IsSourcePopup ⇒ Object
is the top level window source popup?
1066 1067 1068 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1066 def IsSourcePopup UI.WidgetExists(Id(:progress)) && UI.WidgetExists(Id(:label_source_popup)) end |
#main ⇒ Object
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 95 def main Yast.import "Pkg" Yast.import "UI" textdomain "base" Yast.import "Directory" Yast.import "Label" Yast.import "Mode" Yast.import "Stage" Yast.import "Popup" Yast.import "URL" Yast.import "CommandLine" Yast.import "String" Yast.import "Icon" Yast.import "Report" Yast.import "Wizard" Yast.import "Progress" Yast.import "FileUtils" Yast.import "SignatureCheckCallbacks" Yast.import "Linuxrc" @_provide_popup = false @_package_popup = false @_script_popup = false @_scan_popup = false @_package_name = "" @_package_size = 0 @_deleting_package = false @_current_source = 1 # make showLongInfo module-global so it gets remembered (cf. #14018) @showLongInfo = false # used to en-/disable StartPackage, ProgressPackage and DonePackage @enable_asterix_package = true @provide_aborted = false @source_aborted = false @back_string = "\b\b\b\b\b\b\b\b\b\b" @clear_string = Ops.add(Ops.add(@back_string, " "), @back_string) # max. length of the text in the repository popup window @max_size = 60 @autorefreshing = false @autorefreshing_aborted = false # Location of the persistent storage @conf_file = File.join(Directory.vardir, "/package_callbacks.conf") @config = nil # auto ejecting is in progress @doing_eject = false # current values for retry functionality @retry_url = "" @current_retry_timeout = RETRY_TIMEOUT @current_retry_attempt = 0 #============================================================================= # MEDIA CHANGE #============================================================================= @detected_cd_devices = [] # reference counter to the open popup window @_source_open = 0 @download_file = "" # TODO: use the ID in the prgress popup callbacks, # then callbacks may be nested... @tick_progress = false @val_progress = false @current_tick = 0 # ProgressStart/End events may be nested, remember the types of progresses @progress_stack = [] @last_stage = 0 @opened_wizard = [] Builtins.y2milestone("PackageCallbacks constructor") InitPackageCallbacks() end |
#MediaChange(error_code, error, url, product, current, current_label, wanted, wanted_label, double_sided, devices, current_device) ⇒ Object
media change callback
if current == -1, show "Ignore"
return "" for ok, retry return "E" for eject media return "I" for ignore bad media return "S" for skip this media return "C" for cancel (not implemented !) return url to change media URL
620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 620 def MediaChange(error_code, error, url, product, current, current_label, wanted, wanted_label, double_sided, devices, current_device) devices = deep_copy(devices) if @autorefreshing && @autorefreshing_aborted Builtins.y2milestone("Refresh aborted") return "C" end Builtins.y2milestone( "MediaChange error: err'%1', url'%2', prd'%3', cur'%4'/'%5', wan'%6'/'%7', devs: %8, curr_dev: %9", Ops.add(Ops.add(error_code, ":"), error), URL.HidePassword(url), product, current, current_label, wanted, wanted_label, devices, current_device ) if full_screen # make sure the old subprogress is cleared when displaying a popup (bsc#1175926) Progress.SubprogressValue(0) Progress.SubprogressTitle("") end url_scheme = Ops.get_string(URL.Parse(url), "scheme", "").downcase # true if it makes sense to offer an eject button (for cd/dvd only ...) is_disc = ["cd", "dvd"].include?(url_scheme) # do automatic eject if is_disc && autoeject && !@doing_eject Builtins.y2milestone("Automatically ejecting the medium...") @doing_eject = true return "E" end if Builtins.issubstring(error, "ERROR(InstSrc:E_bad_id)") error = # error report _( "<p>The repository at the specified URL now provides a different media ID.\n" \ "If the URL is correct, this indicates that the repository content has changed. To \n" \ "continue using this repository, start <b>Installation Repositories</b> from \n" \ "the YaST control center and refresh the repository.</p>\n" ) end if wanted_label == "" # use only product name for network repository # there is no medium 1, 2, ... if double_sided # media is double sided, we want the user to insert the 'Side A' of the media # the complete string will be "<product> <media> <number>, <side>" # e.g. "'SuSE Linux 9.0' DVD 1, Side A" side = _("Side A") if Ops.bitwise_and(wanted, 1) == 0 # media is double sided, we want the user to insert the 'Side B' of the media side = _("Side B") end wanted = Ops.shift_right(Ops.add(wanted, 1), 1) wanted_label = if is_disc # label for a repository - %1 product name (e.g. "openSUSE 10.2"), %2 medium number (e.g. 2) # %3 side (e.g. "Side A") Builtins.sformat("%1 (Disc %2, %3)", product, wanted, side) else # label for a repository - %1 product name (e.g. "openSUSE 10.2"), %2 medium number (e.g. 2) # %3 side (e.g. "Side A") Builtins.sformat("%1 (Medium %2, %3)", product, wanted, side) end else wanted_label = if is_disc # label for a repository - %1 product name (e.g. openSUSE 10.2), %2 medium number (e.g. 2) Builtins.sformat(_("%1 (Disc %2)"), product, wanted) else # label for a repository - %1 product name (e.g. openSUSE 10.2), %2 medium number (e.g. 2) Builtins.sformat(_("%1 (Medium %2)"), product, wanted) end end end # prompt to insert product (%1 == "SuSE Linux version 9.2 CD 2") = Builtins.sformat(_("Insert\n'%1'"), wanted_label) # with network repository it doesn't make sense to ask for disk if url_scheme == "dir" # report error while accessing local directory with product (%1 = URL, %2 = "SuSE Linux ...") = Builtins.sformat( _( "Cannot access installation media\n" \ "%1\n" \ "%2.\n" \ "Check whether the directory is accessible." ), URL.HidePassword(url), wanted_label ) elsif !is_disc # report error while accessing network media of product (%1 = URL, %2 = "SuSE Linux ...") = Builtins.sformat( _( "Cannot access installation media \n" \ "%1\n" \ "%2.\n" \ "Check whether the server is accessible." ), URL.HidePassword(url), wanted_label ) end # -------------------------------------- # build up button box = ButtonBox( PushButton(Id(:retry), Opt(:default, :okButton), Label.RetryButton) ) .params << PushButton(Id(:ignore), Opt(:customButton), Label.IgnoreButton) if current == -1 # wrong media id, offer "Ignore" .params << PushButton( Id(:cancel), Opt(:cancelButton), @autorefreshing ? _("Skip Autorefresh") : Label.AbortButton ) # push button label during media change popup, user can skip # this media (CD) so no packages from this media will be installed .params << PushButton(Id(:skip), Opt(:customButton), _("&Skip")) if is_disc @detected_cd_devices = cd_devices(Ops.get(devices, current_device, "")) if !@doing_eject # detect the CD/DVD devices if the ejecting is not in progress, # the CD detection closes the ejected tray! cds = deep_copy(@detected_cd_devices) # display a menu button if there are more CD devices if Ops.greater_than(Builtins.size(cds), 1) # menu button label - used for more then one device = HBox(, MenuButton(_("&Eject"), cds)) else # push button label - in the media change popup, user can eject the CD/DVD .params << PushButton(Id(:eject), Opt(:customButton), _("&Eject")) end = VBox( Left( CheckBox( Id(:auto_eject), _("A&utomatically Eject CD or DVD Medium"), autoeject ) ), ) end @doing_eject = false # Autoretry code doing_auto_retry = false if error_code == "IO_SOFT" || Builtins.contains( ["ftp", "sftp", "http", "https", "nfs", "smb"], url_scheme ) # this a different file, reset the retry counter if @retry_url != url @retry_url = url @current_retry_attempt = 0 end # is the maximum retry count reached? if Ops.less_than(@current_retry_attempt, RETRY_ATTEMPTS) # reset the counter, use logarithmic back-off with maximum limit @current_retry_timeout = if @current_retry_attempt < 10 RETRY_TIMEOUT * (1 << @current_retry_attempt) else RETRY_MAX_TIMEOUT end @current_retry_timeout = RETRY_MAX_TIMEOUT if Ops.greater_than(@current_retry_timeout, RETRY_MAX_TIMEOUT) = VBox( # failed download will be automatically retried after the timeout, %1 = formatted time (MM:SS format) Left(Label(Id(:auto_retry), retry_label(@current_retry_timeout))), ) doing_auto_retry = true else Builtins.y2warning( "Max. autoretry count (%1) reached, giving up...", RETRY_ATTEMPTS ) end end Builtins.y2milestone("Autoretry: %1", doing_auto_retry) Builtins.y2milestone("Autoretry attempt: %1", @current_retry_attempt) if doing_auto_retry if Mode.commandline CommandLine.Print() CommandLine.Print(error) # ask user in the interactive mode if CommandLine.Interactive CommandLine.Print("") # command line mode - ask user whether installation of the failed package should be retried CommandLine.Print(_("Retry the installation?")) if CommandLine.YesNo # return Retry return "" end # command line mode - ask user whether the installation should be aborted CommandLine.Print(_("Skip the medium?")) if CommandLine.YesNo # return Skip return "S" end # otherwise ignore the medium CommandLine.Print(_("Ignoring the bad medium...")) return "I" end return "S" end Builtins.y2debug( "Opening Dialog: %1", layout_popup(, , true) ) if @showLongInfo UI.OpenDialog( Opt(:decorated), layout_popup(, , true) ) # TextEntry label UI.ReplaceWidget( Id(:info), VBox( InputField(Id(:url), Opt(:hstretch), _("&URL")), RichText(Opt(:plainText), error) ) ) UI.ChangeWidget(Id(:url), :Value, url) else UI.OpenDialog( Opt(:decorated), layout_popup(, , false) ) UI.ReplaceWidget(Id(:info), Empty()) end # notification UI.Beep r = nil eject_device = "" loop do r = doing_auto_retry ? UI.TimeoutUserInput(1000) : UI.UserInput # timout in autoretry mode? if doing_auto_retry if r == :timeout # decrease timeout counter @current_retry_timeout -= 1 if @current_retry_timeout == 0 Builtins.y2milestone("The time is out, doing automatic retry...") # do the retry r = :retry @current_retry_attempt += 1 else # popup string - refresh the displayed counter UI.ChangeWidget( Id(:auto_retry), :Label, retry_label(@current_retry_timeout) ) end else # user has pressed a button, reset the retry counter in the next timeout Builtins.y2milestone("User input: %1, resetting autoretry url", r) @retry_url = "" end end if r == :show @showLongInfo = show_log_info(, ) if @showLongInfo # TextEntry label UI.ReplaceWidget( Id(:info), VBox( TextEntry(Id(:url), _("&URL")), RichText(Opt(:plainText), error) ) ) UI.ChangeWidget(Id(:url), :Value, url) else UI.ReplaceWidget(Id(:info), Empty()) end elsif [:retry, :url].include?(r) if @showLongInfo # id(`url) must exist newurl = Convert.to_string(UI.QueryWidget(Id(:url), :Value)) if newurl != url url = newurl r = :url end end elsif r.is_a?(::String) && r.start_with?("/dev/") Builtins.y2milestone("Eject request for %1", r) eject_device = r r = :eject end break if [:cancel, :retry, :eject, :skip, :ignore, :url].include?(r) end # check and save the autoeject configuration if needed remember_autoeject if is_disc Builtins.y2milestone("MediaChange %1", r) UI.CloseDialog if @_provide_popup UI.CloseDialog @_provide_popup = false end case r when :ignore then "I" when :skip then "S" when :cancel # abort during autorefresh should abort complete autorefresh, not only the failed repo if @autorefreshing @autorefreshing_aborted = true Pkg.SkipRefresh else @provide_aborted = true end "C" when :eject @doing_eject = true return "E" if eject_device == "" # get the index in the list dindex = -1 found = Builtins.find(devices) do |d| dindex = Ops.add(dindex, 1) d == eject_device end if found Builtins.y2milestone("Device %1 has index %2", eject_device, dindex) "E#{dindex}" else Builtins.y2warning( "Device %1 not found in the list, using default", eject_device ) "E" end when :url Builtins.y2milestone("Redirecting to: %1", URL.HidePassword(url)) url else "" end end |
#Message(patch_name, patch_version, patch_arch, message) ⇒ Object
1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1685 def Message(patch_name, patch_version, patch_arch, ) patch_full_name = FormatPatchName(patch_name, patch_version, patch_arch) Builtins.y2milestone("Message (%1): %2", patch_full_name, ) if patch_full_name != "" # label, %1 is patch name with version and architecture patch_full_name = Builtins.sformat(_("Patch: %1\n\n"), patch_full_name) end ret = Popup.ContinueCancel(Ops.add(patch_full_name, )) Builtins.y2milestone("User input: %1", ret) ret end |
#NextTick ⇒ Object
2325 2326 2327 2328 2329 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 2325 def NextTick @current_tick = (@current_tick + 1) % TICK_LABELS nil end |
#NotifyConvertDB ⇒ Object
2064 2065 2066 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 2064 def NotifyConvertDB nil end |
#NotifyRebuildDB ⇒ Object
1994 1995 1996 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1994 def NotifyRebuildDB nil end |
#OpenSourcePopup ⇒ Object
1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1013 def OpenSourcePopup if @_source_open == 0 UI.OpenDialog( VBox( HSpacing(MAX_POPUP_TEXT_SIZE), Heading(Id(:label_source_popup), Opt(:hstretch), " "), ProgressBar(Id(:progress), " ", 100, 0) ) ) end @_source_open = Ops.add(@_source_open, 1) Builtins.y2milestone("OpenSourcePopup: _source_open: %1", @_source_open) nil end |
#pkg_gpg_check(data) ⇒ String
Handle GPG check result (pkgGpgCheck)
If insecure mode is set to '1', the check result is ignored. Otherwise, no decision is made. When running on an installed system, it always return "".
475 476 477 478 479 480 481 482 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 475 def pkg_gpg_check(data) log.debug("pkgGpgCheck data: #{data}") log.warn("Signature check failed: #{data}") if data["CheckPackageResult"] && data["CheckPackageResult"] != 0 insecure = Stage.initial && Linuxrc.InstallInf("Insecure") == "1" insecure ? "I" : "" end |
#ProblemDeltaApply(descr) ⇒ Object
1537 1538 1539 1540 1541 1542 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1537 def ProblemDeltaApply(descr) FinishDeltaProvide() # close popup Builtins.y2milestone("Failed to apply delta RPM: %1", descr) nil end |
#ProblemDeltaDownload(descr) ⇒ Object
1530 1531 1532 1533 1534 1535 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1530 def ProblemDeltaDownload(descr) FinishDeltaProvide() # close popup Builtins.y2milestone("Failed to download delta RPM: %1", descr) nil end |
#ProcessDone ⇒ Object
Hander for ProcessDone callback - the process has been finished
2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 2528 def ProcessDone Builtins.y2milestone("Process: Finished") return if Mode.commandline idx = Ops.subtract(Builtins.size(@opened_wizard), 1) close = Ops.get(@opened_wizard, idx, false) @opened_wizard = Builtins.remove(@opened_wizard, idx) Builtins.y2milestone( "Close Wizard window: %1, new stack: %2", close, @opened_wizard ) # set 100% Progress.Finish if close Builtins.y2milestone("Closing Wizard window...") Wizard.CloseDialog end nil end |
#ProcessNextStage ⇒ Object
Hander for ProcessNextStage callback - the current stage has been finished
2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 2515 def ProcessNextStage Builtins.y2milestone("Setting stage: %1", @last_stage) return if Mode.commandline Progress.Stage(@last_stage, "", -1) @last_stage = Ops.add(@last_stage, 1) nil end |
#ProcessProgress(percent) ⇒ Object
Hander for ProcessProgress callback - report total progress
2504 2505 2506 2507 2508 2509 2510 2511 2512 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 2504 def ProcessProgress(percent) Builtins.y2debug("Process: %1%%", percent) return true if Mode.commandline Progress.Step(percent) true end |
#ProcessStart(task, stages, help) ⇒ Object
Hanler for ProcessStart callback - handle start of a package manager process
2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 2463 def ProcessStart(task, stages, help) stages = deep_copy(stages) Builtins.y2milestone( "Process: Start: task: %1, stages: %2, help: %3", task, stages, help ) Builtins.y2milestone( "Progress: status: %1, isrunning: %2", Progress.status, Progress.IsRunning ) return if Mode.commandline opened = false if Progress.status if !Progress.IsRunning Builtins.y2milestone("Opening Wizard window...") Wizard.CreateDialog opened = true end # set 100 + number of stages as the max value, # Progress module counts stages as extra steps Progress.New(task, "", 100 + stages.size, stages, [], help) Progress.Title(task) @last_stage = 0 end @opened_wizard = Builtins.add(@opened_wizard, opened) Builtins.y2milestone("Wizard stack: %1", @opened_wizard) nil end |
#ProgressConvertDB(percent, _file) ⇒ Object
2042 2043 2044 2045 2046 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 2042 def ProgressConvertDB(percent, _file) UI.ChangeWidget(Id(:progress), :Value, percent) nil end |
#ProgressDeltaApply(percent) ⇒ Object
redirect ProgressDeltaApply callback (a different signature is required)
235 236 237 238 239 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 235 def ProgressDeltaApply(percent) ProgressProvide(percent) nil end |
#ProgressDownload(percent, bps_avg, bps_current) ⇒ Object
1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1818 def ProgressDownload(percent, bps_avg, bps_current) if @autorefreshing && @autorefreshing_aborted Builtins.y2milestone("Refresh aborted") return false end if Mode.commandline CommandLine.PrintVerboseNoCR(CLEAR_PROGRESS_TEXT + "#{percent}%") if percent == 100 # sleep for a wile Builtins.sleep(200) # remove the progress CommandLine.PrintVerboseNoCR(CLEAR_PROGRESS_TEXT) # print newline when reached 100% end else msg_rate = "" if Ops.greater_than(bps_current, 0) # do not show the average download rate if the space is limited bps_avg = -1 if textmode && Ops.less_than(display_width, 100) format = if textmode Ops.add("%1 - ", @download_file) else Ops.add(@download_file, " - %1") end # progress bar label, %1 is URL with optional download rate msg_rate = Builtins.sformat( _("Downloading: %1"), String.FormatRateMessage(format, bps_avg, bps_current) ) end if full_screen Progress.SubprogressValue(percent) Progress.SubprogressTitle(msg_rate) if Ops.greater_than(Builtins.size(msg_rate), 0) else UI.ChangeWidget(Id(:progress), :Value, percent) UI.ChangeWidget(Id(:progress), :Label, msg_rate) if Ops.greater_than(Builtins.size(msg_rate), 0) end download_aborted = UI.PollInput == :abort if download_aborted && @autorefreshing # display "Continue", "Skip Refresh" dialog answer = AskAbortRefresh() case answer when :continue download_aborted = false when :skip download_aborted = true @autorefreshing_aborted = true Pkg.SkipRefresh else Builtins.y2error("Unknown input value: %1", answer) end end return !download_aborted end true end |
#ProgressEnd(id) ⇒ Object
2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 2390 def ProgressEnd(id) Builtins.y2milestone("ProgressFinish: %1", id) # remove the last element from the progress stack @progress_stack = Builtins.remove( @progress_stack, Ops.subtract(Builtins.size(@progress_stack), 1) ) if !Mode.commandline && IsProgressPopup() UI.CloseDialog if Builtins.size(@progress_stack) == 0 elsif full_screen if Ops.greater_than(Builtins.size(@progress_stack), 0) progress_type = Ops.get_symbol( @progress_stack, [Ops.subtract(Builtins.size(@progress_stack), 1), "type"], :none ) task = Ops.get_string( @progress_stack, [Ops.subtract(Builtins.size(@progress_stack), 1), "task"], "" ) Progress.SubprogressType(progress_type, 100) Progress.SubprogressTitle(task) end end nil end |
#ProgressPackage(percent) ⇒ Object
During package install.
446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 446 def ProgressPackage(percent) if @_package_popup UI.ChangeWidget(Id(:progress), :Value, percent) return UI.PollInput != :abort elsif Mode.commandline CommandLine.PrintVerboseNoCR(CLEAR_PROGRESS_TEXT + "#{percent}%") if percent == 100 # sleep for a wile Builtins.sleep(200) # remove the progress CommandLine.PrintVerboseNoCR(CLEAR_PROGRESS_TEXT) end end true end |
#ProgressProgress(id, val_raw, val_percent) ⇒ Object
2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 2422 def ProgressProgress(id, val_raw, val_percent) Builtins.y2debug("ProgressProgress: %1, %2%% ", id, val_percent) if Mode.commandline if @tick_progress tick_label = TICK_LABELS[@current_tick] CommandLine.PrintVerboseNoCR(CLEAR_PROGRESS_TEXT + tick_label) NextTick() else CommandLine.PrintVerboseNoCR(CLEAR_PROGRESS_TEXT + "#{val_percent}%") end elsif IsProgressPopup() if @tick_progress || @val_progress UI.ChangeWidget(Id(:progress_widget), :Alive, true) else UI.ChangeWidget(Id(:progress_widget), :Value, val_percent) end # aborted ? input = UI.PollInput if input == :abort Builtins.y2warning( "Callback %1 has been aborted at %2%% (raw: %3)", id, val_percent, val_raw ) return false end elsif full_screen # fullscreen callbacks Progress.SubprogressValue(val_percent) end true end |
#ProgressProvide(percent) ⇒ Object
during file providal
221 222 223 224 225 226 227 228 229 230 231 232 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 221 def ProgressProvide(percent) Builtins.y2milestone("ProgressProvide: %1", percent) if @_provide_popup UI.ChangeWidget(Id(:progress), :Value, percent) @provide_aborted = UI.PollInput == :abort return !@provide_aborted elsif Mode.commandline # there is no popup window, but command line mode is set CommandLine.PrintVerboseNoCR(CLEAR_PROGRESS_TEXT + "#{percent}%") end true end |
#ProgressRebuildDB(percent) ⇒ Object
1972 1973 1974 1975 1976 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1972 def ProgressRebuildDB(percent) UI.ChangeWidget(Id(:progress), :Value, percent) nil end |
#ProgressScanDb(value) ⇒ Object
Callback for RPM DB scan progress
2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 2127 def ProgressScanDb(value) if Mode.commandline CommandLine.PrintVerboseNoCR(CLEAR_PROGRESS_TEXT + "#{value}%") elsif @_scan_popup && UI.WidgetExists(Id(:label_scanDB_popup)) UI.ChangeWidget(Id(:progress), :Value, value) cont = UI.PollInput != :abort Builtins.y2warning("Scan DB aborted") if !cont return cont elsif full_screen Progress.Step(value) end # continue true end |
#ProgressStart(id, task, in_percent, is_alive, _min, _max, _val_raw, val_percent) ⇒ Object
2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 2337 def ProgressStart(id, task, in_percent, is_alive, _min, _max, _val_raw, val_percent) Builtins.y2milestone("ProgressStart: %1", id) @tick_progress = is_alive @val_progress = !in_percent && !is_alive @current_tick = 0 if Mode.commandline CommandLine.Print(task) else subprogress_type = @tick_progress ? :tick : :progress @progress_stack = Builtins.add( @progress_stack, "type" => subprogress_type, "task" => task ) if IsProgressPopup() && Ops.less_or_equal(Builtins.size(@progress_stack), 1) # huh, the popup is already there? Builtins.y2warning("Progress popup already opened...") UI.CloseDialog end if full_screen Progress.SubprogressType(subprogress_type, 100) Progress.SubprogressTitle(task) else UI.OpenDialog( HBox( HSpacing(1), VBox( VSpacing(0.5), HSpacing(Id(:callback_progress_popup), MAX_POPUP_TEXT_SIZE), if in_percent ProgressBar(Id(:progress_widget), task, 100, val_percent) else BusyIndicator(Id(:progress_widget), task, 3000) end, VSpacing(0.2), ButtonBox( PushButton(Id(:abort), Opt(:cancelButton), Label.AbortButton) ), VSpacing(0.5) ), HSpacing(1) ) ) end end nil end |
#RefreshDone ⇒ Object
1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1920 def RefreshDone if !Mode.commandline && UI.WidgetExists(Id(:abort)) UI.ChangeWidget(Id(:abort), :Label, Label.AbortButton) UI.RecalcLayout end Builtins.y2milestone("Autorefresh done") @autorefreshing = false @autorefreshing_aborted = false nil end |
#RefreshStarted ⇒ Object
1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1905 def RefreshStarted Builtins.y2milestone("Autorefreshing repositories...") if !Mode.commandline && UI.WidgetExists(Id(:abort)) # push button label UI.ChangeWidget(Id(:abort), :Label, _("Skip Autorefresh")) UI.RecalcLayout end @autorefreshing = true @autorefreshing_aborted = false nil end |
#RegisterEmptyProgressCallbacks ⇒ Object
=============================================================================
constructor and callback init
2938 2939 2940 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 2938 def RegisterEmptyProgressCallbacks ::Packages::DummyCallbacks.register end |
#ResetDownloadCallbacks ⇒ Object
2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 2644 def ResetDownloadCallbacks Pkg.CallbackInitDownload(nil) Pkg.CallbackStartDownload(nil) Pkg.CallbackProgressDownload(nil) Pkg.CallbackDoneDownload(nil) Pkg.CallbackDestDownload(nil) Pkg.CallbackStartRefresh(nil) Pkg.CallbackDoneRefresh(nil) nil end |
#ResetScanDBCallbacks ⇒ Object
2614 2615 2616 2617 2618 2619 2620 2621 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 2614 def ResetScanDBCallbacks Pkg.CallbackStartScanDb(nil) Pkg.CallbackProgressScanDb(nil) Pkg.CallbackErrorScanDb(nil) Pkg.CallbackDoneScanDb(nil) nil end |
#RestorePatchCallbacks ⇒ Object
2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 2963 def RestorePatchCallbacks Pkg.CallbackStartDeltaDownload(nil) Pkg.CallbackProgressDeltaDownload(nil) Pkg.CallbackProblemDeltaDownload(nil) Pkg.CallbackFinishDeltaDownload(nil) Pkg.CallbackStartDeltaApply(nil) Pkg.CallbackProgressDeltaApply(nil) Pkg.CallbackProblemDeltaApply(nil) Pkg.CallbackFinishDeltaApply(nil) nil end |
#RestorePreviousProgressCallbacks ⇒ Object
3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 3007 def RestorePreviousProgressCallbacks RestoreProcessCallbacks() RestoreProvideCallbacks() RestorePatchCallbacks() RestoreSourceCreateCallbacks() RestoreSourceReportCallbacks() RestoreProgressReportCallbacks() ClearScriptCallbacks() ResetScanDBCallbacks() ResetDownloadCallbacks() nil end |
#RestoreProcessCallbacks ⇒ Object
2942 2943 2944 2945 2946 2947 2948 2949 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 2942 def RestoreProcessCallbacks Pkg.CallbackProcessStart(nil) Pkg.CallbackProcessProgress(nil) Pkg.CallbackProcessNextStage(nil) Pkg.CallbackProcessDone(nil) nil end |
#RestoreProgressReportCallbacks ⇒ Object
2999 3000 3001 3002 3003 3004 3005 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 2999 def RestoreProgressReportCallbacks Pkg.CallbackProgressReportStart(nil) Pkg.CallbackProgressReportProgress(nil) Pkg.CallbackProgressReportEnd(nil) nil end |
#RestoreProvideCallbacks ⇒ Object
2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 2951 def RestoreProvideCallbacks Pkg.CallbackStartProvide(nil) Pkg.CallbackProgressProvide(nil) Pkg.CallbackDoneProvide(nil) Pkg.CallbackStartPackage(nil) Pkg.CallbackProgressPackage(nil) Pkg.CallbackDonePackage(nil) Pkg.CallbackPkgGpgCheck(nil) nil end |
#RestoreSourceCreateCallbacks ⇒ Object
2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 2977 def RestoreSourceCreateCallbacks Pkg.CallbackSourceCreateStart(nil) Pkg.CallbackSourceCreateProgress(nil) Pkg.CallbackSourceCreateError(nil) Pkg.CallbackSourceCreateEnd(nil) Pkg.CallbackSourceCreateInit(nil) Pkg.CallbackSourceCreateDestroy(nil) nil end |
#RestoreSourceReportCallbacks ⇒ Object
2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 2988 def RestoreSourceReportCallbacks Pkg.CallbackSourceReportStart(nil) Pkg.CallbackSourceReportProgress(nil) Pkg.CallbackSourceReportError(nil) Pkg.CallbackSourceReportEnd(nil) Pkg.CallbackSourceReportInit(nil) Pkg.CallbackSourceReportDestroy(nil) nil end |
#ScriptFinish ⇒ Object
1677 1678 1679 1680 1681 1682 1683 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1677 def ScriptFinish Builtins.y2milestone("ScriptFinish") UI.CloseDialog if @_script_popup nil end |
#ScriptProblem(description) ⇒ Object
1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1643 def ScriptProblem(description) Builtins.y2warning("ScriptProblem: %1", description) ui = Popup.AnyQuestion3( "", # symbol focus description, Label.RetryButton, # yes_button_message Label.AbortButton, # no_button_message Label.IgnoreButton, # retry_button_message :retry ) Builtins.y2milestone("Problem result: %1", ui) # Abort is the default ret = "A" case ui when :retry # ignore ret = "I" when :yes # retry ret = "R" when :no # abort ret = "A" else Builtins.y2warning("Unknown result: %1, aborting", ui) end ret end |
#ScriptProgress(ping, output) ⇒ Object
1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1623 def ScriptProgress(ping, output) Builtins.y2milestone("ScriptProgress: ping:%1, output: %2", ping, output) if @_script_popup if ping # TODO: refresh progress indicator Builtins.y2debug("-ping-") end if !output.nil? && output != "" # add the output to the log widget UI.ChangeWidget(Id(:log), :Value, output) end input = UI.PollInput return false if [:abort, :close].include?(input) end true end |
#ScriptStart(patch_name, patch_version, patch_arch, script_path) ⇒ Object
1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1561 def ScriptStart(patch_name, patch_version, patch_arch, script_path) patch_full_name = FormatPatchName(patch_name, patch_version, patch_arch) Builtins.y2milestone( "ScriptStart callback: patch: %1, script: %2", patch_full_name, script_path ) if Mode.commandline CommandLine.PrintVerbose( Builtins.sformat( _("Starting script %1 (patch %2)..."), script_path, patch_full_name ) ) else progressbox = VBox( HSpacing(60), # popup heading Heading(_("Running Script")), VBox( if patch_full_name == "" Empty() else HBox( # label, patch name follows Label(Opt(:boldFont), _("Patch: ")), Label(patch_full_name), HStretch() ) end, HBox( # label, script name follows Label(Opt(:boldFont), _("Script: ")), Label(script_path), HStretch() ) ), # label LogView(Id(:log), _("Output of the Script"), 10, 0), ButtonBox( PushButton( Id(:abort), Opt(:default, :key_F9, :cancelButton), Label.AbortButton ) ) ) UI.CloseDialog if @_script_popup UI.OpenDialog(progressbox) UI.SetFocus(Id(:abort)) @_script_popup = true end nil end |
#SetConvertDBCallbacks ⇒ Object
2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 2068 def SetConvertDBCallbacks Pkg.CallbackStartConvertDb( fun_ref(method(:StartConvertDB), "void (string)") ) Pkg.CallbackProgressConvertDb( fun_ref(method(:ProgressConvertDB), "void (integer, string)") ) Pkg.CallbackStopConvertDb( fun_ref(method(:StopConvertDB), "void (integer, string)") ) Pkg.CallbackNotifyConvertDb(fun_ref(method(:NotifyConvertDB), "void ()")) nil end |
#SetDownloadCallbacks ⇒ Object
2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 2623 def SetDownloadCallbacks Pkg.CallbackInitDownload(fun_ref(method(:InitDownload), "void (string)")) Pkg.CallbackStartDownload( fun_ref(method(:StartDownload), "void (string, string)") ) Pkg.CallbackProgressDownload( fun_ref( method(:ProgressDownload), "boolean (integer, integer, integer)" ) ) Pkg.CallbackDoneDownload( fun_ref(method(:DoneDownload), "void (integer, string)") ) Pkg.CallbackDestDownload(fun_ref(method(:DestDownload), "void ()")) Pkg.CallbackStartRefresh(fun_ref(method(:RefreshStarted), "void ()")) Pkg.CallbackDoneRefresh(fun_ref(method(:RefreshDone), "void ()")) nil end |
#SetFileConflictCallbacks ⇒ Object
2829 2830 2831 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 2829 def SetFileConflictCallbacks ::Packages::FileConflictCallbacks.register end |
#SetHeaderSourcePopup(text) ⇒ Object
1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1030 def SetHeaderSourcePopup(text) # Qt UI uses bold font, the string must be shortened even more ui_adjustment = textmode ? 0 : 5 if Ops.greater_than( Builtins.size(text), Ops.subtract(MAX_POPUP_TEXT_SIZE, ui_adjustment) ) text = (text, Ops.subtract(MAX_POPUP_TEXT_SIZE, ui_adjustment)) end UI.ChangeWidget(:label_source_popup, :Value, text) Builtins.y2milestone("SourcePopup: new header: %1", text) nil end |
#SetLabelSourcePopup(text) ⇒ Object
1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1047 def SetLabelSourcePopup(text) # Qt uses proportional font, the string might be longer ui_adjustment = textmode ? 0 : 6 if Ops.greater_than( Builtins.size(text), Ops.add(MAX_POPUP_TEXT_SIZE, ui_adjustment) ) text = (text, Ops.add(MAX_POPUP_TEXT_SIZE, ui_adjustment)) end # refresh the label in the popup UI.ChangeWidget(:progress, :Label, text) Builtins.y2milestone("SourcePopup: new label: %1", text) nil end |
#SetMediaCallbacks ⇒ Object
Register callbacks for media change
2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 2555 def SetMediaCallbacks Pkg.CallbackMediaChange( fun_ref( method(:MediaChange), "string (string, string, string, string, integer, string, integer, string, boolean, list <string>, integer)" ) ) Pkg.CallbackSourceChange( fun_ref(method(:SourceChange), "void (integer, integer)") ) nil end |
#SetPatchCallbacks ⇒ Object
2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 2749 def SetPatchCallbacks Pkg.CallbackStartDeltaDownload( fun_ref(method(:StartDeltaProvide), "void (string, integer)") ) Pkg.CallbackProgressDeltaDownload( fun_ref(method(:ProgressProvide), "boolean (integer)") ) Pkg.CallbackProblemDeltaDownload( fun_ref(method(:ProblemDeltaDownload), "void (string)") ) Pkg.CallbackFinishDeltaDownload( fun_ref(method(:FinishDeltaProvide), "void ()") ) Pkg.CallbackStartDeltaApply( fun_ref(method(:StartDeltaApply), "void (string)") ) Pkg.CallbackProgressDeltaApply( fun_ref(method(:ProgressDeltaApply), "void (integer)") ) Pkg.CallbackProblemDeltaApply( fun_ref(method(:ProblemDeltaApply), "void (string)") ) Pkg.CallbackFinishDeltaApply( fun_ref(method(:FinishDeltaProvide), "void ()") ) nil end |
#SetProcessCallbacks ⇒ Object
2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 2704 def SetProcessCallbacks # register process callbacks (total progress) Pkg.CallbackProcessStart( fun_ref(method(:ProcessStart), "void (string, list <string>, string)") ) Pkg.CallbackProcessProgress( fun_ref(method(:ProcessProgress), "boolean (integer)") ) Pkg.CallbackProcessNextStage( fun_ref(method(:ProcessNextStage), "void ()") ) Pkg.CallbackProcessDone(fun_ref(method(:ProcessDone), "void ()")) nil end |
#SetProgressReportCallbacks ⇒ Object
2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 2809 def SetProgressReportCallbacks Pkg.CallbackProgressReportStart( fun_ref( method(:ProgressStart), "void (integer, string, boolean, boolean, integer, integer, integer, integer)" ) ) Pkg.CallbackProgressReportProgress( fun_ref( method(:ProgressProgress), "boolean (integer, integer, integer)" ) ) Pkg.CallbackProgressReportEnd( fun_ref(method(:ProgressEnd), "void (integer)") ) nil end |
#SetProvideCallbacks ⇒ Object
2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 2720 def SetProvideCallbacks Pkg.CallbackStartProvide( fun_ref(method(:StartProvide), "void (string, integer, boolean)") ) Pkg.CallbackProgressProvide( fun_ref(method(:ProgressProvide), "boolean (integer)") ) Pkg.CallbackDoneProvide( fun_ref(method(:DoneProvide), "string (integer, string, string)") ) Pkg.CallbackStartPackage( fun_ref( method(:StartPackage), "void (string, string, string, integer, boolean)" ) ) Pkg.CallbackProgressPackage( fun_ref(method(:ProgressPackage), "boolean (integer)") ) Pkg.CallbackDonePackage( fun_ref(method(:DonePackage), "string (integer, string)") ) Pkg.CallbackPkgGpgCheck( fun_ref(method(:pkg_gpg_check), "string(map)") ) nil end |
#SetRebuildDBCallbacks ⇒ Object
1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1998 def SetRebuildDBCallbacks Pkg.CallbackStartRebuildDb(fun_ref(method(:StartRebuildDB), "void ()")) Pkg.CallbackProgressRebuildDb( fun_ref(method(:ProgressRebuildDB), "void (integer)") ) Pkg.CallbackStopRebuildDb( fun_ref(method(:StopRebuildDB), "void (integer, string)") ) Pkg.CallbackNotifyRebuildDb(fun_ref(method(:NotifyRebuildDB), "void ()")) nil end |
#SetScanDBCallbacks ⇒ Object
2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 2599 def SetScanDBCallbacks Pkg.CallbackStartScanDb(fun_ref(method(:StartScanDb), "void ()")) Pkg.CallbackProgressScanDb( fun_ref(method(:ProgressScanDb), "boolean (integer)") ) Pkg.CallbackErrorScanDb( fun_ref(method(:ErrorScanDb), "string (integer, string)") ) Pkg.CallbackDoneScanDb( fun_ref(method(:DoneScanDb), "void (integer, string)") ) nil end |
#SetScriptCallbacks ⇒ Object
2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 2580 def SetScriptCallbacks Pkg.CallbackScriptStart( fun_ref(method(:ScriptStart), "void (string, string, string, string)") ) Pkg.CallbackScriptProgress( fun_ref(method(:ScriptProgress), "boolean (boolean, string)") ) Pkg.CallbackScriptProblem( fun_ref(method(:ScriptProblem), "string (string)") ) Pkg.CallbackScriptFinish(fun_ref(method(:ScriptFinish), "void ()")) Pkg.CallbackMessage( fun_ref(method(:Message), "boolean (string, string, string, string)") ) nil end |
#SetSourceCreateCallbacks ⇒ Object
2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 2656 def SetSourceCreateCallbacks # source create callbacks Pkg.CallbackSourceCreateStart( fun_ref(method(:SourceCreateStart), "void (string)") ) Pkg.CallbackSourceCreateProgress( fun_ref(method(:SourceCreateProgress), "boolean (integer)") ) Pkg.CallbackSourceCreateError( fun_ref(method(:SourceCreateError), "symbol (string, symbol, string)") ) Pkg.CallbackSourceCreateEnd( fun_ref(method(:SourceCreateEnd), "void (string, symbol, string)") ) Pkg.CallbackSourceCreateInit( fun_ref(method(:SourceCreateInit), "void ()") ) Pkg.CallbackSourceCreateDestroy( fun_ref(method(:SourceCreateDestroy), "void ()") ) nil end |
#SetSourceProbeCallbacks ⇒ Object
2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 2680 def SetSourceProbeCallbacks # source probing callbacks Pkg.CallbackSourceProbeStart( fun_ref(method(:SourceProbeStart), "void (string)") ) Pkg.CallbackSourceProbeFailed( fun_ref(method(:SourceProbeFailed), "void (string, string)") ) Pkg.CallbackSourceProbeSucceeded( fun_ref(method(:SourceProbeSucceeded), "void (string, string)") ) Pkg.CallbackSourceProbeProgress( fun_ref(method(:SourceProbeProgress), "boolean (string, integer)") ) Pkg.CallbackSourceProbeError( fun_ref(method(:SourceProbeError), "symbol (string, symbol, string)") ) Pkg.CallbackSourceProbeEnd( fun_ref(method(:SourceProbeEnd), "void (string, symbol, string)") ) nil end |
#SetSourceReportCallbacks ⇒ Object
2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 2779 def SetSourceReportCallbacks # source report callbacks Pkg.CallbackSourceReportStart( fun_ref(method(:SourceReportStart), "void (integer, string, string)") ) Pkg.CallbackSourceReportProgress( fun_ref(method(:SourceReportProgress), "boolean (integer)") ) Pkg.CallbackSourceReportError( fun_ref( method(:SourceReportError), "symbol (integer, string, symbol, string)" ) ) Pkg.CallbackSourceReportEnd( fun_ref( method(:SourceReportEnd), "void (integer, string, string, symbol, string)" ) ) Pkg.CallbackSourceReportInit( fun_ref(method(:SourceReportInit), "void ()") ) Pkg.CallbackSourceReportDestroy( fun_ref(method(:SourceReportDestroy), "void ()") ) nil end |
#SourceChange(source, medianr) ⇒ Object
dummy repository change callback, see SlideShowCallbacks for the real one
1006 1007 1008 1009 1010 1011 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1006 def SourceChange(source, medianr) Builtins.y2milestone("SourceChange (%1, %2)", source, medianr) @_current_source = source nil end |
#SourceCreateDestroy ⇒ Object
1106 1107 1108 1109 1110 1111 1112 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1106 def SourceCreateDestroy Builtins.y2milestone("SourceCreateDestroy") CloseSourcePopup() nil end |
#SourceCreateEnd(url, error, description) ⇒ Object
1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1206 def SourceCreateEnd(url, error, description) # set 100% progress SourcePopupSetProgress(100) Builtins.y2milestone( "Source create end: error: url: %1, error: %2, description: %3", URL.HidePassword(url), error, description ) nil end |
#SourceCreateError(url, error, description) ⇒ Object
1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1142 def SourceCreateError(url, error, description) Builtins.y2milestone( "Source create: error: url: %1, error: %2, description: %3", URL.HidePassword(url), error, description ) # error message - a label followed by a richtext with details = _("An error occurred while creating the repository.") case error when :NOT_FOUND # error message - a label followed by a richtext with details = _("Unable to retrieve the remote repository description.") when :IO # error message - a label followed by a richtext with details = _("An error occurred while retrieving the new metadata.") when :INVALID # error message - a label followed by a richtext with details = _("The repository is not valid.") when :REJECTED # error message - a label followed by a richtext with details = _("The repository metadata is invalid.") end if Mode.commandline CommandLine.Print() CommandLine.Print(URL.HidePassword(url)) CommandLine.Print(description) # ask user in the interactive mode if CommandLine.Interactive CommandLine.Print("") # command line mode - ask user whether the repository refreshment should be retried CommandLine.Print(_("Retry?")) if CommandLine.YesNo # return Retry return :RETRY end end return :ABORT end detail = Builtins.sformat("%1<br>%2", url, description) UI.OpenDialog( VBox( Label(), RichText(detail), ButtonBox( PushButton(Id(:RETRY), Opt(:okButton), Label.RetryButton), PushButton(Id(:ABORT), Opt(:cancelButton), Label.AbortButton) ) ) ) ret = Convert.to_symbol(UI.UserInput) UI.CloseDialog Builtins.y2milestone("Source create error: Returning %1", ret) ret end |
#SourceCreateInit ⇒ Object
1098 1099 1100 1101 1102 1103 1104 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1098 def SourceCreateInit Builtins.y2milestone("SourceCreateInit") OpenSourcePopup() nil end |
#SourceCreateProgress(percent) ⇒ Object
1135 1136 1137 1138 1139 1140 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1135 def SourceCreateProgress(percent) ret = SourcePopupSetProgress(percent) Builtins.y2milestone("SourceCreateProgress(%1) = %2", percent, ret) ret end |
#SourceCreateStart(url) ⇒ Object
1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1114 def SourceCreateStart(url) Builtins.y2milestone("SourceCreateStart: %1", url) # popup label (%1 is repository URL) msg = Builtins.sformat(_("Creating Repository %1"), url) if Mode.commandline CommandLine.Print(msg) else Builtins.y2milestone("_source_open: %1", @_source_open) if @_source_open == 1 SetHeaderSourcePopup(msg) else SetLabelSourcePopup(msg) end end nil end |
#SourcePopupSetProgress(value) ⇒ Object
1070 1071 1072 1073 1074 1075 1076 1077 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1070 def SourcePopupSetProgress(value) if Ops.greater_than(@_source_open, 0) && IsSourcePopup() UI.ChangeWidget(Id(:progress), :Value, value) input = UI.PollInput return false if input == :abort end true end |
#SourceProbeEnd(url, error, description) ⇒ Object
1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1336 def SourceProbeEnd(url, error, description) CloseSourcePopup() CloseSourcePopup() Builtins.y2milestone( "Source probe end: error: url: %1, error: %2, description: %3", URL.HidePassword(url), error, description ) nil end |
#SourceProbeError(url, error, description) ⇒ Object
1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1270 def SourceProbeError(url, error, description) Builtins.y2milestone( "Source probe: error: url: %1, error: %2, description: %3", URL.HidePassword(url), error, description ) # error message - a label followed by a richtext with details = _("Error occurred while probing the repository.") case error when :NOT_FOUND # error message - a label followed by a richtext with details = _("Unable to retrieve the remote repository description.") when :IO # error message - a label followed by a richtext with details = _("An error occurred while retrieving the new metadata.") when :INVALID # error message - a label followed by a richtext with details = _("The repository is not valid.") when :NO_ERROR # error message - a label followed by a richtext with details = _("Repository probing details.") when :REJECTED # error message - a label followed by a richtext with details = _("Repository metadata is invalid.") end if Mode.commandline CommandLine.Print() CommandLine.Print(URL.HidePassword(url)) CommandLine.Print(description) # ask user in the interactive mode if CommandLine.Interactive CommandLine.Print("") # command line mode - ask user whether the repository refreshment should be retried CommandLine.Print(_("Retry?")) if CommandLine.YesNo # return Retry return :RETRY end end return :ABORT end detail = Builtins.sformat("%1<br>%2", url, description) UI.OpenDialog( VBox( Label(), RichText(detail), ButtonBox( PushButton(Id(:RETRY), Opt(:okButton), Label.RetryButton), PushButton(Id(:ABORT), Opt(:cancelButton), Label.AbortButton) ) ) ) ret = Convert.to_symbol(UI.UserInput) UI.CloseDialog Builtins.y2milestone("Source probe error: Returning %1", ret) ret end |
#SourceProbeFailed(url, type) ⇒ Object
1246 1247 1248 1249 1250 1251 1252 1253 1254 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1246 def SourceProbeFailed(url, type) Builtins.y2milestone( "Repository %1 is not %2 repository", URL.HidePassword(url), type ) nil end |
#SourceProbeProgress(_url, value) ⇒ Object
1266 1267 1268 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1266 def SourceProbeProgress(_url, value) SourcePopupSetProgress(value) end |
#SourceProbeStart(url) ⇒ Object
1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1220 def SourceProbeStart(url) Builtins.y2milestone("SourceProbeStart: %1", URL.HidePassword(url)) # popup label (%1 is repository URL) msg = Builtins.sformat(_("Probing Repository %1"), URL.HidePassword(url)) if Mode.commandline CommandLine.Print(msg) else OpenSourcePopup() msg2 = Builtins.sformat( _("Probing Repository %1"), URL.HidePassword(url) ) if @_source_open == 1 SetHeaderSourcePopup(msg2) else SetLabelSourcePopup(msg2) end end nil end |
#SourceProbeSucceeded(url, type) ⇒ Object
1256 1257 1258 1259 1260 1261 1262 1263 1264 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1256 def SourceProbeSucceeded(url, type) Builtins.y2milestone( "Repository %1 is type %2", URL.HidePassword(url), type ) nil end |
#SourceReportDestroy ⇒ Object
1465 1466 1467 1468 1469 1470 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1465 def SourceReportDestroy Builtins.y2milestone("Source report destroy") CloseSourcePopup() nil end |
#SourceReportEnd(src_id, url, task, error, description) ⇒ Object
1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1442 def SourceReportEnd(src_id, url, task, error, description) Builtins.y2milestone( "Source report end: src: %1, url: %2, task: %3, error: %4, description: %5", src_id, URL.HidePassword(url), task, error, description ) # set 100% progress SourcePopupSetProgress(100) nil end |
#SourceReportError(source_id, url, error, description) ⇒ Object
1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1380 def SourceReportError(source_id, url, error, description) Builtins.y2milestone( "Source report: error: id: %1, url: %2, error: %3, description: %4", source_id, URL.HidePassword(url), error, description ) # error message - a label followed by a richtext with details = Builtins.sformat(_("Repository %1"), url) case error when :NOT_FOUND # error message - a label followed by a richtext with details = _("Unable to retrieve the remote repository description.") when :IO # error message - a label followed by a richtext with details = _("An error occurred while retrieving the new metadata.") when :INVALID # error message - a label followed by a richtext with details = _("The repository is not valid.") end if Mode.commandline CommandLine.Print() CommandLine.Print(url) CommandLine.Print(description) # ask user in the interactive mode if CommandLine.Interactive CommandLine.Print("") # command line mode - ask user whether the repository refreshment should be retried CommandLine.Print(_("Retry?")) if CommandLine.YesNo # return Retry return :RETRY end end return :ABORT end detail = Builtins.sformat("%1<br>%2", url, description) UI.OpenDialog( VBox( Label(), RichText(detail), HBox( PushButton(Id(:RETRY), Opt(:okButton), Label.RetryButton), PushButton(Id(:ABORT), Opt(:cancelButton), Label.AbortButton) ) ) ) ret = Convert.to_symbol(UI.UserInput) UI.CloseDialog Builtins.y2milestone("Source report error: Returning %1", ret) ret end |
#SourceReportInit ⇒ Object
1458 1459 1460 1461 1462 1463 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1458 def SourceReportInit Builtins.y2milestone("Source report init") OpenSourcePopup() nil end |
#SourceReportProgress(value) ⇒ Object
1373 1374 1375 1376 1377 1378 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1373 def SourceReportProgress(value) ret = SourcePopupSetProgress(value) Builtins.y2debug("SourceReportProgress(%1) = %2", value, ret) ret end |
#SourceReportStart(source_id, url, task) ⇒ Object
1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1350 def SourceReportStart(source_id, url, task) Builtins.y2milestone( "Source report start: src: %1, URL: %2, task: %3", source_id, URL.HidePassword(url), task ) if Mode.commandline CommandLine.Print(task) else Builtins.y2milestone("_source_open: %1", @_source_open) if @_source_open == 1 SetHeaderSourcePopup(task) else SetLabelSourcePopup(task) end end nil end |
#StartConvertDB(_unused1) ⇒ Object
2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 2011 def StartConvertDB(_unused1) # heading of popup heading = _("Checking Package Database") # message in a progress popup = _( "Converting package database. This process can take some time." ) UI.OpenDialog( Opt(:decorated), VBox( Heading(heading), VBox( Label(), HSpacing(60), HBox( HSpacing(2), ProgressBar(Id(:progress), _("Status"), 100), HSpacing(2) ), VSpacing(1) ) ) ) UI.ChangeWidget(Id(:progress), :Value, 0) nil end |
#StartDeltaApply(name) ⇒ Object
at start of delta application
1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1497 def StartDeltaApply(name) if Mode.commandline CommandLine.PrintVerbose( Builtins.sformat(_("Applying delta RPM package %1..."), name) ) else # popup heading progressbox = VBox( HSpacing(40), # popup heading Heading(_("Applying delta RPM package")), Left( HBox(Left(Label(Opt(:boldFont), _("Package: "))), Left(Label(name))) ), ProgressBar(Id(:progress), "", 100, 0) ) UI.CloseDialog if @_provide_popup UI.OpenDialog(progressbox) @_provide_popup = true end nil end |
#StartDeltaProvide(name, archivesize) ⇒ Object
at start of delta providal
1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1474 def StartDeltaProvide(name, archivesize) sz = String.FormatSizeWithPrecision(archivesize, 2, false) if Mode.commandline CommandLine.PrintVerbose( Builtins.sformat( _("Downloading delta RPM package %1 (%2)..."), name, sz ) ) else UI.CloseDialog if @_provide_popup # popup heading providebox = progress_box(_("Downloading Delta RPM package"), name, sz) UI.OpenDialog(providebox) @_provide_popup = true end nil end |
#StartDownload(url, localfile) ⇒ Object
1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1789 def StartDownload(url, localfile) Builtins.y2milestone( "Downloading %1 to %2", URL.HidePassword(url), localfile ) # reformat the URL url_report = URL.FormatURL(URL.Parse(URL.HidePassword(url)), MAX_POPUP_TEXT_SIZE) # remember the URL @download_file = url_report # message in a progress popup = Builtins.sformat(_("Downloading: %1"), url_report) if Mode.commandline CommandLine.PrintVerbose() elsif IsDownloadProgressPopup() # change the label UI.ChangeWidget(Id(:progress), :Label, ) UI.ChangeWidget(Id(:progress), :Value, 0) elsif full_screen Progress.SubprogressType(:progress, 100) Progress.SubprogressTitle() end nil end |
#StartPackage(name, _location, _summary, installsize, is_delete) ⇒ Object
At start of package install.
411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 411 def StartPackage(name, _location, _summary, installsize, is_delete) return if !@enable_asterix_package @_package_name = name @_package_size = installsize @_deleting_package = is_delete sz = String.FormatSizeWithPrecision(installsize, 2, false) if Mode.commandline CommandLine.PrintVerbose( Builtins.sformat( if is_delete _("Uninstalling package %1 (%2)...") else _("Installing package %1 (%2)...") end, @_package_name, sz ) ) else packagebox = progress_box( is_delete ? _("Uninstalling Package") : _("Installing Package"), @_package_name, sz ) UI.OpenDialog(Opt(:decorated), packagebox) @_package_popup = true end nil end |
#StartProvide(name, archivesize, remote) ⇒ Object
at start of file providal
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 191 def StartProvide(name, archivesize, remote) Builtins.y2milestone("StartProvide: name: %1, remote: %2", name, remote) if remote sz = String.FormatSizeWithPrecision(archivesize, 2, false) if Mode.commandline CommandLine.PrintVerbose( Builtins.sformat(_("Downloading package %1 (%2)..."), name, sz) ) else UI.CloseDialog if @_provide_popup if full_screen Progress.SubprogressType(:progress, 100) Progress.SubprogressTitle( Builtins.sformat(_("Downloading package %1 (%2)..."), name, sz) ) else # popup heading providebox = progress_box(_("Downloading Package"), name, sz) UI.OpenDialog(providebox) @_provide_popup = true end end end nil end |
#StartRebuildDB ⇒ Object
1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1945 def StartRebuildDB # heading of popup heading = _("Checking Package Database") # message in a progress popup = _( "Rebuilding package database. This process can take some time." ) UI.OpenDialog( Opt(:decorated), VBox( Heading(heading), VBox( Label(), HSpacing(60), HBox(HSpacing(2), ProgressBar(Id(:progress), "", 100), HSpacing(2)), VSpacing(1) ) ) ) UI.ChangeWidget(Id(:progress), :Value, 0) nil end |
#StartScanDb ⇒ Object
Callback for start RPM DB scan event
2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 2084 def StartScanDb Builtins.y2milestone("Scanning RPM DB...") if Mode.commandline # progress message (command line mode) CommandLine.PrintVerbose(_("Reading RPM database...")) elsif !full_screen UI.OpenDialog( VBox( HSpacing(60), # popup heading Heading( Id(:label_scanDB_popup), Opt(:hstretch), _("Reading Installed Packages") ), HBox( # progress bar label ProgressBar( Id(:progress), _("Scanning RPM database..."), 100, 0 ), # TODO: allow Abort # , # `VBox( # `Label(""), # `PushButton(`id(`abort), Label::AbortButton()) # ) HSpacing(1) ) ) ) @_scan_popup = true else Progress.Title(_("Scanning RPM database...")) end nil end |
#StopConvertDB(error_value, error_text) ⇒ Object
2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 2048 def StopConvertDB(error_value, error_text) if error_value != 0 # error message, %1 is the cause for the error Popup.Error( Builtins.sformat( _("Conversion of package database failed:\n%1"), error_text ) ) end UI.CloseDialog nil end |
#StopRebuildDB(error_value, error_text) ⇒ Object
1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 |
# File 'library/packages/src/modules/PackageCallbacks.rb', line 1978 def StopRebuildDB(error_value, error_text) if error_value != 0 # error message, %1 is the cause for the error Popup.Error( Builtins.sformat( _("Rebuilding of package database failed:\n%1"), error_text ) ) end UI.CloseDialog nil end |