Advertisement
GameNationRDF

Python Control Center & Launcher beta 1.3

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