LearnProgramming/Hatter — pull request #11 by Expez (2013-02-16 12:27:19+00:00)
Title: Ui

The terminals and the views are implemented in the composite pattern:
terminal.draw will draw the terminal ui by calling the draw function of each view.

The mailbox format is read from the configuration file and with some metaprogramming the correct mailbox type is instantiated and used. Thus, it should be very easy to add support for another mailbox at present.

I initially wanted to name the Terminal class 'Display', but since termbox has support for capturing key events I think it makes sense to go with this abstraction instead. Even though this leads to the Terminal class having more than one responsibility. The future will thus bring Terminal.get_key_event, using the tb_poll_event method, which is a blocking call returning an event. We can then use this event to find out what commands the user issued.

I found a nice dataset, of thousands of emails, used as a training set for machine learning systems tackling automatic spam detection. The test mail included in the fixture is of somewhat explicit nature, and I expect more to follow :)