Advertisement
Guest User

info_of_computer_main

a guest
Feb 17th, 2020
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.71 KB | None | 0 0
  1.  
  2. -- Import libraries
  3. local GUI = require("GUI")
  4. local system = require("System")
  5. local paths = require("Paths")
  6. local fs = require("filesystem")
  7. local component = require("component")
  8. local image = require("Image")
  9. local EFI = component.eeprom
  10. local totalMemory = computer.totalMemory()
  11. local freeMemory = computer.freeMemory()
  12. local cache = fs.path(system.getCurrentScript())
  13. local lvlenergy = computer.energy()
  14. local maxenergy = computer.maxEnergy()
  15. local uptime = computer.uptime()
  16. local efiname = EFI.getLabel()
  17. local boot = EFI.getData()
  18.  
  19. ---------------------------------------------------------------------------------
  20.  
  21. -- Add a new window to MineOS workspace
  22. local workspace, window, menu = system.addWindow(GUI.filledWindow(1, 1, 113, 43, 0xE1E1E1))
  23.  
  24. -- Get localization table dependent of current system language
  25.  
  26. -- Add single cell layout to window
  27. local layout = window:addChild(GUI.layout(1, 1, window.width, window.height, 1, 1))
  28.  
  29. -- Add nice gray text object to layout
  30. layout:addChild(GUI.image(1, 1, image.load(cache .. "/Icon.pic")))
  31. layout:addChild(GUI.text(2, 2, 0x4B4B4B, "Привет, ".. system.getUser()))
  32. layout:addChild(GUI.text(3, 3, 0x4B4B4B, totalMemory .." КБ оперативной памяти у Вас всего"))
  33. layout:addChild(GUI.text(4, 4, 0x4B4B4B, freeMemory .. " КБ оперативной памяти у Вас свободно"))
  34. layout:addChild(GUI.text(5, 5, 0x4B4B4B, lvlenergy .. " зафиксированная энергия на компьютере(".. maxenergy .." максимальная энергия)"))
  35. layout:addChild(GUI.text(6, 6, 0x4B4B4B, uptime .. " секунд работает компьютер"))
  36. layout:addChild(GUI.text(7, 7, 0x4B4B4B, efiname .. " - название EFI"))
  37. layout:addChild(GUI.text(8, 8, 0x4B4B4B, boot .. " - адрес диска, с которого запущена операционная система"))
  38. layout:addChild(GUI.text(9, 9, 0x33DB40, "Функции будут добавляться"))
  39. layout:addChild(GUI.text(10, 10, 0x0049FF, "Разработано на проекте Hilarious(hil.su)"))
  40.  
  41.  
  42.  
  43. -- Customize MineOS menu for this application by your will
  44. --local contextMenu = menu:addContextMenuItem("File")
  45. --end
  46.  
  47. -- You can also add items without context menu
  48. menu:addItem("exit").onTouch = function()
  49.   window:remove()
  50. end
  51.  
  52. -- Create callback function with resizing rules when window changes its' size
  53. window.onResize = function(newWidth, newHeight)
  54.   window.backgroundPanel.width, window.backgroundPanel.height = newWidth, newHeight
  55.   layout.width, layout.height = newWidth, newHeight
  56. end
  57.  
  58. ---------------------------------------------------------------------------------
  59.  
  60. -- Draw changes on screen after customizing your window
  61. workspace:draw()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement