def delayfunc(msecs): msecs = int(msecs) # # Check for immediate stdwin event # event = stdwinq.pollevent() if event: mainloop.dispatch(event) return # # Use sleep for very short delays or if there are no windows # if msecs < 100 or mainloop.countwindows() == 0: if msecs > 0: time.sleep(msecs * 0.001) return # # Post a timer event on an arbitrary window and wait for it # window = mainloop.anywindow() window.settimer(msecs/100) event = stdwinq.getevent() window.settimer(0) if event[0] <> WE_TIMER: mainloop.dispatch(event)
def empty(): return q.empty() and mainloop.countwindows() == 0
args.append(history[-1]) del history[-1] # if server_mode: start_server() # stdwin.setdefwinsize(0, 0) for addr in args: w = WWWWindow() w.set_raw_mode(raw_mode) if not w.setaddr(addr): w.close() else: w.set_history(history) # if not server_mode and mainloop.countwindows() == 0: # Fallback -- try default pages for addr in wwwutil.user_home, wwwutil.system_home: if addr not in args: w = WWWWindow() w.set_raw_mode(raw_mode) if not w.setaddr(addr): w.close() else: w.set_history(history) break # if help or not server_mode and mainloop.countwindows() == 0: make_help_window() # mainloop.mainloop()
def CountWindows(): return mainloop.countwindows()