Advertisement
1400_SpaceCat

ROS / old project

Aug 4th, 2015
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 13.81 KB | None | 0 0
  1. #RainOS / Version: 0.3.1 / Linux Version / Python version: 3.x / BASH
  2. import time,os,sys,datetime,ros_demo
  3. from time import gmtime,strftime
  4. from re import sub
  5.  
  6. class fc_Standart():
  7.     BLACK   =  '\033[0;30m'
  8.     RED     =  '\033[0;31m'
  9.     GREEN   =  '\033[0;32m'
  10.     YELLOW  =  '\033[0;33m'
  11.     BLUE    =  '\033[0;34m'
  12.     MAGENTA =  '\033[0;35m'
  13.     LBLUE   =  '\033[0;36m'
  14.     WHITE   =  '\033[0;37m'
  15.  
  16. class fc_Fat():
  17.     BLACK   =  '\033[1;30m'
  18.     RED     =  '\033[1;31m'
  19.     GREEN   =  '\033[1;32m'
  20.     YELLOW  =  '\033[1;33m'
  21.     BLUE    =  '\033[1;34m'
  22.     MAGENTA =  '\033[1;35m'
  23.     LBLUE   =  '\033[1;36m'
  24.     WHITE   =  '\033[1;37m'
  25.    
  26. class bg_Color():
  27.     BLACK   =  '\033[40m'
  28.     RED     =  '\033[41m'
  29.     GREEN   =  '\033[42m'
  30.     YELLOW  =  '\033[43m'
  31.     BLUE    =  '\033[44m'
  32.     MAGENTA =  '\033[45m'
  33.     LBLUE   =  '\033[46m'
  34.     WHITE   =  '\033[47m'
  35.  
  36. class end_Color():
  37.     ENDC      =  '\033[0m'
  38.  
  39. #LOGOS
  40. logo_0 = (fc_Fat.RED+ '''
  41.                   ----
  42.                  ------
  43.                 ---  ---
  44.                ----------  
  45.               ----    ----
  46. [ ARKON.F BIOP | Version is 2.6 | Wizzard-Texas Inc. ]
  47. ======================================================
  48. *114 (KB) is free of 120 (KB)
  49. *CPU have 33 (HZ)
  50. *CPU is x8 (BIT)
  51. *Cache equal 100 (BIT)
  52. ======================================================
  53.  
  54. <Load operation system | Load method is the SHELL-LOAD>
  55. Please wait . . .
  56. '''+end_Color.ENDC)
  57.  
  58. logo_1 = (fc_Standart.GREEN+ '''
  59.             ###########
  60.          ##################
  61.        #####################  
  62.    ######----------------######
  63.  ######-------------------######
  64. ######---------------------######
  65. ######---------------------######
  66. ######---------------------######
  67.  ######-------------------######
  68.   ######----------------######
  69.       #####################
  70.        ##################
  71.            #########\t\t''',fc_Fat.RED+'''OpenBPA LAN program
  72. '''+end_Color.ENDC)
  73.  
  74. logo_2 = (fc_Standart.LBLUE+ '''
  75.   \t           #
  76.   \t          ##
  77.   \t         ###
  78.   \t        #####
  79.   \t       ######
  80.   \t     ########
  81.   \t    ##########
  82.   \t   ###########
  83.   \t   ###########
  84.   \t    #########
  85.   \t     #######
  86. \t\t\t''',fc_Fat.GREEN+'"Rain" Operation System | Version 0.1.3'+end_Color.ENDC)
  87.  
  88. #MENUES
  89. menu_0 = ('''
  90.     1 [ Information about your PC ]
  91.     2 [ Information about your OS ]
  92.     3 [ Open Rain OS scripts      ]
  93.     4 [ Go to User folder         ]
  94.     5 [ Reboot your PC            ]
  95.     6 [ Shutdown your PC          ]
  96.     9 [ Open RainOS command line  ]
  97.     0 [ Refresh your screen       ]
  98. ''')
  99.  
  100. #INFORMATION
  101. info_0 = ('''
  102. 1 [ Mother board : computer-mother-14 / gElectronics ]
  103. 2 [ CPU          : zero-one-brain-2 / gElectronics   ]
  104. 3 [ Socket       : ge-420                            ]
  105. 4 [ Video        : El-Graphics-simple / electro-Me   ]
  106. 5 [ Audio        : MIDIonly-g2 / SoundsJohnson       ]
  107. 6 [ LAN-connecter: openBPA-model-2 / BPA-electronics ]\33[0m''')
  108.  
  109. info_1 =  ('''
  110. Kernel version:         0.7
  111. Programming language:   LightScript (version - 2.1)
  112. Command interpreter:    JoStar-CommandShell (version - 1.3)
  113. Interpreter zero:       rIOP-command
  114. InputOutput controller: rIOP-io
  115. Power controller:       rIOP-power
  116. StandardFilesFormat:    GEOSL
  117. Graphics controller:    xGraph
  118. LAN virtual controller: Open-BluePineapple-LAN
  119. HDD virtual controller: Open-BluePineapple-HDD
  120. Floppy disk controller: JSFloppyController
  121.           ''')
  122. #HELP
  123. help_1 = (fc_Standart.YELLOW+'''
  124. <-------------------------------------------->
  125. <-------------------HELP--------------------->
  126. <-------------------------------------------->
  127. cscr          -- clear screen
  128. exit          -- exit from the terminal
  129. date          -- show current date
  130. time          -- show current time
  131. date_time     -- show date and time together
  132. msg           -- open SimpleTextEditor                 
  133. lnetw         -- open lan-network
  134. pres          -- power reboot
  135. poff          -- power shutdown
  136. pcinfo        -- pc information
  137. osinfo        -- os information
  138. osdemo        -- show rain os demo-scripts
  139. oslogo        -- show os logotype
  140. <-------------------------------------------->
  141. <-------------------------------------------->
  142. <-------------------------------------------->
  143. \n'''+end_Color.ENDC)
  144.  
  145. help_2 = (fc_Standart.YELLOW+ '''
  146. <-------------------------------------------->
  147. <-------------------HELP--------------------->
  148. <-------------------------------------------->
  149. Command:
  150. write -- start writing message
  151. exit  -- for exit
  152. help  -- this help text
  153. smsg  -- secret message
  154. cscr  -- clear screen
  155.  
  156. When you will writing in text editor:
  157. *press <ENTER> for next line
  158. *<CTRL> + <D> to exit from text editor
  159. --------------------------------------------
  160. --------------------------------------------
  161. --------------------------------------------
  162. \n'''+end_Color.ENDC)
  163.  
  164. help_3 = (fc_Standart.YELLOW+'''
  165. Я не знаю, что делать. Пытаюсь всё поменять в своей жизни, но плохо.
  166. Пусто, никакой искры. Ты убиваешь молчанием. Я понимаю, что ты устроила
  167. настоящее испытание, которое убивает... Я это заслужил.
  168. Если ты нашла кого-то другого -- я пойму. Такой я тебе не нужен.
  169. Если же я тебя встречу, то я буду "туманным".
  170. '''+end_Color.ENDC)
  171.  
  172. #FUNCTIONS
  173.  
  174. def ShowIt(currentLogo,fts):
  175.     for x in range(len(currentLogo)):
  176.         print(currentLogo[x],end="")
  177.         time.sleep(fts)
  178.  
  179.     inp = 0
  180.     if (inp == 1):
  181.         input("\n\nPress any key to continue . . .")
  182.  
  183. def whats_timedate():
  184.     print(fc_Fat.BLUE+bg_Color.WHITE+"   Year: 1983",strftime("Month: %m Day: %d | Time: %H:%M:%S",gmtime())," "+end_Color.ENDC)
  185.  
  186. def whats_time():
  187.     print(fc_Fat.BLUE+bg_Color.WHITE+strftime("Time: %H:%M:%S",gmtime()),"  "+end_Color.ENDC)
  188. def whats_date():
  189.     print(fc_Fat.BLUE+bg_Color.WHITE+"   Year: 1983",strftime("Month: %m Day: %d",gmtime())," "+end_Color.ENDC)
  190.  
  191. def ROSscripts(choice):
  192.     os.system('clear')
  193.     print(fc_Fat.WHITE+bg_Color.BLUE+"   Year: 1983",strftime("Month: %m Day: %d | %H:%M:%S",gmtime()),'''  '''+end_Color.ENDC,
  194.         "\n",fc_Standart.YELLOW+'''[ Path: disk0/system/user/userfolder/ ]'''+end_Color.ENDC,'''
  195.  
  196. 1 [ Show how alphabet is working ]
  197. 2 [ Show how keyCheck is working ]
  198. 3 [ Show how menuGen is working  ]
  199. 4 [ Show how powerCon is working ]
  200. ''')
  201.     choice = input("\nChoose: ")
  202.     if ( choice == '1' ):
  203.         This = ros_demo.ROS_Alphabete
  204.         print(ros_demo.rosShow(This))
  205.         input("\n\nPress any key to continue . . .")
  206.     if ( choice == '2' ):
  207.         This = ros_demo.ROS_Keycheck
  208.         print(ros_demo.rosShow(This))
  209.         input("\n\nPress any key to continue . . .")
  210.     if ( choice == '3' ):
  211.         This = ros_demo.ROS_MenuGen
  212.         print(ros_demo.rosShow(This))
  213.         input("\n\nPress any key to continue . . .")
  214.     if ( choice == '4' ):
  215.         This = ros_demo.ROS_Powercontrol
  216.         print(ros_demo.rosShow(This))
  217.         input("\n\nPress any key to continue . . .")
  218.     else: print (bg_Color.RED+fc_Fat.WHITE+ "< ERROR IN TYPE >" +end_Color.ENDC)
  219.  
  220. def UserFolder():
  221.  
  222.     while( True ):
  223.         print("[ Path: disk0/system/user/userfolder/ ]")
  224.         file_action = input("What do you want to do? Answer: ")
  225.  
  226.         if ( file_action == "read" ):
  227.             open_filename = str(input("File: "))
  228.  
  229.             while( len(open_filename) < 1 ):
  230.                 open_filename = str(input("File too small! Name: "))
  231.  
  232.             open_fileformat = str(input("Format: "))
  233.             open_fileformat = open_filename.lower()
  234.  
  235.             while( len(open_fileformat) < 1 or open_fileformat > 4 ):
  236.                 open_fileformat = str(input("Format is wrong! Format: "))
  237.  
  238.             current_opened_file = open_filename+"."+open_fileformat
  239.            
  240.             if not os.path.exists(current_opened_file):
  241.                 print("I didn't see your file . . .")
  242.  
  243.             if os.path.exists(current_opened_file):
  244.                 openit = open("/userfolder/"+current_opened_file,"r")
  245.                 openit.read()
  246.                 print(openit)
  247.  
  248.         if ( file_action == "write" ):
  249.             write_filename = str(input("File: "))
  250.  
  251.             while( len(write_filename) < 1 ):
  252.                 write_filename = str(input("File too small! Name: "))
  253.  
  254.             write_fileformat = str(input("Format: "))
  255.             write_fileformat = open_fileformat.lower()
  256.  
  257.             while( len(write_fileformat) < 1 or len(write_fileformat) > 4 ):
  258.                 write_fileformat = str(input("Format is wrong! Format: "))
  259.  
  260.             current_writen_file = write_filename+"."+write_fileformat
  261.             writeit = open("/userfolder/"+current_writen_file,"w")
  262.  
  263.             chunks = []
  264.             check = 1
  265.                
  266.             while( True ):
  267.                 try:
  268.                     print(fc_Standart.GREEN+ "[",check,"]" +end_Color.ENDC)
  269.                     chunk = str(input(">"))
  270.                     check += 1
  271.                
  272.                 except EOFError:
  273.                     break
  274.                 chunks.append(chunk)
  275.            
  276.             return print("\n".join(chunks))
  277.             writeit.write()
  278.            
  279. def LoadSF():
  280.     for i in range(101):
  281.         print (fc_Fat.WHITE+bg_Color.BLUE+ "Upload files: [ ",i,"% ]" +end_Color.ENDC)
  282.         time.sleep(0.1)
  283.         os.system("clear")
  284.         if ( i == 101 ):
  285.             print (fc_Fat.WHITE+bg_Color.BLUE+ "All system files was uploaded!" +end_Color.ENDC)
  286.  
  287. def Reboot():
  288.     print ("Signal to ''ZEROLEVEL'' with logsSIGNAL = STOP PROCESS")
  289.     time.sleep(4)
  290.     for x in range(201):
  291.         print (fc_Fat.GREEN+"PROCESS...............................#",x,""+end_Color.ENDC)
  292.         time.sleep(0.03)
  293.         if ( x == 167 ):
  294.             print (fc_Fat.MAGENTA+bg_Color.BLACK+ "< ERROR: CAN'T STOP ''STRM-BREAK'', ''POFF-DO''" +end_Color.ENDC)
  295.             time.sleep(4)
  296.     if ( x == 207 ):
  297.         print (fc_Fat.WHITE+bg_Color.BLUE+"System reboot!"+end_Color.ENDC)
  298.    
  299. def Shutdown():
  300.     print ("Signal to ''ZEROLEVEL'' with logsSIGNAL = STOP PROCESS, HALT PC")
  301.     time.sleep(4)
  302.     print ("Goodbye! :)")
  303.     for x in range(218):
  304.         print (fc_Fat.GREEN+"PROCESS...............................#",x,""+end_Color.ENDC)
  305.         time.sleep(0.1)
  306.        
  307. def ProgressBar():
  308.     progress = 0
  309.     #while(progress!=101):
  310.     for progress in range(101):  
  311.         print(fc_Fat.BLUE+'\r{0}{1}%'.format('█' * progress * 1+end_Color.ENDC, progress),end='%')  
  312.         time.sleep(0.2)
  313.         #progress+=1
  314.    
  315. def SimpleTextEditor():
  316.     chunks = []
  317.     check = 1
  318.     while True:
  319.         try:
  320.             print(fc_Standart.GREEN+ "[",check,"]" +end_Color.ENDC);
  321.             chunk = str(input(">"))
  322.             check += 1
  323.         except EOFError:
  324.             break
  325.         chunks.append(chunk)
  326.     return print('\n '.join(chunks))
  327.        
  328. #PROGRAM CONSTRUCTION#
  329.  
  330. os.system('clear')
  331. currentLogo = logo_0
  332. gts = fts = 0.03
  333. inpg = inp = 0
  334. ShowIt(currentLogo,fts)
  335.  
  336. print(ProgressBar())
  337. #print(LoadSF())
  338. os.system("clear")
  339. while ( True ):
  340.     print (whats_timedate(),"\t")
  341.  
  342.     currentLogo = menu_0
  343.     inpg = inp = 0
  344.     gts = fts = 0.01
  345.     ShowIt(currentLogo,fts)
  346.  
  347.     cmdCh = input("Choose "+fc_Fat.BLUE+">>> "+end_Color.ENDC)
  348.    
  349.     if ( cmdCh == "1" ):
  350.         currentLogo = info_0
  351.         inpg = inp = 1
  352.         gts = fts = 0.01
  353.         ShowIt(currentLogo,fts)
  354.        
  355.     if ( cmdCh == "2" ):
  356.         currentLogo = info_1
  357.         inpg = inp = 1
  358.         gts = fts = 0.02
  359.         ShowIt(currentLogo,fts)
  360.  
  361.     if ( cmdCh == "3" ):
  362.         choice = cmdCh
  363.         ROSscripts(choice)
  364.        
  365.     if ( cmdCh == "4" ):
  366.         print(UserFolder())
  367.        
  368.     if ( cmdCh == "5" ):
  369.         cmdCh = input("You realy want to reboot your PC? [y/n]")
  370.         if ( cmdCh == "y" ):
  371.             print (Reboot(),loadSF())
  372.         if ( cmdCh == "n" ):
  373.             print (fc_Fat.BLUE+bg_Color.WHITE+ "Okay, let's continue this session! :)" +end_Color.ENDC)
  374.             time.sleep(2)
  375.             os.system("clear")
  376.             continue
  377.         else:
  378.             print (bg_Color.RED+fc_Fat.WHITE+ "< ERROR IN TYPE >" +end_Color.ENDC)
  379.        
  380.     if ( cmdCh == "6" ):
  381.         cmdCh = input("You realy want to shutdown your PC? [y/n]")
  382.         if ( cmdCh == "y" ):
  383.             print (Shutdown())
  384.             exit()
  385.         if ( cmdCh == "n" ):
  386.             print (fc_Fat.BLUE+bg_Color.WHITE+ "Okay, let's continue this session! :)" +end_Color.ENDC)
  387.             os.system("clear")
  388.             continue
  389.         else:
  390.             print (bg_Color.RED+fc_Fat.WHITE+ "< ERROR IN TYPE >" +end_Color.ENDC)
  391.            
  392.     if ( cmdCh == "9" ):
  393.         cmdVar = 'open'
  394.         x = 0
  395.         while( x != 1 ):
  396.             print(fc_Fat.BLUE+ "\n[ RainOS command shell | version 0.2 ] \n" +end_Color.ENDC)  
  397.             cmdAnswer = input("\nShell command "+fc_Fat.BLUE+">>> "+end_Color.ENDC)
  398.  
  399.             if (cmdAnswer == 'help'):
  400.                 print(help_1)
  401.            
  402.             if (cmdAnswer == 'cscr'):
  403.                 os.system("clear")
  404.  
  405.             if (cmdAnswer == 'date_time'):
  406.                 print(whats_timedate())
  407.             if (cmdAnswer == 'time'):
  408.                 print(whats_time())
  409.             if (cmdAnswer == 'date'):
  410.                 print(whats_date())
  411.                    
  412.             if (cmdAnswer == 'msg'):
  413.                 print(fc_Fat.BLUE+bg_Color.WHITE+ "Simple text editor" +end_Color.ENDC,"\n")
  414.                 while( True ):
  415.                     msgAnswer = input("What do you want?: ")
  416.                     msgAnswer = msgAnswer.lower()
  417.                        
  418.                     if ( msgAnswer == "exit" ):
  419.                         break
  420.                     if ( msgAnswer == 'help' ):
  421.                         print(help_2)
  422.                     if (msgAnswer == 'smsg'):
  423.                             print(help_3)
  424.                     if ( msgAnswer == 'cscr' ):
  425.                         os.system('clear')
  426.                    
  427.                     if ( msgAnswer == 'write' ):
  428.                         print(SimpleTextEditor())
  429.                    
  430.             if (cmdAnswer == 'lnetw'):
  431.                 print(fc_Fat.GREEN+ "Please wait . . ." +end_Color.ENDC)
  432.                 time.sleep(5)
  433.                 #print(ProgressBar())
  434.                 time.sleep(2)
  435.                 print(logo_1)
  436.                 time.sleep(1)
  437.                 print("Please, wait... I trying to connect")
  438.                 time.sleep(5)
  439.                 print(fc_Fat.RED+ "ERROR TO CONNECT. CODE < 1 >" +end_Color.ENDC)
  440.                        
  441.             if (cmdAnswer == 'exit'):
  442.                 x += 1
  443.                
  444.             if (cmdAnswer == 'pres'):
  445.                 print(Reboot())
  446.                 x+=1
  447.            
  448.             if (cmdAnswer == 'poff'):
  449.                 print(Shutdown())
  450.                 exit()
  451.  
  452.             if (cmdAnswer == 'pcinfo'):
  453.                 currentLogo = info_0
  454.                 inpg = inp = 0
  455.                 gts = fts = 0.01
  456.                 ShowIt(currentLogo,fts)
  457.            
  458.             if (cmdAnswer == 'osinfo'):
  459.                 currentLogo = info_1
  460.                 inpg = inp = 0
  461.                 gts = fts = 0.01
  462.                 ShowIt(currentLogo,fts)
  463.            
  464.             if (cmdAnswer == 'osdemo'):
  465.                 choice = cmdCh
  466.                 ROSscripts(choice)
  467.             if (cmdAnswer == 'oslogo'):
  468.                 currentLogo = logo_2
  469.                 inpg = inp = 0
  470.                 gts = fts = 0.01
  471.                 ShowIt(currentLogo,fts)
  472.        
  473.     if ( cmdCh == "0" ):
  474.         os.system("clear")
  475.         continue
  476.    
  477.     else:
  478.         print (bg_Color.RED+fc_Fat.WHITE+ "< ERROR IN TYPE >" +end_Color.ENDC)
  479.         time.sleep(2)
  480.         os.system('clear')
  481.         continue
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement