hooke.ui.gui was getting complicated, so I stripped it down for a moment.
[hooke.git] / hooke / ui / gui / handler / string.py
1 # Copyright
2
3 """Define :class:`StringHandler` to handle
4 :class:`~hooke.interaction.StringRequest`\s.
5 """
6
7 import wx
8
9 from . import Handler
10
11
12
13
14 class StringHandler (Handler):
15     def __init__(self):
16         super(StringHandler, self).__init__(name='string')
17
18     def run(self, hooke_frame, msg):
19         pass
20
21     def _string_request_prompt(self, msg):
22         if msg.default == None:
23             d = ' '
24         else:
25             d = ' [%s] ' % msg.default
26         return msg.msg + d
27
28     def _string_request_parser(self, msg, response):
29         return response.strip()
30