Aircraft Center: fixes for install progress in reopened windows.
Restore install progress indication after closing and reopening Aircraft Center.
This commit is contained in:
parent
bc714fa39c
commit
c75869271e
2 changed files with 14 additions and 17 deletions
|
@ -122,39 +122,35 @@ var AircraftCenter = {
|
||||||
(func {
|
(func {
|
||||||
var p = package;
|
var p = package;
|
||||||
var b = gui.widgets.Button.new(me._scroll_content, style, {});
|
var b = gui.widgets.Button.new(me._scroll_content, style, {});
|
||||||
var installed = p.installed;
|
|
||||||
var install_text = sprintf("Install (%.1fMB)", p.fileSize/1024/1024);
|
var install_text = sprintf("Install (%.1fMB)", p.fileSize/1024/1024);
|
||||||
|
|
||||||
if( installed )
|
if( p.installed )
|
||||||
b.setText("Remove");
|
b.setText("Remove");
|
||||||
else
|
else
|
||||||
b.setText(install_text);
|
b.setText(install_text);
|
||||||
|
|
||||||
b.listen("clicked", func
|
b.listen("clicked", func
|
||||||
{
|
{
|
||||||
if( installed )
|
if( p.installed )
|
||||||
{
|
{
|
||||||
p.uninstall();
|
p.uninstall();
|
||||||
installed = 0;
|
|
||||||
b.setText(install_text);
|
b.setText(install_text);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
b.setEnabled(0)
|
b.setText("Wait...").setEnabled(0);
|
||||||
.setText("Wait...");
|
p.install();
|
||||||
p.install()
|
|
||||||
.progress(func(i, cur, total)
|
|
||||||
b.setText(sprintf("%.1f%%", (cur / total) * 100))
|
|
||||||
)
|
|
||||||
.fail(func b.setText('Failed'))
|
|
||||||
.done(func {
|
|
||||||
installed = 1;
|
|
||||||
b.setText("Remove")
|
|
||||||
.setEnabled(1);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
p.existingInstall(func(pkg, ins) {
|
||||||
|
ins.progress(func(i, cur, total)
|
||||||
|
b.setText(sprintf("%.1f%%", (cur / total) * 100))
|
||||||
|
);
|
||||||
|
ins.fail(func b.setText('Failed'));
|
||||||
|
ins.done(func b.setText("Remove").setEnabled(1));
|
||||||
|
});
|
||||||
|
|
||||||
title_box.addItem(b);
|
title_box.addItem(b);
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,8 @@ gui.widgets.Button = {
|
||||||
},
|
},
|
||||||
setText: func(text)
|
setText: func(text)
|
||||||
{
|
{
|
||||||
me._view.setText(me, text);
|
if( me._view != nil )
|
||||||
|
me._view.setText(me, text);
|
||||||
return me;
|
return me;
|
||||||
},
|
},
|
||||||
setCheckable: func(checkable)
|
setCheckable: func(checkable)
|
||||||
|
|
Loading…
Add table
Reference in a new issue