Author: aschnell Date: Tue Apr 8 15:57:09 2008 New Revision: 46238 URL: http://svn.opensuse.org/viewcvs/yast?rev=46238&view=rev Log: - added ReplacePoints beneath MultiSelectionBoxes - correctly update total sizes Modified: branches/tmp/aschnell/part-redesign/storage/src/include/ep-lvm-dialogs.ycp branches/tmp/aschnell/part-redesign/storage/src/modules/DualMultiSelectionBox.ycp Modified: branches/tmp/aschnell/part-redesign/storage/src/include/ep-lvm-dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/part-redesign/storage/src/include/ep-lvm-dialogs.ycp?rev=46238&r1=46237&r2=46238&view=diff ============================================================================== --- branches/tmp/aschnell/part-redesign/storage/src/include/ep-lvm-dialogs.ycp (original) +++ branches/tmp/aschnell/part-redesign/storage/src/include/ep-lvm-dialogs.ycp Tue Apr 8 15:57:09 2008 @@ -33,22 +33,42 @@ any StepTheOne() { + void UpdateTotalSizes() + { + integer unsel_size_k = 0; + integer sel_size_k = 0; + + list<term> tmp = DualMultiSelectionBox::GetSelectedItems(); + + foreach(map candidate, candidates, { + any id = `id(candidate["device"]:""); + if (find(term t, tmp, { return t[0]:nil == id; }) == nil) + unsel_size_k = unsel_size_k + candidate["size_k"]:0; + else + sel_size_k = sel_size_k + candidate["size_k"]:0; + }); + + UI::ReplaceWidget(`id(`unsel_rp), + `Left(`Label(sformat(_("Total size: %1"), + Partitions::ByteToHumanStringWithZero(unsel_size_k*1024))))); + UI::ReplaceWidget(`id(`sel_rp), + `Left(`Label(sformat(_("Total size: %1"), + Partitions::ByteToHumanStringWithZero(sel_size_k*1024))))); + } + term contents = `VBox( `Left(`InputField(`id("vgname"), "Volume Group Name")), - `Left(`InputField(`id("pesize"), _("&Physical Extent Size"), "4M")), - DualMultiSelectionBox::Create(candidates_list), - `HBox( // FIXME - `HStretch(), - `Label(`id(`size), sformat("Total size: %1", - Partitions::ByteToHumanStringWithZero(0))) - ) - ); + `Left(`InputField(`id("pesize"), _("&Physical Extent Size"), "4 M")), + DualMultiSelectionBox::Create(candidates_list) + ); MiniWorkflow::SetContents(Greasemonkey::Transform(contents), "help"); MiniWorkflow::SetLastStep(true); + UpdateTotalSizes(); + symbol widget = nil; @@ -59,15 +79,7 @@ if (contains([`add, `add_all, `remove, `remove_all], widget)) { - integer size_k = 0; - list<term> tmp1 = DualMultiSelectionBox::GetSelectedItems(); - list<map> candidates_selected = filter(map candidate, candidates, { - any id = `id(candidate["device"]:""); - return find (term t, tmp1, { return t[0]:nil == id; }) != nil; - }); - foreach(map candidate, candidates_selected, { size_k = size_k + candidate["size_k"]:10; }); - UI::ChangeWidget(`id(`size), `Value, sformat("Total size: %1", - Partitions::ByteToHumanStringWithZero(size_k*1024))); + UpdateTotalSizes(); } else if (widget == `next) { @@ -155,8 +167,8 @@ return MiniWorkflow::UserInput(); } - - + + any StepSize() { MiniWorkflow::SetContents(Greasemonkey::Transform(`HVSquash(StackFrames([ FrameSize(`lv), @@ -167,8 +179,8 @@ return MiniWorkflow::UserInput(); } - - + + any StepFormatMount() { // TODO almost identical to "Add Partitiion" Modified: branches/tmp/aschnell/part-redesign/storage/src/modules/DualMultiSelectionBox.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/part-redesign/storage/src/modules/DualMultiSelectionBox.ycp?rev=46238&r1=46237&r2=46238&view=diff ============================================================================== --- branches/tmp/aschnell/part-redesign/storage/src/modules/DualMultiSelectionBox.ycp (original) +++ branches/tmp/aschnell/part-redesign/storage/src/modules/DualMultiSelectionBox.ycp Tue Apr 8 15:57:09 2008 @@ -38,7 +38,10 @@ items = i; return `HBox( - `MultiSelectionBox(`id(`unsel), "Available Physical Volumes:", MakeUnselContents()), + `VBox( + `MultiSelectionBox(`id(`unsel), "Available Physical Volumes:", MakeUnselContents()), + `ReplacePoint(`id(`unsel_rp), `Empty()) + ), `VBox( `PushButton(`id(`add), "Add" + " " + UI::Glyph(`ArrowRight)), `PushButton(`id(`add_all), "Add All" + " " + UI::Glyph(`ArrowRight)), @@ -46,7 +49,10 @@ `PushButton(`id(`remove), UI::Glyph(`ArrowLeft) + " " + "Remove"), `PushButton(`id(`remove_all), UI::Glyph(`ArrowLeft) + " " + "Remove All") ), - `MultiSelectionBox(`id(`sel), "Selected Physical Volumes:", MakeSelContents()) + `VBox( + `MultiSelectionBox(`id(`sel), "Selected Physical Volumes:", MakeSelContents()), + `ReplacePoint(`id(`sel_rp), `Empty()) + ) ); } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org