Made the evennia launcher menu work correctly again.

This commit is contained in:
Griatch 2015-01-18 22:49:18 +01:00
parent 4bc39029f1
commit 3159ceceaa

View file

@ -200,55 +200,44 @@ ABOUT_INFO= \
HELP_ENTRY = \ HELP_ENTRY = \
""" """
See python evennia.py -h for controlling Evennia directly from Enter 'evennia -h' for command-line options.
the command line.
Evennia has two parts that both must run:
Portal - the connection to the outside world (via telnet, web, ssh
etc). This is normally running as a daemon and don't need to
be reloaded unless you are debugging a new connection
protocol.
Server - the game server itself. This will often need to be reloaded
as you develop your game. The Portal will auto-connect to the
Server whenever the Server activates.
Use option (1) in a production environment. During development (2) is Use option (1) in a production environment. During development (2) is
usually enough, portal debugging is usually only useful if you are usually enough, portal debugging is usually only useful if you are
adding new protocols or are debugging an Evennia bug. adding new protocols or are debugging Evennia itself.
Reload with (5) to update the server with your changes without Reload with (5) to update the server with your changes without
disconnecting any players. disconnecting any players.
Reload and stop are sometimes poorly supported in Windows. If you have Note: Reload and stop are sometimes poorly supported in Windows. If you have
issues, log into the game to stop or restart the server instead. issues, log into the game to stop or restart the server instead.
""" """
MENU = \ MENU = \
""" """
+----Evennia Launcher-------------------------------------------------------+ +----Evennia Launcher-------------------------------------------+
| | | |
+--- Starting --------------------------------------------------------------+ +--- Starting --------------------------------------------------+
| | | |
| 1) (default): All output to logfiles. | | 1) (normal): All output to logfiles |
| 2) (game debug): Server outputs to terminal instead of to logfile. | | 2) (server devel): Server logs to terminal (-i option) |
| 3) (portal debug): Portal outputs to terminal instead of to logfile. | | 3) (portal devel): Portal logs to terminal |
| 4) (full debug): Both Server and Portal output to terminal | | 4) (full devel): Both Server and Portal logs to terminal |
| | | |
+--- Restarting ------------------------------------------------------------+ +--- Restarting ------------------------------------------------+
| | | |
| 5) Reload the Server | | 5) Reload the Server |
| 6) Reload the Portal (only works with portal/full debug) | | 6) Reload the Portal (only works with portal/full debug) |
| | | |
+--- Stopping --------------------------------------------------------------+ +--- Stopping --------------------------------------------------+
| | | |
| 7) Stopping both Portal and Server. | | 7) Stopping both Portal and Server |
| 8) Stopping only Server. | | 8) Stopping only Server |
| 9) Stopping only Portal. | | 9) Stopping only Portal |
| | | |
+---------------------------------------------------------------------------+ +---------------------------------------------------------------+
| h) Help i) About info q) Abort | | h) Help i) About info q) Abort |
+---------------------------------------------------------------------------+ +---------------------------------------------------------------+
""" """
ERROR_PYTHON_VERSION = \ ERROR_PYTHON_VERSION = \
@ -709,9 +698,6 @@ def run_menu():
""" """
This launches an interactive menu. This launches an interactive menu.
""" """
cmdstr = [sys.executable, EVENNIA_RUNNER]
while True: while True:
# menu loop # menu loop
@ -720,9 +706,9 @@ def run_menu():
# quitting and help # quitting and help
if inp.lower() == 'q': if inp.lower() == 'q':
sys.exit() return
elif inp.lower() == 'h': elif inp.lower() == 'h':
print HELP_ENTRY % EVENNIA_VERSION print HELP_ENTRY
raw_input("press <return> to continue ...") raw_input("press <return> to continue ...")
continue continue
elif inp.lower() in ('v', 'i', 'a'): elif inp.lower() in ('v', 'i', 'a'):
@ -736,41 +722,39 @@ def run_menu():
except ValueError: except ValueError:
print "Not a valid option." print "Not a valid option."
continue continue
errmsg = "The %s does not seem to be running."
if inp < 5:
if inp == 1: if inp == 1:
pass # default operation # start everything, log to log files
server_operation("start", "all", False, False)
elif inp == 2: elif inp == 2:
cmdstr.extend(['--iserver']) # start everything, server interactive start
server_operation("start", "all", True, False)
elif inp == 3: elif inp == 3:
cmdstr.extend(['--iportal']) # start everything, portal interactive start
server_operation("start", "server", False, False)
server_operation("start", "portal", True, False)
elif inp == 4: elif inp == 4:
cmdstr.extend(['--iserver', '--iportal']) # start both server and portal interactively
# start server server_operation("start", "server", True, False)
cmdstr.append("start") server_operation("start", "portal", True, False)
Popen(cmdstr, env=getenv()) elif inp == 5:
return # reload the server
elif inp < 10: server_operation("reload", "server", None, None)
if inp == 5:
if os.name == 'nt':
print "This operation is not supported under Windows. Log into the game to restart/reload the server."
return
kill(SERVER_PIDFILE, SIG, "Server reloaded.", errmsg % "Server", SERVER_RESTART, restart=True)
elif inp == 6: elif inp == 6:
if os.name == 'nt': # reload the portal
print "This operation is not supported under Windows." server_operation("reload", "portal", None, None)
return
kill(PORTAL_PIDFILE, SIG, "Portal reloaded (or stopped if in daemon mode).", errmsg % "Portal", PORTAL_RESTART, restart=True)
elif inp == 7: elif inp == 7:
kill(PORTAL_PIDFILE, SIG, "Stopped Portal.", errmsg % "Portal", PORTAL_RESTART) # stop server and portal
kill(SERVER_PIDFILE, SIG, "Stopped Server.", errmsg % "Server", SERVER_RESTART) server_operation("stop", "all", None, None)
elif inp == 8: elif inp == 8:
kill(SERVER_PIDFILE, SIG, "Stopped Server.", errmsg % "Server", SERVER_RESTART) # stop server
server_operation("stop", "server", None, None)
elif inp == 9: elif inp == 9:
kill(PORTAL_PIDFILE, SIG, "Stopped Portal.", errmsg % "Portal", PORTAL_RESTART) # stop portal
return server_operation("stop", "portal", None, None)
else: else:
print "Not a valid option." print "Not a valid option."
continue
return
def server_operation(mode, service, interactive, profiler): def server_operation(mode, service, interactive, profiler):