Advertisement
GameNationRDF

Control Center & Launcher Beta 1.6 (Python)

Sep 29th, 2013
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 6.94 KB | None | 0 0
  1. #Python Control Center version "Beta 1.6"
  2. #Coded by Umut Bilgic (GameNationRDF)
  3. #It will be updated frequently with bug fixes and new feautures!
  4.  
  5. #Download link: ---
  6.  
  7. import webbrowser
  8. import sys
  9. import os
  10. import time
  11. import urllib.request
  12. import math
  13.  
  14. currentVersion = ("Beta 1.6")
  15. developer = ("Umut Bilgic")
  16. year = ("2013")
  17.  
  18. def spanLister(LIST):
  19.     for i in (LIST):
  20.         print (i)
  21.         blank()
  22.  
  23. def viewChangeLog():
  24.     cl0=("In this version ("+currentVersion+") :")
  25.     cl1=("    * Added changelog viewer. (change)")
  26.     cl2=("    * Added logarith menu. (math/log)")
  27.     cl3=("    * Help menu fixed.")
  28.     cl4=("    * ASCII Box and unknown command got better.")
  29.     cl5=("    * Added screen cleaner. (clear)")
  30.     cl6=("    * Added multiple help pages.")
  31.     cl7=("    * Added developer page command (dev).")
  32.     cl8=("    * Added os system commands. (os (command))")
  33.     changeLogList=[cl0,cl1, cl2, cl3, cl4, cl5, cl6, cl7, cl8]
  34.     spanLister(changeLogList)
  35.  
  36. def halfBlankScreenShort():
  37.     for i in range(10):
  38.         print("")
  39.  
  40. def halfBlankScreenLong():
  41.     for i in range(24):
  42.         print("")
  43.  
  44. def blank():
  45.     print ("")
  46.  
  47. def helpF1():
  48.     st1_1= ("Here are the things you can do (Viewing page 1): ")
  49.     st1_2= ("    * Type the website and hit enter to launch that website!")
  50.     st1_3= ("    * Type 'source' and then the URL to view the sourcecode of that website!")
  51.     st1_4= ("    * Type 'file', and write the location of a file/program to launch it!")
  52.     st1_5= ("    * Type 'c' to qucikly launch a file browser under 'file' menu!")
  53.     st1_6= ("    * Type 'p' to quickly launch a python shell under 'file' menu!)")
  54.     st1_7= ("    * Type 'math' to do basic math operations!")
  55.     st1_8= ("    * Type 'time' to set up a timer!")
  56.     st1_9= ("    * Type 'change' to view the changelog!")
  57.     st1_10=("    * Type 'ping' to open up the ping menu and ping websites!")
  58.     st1_11=("    * Type 'info' to get info about the program.")
  59.     st1_12=("    * Type 'os.' and command after dot to perform default OS commands!")
  60.     helpStringList1=[st1_1,st1_2,st1_3,st1_4,st1_5,st1_6,st1_7,st1_8,st1_9,st1_10,st1_11,st1_12]
  61.     spanLister(helpStringList1)
  62.  
  63. def helpF2():
  64.     st2_1= ("Here are the things you can do (Viewing page 2): ")
  65.     st2_2= ("    * Type 'dev' to launch developer webpage.")
  66.     st2_3= ("    * Type 'clear' to clear the program screen!")
  67.     st2_4=("Type 'exit' to close program.")
  68.     helpStringList2=[st2_1,st2_2,st2_3,st2_4]
  69.     spanLister(helpStringList2)
  70.    
  71. halfBlankScreenShort()
  72. print ("                             /--------------------\ ")
  73. print ("                             |  LOADING LAUNCHER  | ")
  74. print ("                             \--------------------/ ")
  75. time.sleep(0.5)
  76. halfBlankScreenLong()
  77.  
  78. print (" * Type 'help-1' or 'help-2' to see what you can do! * ")
  79. blank()
  80.  
  81. # --- MAIN LOOP --- #
  82.  
  83. while True:
  84.     userIn=str(input("Enter address/command here: "))
  85.     blank()
  86.  
  87.     if userIn == ("help-1"):
  88.         helpF1()
  89.  
  90.     elif userIn == ("help-2"):
  91.         helpF2()
  92.        
  93.     elif userIn == ("exit"):
  94.         print ("Program will close in a moment..")
  95.         time.sleep(0.7)
  96.         sys.exit()
  97.  
  98.     elif userIn.startswith("os.")is True:
  99.         cmdList=userIn.split(".")
  100.         os.system(cmdList[1])
  101.         blank()
  102.        
  103.     elif userIn == ("file"):
  104.         filename=str(input("    * Enter file place: "))
  105.         blank()
  106.         if filename == ("c"):
  107.             c=("C:\ ")
  108.             os.system("start " + c)
  109.         if filename == ("p"):
  110.             os.system("start "+"C:\python33\python")
  111.         else:
  112.             os.system("start "+filename)
  113.  
  114.     elif userIn == ("dev"):
  115.         webbrowser.open("www.pastebin.com/u/GameNationRDF/")
  116.            
  117.     elif userIn.startswith("www") is True:
  118.         webbrowser.open(userIn)
  119.  
  120.     elif userIn == ("source"):
  121.         userURL=str(input("    * Enter the URL Address: "))
  122.         print (urllib.request.urlopen(userURL).read())
  123.         blank()
  124.        
  125.     elif userIn == ("math"):
  126.         op = str(input("    * Enter operation (+, -, *, /, exp, sqrt, log): "))
  127.         blank()
  128.         if op==("+") or op==("-") or op==("*") or op==("/") or op==("exp"):
  129.             input_1 = int(input("       * Enter first number:  "))
  130.             blank()
  131.             input_2 = int(input("       * Enter second number: "))
  132.             blank()
  133.         if op == ("+"):
  134.             print ("       > "+str(input_1 + input_2))
  135.             blank()
  136.         elif op == ("-"):
  137.             print ("       > "+str(input_1-input_2))
  138.             blank()
  139.         elif op == ("*"):
  140.             print ("       > "+str(input_1*input_2))
  141.             blank()
  142.         elif op == ("/"):
  143.             print ("       > "+str(input_1/input_2))
  144.             blank()
  145.         elif op == ("exp"):
  146.             print ("       > "+str(input_1**input_2))
  147.             blank()
  148.         elif op == ("sqrt"):
  149.             oneInput=int(input("        * Enter number: "))
  150.             blank()
  151.             print ("       > "+str(math.sqrt(oneInput)))
  152.             blank()
  153.         elif op == ("log"):
  154.             input_1 = int(input("       * Enter number:  "))
  155.             blank()
  156.             input_2 = int(input("       * Enter base: "))
  157.             blank()
  158.             print ("       > "+str(int((math.log(input_1, input_2)))))
  159.             blank()
  160.            
  161.     elif userIn == ("ping"):
  162.         userWebsite=str(input("    * Enter the website: "))
  163.         os.system("ping "+(userWebsite))
  164.         blank()
  165.  
  166.     elif userIn == ("info"):
  167.         print (" - Current Version: "+currentVersion)
  168.         print (" - Developer: "+developer)
  169.         print (" - "+year)
  170.         blank()
  171.        
  172.     elif userIn == ("time"):
  173.         userTimeMode = str(input("  * Minutes or Seconds? (m/s): "))
  174.         blank()
  175.         if userTimeMode == ("m"):
  176.             userLimitMin = int(input("  * Set your timer (minutes): "))
  177.             blank()
  178.             userLimit = (userLimitMin * 60)
  179.         else:
  180.             userLimit = int(input("    * Set your timer (seconds): "))
  181.             blank()
  182.         userMode  = str(input("    * Display mode? (y/n): "))
  183.         blank()
  184.         for i in range(1, userLimit):
  185.             if userMode == ("y") or userMode == ("Y"):
  186.                 print (i)
  187.             time.sleep(1.0)
  188.         blank()
  189.         print ("/---------------------\ ")
  190.         print ("| Countdown finished! | ")
  191.         print ("\---------------------/ ")
  192.         blank()
  193.  
  194.     elif userIn==("change"):
  195.         viewChangeLog()
  196.  
  197.     elif ((userIn.endswith(".com") is True) or (userIn.endswith(".org") is True) or ((userIn.endswith(".net") is True)))  and userIn.startswith("www") is False:
  198.         userIn = ("www."+userIn)
  199.         webbrowser.open(userIn)
  200.         blank()
  201.  
  202.     elif userIn==("clear"):
  203.         halfBlankScreenShort()
  204.         os.system("cls")
  205.        
  206.     else:
  207.         print (" - Sorry, unknown command! -")
  208.         blank()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement