Author: aschnell
Date: Wed Jun 18 17:21:34 2008
New Revision: 48396
URL: http://svn.opensuse.org/viewcvs/yast?rev=48396&view=rev
Log:
- work on entering sizes
Modified:
branches/tmp/aschnell/part-redesign/storage/src/include/ep-dialogs.ycp
branches/tmp/aschnell/part-redesign/storage/src/include/ep-hd-dialogs.ycp
branches/tmp/aschnell/part-redesign/storage/src/include/ep-lvm-dialogs.ycp
branches/tmp/aschnell/part-redesign/storage/src/include/ep-main.ycp
Modified: branches/tmp/aschnell/part-redesign/storage/src/include/ep-dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/part-redesign/storage/src/include/ep-dialogs.ycp?rev=48396&r1=48395&r2=48396&view=diff
==============================================================================
--- branches/tmp/aschnell/part-redesign/storage/src/include/ep-dialogs.ycp (original)
+++ branches/tmp/aschnell/part-redesign/storage/src/include/ep-dialogs.ycp Wed Jun 18 17:21:34 2008
@@ -15,33 +15,97 @@
* read data["cyl_size"]
* read/write data["region"]
*/
- symbol MiniWorkflowStepSize(map &data)
+ symbol MiniWorkflowStepPartitionSize(map &data)
{
- y2milestone("MiniWorkflowStepSize data:%1", data);
+ y2milestone("MiniWorkflowStepPartitionSize data:%1", data);
- symbol flavour = data["flavour"]:`none;
+ list slot = data["slots", data["type"]:`unknown]:[];
+ integer max_size = slot[1]:0 * data["cyl_size"]:0;
- term cyl = `Empty();
- if (flavour == `part)
- cyl = `Left(`Label(sformat(_("Cylinder size is %1"), Storage::ByteToHumanString(data["cyl_size"]:0))));
+ string tmp = Storage::ByteToHumanString(max_size);
- term frames = `VStackFrames();
+ term contents = `HVSquash(
+ `Frame(_("Size"),
+ `RadioButtonGroup(`id(`size),
+ `VBox(
+ `LeftRadioButton(`id(`max_size), `opt(`notify),
+ sformat(_("Maximum Size (%1)"), tmp)),
+ `LeftRadioButtonWithAttachment(`id(`manual_size), `opt(`notify), _("Manual Size"),
+ `VBox(`id(`manual_size_attachment),
+ `MinWidth(15, `InputField(`id(`size_input), `opt(`shrinkable), _("Size")))
+ )
+ )
+ )
+ )));
+
+ MiniWorkflow::SetContents(Greasemonkey::Transform(contents), "help");
+
+ MiniWorkflow::SetLastStep(data["type"]:`unknown == `extended);
+
+ symbol widget = nil;
+
+ repeat
+ {
+ widget = MiniWorkflow::UserInput();
+
+ switch (widget)
+ {
+ case `max_size:
+ UI::ChangeWidget(`id(`manual_size_attachment), `Enabled, false);
+ break;
- list slot = [];
- integer max_size = 0;
+ case `manual_size:
+ UI::ChangeWidget(`id(`manual_size_attachment), `Enabled, true);
+ break;
+ }
+ }
+ until (widget == `abort || widget == `back || widget == `next);
- switch (flavour)
+ if (widget == `next)
{
- case `part:
- list slot = data["slots", data["type"]:`unknown]:[];
- max_size = slot[1]:0 * data["cyl_size"]:0;
- break;
-
- case `lv:
- max_size = data["max_size"]:0;
- break;
+ switch ((symbol) UI::QueryWidget(`id(`size), `Value))
+ {
+ case `max_size:
+ {
+ data["region"] = slot;
+ break;
+ }
+
+ case `manual_size:
+ {
+ // TODO
+ string s = (string) UI::QueryWidget(`id(`size_input), `Value);
+ integer i = Storage::KmgtStrToByte(s);
+ integer num_cyl = tointeger(float::ceil(tofloat(i) / tofloat(data["cyl_size"]:42)));
+ data["region"] = [ slot[0]:0, num_cyl ];
+ break;
+ }
+ }
+
+ if (data["type"]:`unknown == `extended)
+ {
+ widget = `finish;
+ }
+
+ Debug("data", data);
}
+ y2milestone("MiniWorkflowStepPartitionSize data:%1 ret:%2", data, widget);
+
+ return widget;
+ }
+
+
+ symbol MiniWorkflowStepLvSize(map &data)
+ {
+ y2milestone("MiniWorkflowStepLvSize data:%1", data);
+
+ term frames = `VStackFrames();
+
+ integer max_size = data["max_size"]:0;
+ integer stripes = data["stripes"]:1;
+ integer stripe_size = data["stripesize"]:64;
+
string tmp = Storage::ByteToHumanString(max_size);
frames = add(frames,
@@ -52,31 +116,36 @@
sformat(_("Maximum Size (%1)"), tmp)),
`LeftRadioButtonWithAttachment(`id(`manual_size), `opt(`notify), _("Manual Size"),
`VBox(`id(`manual_size_attachment),
- `MinWidth(15, `InputField(`id(`size_input), `opt(`shrinkable), _("Size"))),
- cyl
+ `MinWidth(15, `InputField(`id(`size_input), `opt(`shrinkable), _("Size")))
)
)
)
)));
- if (flavour == `lv)
- {
- frames = add(frames, `Frame("Stripes",
- `HBox(
- `Left(`ComboBox("Number", ["1", "2", "3", "4"])),
- `Left(`ComboBox("Size", ["4 kB", "8 kB", "16 kB", "32 kB"])),
- `HStretch())
- )
- );
- }
+
+ list<term> stripes_list = maplist(integer i, Integer::Range(8), {
+ integer j = i + 1;
+ return `item(`id(j), tostring(j), stripes == j);
+ });
+
+ list<term> stripe_sizes_list = maplist(integer i, Integer::Range(8), {
+ integer j = 2 << (i + 1);
+ return `item(`id(j), Storage::ByteToHumanStringWithPrecision(j*1024, 2, true), stripe_size == j);
+ });
+
+ frames = add(frames, `Frame("Stripes",
+ `HBox(
+ `Left(`ComboBox(`id(`stripes), `opt(`notify), "Number", stripes_list)),
+ `Left(`ComboBox(`id(`stripe_size), "Size", stripe_sizes_list)),
+ `HStretch())
+ )
+ );
term contents = `HVSquash(frames);
MiniWorkflow::SetContents(Greasemonkey::Transform(contents), "help");
MiniWorkflow::SetLastStep(false);
- if (flavour == `part && data["type"]:`unknown == `extended)
- MiniWorkflow::SetLastStep(true);
symbol widget = nil;
@@ -93,6 +162,16 @@
case `manual_size:
UI::ChangeWidget(`id(`manual_size_attachment), `Enabled, true);
break;
+
+ case `stripes:
+ stripes = (integer) UI::QueryWidget(`id(`stripes), `Value);
+ UI::ChangeWidget(`id(`stripe_size), `Enabled, stripes > 1);
+ break;
+
+ case `next:
+ stripes = (integer) UI::QueryWidget(`id(`stripes), `Value);
+ stripe_size = (integer) UI::QueryWidget(`id(`stripe_size), `Value);
+ break;
}
}
until (widget == `abort || widget == `back || widget == `next);
@@ -102,55 +181,23 @@
switch ((symbol) UI::QueryWidget(`id(`size), `Value))
{
case `max_size:
- {
- switch (flavour)
- {
- case `part:
- data["region"] = slot;
- break;
-
- case `lv:
- data["size_k"] = max_size / 1024;
- break;
- }
+ data["size_k"] = max_size / 1024;
break;
- }
case `manual_size:
- {
- switch (flavour)
- {
- case `part:
- {
- // TODO
- string s = (string) UI::QueryWidget(`id(`size_input), `Value);
- integer i = Storage::KmgtStrToByte(s);
- integer num_cyl = tointeger(float::ceil(tofloat(i) / tofloat(data["cyl_size"]:42)));
- data["region"] = [ slot[0]:0, num_cyl ];
- break;
- }
-
- case `lv:
- {
- string s = (string) UI::QueryWidget(`id(`size_input), `Value);
- integer i = Storage::KmgtStrToByte(s);
- data["size_k"] = i / 1024;
- break;
- }
- }
+ string s = (string) UI::QueryWidget(`id(`size_input), `Value);
+ integer i = Storage::KmgtStrToByte(s);
+ data["size_k"] = i / 1024;
break;
- }
}
- if (flavour == `part && data["type"]:`unknown == `extended)
- {
- widget = `finish;
- }
+ data["stripes"] = stripes;
+ data["stripesize"] = stripe_size;
Debug("data", data);
}
- y2milestone("MiniWorkflowStepSize data:%1 ret:%2", data, widget);
+ y2milestone("MiniWorkflowStepLvSize data:%1 ret:%2", data, widget);
return widget;
}
Modified: branches/tmp/aschnell/part-redesign/storage/src/include/ep-hd-dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/part-redesign/storage/src/include/ep-hd-dialogs.ycp?rev=48396&r1=48395&r2=48396&view=diff
==============================================================================
--- branches/tmp/aschnell/part-redesign/storage/src/include/ep-hd-dialogs.ycp (original)
+++ branches/tmp/aschnell/part-redesign/storage/src/include/ep-hd-dialogs.ycp Wed Jun 18 17:21:34 2008
@@ -80,7 +80,7 @@
map aliases = $[
"Type" : ``(MiniWorkflowStepPartitionType(data)),
- "Size" : ``(MiniWorkflowStepSize(data)),
+ "Size" : ``(MiniWorkflowStepPartitionSize(data)),
"FormatMount" : ``(MiniWorkflowStepFormatMount(data)),
"Password" : ``(MiniWorkflowStepPassword(data))
];
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=48396&r1=48395&r2=48396&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 Wed Jun 18 17:21:34 2008
@@ -206,17 +206,17 @@
boolean DlgCreateLogicalVolume(string vg_name)
{
map target_map = Storage::GetTargetMap();
-
+
map data = $[];
data["flavour"] = `lv;
data["vg_name"] = vg_name;
- data["max_size"] = target_map["/dev/" + vg_name, "pe_free"]:0 *
+ data["max_size"] = target_map["/dev/" + vg_name, "pe_free"]:0 *
target_map["/dev/" + vg_name, "pesize"]:0;
map aliases = $[
"Name" : ``(MiniWorkflowStepLvName(data)),
- "Size" : ``(MiniWorkflowStepSize(data)),
+ "Size" : ``(MiniWorkflowStepLvSize(data)),
"FormatMount" : ``(MiniWorkflowStepFormatMount(data)),
"Password" : ``(MiniWorkflowStepPassword(data))
];
Modified: branches/tmp/aschnell/part-redesign/storage/src/include/ep-main.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/part-redesign/storage/src/include/ep-main.ycp?rev=48396&r1=48395&r2=48396&view=diff
==============================================================================
--- branches/tmp/aschnell/part-redesign/storage/src/include/ep-main.ycp (original)
+++ branches/tmp/aschnell/part-redesign/storage/src/include/ep-main.ycp Wed Jun 18 17:21:34 2008
@@ -18,6 +18,7 @@
import "Greasemonkey";
import "Partitions";
import "DualMultiSelectionBox";
+ import "Integer";
void Debug(string text, any value)
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org