Clean up logging in handler.py
This commit is contained in:
parent
0c1770ef0a
commit
cc0f6f9f9e
|
@ -9,8 +9,10 @@ class Handler(npyscreen.ButtonPress):
|
|||
3: re-render the screen
|
||||
"""
|
||||
def whenPressed(self):
|
||||
self.parent.parentApp.log.debug('Send button pressed!')
|
||||
# This is the raw command from the user
|
||||
raw_command = self.parent.dialogueBox.value
|
||||
self.parent.dialogueBox.value = '' # Clear the dialogue box, TODO: This may become unneeded if issue #8 is fixed
|
||||
|
||||
# This is the raw command from the user
|
||||
parsed_command = raw_command.split()
|
||||
|
@ -18,11 +20,12 @@ class Handler(npyscreen.ButtonPress):
|
|||
try:
|
||||
command = parsed_command.pop(0)
|
||||
except IndexError:
|
||||
pass
|
||||
arguments = parsed_command
|
||||
self.parent.parentApp.log.warn('Command "{0}" could not be split, was it malformed or incomplete?'.format(raw_command))
|
||||
command = ''
|
||||
arguments = parsed_command # Whatever is left in the list, are arguments.
|
||||
|
||||
self.parent.parentApp.log.info('Parsed command "{0}" with arguments "{1}"'.format(command, arguments))
|
||||
self.parent.update_log('command: ' + command)
|
||||
self.parent.update_log('args: {0}'.format(arguments))
|
||||
self.parent.dialogueBox.value = ''
|
||||
self.parent.artContent.display()
|
||||
self.parent.parentApp.switchForm('GAME')
|
||||
|
|
Loading…
Reference in New Issue