Add experimental urwid-based GUI
[mspang/pyceo.git] / pylib / csc / apps / urwid / info.py
1 import urwid
2
3 from csc.apps.urwid.widgets import *
4 from csc.apps.urwid.window import *
5
6 from csc.adm import accounts, members
7 from csc.common.excep import InvalidArgument
8
9 class InfoPage(WizardPanel):
10     def init_widgets(self):
11         self.userid = urwid.Text("")
12         self.name = urwid.Text("")
13         self.terms = urwid.Text("")
14         self.program = urwid.Text("")
15
16         self.widgets = [
17             urwid.Text( "Member Details" ),
18             urwid.Divider(),
19             self.name,
20             self.userid,
21             self.program,
22             urwid.Divider(),
23             self.terms,
24         ]
25     def focusable(self):
26         return False
27     def activate(self):
28         member  = self.state.get('member', {})
29         name    = member.get('cn', [''])[0]
30         userid  = self.state['userid']
31         program = member.get('program', [''])[0]
32         terms   = member.get('term', [])
33
34         self.name.set_text("Name: %s" % name)
35         self.userid.set_text("User: %s" % userid)
36         self.program.set_text("Program: %s" % program)
37         self.terms.set_text("Terms: %s" % ", ".join(terms))
38     def check(self):
39         pop_window()