Show "Rep Terms" when displaying member
[public/pyceo-broken.git] / ceo / urwid / info.py
1 import urwid
2 from ceo.urwid.widgets import *
3 from ceo.urwid.window import *
4
5 class InfoPage(WizardPanel):
6     def init_widgets(self):
7         self.userid = urwid.Text("")
8         self.name = urwid.Text("")
9         self.terms = urwid.Text("")
10         self.nmterms = urwid.Text("")
11         self.program = urwid.Text("")
12
13         self.widgets = [
14             urwid.Text( "Member Details" ),
15             urwid.Divider(),
16             self.name,
17             self.userid,
18             self.program,
19             urwid.Divider(),
20             self.terms,
21             self.nmterms,
22         ]
23     def focusable(self):
24         return False
25     def activate(self):
26         member  = self.state.get('member', {})
27         name    = member.get('cn', [''])[0]
28         userid  = self.state['userid']
29         program = member.get('program', [''])[0]
30         shell   = member.get('loginShell', [''])[0]
31         terms   = member.get('term', [])
32         nmterms = member.get('nonMemberTerm', [])
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.program.set_text("Shell: %s" % shell)
38         self.terms.set_text("Terms: %s" % ", ".join(terms))
39
40         if nmterms:
41             self.nmterms.set_text("Rep Terms: %s" % ", ".join(nmterms))
42     def check(self):
43         pop_window()