Advertisement
GameNationRDF

Python Control Center & Launcher beta 1.2

Sep 21st, 2013
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.73 KB | None | 0 0
  1. #Python Control Center version "Beta 1.2"
  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 math
  10.  
  11. currentVersion = ("Beta 1.2")
  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. halfBlankScreenShort()
  27. print ("                             |--------------------|")
  28. print ("                             |  LOADING LAUNCHER  |")
  29. print ("                             |--------------------|")
  30. time.sleep(0.5)
  31. halfBlankScreenLong()
  32.  
  33.  
  34. def helpF():
  35.    
  36.     st1=("Here are the things you can do: ")
  37.     st2=("    * Type the website and hit enter to launch that website!")
  38.     st3=("    * Type 'file', and write the location of a file/program to launch it!")
  39.     st4=("    * Type 'c' to qucikly launch a file browser under 'file' menu!")
  40.     st5=("    * Type 'math' to do basic math operations!")
  41.     st6=("    * Type 'time' to set up a timer!")
  42.     st7=("    * Type 'ping' to open up the ping menu and ping websites!")
  43.     st8=("    * Type 'info' to get info about the program.")
  44.     st9=("    * Type 'exit' to close the program!")
  45.     introStringList=[st1, st2, st3, st4, st5, st6, st7, st8, st9]
  46.     for i in (introStringList):
  47.         print (i)
  48.         blank()
  49.  
  50. print ("Type 'help' to see what you can do!")
  51. blank()
  52.    
  53. while True:
  54.     userIn=str(input("Enter address/command here: "))
  55.     blank()
  56.  
  57.     if userIn == ("help"):
  58.         helpF()
  59.     elif userIn == ("exit"):
  60.         print ("Program will close in a second..")
  61.         time.sleep(1)
  62.         sys.exit()
  63.     elif userIn == ("file"):
  64.         filename=str(input("    * Enter file place: "))
  65.         blank()
  66.         if filename == ("c"):
  67.             c=("C:\ ")
  68.             os.system("start " + c)
  69.         else:
  70.             os.system("start "+filename)
  71.     elif userIn.startswith("www") is True:
  72.         webbrowser.open(userIn)
  73.     elif userIn == ("math"):
  74.         op = str(input("Enter operation (+, -, *, /, exp, sqrt): "))
  75.         blank()
  76.         if op==("+") or op==("-") or op==("*") or op==("/") or op==("exp"):
  77.             input_1 = int(input("   * Enter first number:  "))
  78.             input_2 = int(input("   * Enter second number: "))
  79.         if op == ("+"):
  80.             print (input_1 + input_2)
  81.             blank()
  82.         elif op == ("-"):
  83.             print (input_1-input_2)
  84.             blank()
  85.         elif op == ("*"):
  86.             print (input_1*input_2)
  87.             blank()
  88.         elif op == ("/"):
  89.             print (input_1/input_2)
  90.             blank()
  91.         elif op == ("exp"):
  92.             print (input_1**input_2)
  93.             blank()
  94.         elif op == ("sqrt"):
  95.             oneInput=int(input("    * Enter number: "))
  96.             blank()
  97.             print ("    *"+str((math.sqrt(oneInput))))
  98.             blank()
  99.  
  100.     elif userIn == ("ping"):
  101.         userWebsite=str(input("    * Enter the website: "))
  102.         os.system("ping "+(userWebsite))
  103.         blank()
  104.  
  105.     elif userIn == ("info"):
  106.         print (" - Current Version: "+currentVersion)
  107.         print (" - Developer: "+developer)
  108.         print (" - "+year)
  109.         blank()
  110.     elif userIn == ("time"):
  111.         userTimeMode = str(input("  * Minutes or Seconds? (m/s): "))
  112.         blank()
  113.         if userTimeMode == ("m"):
  114.             userLimitMin = int(input("  * Set your timer (minutes): "))
  115.             blank()
  116.             userLimit = (userLimitMin * 60)
  117.         else:
  118.             userLimit = int(input("    * Set your timer (seconds): "))
  119.             blank()
  120.         userMode  = str(input("    * Display mode? (y/n): "))
  121.         blank()
  122.         for i in range(1, userLimit):
  123.             if userMode == ("y") or userMode == ("Y"):
  124.                 print (i)
  125.             time.sleep(1.0)
  126.         blank()
  127.         print ("|---------------------|")
  128.         print ("| Countdown finished! |")
  129.         print ("|---------------------|")
  130.         blank()
  131.  
  132.     elif ((userIn.endswith(".com") is True) or (userIn.endswith(".org") is True) or ((userIn.endswith(".net") is True)))  and userIn.startswith("www") is False:
  133.         userIn = ("www."+userIn)
  134.         webbrowser.open(userIn)
  135.         blank()
  136.        
  137.     else:
  138.         print ("Sorry, unknown command!")
  139.         blank()
  140.  
  141. #Changelog:
  142.         # -General improvements over code and UI.
  143.         # -Help made optional.
  144.         # -Better URL handling (The URL does not have to start with "www." anymore, at least for ".com", ".org" and ".net" !)
  145.         # -A bug with 'sqrt' has been fixed.
  146.  
  147. #Edit:
  148.     # -Fixed: Version number not displaying correctly.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement