shadowbrokers-exploits/windows/fuzzbunch/pyreadline/console/event.py
2017-04-14 11:45:07 +02:00

25 lines
No EOL
1 KiB
Python

class Event(object):
'''Represent events from the console.'''
def __init__(self, console, input):
pass
def __repr__(self):
'''Display an event for debugging.'''
if self.type in ['KeyPress', 'KeyRelease']:
s = "%s char='%s'%d keysym='%s' keycode=%d:%x state=%x keyinfo=%s" % \
(self.type, self.char, ord(self.char), self.keysym, self.keycode, self.keycode,
self.state, self.keyinfo)
elif self.type in ['Motion', 'Button']:
s = '%s x=%d y=%d state=%x' % (self.type, self.x, self.y, self.state)
elif self.type == 'Configure':
s = '%s w=%d h=%d' % (self.type, self.width, self.height)
elif self.type in ['FocusIn', 'FocusOut']:
s = self.type
elif self.type == 'Menu':
s = '%s state=%x' % (self.type, self.state)
else:
s = 'unknown event type'
return s
# def __str__(self):
# return "('%s',%s,%s,%s)"%(self.char,self.key,self.state,self.keyinfo)