Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local verze = "20.0904.R1"
- local anim = 0.1
- local RamCesta = ("/C/system/RAM/elektro")
- local dataPath = "/C/system/Users/Administrator/Desktop/database/"
- local w, h = term.getSize()
- ----------------------------------------------------
- local f=fs.open("/C/system/RAM/user","r")
- user=f.readLine()
- f.close()
- local function bgc(barvaP) term.setBackgroundColor(barvaP) end
- local function txc(barvaP) term.setTextColor(barvaP) end
- local function curs(xi,yi) term.setCursorPos(xi,yi) end
- local function Barvy()
- if fs.exists ("/C/system/Users/"..user.."/.Registry/colors") then
- local data = fs.open("/C/system/Users/"..user.."/.Registry/colors", "r")
- BarPoz = tonumber(data.readLine())
- BarTxt = tonumber(data.readLine())
- data.close()
- end
- if BarPoz == nil or BarTxt == nil then BarPoz = 2048 BarTxt = 1 end
- end
- local function prc(text, y)
- local w = term.getSize()
- local _, cy = term.getCursorPos()
- curs(math.ceil((w-#text)/2), y or cy)
- write(text)
- end
- function ukonceni ()
- fs.delete (RamCesta)
- error()
- end
- function cbarva()
- lista.setTextColor(colors.black)
- lista.setBackgroundColor(colors.gray)
- end
- function defaultvalue()
- end
- function start()
- defaultvalue()
- Barvy()
- local myWindow = window.create(term.current(),w/2-11,h/2-5,25,9)
- myWindow.setBackgroundColor(colors.green)
- myWindow.setTextColor(colors.white)
- myWindow.clear()
- myWindow.setCursorPos (5, 5)
- myWindow.write"Spravce Elektra"
- myWindow.setCursorPos (1, 1)
- myWindow.write"Pepek@Soft"
- myWindow.setCursorPos (22, 9)
- myWindow.write"2023"
- sleep(1)
- menu()
- end
- function plocha()
- w, h = term.getSize()
- paintutils.drawLine(1, 1, 51, 1, BarPoz)
- paintutils.drawPixel (51,1, colors.red)
- term.setCursorPos (51,1)
- term.setTextColor(BarTxt)
- write "X"
- barW = window.create(term.current(),1,2,w,1)
- barW.setBackgroundColor(colors.gray)
- barW.clear()
- barW.setTextColor(colors.white)
- barW.setCursorPos(2,1)
- barW.write"Mereni spotreby >"
- pozadi = window.create(term.current(),13,3,w,h-2)
- pozadi.setBackgroundColor(colors.white)
- pozadi.setTextColor(colors.black)
- pozadi.clear()
- lista = window.create(term.current(),1,3,12,h-2)
- lista.setBackgroundColor(BarPoz)
- lista.setTextColor(BarTxt)
- lista.clear()
- lista.setCursorPos(2,3)
- lista.write"Prehled"
- lista.setCursorPos(2,5)
- lista.write"Fakturace"
- lista.setCursorPos(2,h-2)
- lista.setTextColor(colors.white)
- lista.write("Pepek@Soft")
- term.setBackgroundColor(colors.lightGray)
- end
- -----------------------------------------------------------------------------
- local page = "main"
- function main()
- barW.setCursorPos(21,1)
- barW.write"Prehled"
- barW.setCursorPos(19,1)
- barW.setCursorPos(w-7,1)
- barW.write"Refresh"
- SerT = window.create(term.current(),14,6,w-14,h-6)
- SerT.setBackgroundColor(colors.lightBlue)
- SerT.setTextColor(colors.black)
- SerT.clear()
- end
- function menu()
- plocha()
- if (page == "main") then
- main ()
- end
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if event == "mouse_click" and x >= 2 and x <= 12 and y == 5 then
- cbarva()
- lista.setCursorPos(1,3)--
- lista.write" Prehled "
- sleep(anim)
- page = "main"
- menu()
- elseif event == "mouse_click" and x >= 2 and x <= 12 and y == 7 then
- cbarva()
- lista.setCursorPos(1,5)--
- lista.write" Fakturace "
- sleep(anim)
- page = "main"
- menu()
- end
- if x == 51 and y == 1 then
- ukonceni ()
- else
- menu() -------- stejne jako nazev funkce
- end
- end
- end
- start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement