Advertisement
tima_gt

tde-desktop 3.4-alpha

Aug 19th, 2014
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.14 KB | None | 0 0
  1. os.loadAPI("/API/tde-msg")
  2. os.loadAPI("advPrint")
  3.  
  4. powermenu = "no"
  5. function aloadImage()
  6. end
  7. --[[ THIS IS SPARTAA!
  8. local function wallpaper()
  9. term.setBackgroundColor(colors.white)
  10. term.setTextColor(colors.black)
  11. term.clear()
  12. term.setCursorPos(1, 1)
  13. --wallpaper = paintutils.loadImage("tde-wallpaper")
  14. paintutils.drawImage(wallpaper, 3, 2)
  15. end
  16. Don't enable this option, this very bug function!
  17. ]]
  18.  
  19. local function restore()
  20. term.setBackgroundColor(colors.white)
  21. term.setTextColor(colors.black)
  22. term.clear()
  23. end
  24. local function menu()
  25. term.setBackgroundColor(colors.white)
  26. term.setTextColor(colors.black)
  27. term.setCursorPos(1, 1)
  28. write("[S] ")
  29. term.setCursorPos(5, 1)
  30. --term.setBackgroundColor(colors.black)
  31. --term.setTextColor(colors.white)
  32. write("[Menu]")
  33. term.setTextColor(colors.white)
  34. term.setCursorPos(43, 18)
  35. xx, yy = term.getSize()
  36. term.setCursorPos(xx-2, 1)
  37. term.setBackgroundColor(colors.blue)
  38. write("[P]")
  39. term.setCursorPos(xx-5, 1)
  40. term.setBackgroundColor(colors.white)
  41. term.setTextColor(colors.blue)
  42. write("===")
  43. term.setBackgroundColor(colors.white)
  44.  
  45. end
  46. aloadImage()
  47. term.setBackgroundColor(colors.white)
  48. term.setTextColor(colors.black)
  49. term.clear()
  50. term.setCursorPos(1, 1)
  51. wallpaper = paintutils.loadImage("tde-wallpaper")
  52. paintutils.drawImage(wallpaper, 3, 2)
  53. while true do
  54. paintutils.drawImage(wallpaper, 3, 2)
  55.  
  56. menu()
  57. x1, y1, x2, y2 = 1, 18, 6, 18
  58. local event, button, X, Y = os.pullEventRaw()
  59.   if event == "mouse_click" then
  60. if X >= xx-3 and X <= xx and Y == 3 and powermenu == "yes" then
  61. term.setBackgroundColor(colors.black)
  62. term.setTextColor(colors.white)
  63. term.clear()
  64. advPrint.tout(1, "* * * TDE-DESKTOP * * *")
  65. print("  Thank's for using!")
  66. break
  67. elseif X >= xx-2 and X <= xx and Y == 1 and powermenu ~= "yes" then
  68.     powermenu = "yes"
  69.     if powermenu == "yes" then
  70.   term.setCursorPos(xx-6, 2)
  71.   term.setBackgroundColor(colors.blue)
  72.   term.setTextColor(colors.white)
  73.   os.sleep(0.01)
  74.   write("  lock ")
  75.   os.sleep(0.01)
  76.   term.setCursorPos(xx-6, 3)
  77.   write("  exit ")
  78. end
  79. elseif X >= xx-3 and X <= xx and Y == 2 and powermenu == "yes" then
  80.   shell.run("tde-lock")
  81.   restore()
  82.   powermenu = "no"
  83. elseif X >= 1 and Y >= 1 and X<= 3 and Y <= 1 then
  84. term.setCursorPos(1, 1)
  85. term.setBackgroundColor(colors.white)
  86. shell.run("tde-settings")
  87. restore()
  88. elseif X>=5 and Y>= 1 and X<= 10 and Y<= 1 then
  89. shell.run("tde-menu")
  90. restore()
  91. elseif X >= xx-5 and X <= xx-3 and Y == 1 and messagemenu ~= "yes" then
  92.  
  93. i = 0
  94. while i <= 15 do
  95. term.setCursorPos(xx-i, 2)
  96. term.setBackgroundColor(colors.lightBlue)
  97. term.setTextColor(colors.yellow)
  98. write(" ")
  99. i = i + 1
  100. end
  101. messagemenu = "yes"
  102. i = 3
  103. while i <= 7 do
  104. term.setCursorPos(xx-15, i)
  105. write("                ")
  106. i = i + 1
  107. end
  108. term.setCursorPos(xx-15, 2)
  109. shell.run("check.tde")
  110. if fs.exists(".tde.msg1") then
  111. file = fs.open(".tde.msg1", "r")
  112. text = file.readLine()
  113. if string.len(text) > 16 then
  114. text = string.sub(text, 1, 16)
  115. end
  116. file.close()
  117. term.setCursorPos(xx-15, 4)
  118. write(text)
  119. shell.run("rm .tde.msg1")
  120. end
  121. --
  122. if fs.exists(".tde.msg2") then
  123. file = fs.open(".tde.msg2", "r")
  124. text = file.readLine()
  125. if string.len(text) > 16 then
  126. text = string.sub(text, 1, 16)
  127. end
  128. file.close()
  129. term.setCursorPos(xx-15, 6)
  130. write(text)
  131. shell.run("rm .tde.msg2")
  132. end
  133. --
  134. while true do
  135. local event, button, X, Y = os.pullEventRaw()
  136. if event == "mouse_click" then
  137. if X >= xx-15 and X <= xx-3 and Y == 2 and fs.exists(".update") then
  138. file = fs.open(".update", 'r')
  139. update = file.readLine()
  140. file.close()
  141. local function check()
  142. shell.run("rm .update")
  143. end
  144. local function WaitForAny1()
  145.   while true do
  146.   local event, button, X, Y = os.pullEventRaw()
  147.    if event == "mouse_click" then
  148.     break
  149.    end
  150.   end
  151. end
  152. parallel.waitForAny(check, WaitForAny1)
  153. term.setBackgroundColor(colors.black)
  154. term.setTextColor(colors.yellow)
  155. term.setCursorPos(1, 1)
  156. term.clear()
  157. print("tde-desktop 3.4 updating...")
  158. os.sleep(1)
  159. term.setTextColor(colors.white)
  160. shell.run("pastebin run "..update)
  161. else
  162. restore()
  163. messagemenu = "no"
  164. break
  165. end
  166. end
  167. end
  168. else
  169. if powermenu == "yes" then
  170. powermenu = "no"
  171. restore()
  172. end
  173. end
  174. end
  175. end
  176. os.unloadAPI("/API/tde-msg")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement