change text locations

This commit is contained in:
Jannik Beyerstedt 2023-04-17 21:30:21 +02:00
parent c48c01f575
commit 61d7ef381d
2 changed files with 26 additions and 37 deletions

View file

@ -50,48 +50,37 @@ function node.render()
lower_width = font:width(lower_text, 20) lower_width = font:width(lower_text, 20)
font:write(960-(lower_width/2), 679, lower_text, 20, 1,1,1,1) font:write(960-(lower_width/2), 679, lower_text, 20, 1,1,1,1)
-- TODO -- available space y: 450 to 700
local size, k_x, v_x, y local fontsize = 40
local x_left = 90
local x_right = 1400
local y_start = 500
size = math.floor(HEIGHT/20) -- left side: network config, online status
y = 30+size*6 -- if v.network then
k_x, v_x = 30, 30+font:width("XXXXXXXXXXXXXXXX", size) -- font:write(x_left, y_start, "Mode: " .. v.network, fontsize, 1,1,1,1)
-- end
local function key(str)
font:write(k_x, y, str, size, 1,1,1,.5)
end
local function val(str, col)
col = col or {1,1,1,.5}
font:write(v_x, y, str, size, unpack(col))
y = y + size*1.1
end
if v.network then
key "Network config"
val(v.network)
end
if v.ethip then
key "Ethernet IPv4"
val(v.ethip)
end
if v.wlanip then
key "WiFi IPv4"
val(v.wlanip)
end
if v.gw then
key "Gateway"
val(v.gw)
end
font:write(x_left, y_start+50, "online", fontsize, col)
if v.online then if v.online then
key "Online status"
local col = {1,0,0,1} local col = {1,0,0,1}
if v.online == "online" then if v.online == "online" then
col = {0,1,0,1} col = {0,1,0,1}
end end
val(v.online, col) font:write(x_left, y_start+50, v.online, fontsize, col)
end end
-- right side: IP address
if v.ethip then
font:write(x_right, y_start, "Eth: " .. v.ethip, fontsize, 1,1,1,1)
end
if v.wlanip then
font:write(x_right, y_start+50, "WiFi: " .. v.wlanip, fontsize, 1,1,1,1)
end
if v.gw then
font:write(x_right, y_start+100, "GW: " .. v.gw, fontsize, 1,1,1,1)
end
end end

View file

@ -115,4 +115,4 @@ if __name__ == "__main__":
except: except:
traceback.print_exc() traceback.print_exc()
finally: finally:
time.sleep(15) time.sleep(1)