diff --git a/newfol b/newfol index fe42213..e799f22 100755 --- a/newfol +++ b/newfol @@ -55,25 +55,36 @@ def convert_color(x): locale.setlocale(locale.LC_ALL, '') +class View: + def render(self, loop): + pass + +class IntroView(View): + def render(self, loop): + intro1 = urwid.Text(("text", "newfol " + __version__), align="center") + intro2 = urwid.Text(("text", "Press q to quit at any time."), + align="center") + pile = urwid.Pile([ + urwid.AttrMap(intro1, "bg"), + urwid.AttrMap(intro2, "bg")]) + fill = urwid.Filler(pile) + map2 = urwid.AttrMap(fill, "bg") + loop.widget = map2 + + def start_curses(): palette = [ ('bg', 'black', 'yellow', '', 'black', '#ffa'), ('text', 'black', 'yellow', '', '#860', '#ffa'), ] - intro1 = urwid.Text(("text", "newfol " + __version__), align="center") - intro2 = urwid.Text(("text", "Press q to quit at any time."), - align="center") - pile = urwid.Pile([ - urwid.AttrMap(intro1, "bg"), - urwid.AttrMap(intro2, "bg")]) - fill = urwid.Filler(pile) - map2 = urwid.AttrMap(fill, "bg") - def exit_on_q(inp): if inp in ('q', 'Q'): raise urwid.ExitMainLoop() - loop = urwid.MainLoop(map2, palette, unhandled_input=exit_on_q) + + intro = IntroView() + loop = urwid.MainLoop(None, palette, unhandled_input=exit_on_q) loop.screen.set_terminal_properties(colors=256) + intro.render(loop) loop.run() def load_schemata():