Advertisement
GameNationRDF

PC Control Center & Launcher beta 1.8 (Python)

Oct 6th, 2013
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 6.91 KB | None | 0 0
  1. #Python Control Center version "Beta 1.8"
  2. #Coded by Umut Bilgic (GameNationRDF)
  3. #It will be updated frequently with bug fixes and new feautures!
  4.  
  5. #Download link: https://www.dropbox.com/s/h0asj73c1kkfwyw/Control%20Center%20%26%20Launcher%20beta%201.8.py
  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.8")
  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 Google Search.")
  26.     changeLogList=[cl0,cl1]
  27.     spanLister(changeLogList)
  28.  
  29. def halfBlankScreenShort():
  30.     for i in range(10):
  31.         print("")
  32.  
  33. def halfBlankScreenLong():
  34.     for i in range(24):
  35.         print("")
  36.  
  37. def blank():
  38.     print ("")
  39.  
  40. def helpF1():
  41.     st1_1= ("Here are the things you can do (Viewing page 1): ")
  42.     st1_2= ("    * Type the website and hit enter to launch that website!")
  43.     st1_3= ("    * Type 'source' and then the URL to view the sourcecode of that website!")
  44.     st1_4= ("    * Type 'file', and write the location of a file/program to launch it!")
  45.     st1_5= ("    * Type 'c' to qucikly launch a file browser under 'file' menu!")
  46.     st1_6= ("    * Type 'p' to quickly launch a python shell under 'file' menu!)")
  47.     st1_7= ("    * Type 'math' to do basic math operations!")
  48.     st1_8= ("    * Type 'time' to set up a timer!")
  49.     st1_9= ("    * Type 'change' to view the changelog!")
  50.     st1_10=("    * Type 'ping' to open up the ping menu and ping websites!")
  51.     st1_11=("    * Type 'info' to get info about the program.")
  52.     st1_12=("    * Type 'os.' and command after dot to perform default OS commands!")
  53.     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]
  54.     spanLister(helpStringList1)
  55.  
  56. def helpF2():
  57.     st2_1= ("Here are the things you can do (Viewing page 2): ")
  58.     st2_2= ("    * Type 'search.' and the item after dot to search it with Google search!")
  59.     st2_3= ("    * Type 'dev' to launch developer webpage.")
  60.     st2_4= ("    * Type 'clear' to clear the program screen!")
  61.     st2_4=("Type 'exit' to close program.")
  62.     helpStringList2=[st2_1,st2_2,st2_3,st2_4]
  63.     spanLister(helpStringList2)
  64.    
  65. halfBlankScreenShort()
  66. print ("                             /--------------------\ ")
  67. print ("                             |  LOADING LAUNCHER  | ")
  68. print ("                             \--------------------/ ")
  69. time.sleep(0.5)
  70. halfBlankScreenLong()
  71.  
  72. print (" * Type 'help-1' or 'help-2' to see what you can do! * ")
  73. blank()
  74.  
  75. # --- MAIN LOOP --- #
  76.  
  77. while True:
  78.     userIn=str(input("Enter address/command here: "))
  79.     blank()
  80.  
  81.     if userIn == ("help-1"):
  82.         helpF1()
  83.  
  84.     elif userIn == ("help-2"):
  85.         helpF2()
  86.        
  87.     elif userIn == ("exit"):
  88.         print ("Program will close in a moment..")
  89.         time.sleep(0.7)
  90.         sys.exit()
  91.  
  92.     elif userIn.startswith("search.") is True:
  93.         searchList=userIn.split(".")
  94.         searchItem=searchList[1]
  95.         webbrowser.open("www.google.com/search?q="+searchItem)
  96.         blank()
  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