Mercurial > libervia-backend
comparison frontends/primitivus/primitivus @ 112:f551e44adb25
Primitivus first draft
- Sortilège is recoded using urwid, and renamed in Primitivus as it is no more based on curses
- soritlege code moved to sortilege_old, and deprecated
- Primitivus first draft, begining of ProfileManager widget
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 30 Jun 2010 14:24:24 +0800 |
parents | |
children | e5ca22113280 |
comparison
equal
deleted
inserted
replaced
111:6c927140ba82 | 112:f551e44adb25 |
---|---|
1 #!/usr/bin/python | |
2 # -*- coding: utf-8 -*- | |
3 | |
4 """ | |
5 Primitivus: a SAT frontend | |
6 Copyright (C) 2009, 2010 Jérôme Poisson (goffi@goffi.org) | |
7 | |
8 This program is free software: you can redistribute it and/or modify | |
9 it under the terms of the GNU General Public License as published by | |
10 the Free Software Foundation, either version 3 of the License, or | |
11 (at your option) any later version. | |
12 | |
13 This program is distributed in the hope that it will be useful, | |
14 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 GNU General Public License for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
19 along with this program. If not, see <http://www.gnu.org/licenses/>. | |
20 """ | |
21 | |
22 | |
23 from quick_frontend.quick_app import QuickApp | |
24 from quick_frontend.quick_chat_list import QuickChatList | |
25 from quick_frontend.quick_contact_list import QuickContactList | |
26 from quick_frontend.quick_contact_management import QuickContactManagement | |
27 import urwid | |
28 from profile_manager import ProfileManager | |
29 import pdb | |
30 """from window import Window | |
31 from editbox import EditBox | |
32 from statusbar import StatusBar | |
33 from chat import Chat | |
34 from tools.jid import JID""" | |
35 import logging | |
36 from logging import debug, info, error | |
37 #import locale | |
38 import sys, os | |
39 #from curses import ascii | |
40 #import locale | |
41 #from signal import signal, SIGWINCH | |
42 #import fcntl | |
43 #import struct | |
44 #import termios | |
45 #from boxsizer import BoxSizer | |
46 | |
47 | |
48 ### logging configuration FIXME: put this elsewhere ### | |
49 logging.basicConfig(level=logging.CRITICAL, #TODO: configure it to put messages in a log file | |
50 format='%(message)s') | |
51 ### | |
52 | |
53 const_APP_NAME = "Primitivus" | |
54 const_PALETTE = [('title', 'black', 'light gray', 'standout,underline'),] | |
55 | |
56 class PrimitivusApp(QuickApp): | |
57 | |
58 def __init__(self): | |
59 QuickApp.__init__(self) #XXX: yes it's an unusual place for the constructor of a parent class, but the init order is important | |
60 | |
61 ## main loop setup ## | |
62 self.main_widget = self.__buildMainWidget() | |
63 self.loop = urwid.MainLoop(self.main_widget, const_PALETTE, event_loop=urwid.GLibEventLoop(), unhandled_input=self.key_handler) | |
64 | |
65 def start(self): | |
66 self.loop.run() | |
67 | |
68 def key_handler(self, input): | |
69 if input in ('q', 'Q') or input == 'ctrl x': | |
70 raise urwid.ExitMainLoop() | |
71 | |
72 def __buildMainWidget(self): | |
73 main_widget = ProfileManager(self) | |
74 return main_widget | |
75 | |
76 | |
77 sat = PrimitivusApp() | |
78 sat.start() |