From 7c087c69a843750db9db812a162659ff58596ad0 Mon Sep 17 00:00:00 2001 From: Stefano Babic Date: Thu, 6 Dec 2018 10:28:45 +0100 Subject: [PATCH] Added a button to go back from progress window It is possible to go back from the network window pressing the esc key, but this is not possible when the device has only a touchscreen / mouse. Add a "Cancel" button to go back to the main window. Signed-off-by: Stefano Babic --- SWUpdateGUI.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/SWUpdateGUI.lua b/SWUpdateGUI.lua index 2aa36a8..046adf9 100755 --- a/SWUpdateGUI.lua +++ b/SWUpdateGUI.lua @@ -295,6 +295,15 @@ local progwin = ui.Window:new Id = "message-box", } } + }, + ui.Button:new + { + Id = "progress-cancel-button", + Text = L.BACK, + Disabled = true, + onClick = function(self) + app:switchwindow("network-window", "MainWindow") + end } } } @@ -489,6 +498,8 @@ app = ui.Application:new msgUser = function(self,msg) local prog = msg[-1] self:switchtoprog(self) + g = self:getById("progress-cancel-button") + g:setValue("Disabled", true) t = {} for field in string.gmatch(prog, "%S+" ) do k,v = string.match(field, "(%a+)=\'(.*)\'") @@ -537,9 +548,13 @@ app = ui.Application:new elseif status == STATUS_FAILURE then g:setValue("Text", L.FAILURE) g:setValue("Style", "color: #ff0000;") + g = self:getById("progress-cancel-button") + g:setValue("Disabled", false) elseif status == STATUS_SUCCESS then g:setValue("Text", L.SUCCESS) g:setValue("Style", "color: #00ff00;") + g = self:getById("progress-cancel-button") + g:setValue("Disabled", false) elseif status == STATUS_START then g:setValue("Text", L.STARTING_UPDATE) else