diff --git a/PowerManager.lua b/PowerManager.lua index 78690bf..35e94dc 100644 --- a/PowerManager.lua +++ b/PowerManager.lua @@ -110,6 +110,15 @@ function getTotal() end +function drawDesktop() + local halfWidth = newW / 2 + drawLine(halfWidth, 3, 1, 40, 0xffffff) + drawLine(1, 43, newW, 1, 0xffffff) + gpu.set(1, 42, "Speicherzellen") + gpu.set(halfWidth + 1, 42, "Generatoren") + gpu.set((newW - #frameTitle) / 2, 1, frameTitle) +end + local splashText = "Supercoole Stromanzeige" local frameTitle = "Power Monitor - Klicken zum Beenden" @@ -117,9 +126,7 @@ clearScreen() drawLine(1, 1, newW, 1, 0xbbbbbb) gpu.set((newW - #splashText) / 2, 24, splashText) os.sleep(1) - clearScreen() -gpu.set((newW - #frameTitle) / 2, 1, frameTitle) local cellsID = getCells() while true do @@ -127,12 +134,6 @@ while true do local count = 0 if x and y then goto quit end - local halfWidth = newW / 2 - drawLine(halfWidth, 3, 1, 40, 0xffffff) - drawLine(1, 43, newW, 1, 0xffffff) - gpu.set(1, 42, "Speicherzellen") - gpu.set(halfWidth + 1, 42, "Generatoren") - for address, name in pairs(cellsID) do local cell = component.proxy( address ) count = count + 1 @@ -147,4 +148,5 @@ end ::quit:: gpu.setResolution( oldW, oldH ) -clearScreen() \ No newline at end of file +clearScreen() +print("Programm beendet.") \ No newline at end of file diff --git a/installer.lua b/installer.lua index b45da3a..3a26732 100644 --- a/installer.lua +++ b/installer.lua @@ -1,4 +1,3 @@ -local greetingText = "Dieser Installer begleitet Sie für wenige Sekunden bei der Installation eines sehr coolen Programmes. Bitte tun Sie, was das Programm sagt, sonst wird es sauer." local headerText = "PowerManager - Installer\n" local startOnBootText = "Beim Boot ausführen?" local automaticUpdateText = "Automatisch updates herunterladen?" @@ -7,11 +6,11 @@ local automaticUpdateText = "Automatisch updates herunterladen?" local function askThatDamnUser(prompt) while true do print(">>> " .. prompt) - local userInput = term.read() + local userInput = io.read() - if userInput == "Y\n" then + if userInput == "Y" then return true - elseif userInput == "N\n" then + elseif userInput == "N" then return false else print("Hallo? => ( Y / N ) Nicht -> " .. userInput) @@ -19,6 +18,7 @@ local function askThatDamnUser(prompt) end end + local startOnBoot = askThatDamnUser(startOnBootText) local automaticUpdate = askThatDamnUser(automaticUpdateText) diff --git a/updater.lua b/updater.lua index b3635e2..df2ac25 100644 --- a/updater.lua +++ b/updater.lua @@ -3,10 +3,11 @@ print("Updaten? (Y/*)") local abfrage = io.read() if abfrage == "Y" then - print("Ja!") + print("Update und Installationsprogramm werden abgerufen...") os.execute("gitrepo seesberger/PowerManager /home/PowerManager") + dofile("/home/installer.lua") else - print("Nein!") + print("Ohne Update fortfahren...") os.sleep(1) end