This commit is contained in:
2024-02-22 21:52:11 +01:00
parent 462907003b
commit 44a080a9a4
3 changed files with 18 additions and 15 deletions

View File

@@ -110,6 +110,15 @@ function getTotal()
end 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 splashText = "Supercoole Stromanzeige"
local frameTitle = "Power Monitor - Klicken zum Beenden" local frameTitle = "Power Monitor - Klicken zum Beenden"
@@ -117,9 +126,7 @@ clearScreen()
drawLine(1, 1, newW, 1, 0xbbbbbb) drawLine(1, 1, newW, 1, 0xbbbbbb)
gpu.set((newW - #splashText) / 2, 24, splashText) gpu.set((newW - #splashText) / 2, 24, splashText)
os.sleep(1) os.sleep(1)
clearScreen() clearScreen()
gpu.set((newW - #frameTitle) / 2, 1, frameTitle)
local cellsID = getCells() local cellsID = getCells()
while true do while true do
@@ -127,12 +134,6 @@ while true do
local count = 0 local count = 0
if x and y then goto quit end 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 for address, name in pairs(cellsID) do
local cell = component.proxy( address ) local cell = component.proxy( address )
count = count + 1 count = count + 1
@@ -147,4 +148,5 @@ end
::quit:: ::quit::
gpu.setResolution( oldW, oldH ) gpu.setResolution( oldW, oldH )
clearScreen() clearScreen()
print("Programm beendet.")

View File

@@ -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 headerText = "PowerManager - Installer\n"
local startOnBootText = "Beim Boot ausführen?" local startOnBootText = "Beim Boot ausführen?"
local automaticUpdateText = "Automatisch updates herunterladen?" local automaticUpdateText = "Automatisch updates herunterladen?"
@@ -7,11 +6,11 @@ local automaticUpdateText = "Automatisch updates herunterladen?"
local function askThatDamnUser(prompt) local function askThatDamnUser(prompt)
while true do while true do
print(">>> " .. prompt) print(">>> " .. prompt)
local userInput = term.read() local userInput = io.read()
if userInput == "Y\n" then if userInput == "Y" then
return true return true
elseif userInput == "N\n" then elseif userInput == "N" then
return false return false
else else
print("Hallo? => ( Y / N ) Nicht -> " .. userInput) print("Hallo? => ( Y / N ) Nicht -> " .. userInput)
@@ -19,6 +18,7 @@ local function askThatDamnUser(prompt)
end end
end end
local startOnBoot = askThatDamnUser(startOnBootText) local startOnBoot = askThatDamnUser(startOnBootText)
local automaticUpdate = askThatDamnUser(automaticUpdateText) local automaticUpdate = askThatDamnUser(automaticUpdateText)

View File

@@ -3,10 +3,11 @@ print("Updaten? (Y/*)")
local abfrage = io.read() local abfrage = io.read()
if abfrage == "Y" then if abfrage == "Y" then
print("Ja!") print("Update und Installationsprogramm werden abgerufen...")
os.execute("gitrepo seesberger/PowerManager /home/PowerManager") os.execute("gitrepo seesberger/PowerManager /home/PowerManager")
dofile("/home/installer.lua")
else else
print("Nein!") print("Ohne Update fortfahren...")
os.sleep(1) os.sleep(1)
end end