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 {
|
||||
var p = package;
|
||||
var b = gui.widgets.Button.new(me._scroll_content, style, {});
|
||||
var installed = p.installed;
|
||||
var install_text = sprintf("Install (%.1fMB)", p.fileSize/1024/1024);
|
||||
|
||||
if( installed )
|
||||
if( p.installed )
|
||||
b.setText("Remove");
|
||||
else
|
||||
b.setText(install_text);
|
||||
|
||||
b.listen("clicked", func
|
||||
{
|
||||
if( installed )
|
||||
if( p.installed )
|
||||
{
|
||||
p.uninstall();
|
||||
installed = 0;
|
||||
b.setText(install_text);
|
||||
}
|
||||
else
|
||||
{
|
||||
b.setEnabled(0)
|
||||
.setText("Wait...");
|
||||
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);
|
||||
});
|
||||
b.setText("Wait...").setEnabled(0);
|
||||
p.install();
|
||||
}
|
||||
});
|
||||
|
||||
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);
|
||||
})();
|
||||
|
||||
|
|
|
@ -15,7 +15,8 @@ gui.widgets.Button = {
|
|||
},
|
||||
setText: func(text)
|
||||
{
|
||||
me._view.setText(me, text);
|
||||
if( me._view != nil )
|
||||
me._view.setText(me, text);
|
||||
return me;
|
||||
},
|
||||
setCheckable: func(checkable)
|
||||
|
|
Loading…
Reference in a new issue