Cleaner file. And --help
I've added arguments to the end for starting things like Multiuser server and other stuff.
This commit is contained in:
parent
3211c59167
commit
9c9cd8e1be
1 changed files with 65 additions and 23 deletions
88
run.py
88
run.py
|
@ -1,41 +1,83 @@
|
||||||
# THIS FILE IS A PART OF VCStudio
|
# THIS FILE IS A PART OF VCStudio
|
||||||
# PYTHON 3
|
# PYTHON 3
|
||||||
import sys
|
import sys
|
||||||
|
import subprocess
|
||||||
|
|
||||||
# If any arguments
|
# This is our main file. And untill now there was no love given to it. So I
|
||||||
console_force = False
|
# will attemt to polish this file quite a bit. Because the code I see now is
|
||||||
if len(sys.argv) > 1 and sys.argv[1] == "-c":
|
# just ugly. Anyway here we go.
|
||||||
console_force = True
|
|
||||||
|
|
||||||
# Importing various things
|
# We probably need the following modules.
|
||||||
from settings import settings
|
from settings import settings
|
||||||
from settings import talk
|
from settings import talk
|
||||||
|
|
||||||
|
# Before we launch anything let's troubleshoot the bastard
|
||||||
|
if not settings.read("VCStudio-is-good")\
|
||||||
|
or not settings.read("Python-is-good")\
|
||||||
|
or not settings.read("Language"):
|
||||||
|
from troubleshooter import troubleshooter
|
||||||
|
|
||||||
|
|
||||||
try:
|
# It's quite a good thing to use extensions for the software using arguments
|
||||||
|
# in the terminal. Stuff like -c console mode. Or other. So let's work on this
|
||||||
|
|
||||||
|
if len(sys.argv) > 1:
|
||||||
|
command = sys.argv[1]
|
||||||
|
|
||||||
# The :) I'm Happy To See You
|
# So here I gonna have the command so to speak.
|
||||||
talk.alert(talk.text("imissedyouwelcommessage"))
|
|
||||||
|
|
||||||
if not console_force:
|
if command == "-t":
|
||||||
# I'm importing it here so it wont give problems on non GTK systems.
|
# Trouble shooter. Why not.
|
||||||
from project_manager import pm_gtk
|
from troubleshooter import troubleshooter
|
||||||
pm_gtk.run()
|
|
||||||
|
|
||||||
else:
|
elif command == "-c":
|
||||||
|
# Console mode. Why not.
|
||||||
from project_manager import pm_console
|
from project_manager import pm_console
|
||||||
pm_console.run()
|
pm_console.run()
|
||||||
|
|
||||||
|
elif command == "-ms":
|
||||||
except Exception:
|
|
||||||
|
# This one is a bit harder. Because we need a project name.
|
||||||
|
if len(sys.argv) > 2:
|
||||||
|
projectname = sys.argv[2]
|
||||||
|
else:
|
||||||
|
projectname = input("Project Name: ")
|
||||||
|
|
||||||
|
# Then will launch it.
|
||||||
|
subprocess.Popen(["python3", "network/multiuser_server.py", projectname])
|
||||||
|
|
||||||
# If some mistake happened
|
elif command == "-rm":
|
||||||
|
# The read messages terminal app.
|
||||||
# Testing the software
|
from network import read_messages
|
||||||
from troubleshooter import troubleshooter
|
|
||||||
|
|
||||||
if not settings.read("Python-is-good"):
|
elif command == "-sm":
|
||||||
# Project Manager console version
|
# The read messages terminal app.
|
||||||
from project_manager import pm_console
|
from network import send_messages
|
||||||
pm_console.run()
|
|
||||||
|
elif command == "-tc":
|
||||||
|
# The read messages terminal app.
|
||||||
|
from network import test_client
|
||||||
|
|
||||||
|
else:
|
||||||
|
|
||||||
|
# Well technically if they type --help or any other thing
|
||||||
|
# it should give them a help page, right?
|
||||||
|
|
||||||
|
print("VCStudio help page. For those of you, nerdy people.")
|
||||||
|
print()
|
||||||
|
print(" --help Gives you this help page. I know obvious.")
|
||||||
|
print(" -c Console mode. Not all functions available.")
|
||||||
|
print(" -t Troubleshooter. Run Troubleshooter.")
|
||||||
|
print(" -ms Multiuser Server in terminal.")
|
||||||
|
print(" -tc Test Multiuser Client.")
|
||||||
|
print(" -rm Test Broadcast Reader.")
|
||||||
|
print(" -sm Test Broadcast Writer.")
|
||||||
|
print()
|
||||||
|
print()
|
||||||
|
|
||||||
|
|
||||||
|
else:
|
||||||
|
from project_manager import pm_gtk
|
||||||
|
pm_gtk.run()
|
||||||
|
|
||||||
|
# Yeah. Now it looks better.
|
||||||
|
|
Loading…
Add table
Reference in a new issue