Author: locilka Date: Mon Apr 28 17:51:10 2008 New Revision: 47130 URL: http://svn.opensuse.org/viewcvs/yast?rev=47130&view=rev Log: - Added possibility to abort installation during image deployment (bnc #382326). - Progress for inst_proposal. Modified: trunk/installation/package/yast2-installation.changes trunk/installation/src/clients/desktop_finish.ycp trunk/installation/src/clients/inst_deploy_image.ycp trunk/installation/src/clients/inst_proposal.ycp trunk/installation/src/modules/ImageInstallation.ycp Modified: trunk/installation/package/yast2-installation.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/installation/package/yast2-installation.changes?rev=47130&r1=47129&r2=47130&view=diff ============================================================================== --- trunk/installation/package/yast2-installation.changes (original) +++ trunk/installation/package/yast2-installation.changes Mon Apr 28 17:51:10 2008 @@ -5,6 +5,9 @@ (bnc #381821). - Optional and extra URLs moved to control file as well as default update repository (bnc #381360). +- Added possibility to abort installation during image deployment + (bnc #382326). +- Progress for inst_proposal. - 2.16.41 ------------------------------------------------------------------- Modified: trunk/installation/src/clients/desktop_finish.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/installation/src/clients/desktop_finish.ycp?rev=47130&r1=47129&r2=47130&view=diff ============================================================================== --- trunk/installation/src/clients/desktop_finish.ycp (original) +++ trunk/installation/src/clients/desktop_finish.ycp Mon Apr 28 17:51:10 2008 @@ -76,36 +76,17 @@ if (selected_desktop == nil || selected_desktop == "") selected_desktop = "gnome"; - string default_dm = dd_map[selected_desktop, "logon"]:""; - string default_wm = dd_map[selected_desktop, "desktop"]:""; - string default_cursor = dd_map[selected_desktop, "cursor"]:""; + string default_dm = ""; + string default_wm = ""; + string default_cursor = ""; - list <string> selected_desktops = DefaultDesktop::SelectedDesktops(); - - list <string> desktop_order = ["gnome", "kde", "kde3", "xfce", "min_x", "textmode"]; + list <string> desktop_order = [DefaultDesktop::Desktop(), "gnome", "kde", "kde3", "xfce", "min_x", "textmode"]; boolean desktop_found = false; - string pattern_desktop = "gnome"; - - // check what packages are in the patterns - // and adjust logon and window manager according to it - foreach (string d, desktop_order, { - if (contains (selected_desktops, d)) { - pattern_desktop = d; - desktop_found = true; - y2milestone ("Setting desktop according to pattern to %1", pattern_desktop); - break; - } - }); - - // if no desktop was found according to pattern, try - // installed packages - // first the logon manager - desktop_order = prepend (desktop_order, pattern_desktop); - desktop_found = false; foreach (string d, desktop_order, { - if (desktop_found) break; + if (desktop_found) + break; foreach (string package, dd_map[d, "packages"]:[], { if (Pkg::IsProvided (package) && (Pkg::PkgInstalled (package) || Pkg::IsSelected (package))) { @@ -124,8 +105,6 @@ y2milestone ("Package %1 for desktop %2 not selected or installed, trying next desktop...", package, d); } }); - - return desktop_found; }); y2milestone ("Default desktop: %1", default_wm); Modified: trunk/installation/src/clients/inst_deploy_image.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/installation/src/clients/inst_deploy_image.ycp?rev=47130&r1=47129&r2=47130&view=diff ============================================================================== --- trunk/installation/src/clients/inst_deploy_image.ycp (original) +++ trunk/installation/src/clients/inst_deploy_image.ycp Mon Apr 28 17:51:10 2008 @@ -227,7 +227,11 @@ SourceManager::InstInitSourceMoveDownloadArea(); -ImageInstallation::DeployImages (images, Installation::destdir, nil); +boolean dep_ret = ImageInstallation::DeployImages (images, Installation::destdir, nil); +if (dep_ret == nil) { + y2milestone ("Aborting..."); + return `abort; +} y2milestone ("Target image for package selector prepared"); Modified: trunk/installation/src/clients/inst_proposal.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/installation/src/clients/inst_proposal.ycp?rev=47130&r1=47129&r2=47130&view=diff ============================================================================== --- trunk/installation/src/clients/inst_proposal.ycp (original) +++ trunk/installation/src/clients/inst_proposal.ycp Mon Apr 28 17:51:10 2008 @@ -204,6 +204,36 @@ return description; }; + void SubmoduleHelp (map & prop_map, string & submod) { + if (haskey (prop_map, "help")) + { + boolean use_this_help = false; + // using tabs + if (haskey (mod2tab, submod)) { + // visible in the current tab + if (mod2tab[submod]:999 == current_tab) { + use_this_help = true; + } + // not using tabs + } else { + use_this_help = true; + } + + if (use_this_help) { + y2milestone("Submodule '%1' has it's own help", submod); + string own_help = prop_map["help"]:""; + + if (own_help == nil) { + y2error ("Help text cannot be 'nil'"); + } else if (own_help == "") { + y2milestone ("Skipping empty help"); + } else { + submodule_helps[submod] = prop_map["help"]:""; + } + } + } + } + /** * Call each submodule's MakeProposal() function in turn and display the @@ -224,6 +254,9 @@ link2submod = $[]; + UI::ReplaceWidget (`id ("inst_proposal_progress"), `ProgressBar (`id ("pb_ip"), "", 2 * size (submodules), 0)); + integer submodule_nr = 0; + html = $[]; foreach ( string submod, submodules, ``{ string prop = ""; @@ -258,6 +291,9 @@ y2debug("Submodules list before execution: %1", submodules ); foreach ( string submod, submodules, ``{ + submodule_nr = submodule_nr + 1; + UI::ChangeWidget (`id ("pb_ip"), `Value, submodule_nr); + string prop = ""; if ( ! skip_the_rest ) { @@ -276,36 +312,8 @@ titles[no]:_("ERROR: Missing Title")); } - prop_map = submod_make_proposal( submod, force_reset, language_changed ); - - if (haskey (prop_map, "help")) - { - boolean use_this_help = false; - // using tabs - if (haskey (mod2tab, submod)) { - // visible in the current tab - if (mod2tab[submod]:999 == current_tab) { - use_this_help = true; - } - // not using tabs - } else { - use_this_help = true; - } - - if (use_this_help) { - y2milestone("Submodule '%1' has it's own help", submod); - string own_help = prop_map["help"]:""; - - if (own_help == nil) { - y2error ("Help text cannot be 'nil'"); - } else if (own_help == "") { - y2milestone ("Skipping empty help"); - } else { - submodule_helps[submod] = prop_map["help"]:""; - } - } - } - + prop_map = submod_make_proposal (submod, force_reset, language_changed); + SubmoduleHelp (prop_map, submod); // check if it is needed to switch to another tab // because of an error @@ -368,6 +376,9 @@ { skip_the_rest = true; } + + submodule_nr = submodule_nr + 1; + UI::ChangeWidget (`id ("pb_ip"), `Value, submodule_nr); }); // FATE #301151: Allow YaST proposals to have help texts @@ -398,6 +409,7 @@ // now do the display-only proposals + UI::ReplaceWidget (`id ("inst_proposal_progress"), `Empty()); Wizard::EnableNextButton (); UI::NormalCursor(); }; @@ -543,38 +555,6 @@ get_submod_descriptions_and_build_menu(); }; - - /** - * Load a list of submodules. Try loading it from a file named 'file_name' - * from one of several predefined directories. If there is no such list, - * use 'fallback_list'. - * - * @param file_name YCP file name to load from - * @param fallback_list fallback list of submodule names (strings) - * @return submodules_list list of submodule names (strings) - **/ - - /* OBSOLETE CODE - define list load_submodules_list( string file_name, list fallback_list ) ``{ - - list submodules = (list) SCR::Read(.target.ycp, [ file_name, [] ] ); - - if ( submodules == [] ) - { - submodules = (list) SCR::Read(.target.yast2, [ file_name, [] ] ); - } - - if ( submodules == [] ) - { - submodules = fallback_list; - } - - return submodules; - }; - - */ - - /** * Load a list of submodules matching the current internal states * @@ -735,7 +715,7 @@ ); /* change menu */ - term menu_box = + term menu_box = `VBox ( `HBox ( `HStretch (), `ReplacePoint(`id(`rep_menu), @@ -743,7 +723,9 @@ `MenuButton(`id(`menu_dummy), _("&Change..."), [`item(`id(`dummy), "" ) ] ) ), `HStretch () - ); + ), + `ReplacePoint (`id ("inst_proposal_progress"), `Empty()) + ); term vbox = nil; Modified: trunk/installation/src/modules/ImageInstallation.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/installation/src/modules/ImageInstallation.ycp?rev=47130&r1=47129&r2=47130&view=diff ============================================================================== --- trunk/installation/src/modules/ImageInstallation.ycp (original) +++ trunk/installation/src/modules/ImageInstallation.ycp Mon Apr 28 17:51:10 2008 @@ -24,6 +24,7 @@ import "String"; import "Arch"; import "PackageCallbacks"; +import "Popup"; textdomain "installation"; @@ -234,6 +235,9 @@ // Otherwise it will never make 100% integer better_feeling_constant = _checkpoint; + any ret = nil; + boolean aborted = false; + while (SCR::Read (.process.running, pid) == true) { newline = (string) SCR::Read (.process.read_line_stderr, pid); @@ -251,12 +255,23 @@ if (tar_image_progress != nil) tar_image_progress (tointeger (newline) + better_feeling_constant); } else { - // FIXME: UI::PollInput - sleep (200); + ret = UI::PollInput(); + if (ret == `abort || ret == `cancel) { + if (Popup::ConfirmAbort (`unusable)) { + y2warning ("Aborted!"); + aborted = true; + break; + } + } else { + sleep (200); + } } } y2milestone ("Finished"); + if (aborted) + return nil; + // adjust labels etc. if (tar_image_progress != nil) tar_image_progress (100); @@ -513,16 +528,27 @@ integer num = -1; _current_image_from_imageset = -1; + boolean aborted = nil; foreach (string img, images, { num = num + 1; if (progress != nil) progress (num, 0); - DeployImage (img, target); + + if (DeployImage (img, target) == nil) { + aborted = true; + y2milestone ("Aborting..."); + break; + } + if (progress != nil) progress (num, 100); }); + if (aborted) { + return nil; + } + // unregister downloading progress if (download_image_progress != nil) Pkg::CallbackProgressDownload (nil); -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org