def process_deferreds(): """ Forwards log messages and status, cached before main window was available. """ global deferred_logs, deferred_status, window if window: if deferred_logs: for msg in deferred_logs: wx.PostEvent(window, guibase.LogEvent(text=msg)) del deferred_logs[:] if deferred_status: wx.PostEvent(window, guibase.StatusEvent(text=deferred_status[0])) del deferred_status[:]
def status(text, *args): """ Sets main window status text. @param args string format arguments, if any, to substitute in text """ global deferred_status, window msg = text % args if window: process_deferreds() wx.PostEvent(window, guibase.StatusEvent(text=msg)) else: deferred_status[:] = [msg]
def status(text, *args): """ Sets main window status text. @param args string format arguments, if any, to substitute in text """ global deferred_status, is_cli, is_verbose, window try: msg = text % args if args else text except UnicodeError: args = tuple(map(util.to_unicode, args)) msg = text % args if args else text if window: process_deferreds() wx.PostEvent(window, guibase.StatusEvent(text=msg)) elif is_cli and is_verbose: sys.stderr.write(msg + "\n") else: deferred_status[:] = [msg]
def status_flash(text, *args): """ Sets main window status text that will be cleared after a timeout. @param args string format arguments, if any, to substitute in text """ global deferred_status, window try: msg = text % args if args else text except UnicodeError: args = tuple(map(util.to_unicode, args)) msg = text % args if args else text if window: process_deferreds() wx.PostEvent(window, guibase.StatusEvent(text=msg)) def clear_status(): if window.StatusBar and window.StatusBar.StatusText == msg: window.SetStatusText("") wx.CallLater(conf.StatusFlashLength, clear_status) else: deferred_status[:] = [msg]