diff --git a/ceo/urwid/main.py b/ceo/urwid/main.py index 27c1d0c..3417667 100644 --- a/ceo/urwid/main.py +++ b/ceo/urwid/main.py @@ -4,16 +4,6 @@ from ceo.urwid.window import * from ceo.urwid import newmember, renew, info, search, positions, groups, \ shell, library, databases -ui = urwid.curses_display.Screen() - -ui.register_palette([ - # name, foreground, background, mono - ('banner', 'light gray', 'default', None), - ('menu', 'light gray', 'default', 'bold'), - ('selected', 'black', 'light gray', 'bold'), -]) - - def program_name(): cwords = [ "CSC" ] * 20 + [ "Club" ] * 10 + [ "Campus" ] * 5 + \ [ "Communist", "Canadian", "Celestial", "Cryptographic", "Calum's", diff --git a/ceo/urwid/newmember.py b/ceo/urwid/newmember.py index 62f54f6..fd76cf1 100644 --- a/ceo/urwid/newmember.py +++ b/ceo/urwid/newmember.py @@ -172,7 +172,14 @@ class EndPage(WizardPanel): def check(self): pop_window() def activate(self): + self.headtext.set_text("Adding %s" % self.state['userid']) + self.midtext.set_text("Please be patient while the user is added. " + "If more than a few seconds pass, check for a " + "phase variance and try inverting the polarity.") set_status("Contacting the gibson...") + + redraw() + problem = None try: if self.utype == 'member': @@ -192,6 +199,8 @@ class EndPage(WizardPanel): except members.MemberException, e: problem = str(e) + clear_status() + if problem: self.headtext.set_text("Failures Occured Adding User") self.midtext.set_text("The error was:\n\n%s\n\nThe account may be partially added " @@ -199,6 +208,7 @@ class EndPage(WizardPanel): "If this was not expected please contact systems committee." % problem) return else: + set_status("Strombola Delivers") self.headtext.set_text("User Added") self.midtext.set_text("Congratulations, %s has been added " "successfully. You should also rebuild the website in " diff --git a/ceo/urwid/window.py b/ceo/urwid/window.py index 836b11f..cc13a60 100644 --- a/ceo/urwid/window.py +++ b/ceo/urwid/window.py @@ -5,6 +5,16 @@ window_names = [] header = urwid.Text( "" ) footer = urwid.Text( "" ) + +ui = urwid.curses_display.Screen() + +ui.register_palette([ + # name, foreground, background, mono + ('banner', 'light gray', 'default', None), + ('menu', 'light gray', 'default', 'bold'), + ('selected', 'black', 'light gray', 'bold'), +]) + top = urwid.Frame( urwid.SolidFill(), header, footer ) def push_window( frame, name=None ): @@ -44,12 +54,16 @@ def raise_abort(*args, **kwargs): def raise_back(*args, **kwarg): raise Back() +def redraw(): + cols, rows = ui.get_cols_rows() + canvas = top.render( (cols, rows), focus=True ) + ui.draw_screen( (cols, rows), canvas ) + return cols, rows + def event_loop(ui): while True: try: - cols, rows = ui.get_cols_rows() - canvas = top.render( (cols, rows), focus=True ) - ui.draw_screen( (cols, rows), canvas ) + cols, rows = redraw() keys = ui.get_input() for k in keys: