Class: Yast::SlideShowCallbacksClass
- Inherits:
-
Module
- Object
- Module
- Yast::SlideShowCallbacksClass
- Defined in:
- ../../src/modules/SlideShowCallbacks.rb
Instance Method Summary (collapse)
-
- (Object) CallbackSourceChange(source, media)
change of repository source: 0 ..
-
- (Object) DisplayStartInstall(pkg_name, pkg_location, pkg_description, pkg_size, deleting)
Callback that will be called by the packager for each RPM as it is being installed or deleted.
-
- (Object) DonePackage(error, reason)
at end of install just to override the PackageCallbacks default (which does a 'CloseDialog' :-}).
-
- (Object) DoneProvide(error, reason, name)
during file providal.
-
- (Object) FinishDeltaProvide
at end of file providal.
-
- (Object) HandleInput
Check for user button presses and handle them.
-
- (Object) InstallSlideShowCallbacks
Install callbacks for slideshow.
- - (Object) 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) ProblemDeltaApply(descr)
- - (Object) ProblemDeltaDownload(descr)
-
- (Object) ProgressDeltaApply(percent)
during file providal.
- - (Object) ProgressDownload(percent, bps_avg, bps_current)
-
- (Object) ProgressPackage(pkg_percent)
ProgressPackage percent.
-
- (Object) ProgressProvide(percent)
during file providal.
-
- (Object) RemoveSlideShowCallbacks
Remove callbacks for slideshow.
- - (Object) ScriptFinish
- - (Object) ScriptProblem(description)
- - (Object) ScriptProgress(ping, output)
- - (Object) ScriptStart(patch_name, patch_version, patch_arch, script_path)
-
- (Object) StartDeltaApply(name)
at start of file providal.
-
- (Object) StartDeltaProvide(name, archivesize)
at start of file providal.
-
- (Object) StartPackage(name, location, summary, install_size, is_delete)
at start of package install.
-
- (Object) StartProvide(name, archivesize, remote)
at start of file providal.
- - (Object) YesNoAgainWarning(message)
-
- (Object) YesNoButtonBox
————————————————————————– slide show.
Instance Method Details
- (Object) CallbackSourceChange(source, media)
change of repository source: 0 .. n-1 media: 1 .. n
491 492 493 494 495 496 497 498 499 500 501 |
# File '../../src/modules/SlideShowCallbacks.rb', line 491 def CallbackSourceChange(source, media) PackageCallbacks.SourceChange(source, media) # inform PackageCallbacks about the change PackageSlideShow.SetCurrentCdNo(source, media) PackageSlideShow.UpdateCurrentPackageProgress(0) PackageSlideShow.UpdateAllCdProgress(false) # display remaining packages PackageSlideShow.DisplayGlobalProgress nil end |
- (Object) DisplayStartInstall(pkg_name, pkg_location, pkg_description, pkg_size, deleting)
Callback that will be called by the packager for each RPM as it is being installed or deleted. Note: The packager doesn't call this directly - the corresponding wrapper callbacks do and pass the “deleting” flag as appropriate.
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 |
# File '../../src/modules/SlideShowCallbacks.rb', line 284 def DisplayStartInstall(pkg_name, pkg_location, pkg_description, pkg_size, deleting) PackageSlideShow.SlideDisplayStart( pkg_name, pkg_location, pkg_description, pkg_size, deleting ) HandleInput() # warn user about exhausted diskspace during installation (not if deleting packages) if !deleting && @ask_again pkgdu = Pkg.PkgDU(@pkg_inprogress) Builtins.y2debug("PkgDU(%1): %2", @pkg_inprogress, pkgdu) if pkgdu != nil # check each mount point Builtins.foreach(pkgdu) do |part, data| # skip read-only partitions, the package cannot be installed anyway if Ops.get(data, 3, 0) == 1 Builtins.y2debug("Skipping read-only partition %1", part) next end # add slash if missing (needed for target_dir) if part != "/" && Ops.greater_or_equal(Builtins.size(part), 1) && Builtins.substring(part, 0, 1) != "/" part = Ops.add("/", part) end target_dir = Ops.add(Installation.destdir, part) disk_available = Pkg.TargetAvailable(target_dir) Builtins.y2debug( "partition: %1 (%2), available: %3", part, target_dir, disk_available ) if Ops.less_than(disk_available, Ops.get(data, 2, 0)) Builtins.y2warning( "Not enought free space in %1 (%2): available: %3, required: %4", part, target_dir, disk_available, Ops.get(data, 2, 0) ) cont = YesNoAgainWarning( # warning popup - %1 is directory name (e.g. /boot) Builtins.sformat( _( "The disk space in partition %1 is nearly exhausted.\nContinue with the installation?" ), part ) ) SlideShow.SetUserAbort(true) if !cont # don't check the other partitions raise Break end end else # disk usage for each partition is not known # assume that all files will be installed into the root directory disk_available = Pkg.TargetAvailable(Installation.destdir) Builtins.y2milestone( "Available space (%1): %2", Installation.destdir, disk_available ) if Ops.less_than(disk_available, pkg_size) Builtins.y2warning( "Not enough free space in %1: available: %2, required: %3", Installation.destdir, disk_available, pkg_size ) cont = YesNoAgainWarning( # yes-no popup _( "The disk space is nearly exhausted.\nContinue with the installation?" ) ) SlideShow.SetUserAbort(true) if !cont end end end nil end |
- (Object) DonePackage(error, reason)
at end of install just to override the PackageCallbacks default (which does a 'CloseDialog' :-})
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 |
# File '../../src/modules/SlideShowCallbacks.rb', line 411 def DonePackage(error, reason) return "I" if SlideShow.GetUserAbort PackageSlideShow.UpdateCurrentPackageProgress(100) ret = "" if error != 0 ret = PackageCallbacks.DonePackage(error, reason) else # put additional rpm output to the installation log if reason != nil && Ops.greater_than(Builtins.size(reason), 0) Builtins.y2milestone("Additional RPM output: %1", reason) SlideShow.AppendMessageToInstLog(reason) end end if Builtins.size(ret) == 0 || Builtins.tolower(Builtins.substring(ret, 0, 1)) != "r" PackageSlideShow.SlideDisplayDone( PackageCallbacks._package_name, PackageCallbacks._package_size, PackageCallbacks._deleting_package ) end ret end |
- (Object) DoneProvide(error, reason, name)
during file providal
111 112 113 114 115 116 117 118 119 120 121 |
# File '../../src/modules/SlideShowCallbacks.rb', line 111 def DoneProvide(error, reason, name) if @_remote_provide PackageSlideShow.UpdateCurrentPackageProgress(100) PackageSlideShow.DoneProvide(error, reason, name) @_remote_provide = false end return "C" if SlideShow.GetUserAbort return PackageCallbacks.DoneProvide(error, reason, name) if error != 0 "" end |
- (Object) FinishDeltaProvide
at end of file providal
465 466 467 |
# File '../../src/modules/SlideShowCallbacks.rb', line 465 def FinishDeltaProvide nil end |
- (Object) HandleInput
Check for user button presses and handle them.
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File '../../src/modules/SlideShowCallbacks.rb', line 48 def HandleInput # any button = SlideShow::debug ? UI::PollInput() : UI::TimeoutUserInput( 10 ); = UI.PollInput # in case of cancel ask user if he really wants to quit installation if == :abort || == :cancel if Mode.normal SlideShow.SetUserAbort( Popup.AnyQuestion( Popup.NoHeadline, # popup yes-no _("Do you really want\nto quit the installation?"), Label.YesButton, Label.NoButton, :focus_no ) ) elsif Stage.initial SlideShow.SetUserAbort(Popup.ConfirmAbort(:unusable)) # Mode::update (), Stage::cont () else SlideShow.SetUserAbort(Popup.ConfirmAbort(:incomplete)) end SlideShow.AppendMessageToInstLog(_("Aborted")) if SlideShow.GetUserAbort else SlideShow.HandleInput() end nil end |
- (Object) InstallSlideShowCallbacks
Install callbacks for slideshow.
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 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 |
# File '../../src/modules/SlideShowCallbacks.rb', line 541 def InstallSlideShowCallbacks Builtins.y2milestone("InstallSlideShowCallbacks") 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.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.CallbackProgressDownload( fun_ref( method(:ProgressDownload), "boolean (integer, integer, integer)" ) ) Pkg.CallbackSourceChange( fun_ref(method(:CallbackSourceChange), "void (integer, integer)") ) 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 ()") ) 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( PackageCallbacks.method(:Message), "boolean (string, string, string, string)" ) ) Pkg.CallbackMediaChange( fun_ref( method(:MediaChange), "string (string, string, string, string, integer, string, integer, string, boolean, list <string>, integer)" ) ) nil end |
- (Object) main
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File '../../src/modules/SlideShowCallbacks.rb', line 16 def main Yast.import "Pkg" Yast.import "UI" textdomain "packager" Yast.import "Installation" Yast.import "Label" Yast.import "Mode" Yast.import "Stage" Yast.import "PackageCallbacks" Yast.import "Popup" Yast.import "SlideShow" Yast.import "PackageSlideShow" Yast.import "Message" Yast.import "Directory" Yast.import "URL" @_remote_provide = false @pkg_inprogress = "" # never show the disk space warning popup during autoinstallation @ask_again = Mode.autoinst ? false : true # true == continue with the installtion @user_input = true end |
- (Object) MediaChange(error_code, error, url, product, current, current_label, wanted, wanted_label, double_sided, devices, current_device)
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 |
# File '../../src/modules/SlideShowCallbacks.rb', line 506 def MediaChange(error_code, error, url, product, current, current_label, wanted, wanted_label, double_sided, devices, current_device) devices = deep_copy(devices) SlideShow.StopTimer if !Mode.normal ret = PackageCallbacks.MediaChange( error_code, error, url, product, current, current_label, wanted, wanted_label, double_sided, devices, current_device ) if !Mode.normal SlideShow.StartTimer # moved from PackageCallbacks # skip it when there is a popup at the top (see bnc#622286) if (ret == "" || URL.Check(ret)) && UI.WidgetExists(:contents) PackageSlideShow.SetCurrentCdNo( PackageCallbacks._current_source, wanted ) end end ret end |
- (Object) Message(patch_name, patch_version, patch_arch, message)
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
# File '../../src/modules/SlideShowCallbacks.rb', line 188 def Message(patch_name, patch_version, patch_arch, ) patch_full_name = PackageCallbacks.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 Popup.LongMessage(Ops.add(patch_full_name, )) nil end |
- (Object) ProblemDeltaApply(descr)
478 479 480 481 482 483 484 485 |
# File '../../src/modules/SlideShowCallbacks.rb', line 478 def ProblemDeltaApply(descr) # error in installation log, %1 is detail error description SlideShow.AppendMessageToInstLog( Builtins.sformat(_("Failed to apply delta RPM: %1"), descr) ) nil end |
- (Object) ProblemDeltaDownload(descr)
469 470 471 472 473 474 475 476 |
# File '../../src/modules/SlideShowCallbacks.rb', line 469 def ProblemDeltaDownload(descr) # error in installation log, %1 is detail error description SlideShow.AppendMessageToInstLog( Builtins.sformat(_("Failed to download delta RPM: %1"), descr) ) nil end |
- (Object) ProgressDeltaApply(percent)
during file providal
458 459 460 461 462 |
# File '../../src/modules/SlideShowCallbacks.rb', line 458 def ProgressDeltaApply(percent) PackageSlideShow.UpdateCurrentPackageProgress(percent) nil end |
- (Object) ProgressDownload(percent, bps_avg, bps_current)
98 99 100 101 102 103 104 105 106 107 |
# File '../../src/modules/SlideShowCallbacks.rb', line 98 def ProgressDownload(percent, bps_avg, bps_current) PackageSlideShow.UpdateCurrentPackageRateProgress( percent, bps_avg, bps_current ) HandleInput() !SlideShow.GetUserAbort end |
- (Object) ProgressPackage(pkg_percent)
ProgressPackage percent
395 396 397 398 399 400 401 402 403 404 405 406 407 |
# File '../../src/modules/SlideShowCallbacks.rb', line 395 def ProgressPackage(pkg_percent) HandleInput() if !SlideShow.GetUserAbort PackageSlideShow.UpdateCurrentPackageProgress(pkg_percent) end if SlideShow.GetUserAbort Builtins.y2milestone("Aborted at %1%%", pkg_percent) end !SlideShow.GetUserAbort end |
- (Object) ProgressProvide(percent)
during file providal
92 93 94 95 96 |
# File '../../src/modules/SlideShowCallbacks.rb', line 92 def ProgressProvide(percent) PackageSlideShow.UpdateCurrentPackageProgress(percent) if @_remote_provide HandleInput() !SlideShow.GetUserAbort end |
- (Object) RemoveSlideShowCallbacks
Remove callbacks for slideshow. Should be in SlideShowCallbacks but that doesn't work at the moment.
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 |
# File '../../src/modules/SlideShowCallbacks.rb', line 633 def RemoveSlideShowCallbacks Builtins.y2milestone("RemoveSlideShowCallbacks") Pkg.CallbackStartPackage(nil) Pkg.CallbackProgressPackage(nil) Pkg.CallbackDonePackage(nil) Pkg.CallbackStartProvide(nil) Pkg.CallbackProgressProvide(nil) Pkg.CallbackDoneProvide(nil) Pkg.CallbackSourceChange(nil) Pkg.CallbackStartDeltaDownload(nil) Pkg.CallbackProgressDeltaDownload(nil) Pkg.CallbackProblemDeltaDownload(nil) Pkg.CallbackFinishDeltaDownload(nil) Pkg.CallbackStartDeltaApply(nil) Pkg.CallbackProgressDeltaApply(nil) Pkg.CallbackProblemDeltaApply(nil) Pkg.CallbackFinishDeltaApply(nil) Pkg.CallbackScriptStart(nil) Pkg.CallbackScriptProgress(nil) Pkg.CallbackScriptProblem(nil) Pkg.CallbackScriptFinish(nil) Pkg.CallbackMessage(nil) nil end |
- (Object) ScriptFinish
182 183 184 185 186 |
# File '../../src/modules/SlideShowCallbacks.rb', line 182 def ScriptFinish Builtins.y2milestone("ScriptFinish") nil end |
- (Object) ScriptProblem(description)
177 178 179 180 |
# File '../../src/modules/SlideShowCallbacks.rb', line 177 def ScriptProblem(description) # display Abort/Retry/Ignore popup PackageCallbacks.ScriptProblem(description) end |
- (Object) ScriptProgress(ping, output)
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 |
# File '../../src/modules/SlideShowCallbacks.rb', line 150 def ScriptProgress(ping, output) Builtins.y2milestone("ScriptProgress: ping:%1, output: %2", ping, output) if output != nil && output != "" log_line = output # remove the trailing new line character if Builtins.substring(output, Ops.subtract(Builtins.size(output), 1), 1) == "\n" output = Builtins.substring( output, 0, Ops.subtract(Builtins.size(output), 1) ) end # add the output to the log widget SlideShow.AppendMessageToInstLog(output) end input = UI.PollInput Builtins.y2milestone("input: %1", input) return false if input == :abort || input == :close true end |
- (Object) ScriptStart(patch_name, patch_version, patch_arch, script_path)
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 |
# File '../../src/modules/SlideShowCallbacks.rb', line 124 def ScriptStart(patch_name, patch_version, patch_arch, script_path) patch_full_name = PackageCallbacks.FormatPatchName( patch_name, patch_version, patch_arch ) Builtins.y2milestone( "ScriptStart: patch:%1, script:%2", patch_full_name, script_path ) # reset the progressbar if UI.WidgetExists(:progressCurrentPackage) UI.ChangeWidget(:progressCurrentPackage, :Label, patch_full_name) UI.ChangeWidget(:progressCurrentPackage, :Value, 0) end # message in the installation log widget, %1 is a patch name which contains the script log_line = Builtins.sformat(_("Starting script %1"), patch_full_name) SlideShow.AppendMessageToInstLog(log_line) nil end |
- (Object) StartDeltaApply(name)
at start of file providal
451 452 453 454 455 |
# File '../../src/modules/SlideShowCallbacks.rb', line 451 def StartDeltaApply(name) PackageSlideShow.SlideDeltaApplyStart(name) nil end |
- (Object) StartDeltaProvide(name, archivesize)
at start of file providal
439 440 441 442 443 444 445 446 447 448 |
# File '../../src/modules/SlideShowCallbacks.rb', line 439 def StartDeltaProvide(name, archivesize) PackageSlideShow.SlideGenericProvideStart( name, #remote archivesize, _("Downloading delta RPM %1 (download size %2)"), true ) nil end |
- (Object) StartPackage(name, location, summary, install_size, is_delete)
at start of package install
382 383 384 385 386 387 388 389 390 |
# File '../../src/modules/SlideShowCallbacks.rb', line 382 def StartPackage(name, location, summary, install_size, is_delete) PackageCallbacks._package_name = name PackageCallbacks._package_size = install_size PackageCallbacks._deleting_package = is_delete DisplayStartInstall(name, location, summary, install_size, is_delete) nil end |
- (Object) StartProvide(name, archivesize, remote)
at start of file providal
81 82 83 84 85 86 87 88 |
# File '../../src/modules/SlideShowCallbacks.rb', line 81 def StartProvide(name, archivesize, remote) @pkg_inprogress = name @_remote_provide = remote PackageSlideShow.SlideProvideStart(name, archivesize, remote) nil end |
- (Object) YesNoAgainWarning(message)
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 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 |
# File '../../src/modules/SlideShowCallbacks.rb', line 228 def YesNoAgainWarning() return @user_input if !@ask_again icon = Empty() # show the warning icon if possible ui_capabilities = UI.GetDisplayInfo if Ops.get_boolean(ui_capabilities, "HasLocalImageSupport", false) icon = Image( Ops.add(Directory.icondir, "32x32/apps/msg_warning.png"), "" ) end content = MarginBox( 1.5, 0.5, VBox( HBox( VCenter(icon), HSpacing(1), VCenter(Heading(Label.WarningMsg)), HStretch() ), VSpacing(0.2), Left(Label()), VSpacing(0.2), Left(CheckBox(Id(:dont_ask), Message.DoNotShowMessageAgain)), VSpacing(0.5), YesNoButtonBox() ) ) UI.OpenDialog(Opt(:decorated), content) ret = UI.UserInput @ask_again = !Convert.to_boolean(UI.QueryWidget(Id(:dont_ask), :Value)) if !@ask_again # remember the user input @user_input = ret == :yes end UI.CloseDialog ret == :yes end |
- (Object) YesNoButtonBox
————————————————————————– slide show
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 |
# File '../../src/modules/SlideShowCallbacks.rb', line 211 def YesNoButtonBox = PushButton(Id(:yes), Opt(:key_F10), Label.YesButton) = PushButton( Id(:no_button), Opt(:default, :key_F9), Label.NoButton ) HBox( HStretch(), HWeight(1, ), HSpacing(2), HWeight(1, ), HStretch() ) end |