Advertisement
GameNationRDF

Python Control Center & Launcher beta 2.0

Jan 7th, 2014
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 7.11 KB | None | 0 0
  1. #Python Control Center version "Beta 2.0"
  2. #Coded by Umut Bilgic (GameNationRDF)
  3. #It will be updated frequently with bug fixes and new feautures!
  4.  
  5. #Download link: dropbox.com/s/pmhq3x98ktaooju/Control%20Center%20%26%20Launcher%20beta%202.0.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 2.0")
  15. developer = ("Umut Bilgic")
  16. year = ("2014")
  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=("    * Digit calculator added under 'math' ")
  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_5= ("    * 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.3)
  70. halfBlankScreenLong()
  71.  
  72. os.system("cls")
  73.  
  74. print (" * Type 'help-1' or 'help-2' to see what you can do! * ")
  75. blank()
  76.  
  77. # --- MAIN LOOP --- #
  78.  
  79. while True:
  80.  
  81.     userIn=str(input("Enter address/command here: "))
  82.     blank()
  83.  
  84.     if userIn == ("help-1"):
  85.         helpF1()
  86.  
  87.     elif userIn == ("help-2"):
  88.         helpF2()
  89.        
  90.     elif userIn == ("exit"):
  91.         print ("Program will close in a moment..")
  92.         time.sleep(0.7)
  93.         sys.exit("User input was 'exit' ")
  94.  
  95.     elif userIn.startswith("search.") is True:
  96.         searchList=userIn.split(".")
  97.         searchItem=searchList[1]
  98.         webbrowser.open("www.google.com/search?q="+searchItem)
  99.         blank()
  100.  
  101.     elif userIn.startswith("os.")is True:
  102.         cmdList=userIn.split(".")
  103.         os.system(cmdList[1])
  104.         blank()
  105.        
  106.     elif userIn == ("file"):
  107.         filename=str(input("    * Enter file place: "))
  108.         blank()
  109.         if filename == ("c"):
  110.             c=("C:\ ")
  111.             os.system("start "+c)
  112.         elif filename == ("p"):
  113.             os.system("start "+"C:\python33\python")
  114.         else:
  115.             os.system("start "+filename)
  116.  
  117.     elif userIn == ("dev"):
  118.         webbrowser.open("www.pastebin.com/u/GameNationRDF/")
  119.            
  120.     elif userIn.startswith("www.") is True:
  121.         webbrowser.open(userIn)
  122.  
  123.     elif userIn == ("source"):
  124.         userURL=str(input("    * Enter the URL Address: "))
  125.         print (urllib.request.urlopen(userURL).read())
  126.         blank()
  127.        
  128.     elif userIn == ("math"):
  129.         op = str(input("    * Enter operation (+, -, *, /, exp, sqrt, log, digit): "))
  130.         blank()
  131.         if op==("+") or op==("-") or op==("*") or op==("/") or op==("exp"):
  132.             input_1 = input("       * Enter first number:  ")
  133.             blank()
  134.             input_2 = input("       * Enter second number: ")
  135.             blank()
  136.         if op == ("+"):
  137.             print ("       > "+str(input_1 + input_2))
  138.         elif op == ("-"):
  139.             print ("       > "+str(input_1-input_2))
  140.         elif op == ("*"):
  141.             print ("       > "+str(input_1*input_2))
  142.         elif op == ("/"):
  143.             print ("       > "+str(input_1/input_2))
  144.         elif op == ("exp"):
  145.             print ("       > "+str(input_1**input_2))
  146.         elif op == ("sqrt"):
  147.             oneInput=int(input("        * Enter number: "))
  148.             blank()
  149.             print ("       > "+str(math.sqrt(oneInput)))
  150.         elif op == ("log"):
  151.             input_1 = int(input("       * Enter number:  "))
  152.             blank()
  153.             input_2 = int(input("       * Enter base: "))
  154.             blank()
  155.             print ("       > "+str(int((math.log(input_1, input_2)))))
  156.         elif op == ("digit"):
  157.             input_1 = int(input("       * Enter base: "))
  158.             blank()
  159.             input_2 = int(input("       * Enter exponent: "))
  160.             blank()
  161.             print ("       > "+str(int((math.ceil(input_2*(math.log(input_1,10))))+1)))
  162.         blank()
  163.            
  164.     elif userIn == ("ping"):
  165.         userWebsite=str(input("    * Enter the website: "))
  166.         os.system("ping "+(userWebsite))
  167.         blank()
  168.  
  169.     elif userIn == ("info"):
  170.         print (" - Current Version: "+currentVersion)
  171.         print (" - Developer: "+developer)
  172.         print (" - "+year)
  173.         blank()
  174.        
  175.     elif userIn == ("time"):
  176.         userTimeMode = str(input("  * Minutes or Seconds? (m/s): "))
  177.         blank()
  178.         if userTimeMode == ("m"):
  179.             userLimitMin = int(input("  * Set your timer (minutes): "))
  180.             blank()
  181.             userLimit = (userLimitMin * 60)
  182.         else:
  183.             userLimit = int(input("    * Set your timer (seconds): "))
  184.             blank()
  185.         userMode  = str(input("    * Display mode? (y/n): "))
  186.         blank()
  187.         for i in range(1, userLimit):
  188.             if userMode == ("y") or userMode == ("Y"):
  189.                 print (i)
  190.             time.sleep(1.0)
  191.         blank()
  192.         print ("/---------------------\ ")
  193.         print ("| Countdown finished! | ")
  194.         print ("\---------------------/ ")
  195.         blank()
  196.  
  197.     elif userIn==("change"):
  198.         viewChangeLog()
  199.  
  200.     elif ((userIn.endswith(".com") is True) or (userIn.endswith(".org") is True) or ((userIn.endswith(".net") is True)))  and userIn.startswith("www") is False:
  201.         userIn = ("www."+userIn)
  202.         webbrowser.open(userIn)
  203.         blank()
  204.  
  205.     elif userIn==("clear"):
  206.         halfBlankScreenShort()
  207.         os.system("cls")
  208.        
  209.     else:
  210.         print (" - Sorry, unknown command! -")
  211.         blank()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement