run.py 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. ####################################
  2. # #
  3. # COPYRIGHT NOTICE #
  4. # #
  5. # This file is a part of Victori- #
  6. # ous Children Studio Organizer. #
  7. # Or simply VCStudio. Copyright #
  8. # of J.Y.Amihud. But don't be sad #
  9. # because I released the entire #
  10. # project under a GNU GPL license. #
  11. # You may use Version 3 or later. #
  12. # See www.gnu.org/licenses if your #
  13. # copy has no License file. Please #
  14. # note. Ones I used the GPL v2 for #
  15. # it. It's no longer the case. #
  16. # #
  17. ####################################
  18. import sys
  19. import subprocess
  20. # This is our main file. And untill now there was no love given to it. So I
  21. # will attemt to polish this file quite a bit. Because the code I see now is
  22. # just ugly. Anyway here we go.
  23. # We probably need the following modules.
  24. from settings import settings
  25. from settings import talk
  26. # Before we launch anything let's troubleshoot the bastard
  27. if not settings.read("VCStudio-is-good")\
  28. or not settings.read("Python-is-good")\
  29. or not settings.read("Language"):
  30. from troubleshooter import troubleshooter
  31. from troubleshooter import error_notify
  32. # It's quite a good thing to use extensions for the software using arguments
  33. # in the terminal. Stuff like -c console mode. Or other. So let's work on this
  34. if len(sys.argv) > 1:
  35. command = sys.argv[1]
  36. # So here I gonna have the command so to speak.
  37. if command == "-t":
  38. # Trouble shooter. Why not.
  39. from troubleshooter import troubleshooter
  40. elif command == "-c":
  41. # Console mode. Why not.
  42. from project_manager import pm_console
  43. pm_console.run()
  44. elif command == "-ms":
  45. # This one is a bit harder. Because we need a project name.
  46. if len(sys.argv) > 2:
  47. projectname = sys.argv[2]
  48. else:
  49. projectname = input("Project Name: ")
  50. # Then will launch it.
  51. subprocess.Popen(["python3", "network/multiuser_server.py", projectname])
  52. elif command == "-rm":
  53. # The read messages terminal app.
  54. from network import read_messages
  55. elif command == "-sm":
  56. # The read messages terminal app.
  57. from network import send_messages
  58. elif command == "-tc":
  59. # The read messages terminal app.
  60. from network import test_client
  61. else:
  62. # Well technically if they type --help or any other thing
  63. # it should give them a help page, right?
  64. print("VCStudio help page. For those of you, nerdy people.")
  65. print()
  66. print(" --help Gives you this help page. I know obvious.")
  67. print(" -c Console mode. Not all functions available.")
  68. print(" -t Troubleshooter. Run Troubleshooter.")
  69. print(" -ms Multiuser Server in terminal.")
  70. print(" -tc Test Multiuser Client.")
  71. print(" -rm Test Broadcast Reader.")
  72. print(" -sm Test Broadcast Writer.")
  73. print()
  74. print()
  75. else:
  76. from project_manager import pm_gtk
  77. # Some errors could happen while the program is running. Some things to
  78. # notify the user should be implemented.
  79. try:
  80. pm_gtk.run()
  81. except:
  82. error_notify.show()
  83. # Yeah. Now it looks better.