Author: lslezak Date: Wed Apr 22 17:03:15 2009 New Revision: 56920 URL: http://svn.opensuse.org/viewcvs/yast?rev=56920&view=rev Log: - Pkg::CallbackSourceCreateInit/Destroy() and Pkg::CallbackSourceReportInit() handlers (#251726) - 2.13.182 Modified: branches/SuSE-SLE-10-SP3-Branch/packager/ (props changed) branches/SuSE-SLE-10-SP3-Branch/packager/VERSION branches/SuSE-SLE-10-SP3-Branch/packager/package/yast2-packager.changes branches/SuSE-SLE-10-SP3-Branch/packager/src/modules/PackageCallbacks.ycp branches/SuSE-SLE-10-SP3-Branch/packager/yast2-packager.spec.in Modified: branches/SuSE-SLE-10-SP3-Branch/packager/VERSION URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP3-Branch/packager/VERSION?rev=56920&r1=56919&r2=56920&view=diff ============================================================================== --- branches/SuSE-SLE-10-SP3-Branch/packager/VERSION (original) +++ branches/SuSE-SLE-10-SP3-Branch/packager/VERSION Wed Apr 22 17:03:15 2009 @@ -1 +1 @@ -2.13.181 +2.13.182 Modified: branches/SuSE-SLE-10-SP3-Branch/packager/package/yast2-packager.changes URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP3-Branch/packager/package/yast2-packager.changes?rev=56920&r1=56919&r2=56920&view=diff ============================================================================== --- branches/SuSE-SLE-10-SP3-Branch/packager/package/yast2-packager.changes (original) +++ branches/SuSE-SLE-10-SP3-Branch/packager/package/yast2-packager.changes Wed Apr 22 17:03:15 2009 @@ -3,6 +3,9 @@ - callbacks - close download popup and source progress popup if an error occurrs (#216950) +- Pkg::CallbackSourceCreateInit/Destroy() and + Pkg::CallbackSourceReportInit() handlers (#251726) +- 2.13.182 ------------------------------------------------------------------- Fri Apr 10 18:34:12 CEST 2009 - lslezak@suse.cz Modified: branches/SuSE-SLE-10-SP3-Branch/packager/src/modules/PackageCallbacks.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP3-Branch/packager/src/modules/PackageCallbacks.ycp?rev=56920&r1=56919&r2=56920&view=diff ============================================================================== --- branches/SuSE-SLE-10-SP3-Branch/packager/src/modules/PackageCallbacks.ycp (original) +++ branches/SuSE-SLE-10-SP3-Branch/packager/src/modules/PackageCallbacks.ycp Wed Apr 22 17:03:15 2009 @@ -49,6 +49,9 @@ string back_string = "\b\b\b\b\b\b\b\b\b\b"; string clear_string = back_string + " " + back_string; + // max. length of the text in the source popup window + integer max_size = 60; + //-------------------------------------------------------------------------- // defaults @@ -779,84 +782,50 @@ return ret; } -void OpenSourcePopup(string text) +void OpenSourcePopup() { - integer max_size = 60; - if (_source_open == 0) { - // the popup doesn't exist - y2milestone("Opening source progress popup: %1", text); - - // if the text is too long then display only part of the message - // and then refresh the label to the full string - // reason: display a small popup, but user can resize it to see - // the full message - string display = text; - boolean refresh_label = false; - - // Qt UI uses bold font, the string must be shortened even more - integer ui_adjustment = UI::GetDisplayInfo()["TextMode"]:false ? 0 : 5; - - if (size(display) > max_size - ui_adjustment) - { - display = ProcessMessage(display, max_size - ui_adjustment); - } - - // truncate long text - if (size(display) > max_size - ui_adjustment) - { - // ellipsis appended to a truncated text (if it's too long) - string ellipsis = _("..."); - display = substring(display, 0, max_size - ui_adjustment - 1 - size(ellipsis)) + ellipsis; - refresh_label = true; - } - UI::OpenDialog( `VBox( `HSpacing(max_size), - `Heading(`id(`label_source_popup), `opt(`hstretch), display), + `Heading(`id(`label_source_popup), `opt(`hstretch), " "), `ProgressBar (`id (`progress), " ", 100, 0) ) ); - - // set the full text if needed - if (refresh_label) - { - UI::ChangeWidget(`label, `Value, text); - } } - else - { - // Qt uses proportional font, the string might be longer - integer ui_adjustment = UI::GetDisplayInfo()["TextMode"]:false ? 0 : 6; - if (size(text) > max_size + ui_adjustment) - { - text = ProcessMessage(text, max_size + ui_adjustment); - } + _source_open = _source_open + 1; + y2milestone("OpenSourcePopup: _source_open: %1", _source_open); +} + +void SetHeaderSourcePopup(string text) +{ + // Qt UI uses bold font, the string must be shortened even more + integer ui_adjustment = UI::GetDisplayInfo()["TextMode"]:false ? 0 : 5; - // refresh the labels in the popup - UI::ChangeWidget(`progress, `Label, text); - // reset the progressbar - UI::ChangeWidget(`progress, `Value, 0); - y2milestone("OpenSourcePopup: new label: %1", text); + if (size(text) > max_size - ui_adjustment) + { + text = ProcessMessage(text, max_size - ui_adjustment); } - _source_open = _source_open + 1; - y2milestone("OpenSourcePopup: _source_open: %1", _source_open); + UI::ChangeWidget(`label_source_popup, `Value, text); + y2milestone("SourcePopup: new header: %1", text); } -boolean SourcePopupSetProgress(integer value) +void SetLabelSourcePopup(string text) { - if (_source_open > 0) + // Qt uses proportional font, the string might be longer + integer ui_adjustment = UI::GetDisplayInfo()["TextMode"]:false ? 0 : 6; + + if (size(text) > max_size + ui_adjustment) { - UI::ChangeWidget (`id (`progress), `Value, value); - any input = UI::PollInput (); - if (input == `abort) - return false; + text = ProcessMessage(text, max_size + ui_adjustment); } - return true; + + // refresh the label in the popup + UI::ChangeWidget(`progress, `Label, text); + y2milestone("SourcePopup: new label: %1", text); } // is the top level window source popup? @@ -866,6 +835,18 @@ UI::WidgetExists(`id(`label_source_popup)); } +boolean SourcePopupSetProgress(integer value) +{ + if (_source_open > 0 && IsSourcePopup()) + { + UI::ChangeWidget (`id (`progress), `Value, value); + any input = UI::PollInput (); + if (input == `abort) + return false; + } + return true; +} + void CloseSourcePopup() { if (!IsSourcePopup()) @@ -876,9 +857,6 @@ _source_open = _source_open - 1; - // set 100% progress - SourcePopupSetProgress(100); - if (_source_open == 0) { y2milestone("Closing source progress popup"); @@ -887,26 +865,23 @@ y2milestone("CloseSourcePopup: _source_open: %1", _source_open); } -// completely close the source popup window (all instances) -// should be called if an error occurrs -void CloseSourcePopupAll() + +global void SourceCreateInit() { - if (!IsSourcePopup()) - { - y2error("The toplevel dialog is not a source popup dialog!"); - return; - } + y2milestone ("SourceCreateInit"); - _source_open = 0; + OpenSourcePopup(); +} - // set 100% progress - SourcePopupSetProgress(100); +global void SourceCreateDestroy() +{ + y2milestone ("SourceCreateDestroy"); - y2milestone("Closing source progress popup - all instances"); - UI::CloseDialog(); + CloseSourcePopup(); } -global void SourceCreateStart(string url) { +global void SourceCreateStart(string url) +{ y2milestone ("SourceCreateStart: %1", url); // popup label (%1 is source URL) @@ -917,7 +892,16 @@ } else { - OpenSourcePopup(sformat(_("Creating source %1"), url)); + y2internal("_source_open: %1", _source_open); + + if (_source_open == 1) + { + SetHeaderSourcePopup(msg); + } + else + { + SetLabelSourcePopup(msg); + } } } @@ -983,14 +967,13 @@ UI::CloseDialog (); y2milestone ("Source create error: Returning %1", ret); - CloseSourcePopupAll(); - return ret; } global void SourceCreateEnd(string url, symbol error, string description) { - CloseSourcePopup(); + // set 100% progress + SourcePopupSetProgress(100); y2milestone ("Source create end: error: url: %1, error: %2, description: %3", url, error, description); } @@ -1009,8 +992,18 @@ } else { - OpenSourcePopup(_("Probing source...")); - OpenSourcePopup(sformat(_("Probing source %1"), url)); + OpenSourcePopup(); + + string msg = sformat(_("Probing source %1"), url); + + if (_source_open == 1) + { + SetHeaderSourcePopup(msg); + } + else + { + SetLabelSourcePopup(msg); + } } } @@ -1109,7 +1102,16 @@ } else { - OpenSourcePopup(task); + y2internal("_source_open: %1", _source_open); + + if (_source_open == 1) + { + SetHeaderSourcePopup(task); + } + else + { + SetLabelSourcePopup(task); + } } } @@ -1174,16 +1176,27 @@ UI::CloseDialog (); y2milestone ("Source report error: Returning %1", ret); - CloseSourcePopupAll(); - return ret; } global void SourceReportEnd(integer src_id, string url, string task, symbol error, string description) { - CloseSourcePopup(); - y2milestone ("Source report end: src: %1, url: %2, task: %3, error: %4, description: %5", src_id, url, task, error, description); + + // set 100% progress + SourcePopupSetProgress(100); +} + +global void SourceReportInit() +{ + y2milestone("Source report init"); + OpenSourcePopup(); +} + +global void SourceReportDestroy() +{ + y2milestone("Source report destroy"); + CloseSourcePopup(); } /** at start of delta providal Modified: branches/SuSE-SLE-10-SP3-Branch/packager/yast2-packager.spec.in URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP3-Branch/packager/yast2-packager.spec.in?rev=56920&r1=56919&r2=56920&view=diff ============================================================================== --- branches/SuSE-SLE-10-SP3-Branch/packager/yast2-packager.spec.in (original) +++ branches/SuSE-SLE-10-SP3-Branch/packager/yast2-packager.spec.in Wed Apr 22 17:03:15 2009 @@ -4,8 +4,8 @@ @HEADER@ BuildRequires: gcc-c++ libxcrypt-devel yast2-country yast2-xml docbook-xsl-stylesheets doxygen libxslt perl-XML-Writer sgml-skel update-desktop-files yast2 yast2-devtools yast2-testsuite yast2-slp Requires: checkmedia yast2-country -# Pkg::SourceGetBrokenSources() -Requires: yast2-pkg-bindings >= 2.13.121 +# Pkg::CallbackSourceCreateInit/Destroy callbacks +Requires: yast2-pkg-bindings >= 2.13.125 # URL::FormatURL() Requires: yast2 >= 2.13.97 Requires: yast2-storage -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org