tima_gt

tde-desktop

Sep 15th, 2013
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --GUI
  2. slc = 0
  3. --tde-paint:
  4. local function painter()
  5. term.setBackgroundColor(colors.blue)
  6. term.clear()
  7. term.setBackgroundColor(colors.black)
  8. term.setCursorPos(1,1)
  9. write("   Painter                                          ")
  10. term.setTextColor(colors.white)
  11. term.setBackgroundColor(colors.blue)
  12. --program
  13. print("Choise slot for paint")
  14. print("1")
  15. print("2")
  16. print("3")
  17. print("4")
  18. print("5 - desktop image")
  19. write(">")
  20. var = read()
  21. if var == "1" then
  22.  shell.run("paint /tde/paint/1")
  23.   elseif var == "2" then
  24.     shell.run("paint /tde/paint/2")
  25.      elseif var == "3" then
  26.        shell.run("paint /tde/paint/3")
  27.         elseif var == "4" then
  28.          shell.run("paint /tde/paint/4")
  29.           elseif var == "5" then
  30.             shell.run("paint /wallpaper")
  31.               shell.run("tde-desktop")
  32.           else
  33.            painter()
  34.   end
  35. end
  36. --tde-redstone:
  37. tBarC = 8
  38. tBartC = 1
  39. local function redsbskg()
  40. backColor = colors.pink
  41. term.setBackgroundColor(backColor)
  42. term.clear()
  43. end
  44. function RedGui()
  45. redsbskg()
  46. redstonegui = paintutils.loadImage("/tde/redstone.png")
  47. paintutils.drawImage(redstonegui, 0, 0)
  48. term.setCursorPos(1, 19)
  49. write("(C) tima_gt 2013-2014 GNU GPL project         ")
  50. term.setCursorPos(1, 2)
  51. write("Active redstone")
  52. term.setCursorPos(1, 15)
  53. write("DeActive redstone")
  54. term.setCursorPos(50, 1)
  55. write("X")
  56.  
  57. asd = true
  58. while asd == true do
  59. local event, button, X, Y = os.pullEventRaw()
  60.   if slc == 0 then
  61.     if event == "mouse_click" then
  62.       if X >=1 and X <=17 and Y >=3 and Y <=5 and button ==1 then slc = 0
  63.       redstone.setOutput("back", true)
  64.        elseif X >=1 and X <=17 and Y >=14 and Y <=18 and button ==1 then slc = 0
  65.       redstone.setOutput("back", false)
  66.        elseif X ==50 and Y ==1 and button ==1 then slc = 0
  67.         asd = false
  68.          shell.run("tde-desktop")
  69.         else
  70.         RedGui()
  71.     end
  72.   end
  73. end
  74. end
  75. end
  76. --tde-terminal:
  77. local function restoretext()
  78.  term.setTextColor(colors.black)
  79.  term.setBackgroundColor(colors.white)
  80.  term.clear()
  81. end
  82. local function tde_terminal()
  83. term.setBackgroundColor(colors.white)
  84. term.clear()
  85. term.setCursorPos(1,1)
  86. term.setTextColor(colors.white)
  87. term.setBackgroundColor(colors.black)
  88. write("   Terminal                                          ")
  89. term.setTextColor(colors.black)
  90. term.setBackgroundColor(colors.white)
  91. term.setCursorPos(1,2)
  92. write("For exit write exit")
  93. trues = true
  94. local xter yter = term.getCursorPos()
  95. term.setCursorPos(1,3)
  96. while trues == true do
  97. if xter == 1 and yter == 1 then
  98. term.setCursorPos(1, 2)
  99. end
  100. write(">")
  101. command = read()
  102. if command == "exit" then
  103.  print("Exitting...")
  104.  trues = false
  105.   elseif command == "ls" then
  106.    term.setBackgroundColor(colors.black)
  107.     shell.run(command)
  108.       term.setBackgroundColor(colors.white)
  109.       term.setTextColor(colors.black)
  110.       elseif command == "edit" then
  111.         shell.run("pastebin run vyAZc6tJ")
  112.   else
  113.    shell.run(command)
  114.    sleep(1)
  115.    restoretext()
  116.     end
  117.   end
  118. end
  119. --applications app:
  120. local function app_color()
  121. backColor = colors.white
  122. term.setBackgroundColor(backColor)
  123. term.clear()
  124. end
  125. --functions|
  126. --         V
  127. local function applicationslist()
  128. applist = paintutils.loadImage("/tde/program")
  129. paintutils.drawImage(applist, 2, 2)
  130. term.setCursorPos(4, 18)
  131. write("   Back  ")
  132. term.setCursorPos(3, 5)
  133. write(">_")
  134. end
  135.  
  136. --button-home-touch= [Y1=16 X1=1] [Y1=18 X2=14]
  137. --terminal-touch= [Y1=1 X1=1] [Y2=5 X2=9]
  138. --redstone-touch= [Y1=1 X1=11] [Y2=5 X2=20]
  139. --pictures-touch= [Y1=1 X1=23] [Y2=5 X2=31]
  140. applicationslist()
  141. local function whiletruedoapp()
  142. while true do
  143. local event, button, X, Y = os.pullEventRaw()
  144.   if slc == 0 then
  145.     if event == "mouse_click" then
  146.       if X >=1 and X <=14 and Y >=16 and Y <=19 and button ==1 then slc = 0
  147.       shell.run("tde-desktop")
  148.        elseif X >=2 and X <=10 and button == 1 and Y >=2 and Y <=5 then slc = 0
  149.        tde_terminal()
  150.        shell.run("tde-desktop")
  151.        term.setTextColor(colors.white)
  152.         shell.run("tde-desktop")
  153.          elseif X >=12 and X <=21 and button == 1 and Y >=2 and Y <=6 then slc = 0
  154.           RedGui()
  155.            shell.run("tde-desktop")
  156.             elseif X >=24 and X <=32 and button == 1 and Y >=2 and Y <=6 then slc = 0
  157.              painter() --painter
  158.               shell.run("tde-desktop")
  159.                --elseif X >=27 and X<=46 and button == 1 and Y >=2 and Y <=7 then slc = 0
  160.                 --shell.run("/ccYoutube") not working yet
  161.                  shell.run("pastebin run nCN4nL7A")
  162.                   elseif X >=2 and X <=14 and Y >=8 and Y <=14 and button == 1 then slc = 0
  163.                    shell.run("pastebin run vyAZc6tJ")
  164.                     shell.run("tde-desktop")
  165.         else
  166.         applicationslist()
  167.       end
  168.     end
  169.   end
  170.  end
  171. end
  172.  
  173. --tde-desktop
  174. local function fixtext()
  175. term.setTextColor(colors.white)
  176. end
  177.  
  178. local function desktop()
  179. --image fixer
  180. term.setBackgroundColor(colors.white)
  181. term.clear()
  182. --indicators
  183. term.setBackgroundColor(colors.black)
  184. term.setCursorPos(1, 1)
  185. write("[   Menu   ]                                    ")
  186. write("                                                   ")
  187. --Desktop image
  188. image = paintutils.loadImage("wallpaper")
  189. paintutils.drawImage(image, 1, 2)
  190. term.setCursorPos(1, 1)
  191. end
  192.  
  193.  
  194. function tmenu()
  195. term.setBackgroundColor(colors.black)
  196. term.setCursorPos(1,2)
  197. print("Applications")
  198. term.setCursorPos(1,3)
  199. print("  Shutdown  ")
  200. term.setCursorPos(1,4)
  201. print("  Restart   ")
  202. term.setCursorPos(1,5)
  203. print("  Settings  ")
  204. term.setCursorPos(1,6)
  205. print("   LogOut   ")
  206. end
  207.  
  208. fixtext()
  209. desktop()
  210. while true do
  211. local event, button, X, Y = os.pullEventRaw()
  212.   if slc == 0 then
  213.     if event == "mouse_click" then
  214.       if X >=2 and X <=12 and Y==1 and button ==1 then
  215.       slc = 1
  216.       tmenu()
  217.         elseif X>=2 and X <=12 and Y==1 and button ==1 then
  218.         slc = 2
  219.         else
  220.         desktop()
  221.       end
  222.      end
  223.    elseif slc == 1 then
  224.      if X>=1 and X<=12 and Y==2 and button ==1 then slc = 0
  225. app_color()
  226. applicationslist()
  227. whiletruedoapp()
  228.        elseif X >=1 and X <=12 and button == 1 and Y== 3 then slc = 0
  229.        os.shutdown()
  230.        elseif X>=1 and X<=12 and Y==4 and button ==1 then slc = 0
  231.        os.reboot()
  232.        elseif X>=1 and X<=12 and Y==6 and button ==1 then slc = 0
  233.        shell.run("pastebin run CcHLkdUT")
  234.        else
  235.        slc = 0
  236.        desktop()
  237.        end
  238.  
  239.         end
  240.      end
Advertisement
Add Comment
Please, Sign In to add comment