Advertisement
pepeknamornik

APP_vzor_2023+

Aug 21st, 2023
554
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.51 KB | None | 0 0
  1. local verze = "20.0904.R1"
  2. local anim = 0.1
  3. local RamCesta = ("/C/system/RAM/elektro")
  4. local dataPath = "/C/system/Users/Administrator/Desktop/database/"
  5. local w, h = term.getSize()
  6. ----------------------------------------------------
  7. local f=fs.open("/C/system/RAM/user","r")
  8. user=f.readLine()
  9. f.close()
  10.  
  11. local function bgc(barvaP) term.setBackgroundColor(barvaP) end
  12. local function txc(barvaP) term.setTextColor(barvaP) end
  13. local function curs(xi,yi) term.setCursorPos(xi,yi) end
  14.  
  15. local function Barvy()
  16.     if fs.exists ("/C/system/Users/"..user.."/.Registry/colors") then
  17.     local data = fs.open("/C/system/Users/"..user.."/.Registry/colors", "r")
  18.     BarPoz = tonumber(data.readLine())
  19.     BarTxt = tonumber(data.readLine())
  20.     data.close()
  21.     end
  22.     if BarPoz == nil or BarTxt == nil then BarPoz = 2048 BarTxt = 1 end
  23.        
  24. end
  25.  
  26.  
  27.  
  28. local function prc(text, y)
  29.   local w = term.getSize()
  30.   local _, cy = term.getCursorPos()
  31.   curs(math.ceil((w-#text)/2), y or cy)
  32.   write(text)
  33. end
  34.  
  35.  
  36. function ukonceni ()
  37.     fs.delete (RamCesta)
  38.     error()
  39. end
  40.  
  41. function cbarva()
  42. lista.setTextColor(colors.black)
  43. lista.setBackgroundColor(colors.gray)
  44. end
  45.  
  46. function defaultvalue()
  47. end
  48.  
  49. function start()
  50. defaultvalue()
  51. Barvy()
  52. local myWindow = window.create(term.current(),w/2-11,h/2-5,25,9)
  53. myWindow.setBackgroundColor(colors.green)
  54. myWindow.setTextColor(colors.white)
  55. myWindow.clear()
  56. myWindow.setCursorPos (5, 5)
  57. myWindow.write"Spravce Elektra"
  58. myWindow.setCursorPos (1, 1)
  59. myWindow.write"Pepek@Soft"
  60. myWindow.setCursorPos (22, 9)
  61. myWindow.write"2023"
  62. sleep(1)
  63. menu()
  64. end
  65.  
  66. function plocha()
  67. w, h = term.getSize()
  68. paintutils.drawLine(1, 1, 51, 1, BarPoz)
  69. paintutils.drawPixel (51,1, colors.red)
  70. term.setCursorPos (51,1)
  71. term.setTextColor(BarTxt)
  72. write "X"
  73. barW = window.create(term.current(),1,2,w,1)
  74. barW.setBackgroundColor(colors.gray)
  75. barW.clear()
  76. barW.setTextColor(colors.white)
  77. barW.setCursorPos(2,1)
  78. barW.write"Mereni spotreby >"
  79. pozadi = window.create(term.current(),13,3,w,h-2)
  80. pozadi.setBackgroundColor(colors.white)
  81. pozadi.setTextColor(colors.black)
  82. pozadi.clear()
  83. lista = window.create(term.current(),1,3,12,h-2)
  84. lista.setBackgroundColor(BarPoz)
  85. lista.setTextColor(BarTxt)
  86. lista.clear()
  87. lista.setCursorPos(2,3)
  88. lista.write"Prehled"
  89. lista.setCursorPos(2,5)
  90. lista.write"Fakturace"
  91. lista.setCursorPos(2,h-2)
  92. lista.setTextColor(colors.white)
  93. lista.write("Pepek@Soft")
  94. term.setBackgroundColor(colors.lightGray)
  95. end
  96. -----------------------------------------------------------------------------
  97. local page = "main"
  98.  
  99. function main()
  100. barW.setCursorPos(21,1)
  101. barW.write"Prehled"
  102. barW.setCursorPos(19,1)
  103.     barW.setCursorPos(w-7,1)
  104.     barW.write"Refresh"
  105.     SerT = window.create(term.current(),14,6,w-14,h-6)
  106.     SerT.setBackgroundColor(colors.lightBlue)
  107.     SerT.setTextColor(colors.black)
  108.     SerT.clear()
  109.    
  110. end
  111.  
  112. function menu()
  113.     plocha()
  114.     if (page == "main") then
  115.         main ()
  116.     end
  117.  
  118.     while true do
  119.         local event, button, x, y = os.pullEvent("mouse_click")
  120.         xy = x..","..y
  121.        
  122.         if event == "mouse_click" and x >= 2 and x <= 12 and y == 5 then
  123.         cbarva()
  124.         lista.setCursorPos(1,3)--
  125.         lista.write" Prehled    "
  126.         sleep(anim)
  127.         page = "main"
  128.         menu()
  129.         elseif event == "mouse_click" and x >= 2 and x <= 12 and y == 7 then
  130.         cbarva()
  131.         lista.setCursorPos(1,5)--
  132.         lista.write" Fakturace  "
  133.         sleep(anim)
  134.         page = "main"
  135.         menu()
  136.         end
  137.        
  138.        
  139.         if x == 51 and y == 1 then
  140.             ukonceni ()
  141.         else
  142.             menu() -------- stejne jako nazev funkce
  143.         end
  144.     end
  145. end
  146.  
  147. start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement