Mailinglist Archive: yast-commit (210 mails)
| < Previous | Next > |
[yast-commit] r63425 - /branches/tmp/jsuchome/snapper/src/dialogs.ycp
- From: jsuchome@xxxxxxxxxxxxxxxxx
- Date: Tue, 15 Feb 2011 15:24:52 -0000
- Message-id: <20110215152452.A61553256C@svn2.opensuse.org>
Author: jsuchome
Date: Tue Feb 15 16:24:52 2011
New Revision: 63425
URL: http://svn.opensuse.org/viewcvs/yast?rev=63425&view=rev
Log:
one table for all
different data shown for single (WIP)
ask for restoring
Modified:
branches/tmp/jsuchome/snapper/src/dialogs.ycp
Modified: branches/tmp/jsuchome/snapper/src/dialogs.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/branches/tmp/jsuchome/snapper/src/dialogs.ycp?rev=63425&r1=63424&r2=63425&view=diff
==============================================================================
--- branches/tmp/jsuchome/snapper/src/dialogs.ycp (original)
+++ branches/tmp/jsuchome/snapper/src/dialogs.ycp Tue Feb 15 16:24:52 2011
@@ -79,8 +79,8 @@
list<map> snapshots = Snapper::snapshots;
integer i = -1;
- list single_snapshot_items = [];
- list coupled_snapshot_items = [];
+ list snapshot_items = [];
+// list coupled_snapshot_items = [];
foreach (map s, snapshots, {
i = i + 1;
@@ -92,8 +92,8 @@
if (s["type"]:`none == `SINGLE)
{
- single_snapshot_items = add (single_snapshot_items,
- `item (`id (i), date, num, s["description"]:""));
+ snapshot_items = add (snapshot_items,
+ `item (`id (i), num, _("Single"), date, "",
s["description"]:""));
}
else if (s["type"]:`none == `POST)
{
@@ -106,8 +106,8 @@
}
string desc = Snapper::snapshots[index,"description"]:"";
string pre_date = timestring ("%c",
Snapper::snapshots[index,"date"]:0, false);
- coupled_snapshot_items = add (coupled_snapshot_items,
- `item (`id (i), pre, pre_date, num, date, desc));
+ snapshot_items = add (snapshot_items,
+ `item (`id (i), sformat ("%1 - %2", pre, num), _("Pre & Post"),
pre_date, date, desc));
}
else
{
@@ -116,6 +116,7 @@
});
term contents = `VBox (
+ /*
// table label
`Left (`Label (_("Single Snapshots"))),
`Table (`id (`single_snapshots_table), `opt(`notify, `keepSorting),
`header (
@@ -130,10 +131,12 @@
`VSpacing (0.5),
// table label
`Left (`Label (_("Coupled Snapshots"))),
- `Table (`id (`coupled_snapshots_table), `opt(`notify, `keepSorting),
`header (
+ */
+ `Table (`id (`snapshots_table), `opt(`notify, `keepSorting), `header (
// table header
- _("Pre ID"), _("Start Date"), _("Post ID"), _("End Date"),
_("Description")),
- coupled_snapshot_items
+// _("Pre ID"), _("Start Date"), _("Post ID"), _("End Date"),
_("Description")),
+ _("ID"), _("Type"), _("Start Date"), _("End Date"),
_("Description")),
+ snapshot_items
),
`HBox (
`PushButton (`id (`show_c), `opt (`default), _("Show Changes")),
@@ -146,9 +149,11 @@
Wizard::HideBackButton ();
Wizard::HideAbortButton ();
- UI::SetFocus (`id (`coupled_snapshots_table));
+ UI::SetFocus (`id (`snapshots_table));
+ /*
if (coupled_snapshot_items == [] && single_snapshot_items != [])
UI::SetFocus (`id (`single_snapshots_table));
+ */
any ret = nil;
while(true) {
@@ -157,6 +162,7 @@
integer selected = 0;
+ /*
if (ret == `single_snapshots_table || ret == `coupled_snapshots_table) {
selected = (integer) UI::QueryWidget (`id (ret), `CurrentItem);
ret = `show;
@@ -165,8 +171,9 @@
selected = (integer) UI::QueryWidget (`id
(`single_snapshots_table), `CurrentItem);
ret = `show;
}
- if (ret == `show_c) {
- selected = (integer) UI::QueryWidget (`id
(`coupled_snapshots_table), `CurrentItem);
+ */
+ if (ret == `show_c || ret == `snapshots_table) {
+ selected = (integer) UI::QueryWidget (`id (`snapshots_table),
`CurrentItem);
ret = `show;
}
@@ -221,6 +228,7 @@
string description =
Snapper::snapshots[pre_index,"description"]:"";
string pre_date = timestring ("%c",
Snapper::snapshots[pre_index,"date"]:0, false);
string date = timestring ("%c", snapshot["date"]:0,
false);
+ symbol type = snapshot["type"]:`NONE;
if (!haskey (snapshot, "files"))
{
@@ -303,7 +311,10 @@
void show_file_modification (string file, integer from, integer to) {
term content = `VBox ();
+ // busy popup message
+ Popup::ShowFeedback ("", _("Calculating file modifications..."));
map modification = Snapper::GetFileModification (file, from, to);
+ Popup::ClearFeedback ();
if (haskey (modification, "diff"))
{
string diff = modification["diff"]:"";
@@ -371,14 +382,35 @@
}
}
+ string tree_label = sformat ("%1 - %2", previous_num, snapshot_num);
+ term date_widget = `VBox (
+ `HBox (
+ // label, date string will follow at the end of line
+ `Label (`id (`pre_date), _("Time of taking the first
snapshot:")),
+ `Right (`Label (pre_date))
+ ),
+ `HBox (
+ // label, date string will follow at the end of line
+ `Label (`id (`post_date), _("Time of taking the second
snapshot:")),
+ `Right (`Label (date))
+ )
+ );
+ if (type == `SINGLE)
+ {
+ tree_label = tostring (snapshot_num);
+ date_widget = `HBox (
+ // label, date string will follow at the end of line
+ `Label (`id (`date), _("Time of taking the snapshot:")),
+ `Right (`Label (date))
+ );
+ }
+
term contents = `HBox (
`HWeight (1, `HBox (`VSpacing (20), `VBox (`HSpacing(70),
`HBox (
`HSpacing (),
`ReplacePoint (`id (`reptree),
- `Tree (`id(`tree), `opt (`notify, `multiSelection),
- sformat ("%1 - %2", previous_num, snapshot_num), []
- )
+ `Tree (`id(`tree), tree_label, [])
),
`HSpacing ()
),
@@ -394,16 +426,7 @@
))),
`HWeight (2, `VBox (
`Left (`Label (`id (`desc), description)),
- `HBox (
- // label, date string will follow at the end of line
- `Label (`id (`pre_date), _("Time of taking the first
snapshot:")),
- `Right (`Label (pre_date))
- ),
- `HBox (
- // label, date string will follow at the end of line
- `Label (`id (`post_date), _("Time of taking the second
snapshot:")),
- `Right (`Label (date))
- ),
+ date_widget,
`Frame ("", `HBox (
`HSpacing (0.5), `VBox (
`VSpacing (0.5),
@@ -438,9 +461,7 @@
if (size (tree_items) > 0)
{
UI::ReplaceWidget (`id (`reptree),
- `Tree (`id(`tree), `opt (`notify, `multiSelection),
- sformat ("%1 - %2", previous_num, snapshot_num), tree_items
- )
+ `Tree (`id(`tree), `opt (`notify, `immediate, `multiSelection),
tree_label, tree_items)
);
// no item is selected
UI::ChangeWidget (`tree, `CurrentItem, nil);
@@ -495,16 +516,29 @@
continue;
}
else if (ret == `next) {
- if (true)
+ list<string> files = (list<string>) UI::QueryWidget (`id (`tree),
`SelectedItems);
+ y2internal ("files: %1", files);
+ files = filter (string file, files, {
+ return haskey (files_index, file);
+ });
+ y2internal ("files: %1", files);
+
+ if (files == [])
{
+ // popup message
Popup::Message (_("No file was selected for restoring"));
continue;
}
- else if (Popup::YesNo (_("This will probably ruin your system. Are
you sure?")))
+ // FIXME restore from PRE or POST?
+ // popup headline
+ if (Popup::AnyQuestionRichText (_("Restoring files"),
+ // popup message
+ sformat (_("These files will be restored from snapshot
%1:<br>%2<br>Are you sure?"),
+ snapshot_name, mergestring (files, "<br>")),
+ 60, 20, Label::YesButton (), Label::NoButton (), `focus_no))
{
y2milestone ("restoring files...");
- // do it
- break;
+ // TODO copy the files
}
continue;
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx
Date: Tue Feb 15 16:24:52 2011
New Revision: 63425
URL: http://svn.opensuse.org/viewcvs/yast?rev=63425&view=rev
Log:
one table for all
different data shown for single (WIP)
ask for restoring
Modified:
branches/tmp/jsuchome/snapper/src/dialogs.ycp
Modified: branches/tmp/jsuchome/snapper/src/dialogs.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/branches/tmp/jsuchome/snapper/src/dialogs.ycp?rev=63425&r1=63424&r2=63425&view=diff
==============================================================================
--- branches/tmp/jsuchome/snapper/src/dialogs.ycp (original)
+++ branches/tmp/jsuchome/snapper/src/dialogs.ycp Tue Feb 15 16:24:52 2011
@@ -79,8 +79,8 @@
list<map> snapshots = Snapper::snapshots;
integer i = -1;
- list single_snapshot_items = [];
- list coupled_snapshot_items = [];
+ list snapshot_items = [];
+// list coupled_snapshot_items = [];
foreach (map s, snapshots, {
i = i + 1;
@@ -92,8 +92,8 @@
if (s["type"]:`none == `SINGLE)
{
- single_snapshot_items = add (single_snapshot_items,
- `item (`id (i), date, num, s["description"]:""));
+ snapshot_items = add (snapshot_items,
+ `item (`id (i), num, _("Single"), date, "",
s["description"]:""));
}
else if (s["type"]:`none == `POST)
{
@@ -106,8 +106,8 @@
}
string desc = Snapper::snapshots[index,"description"]:"";
string pre_date = timestring ("%c",
Snapper::snapshots[index,"date"]:0, false);
- coupled_snapshot_items = add (coupled_snapshot_items,
- `item (`id (i), pre, pre_date, num, date, desc));
+ snapshot_items = add (snapshot_items,
+ `item (`id (i), sformat ("%1 - %2", pre, num), _("Pre & Post"),
pre_date, date, desc));
}
else
{
@@ -116,6 +116,7 @@
});
term contents = `VBox (
+ /*
// table label
`Left (`Label (_("Single Snapshots"))),
`Table (`id (`single_snapshots_table), `opt(`notify, `keepSorting),
`header (
@@ -130,10 +131,12 @@
`VSpacing (0.5),
// table label
`Left (`Label (_("Coupled Snapshots"))),
- `Table (`id (`coupled_snapshots_table), `opt(`notify, `keepSorting),
`header (
+ */
+ `Table (`id (`snapshots_table), `opt(`notify, `keepSorting), `header (
// table header
- _("Pre ID"), _("Start Date"), _("Post ID"), _("End Date"),
_("Description")),
- coupled_snapshot_items
+// _("Pre ID"), _("Start Date"), _("Post ID"), _("End Date"),
_("Description")),
+ _("ID"), _("Type"), _("Start Date"), _("End Date"),
_("Description")),
+ snapshot_items
),
`HBox (
`PushButton (`id (`show_c), `opt (`default), _("Show Changes")),
@@ -146,9 +149,11 @@
Wizard::HideBackButton ();
Wizard::HideAbortButton ();
- UI::SetFocus (`id (`coupled_snapshots_table));
+ UI::SetFocus (`id (`snapshots_table));
+ /*
if (coupled_snapshot_items == [] && single_snapshot_items != [])
UI::SetFocus (`id (`single_snapshots_table));
+ */
any ret = nil;
while(true) {
@@ -157,6 +162,7 @@
integer selected = 0;
+ /*
if (ret == `single_snapshots_table || ret == `coupled_snapshots_table) {
selected = (integer) UI::QueryWidget (`id (ret), `CurrentItem);
ret = `show;
@@ -165,8 +171,9 @@
selected = (integer) UI::QueryWidget (`id
(`single_snapshots_table), `CurrentItem);
ret = `show;
}
- if (ret == `show_c) {
- selected = (integer) UI::QueryWidget (`id
(`coupled_snapshots_table), `CurrentItem);
+ */
+ if (ret == `show_c || ret == `snapshots_table) {
+ selected = (integer) UI::QueryWidget (`id (`snapshots_table),
`CurrentItem);
ret = `show;
}
@@ -221,6 +228,7 @@
string description =
Snapper::snapshots[pre_index,"description"]:"";
string pre_date = timestring ("%c",
Snapper::snapshots[pre_index,"date"]:0, false);
string date = timestring ("%c", snapshot["date"]:0,
false);
+ symbol type = snapshot["type"]:`NONE;
if (!haskey (snapshot, "files"))
{
@@ -303,7 +311,10 @@
void show_file_modification (string file, integer from, integer to) {
term content = `VBox ();
+ // busy popup message
+ Popup::ShowFeedback ("", _("Calculating file modifications..."));
map modification = Snapper::GetFileModification (file, from, to);
+ Popup::ClearFeedback ();
if (haskey (modification, "diff"))
{
string diff = modification["diff"]:"";
@@ -371,14 +382,35 @@
}
}
+ string tree_label = sformat ("%1 - %2", previous_num, snapshot_num);
+ term date_widget = `VBox (
+ `HBox (
+ // label, date string will follow at the end of line
+ `Label (`id (`pre_date), _("Time of taking the first
snapshot:")),
+ `Right (`Label (pre_date))
+ ),
+ `HBox (
+ // label, date string will follow at the end of line
+ `Label (`id (`post_date), _("Time of taking the second
snapshot:")),
+ `Right (`Label (date))
+ )
+ );
+ if (type == `SINGLE)
+ {
+ tree_label = tostring (snapshot_num);
+ date_widget = `HBox (
+ // label, date string will follow at the end of line
+ `Label (`id (`date), _("Time of taking the snapshot:")),
+ `Right (`Label (date))
+ );
+ }
+
term contents = `HBox (
`HWeight (1, `HBox (`VSpacing (20), `VBox (`HSpacing(70),
`HBox (
`HSpacing (),
`ReplacePoint (`id (`reptree),
- `Tree (`id(`tree), `opt (`notify, `multiSelection),
- sformat ("%1 - %2", previous_num, snapshot_num), []
- )
+ `Tree (`id(`tree), tree_label, [])
),
`HSpacing ()
),
@@ -394,16 +426,7 @@
))),
`HWeight (2, `VBox (
`Left (`Label (`id (`desc), description)),
- `HBox (
- // label, date string will follow at the end of line
- `Label (`id (`pre_date), _("Time of taking the first
snapshot:")),
- `Right (`Label (pre_date))
- ),
- `HBox (
- // label, date string will follow at the end of line
- `Label (`id (`post_date), _("Time of taking the second
snapshot:")),
- `Right (`Label (date))
- ),
+ date_widget,
`Frame ("", `HBox (
`HSpacing (0.5), `VBox (
`VSpacing (0.5),
@@ -438,9 +461,7 @@
if (size (tree_items) > 0)
{
UI::ReplaceWidget (`id (`reptree),
- `Tree (`id(`tree), `opt (`notify, `multiSelection),
- sformat ("%1 - %2", previous_num, snapshot_num), tree_items
- )
+ `Tree (`id(`tree), `opt (`notify, `immediate, `multiSelection),
tree_label, tree_items)
);
// no item is selected
UI::ChangeWidget (`tree, `CurrentItem, nil);
@@ -495,16 +516,29 @@
continue;
}
else if (ret == `next) {
- if (true)
+ list<string> files = (list<string>) UI::QueryWidget (`id (`tree),
`SelectedItems);
+ y2internal ("files: %1", files);
+ files = filter (string file, files, {
+ return haskey (files_index, file);
+ });
+ y2internal ("files: %1", files);
+
+ if (files == [])
{
+ // popup message
Popup::Message (_("No file was selected for restoring"));
continue;
}
- else if (Popup::YesNo (_("This will probably ruin your system. Are
you sure?")))
+ // FIXME restore from PRE or POST?
+ // popup headline
+ if (Popup::AnyQuestionRichText (_("Restoring files"),
+ // popup message
+ sformat (_("These files will be restored from snapshot
%1:<br>%2<br>Are you sure?"),
+ snapshot_name, mergestring (files, "<br>")),
+ 60, 20, Label::YesButton (), Label::NoButton (), `focus_no))
{
y2milestone ("restoring files...");
- // do it
- break;
+ // TODO copy the files
}
continue;
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx
| < Previous | Next > |