Advertisement
GameNationRDF

Python Control Center & Launcher beta 1.4

Sep 22nd, 2013
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 5.12 KB | None | 0 0
  1. #Python Control Center version "Beta 1.4"
  2. #Coded by GameNationRDF
  3. #It will be updated frequently with bug fixes and new feautures!
  4.  
  5. #Download link: #https://www.dropbox.com/s/us4yjtnxamnfseg/Control%20Center%20%26%20Launcher%20beta%201.4.py
  6.  
  7. import webbrowser
  8. import sys
  9. import os
  10. import string
  11. import time
  12. import urllib.request
  13. from math import sqrt
  14. currentVersion = ("Beta 1.4")
  15. developer = ("Umut Bilgic")
  16. year = ("2013")
  17.  
  18. def halfBlankScreenShort():
  19.     for i in range(10):
  20.         print("")
  21.  
  22. def halfBlankScreenLong():
  23.     for i in range(24):
  24.         print("")
  25.  
  26. def blank():
  27.     print ("")
  28.  
  29. def helpF():
  30.    
  31.     st1=("Here are the things you can do: ")
  32.     st2=("    * Type the website and hit enter to launch that website!")
  33.     st3=("    * Type 'source' and then the URL to view the sourcecode of that website!")
  34.     st4=("    * Type 'file', and write the location of a file/program to launch it!")
  35.     st5=("    * Type 'c' to qucikly launch a file browser under 'file' menu!")
  36.     st6=("    * Type 'math' to do basic math operations!")
  37.     st7=("    * Type 'time' to set up a timer!")
  38.     st8=("    * Type 'ping' to open up the ping menu and ping websites!")
  39.     st9=("    * Type 'info' to get info about the program.")
  40.     st10=("    * Type 'exit' to close the program!")
  41.     introStringList=[st1, st2, st3, st4, st5, st6, st7, st8, st9, st10]
  42.     for i in (introStringList):
  43.         print (i)
  44.         blank()
  45.  
  46. halfBlankScreenShort()
  47. print ("                             |--------------------|")
  48. print ("                             |  LOADING LAUNCHER  |")
  49. print ("                             |--------------------|")
  50. time.sleep(0.5)
  51. halfBlankScreenLong()
  52.  
  53. print ("Type 'help' to see what you can do!")
  54. blank()
  55.  
  56. # --- MAIN LOOP --- #
  57.  
  58. while True:
  59.     userIn=str(input("Enter address/command here: "))
  60.     blank()
  61.  
  62.     if userIn == ("help"):
  63.         helpF()
  64.        
  65.     elif userIn == ("exit"):
  66.         print ("Program will close in a moment..")
  67.         time.sleep(0.7)
  68.         sys.exit()
  69.        
  70.     elif userIn == ("file"):
  71.         filename=str(input("    * Enter file place: "))
  72.         blank()
  73.         if filename == ("c"):
  74.             c=("C:\ ")
  75.             os.system("start " + c)
  76.         else:
  77.             os.system("start "+filename)
  78.            
  79.     elif userIn.startswith("www") is True:
  80.         webbrowser.open(userIn)
  81.  
  82.     elif userIn == ("source"):
  83.         userURL=str(input("    * Enter the URL Address: "))
  84.         print (urllib.request.urlopen(userURL).read())
  85.         blank()
  86.        
  87.     elif userIn == ("math"):
  88.         op = str(input("    * Enter operation (+, -, *, /, exp, sqrt): "))
  89.         blank()
  90.         if op==("+") or op==("-") or op==("*") or op==("/") or op==("exp"):
  91.             input_1 = int(input("       * Enter first number:  "))
  92.             blank()
  93.             input_2 = int(input("       * Enter second number: "))
  94.             blank()
  95.         if op == ("+"):
  96.             print ("       > "+str(input_1 + input_2))
  97.             blank()
  98.         elif op == ("-"):
  99.             print ("       > "+str(input_1-input_2))
  100.             blank()
  101.         elif op == ("*"):
  102.             print ("       > "+str(input_1*input_2))
  103.             blank()
  104.         elif op == ("/"):
  105.             print ("       > "+str(input_1/input_2))
  106.             blank()
  107.         elif op == ("exp"):
  108.             print ("       > "+str(input_1**input_2))
  109.             blank()
  110.         elif op == ("sqrt"):
  111.             oneInput=int(input("        * Enter number: "))
  112.             blank()
  113.             print ("       > "+str(sqrt(oneInput)))
  114.             blank()
  115.  
  116.     elif userIn == ("ping"):
  117.         userWebsite=str(input("    * Enter the website: "))
  118.         os.system("ping "+(userWebsite))
  119.         blank()
  120.  
  121.     elif userIn == ("info"):
  122.         print (" - Current Version: "+currentVersion)
  123.         print (" - Developer: "+developer)
  124.         print (" - "+year)
  125.         blank()
  126.        
  127.     elif userIn == ("time"):
  128.         userTimeMode = str(input("  * Minutes or Seconds? (m/s): "))
  129.         blank()
  130.         if userTimeMode == ("m"):
  131.             userLimitMin = int(input("  * Set your timer (minutes): "))
  132.             blank()
  133.             userLimit = (userLimitMin * 60)
  134.         else:
  135.             userLimit = int(input("    * Set your timer (seconds): "))
  136.             blank()
  137.         userMode  = str(input("    * Display mode? (y/n): "))
  138.         blank()
  139.         for i in range(1, userLimit):
  140.             if userMode == ("y") or userMode == ("Y"):
  141.                 print (i)
  142.             time.sleep(1.0)
  143.         blank()
  144.         print ("|---------------------|")
  145.         print ("| Countdown finished! |")
  146.         print ("|---------------------|")
  147.         blank()
  148.  
  149.     elif ((userIn.endswith(".com") is True) or (userIn.endswith(".org") is True) or ((userIn.endswith(".net") is True)))  and userIn.startswith("www") is False:
  150.         userIn = ("www."+userIn)
  151.         webbrowser.open(userIn)
  152.         blank()
  153.        
  154.     else:
  155.         print ("Sorry, unknown command!")
  156.         blank()
  157.  
  158. #Changelog:
  159.         # -Fixed: Help command now showing the complete list.
  160.     # -Added download link!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement