Module Expr Str Import alias alias alias alias Import alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ClassDef bases NameLoad body Pass decorator_list ClassDef bases body Expr Str FunctionDef arguments args NameParam defaults body Expr Str Return Num decorator_list FunctionDef arguments args NameParam defaults body Expr Str decorator_list FunctionDef arguments args NameParam defaults body Return Str decorator_list decorator_list ClassDef bases NameLoad body Expr Str Assign NameStore Str FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore AttributeLoad NameLoad attr attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Pass decorator_list decorator_list ClassDef bases NameLoad body Expr Str Assign NameStore NameLoad FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Return AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Pass decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr Num Assign AttributeStore NameLoad attr Str Assign AttributeStore NameLoad attr Str Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr Num Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr Num Expr Call AttributeLoad NameLoad attr Num Assign TupleStore AttributeStore NameLoad attr AttributeStore NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr Assign AttributeStore NameLoad attr ListLoad Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Num AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Num AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Num Assign NameStore BinOpSub Call NameLoad AttributeLoad NameLoad attr Num While BoolOpAnd CompareLt NameLoad BinOpSub AttributeLoad NameLoad attr Num CompareGtE NameLoad Num body Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpSub BinOpSub AttributeLoad NameLoad attr Num NameLoad Num SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Call AttributeLoad NameLoad attr Num Assign NameStore BinOpAdd NameLoad Num Assign NameStore BinOpSub NameLoad Num Expr Call AttributeLoad AttributeLoad NameLoad attr attr decorator_list FunctionDef arguments args NameParam NameParam defaults body If CompareGt Call NameLoad NameLoad AttributeLoad NameLoad attr body Raise NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpSub AttributeLoad NameLoad attr Num Num BinOpAdd NameLoad BinOpMult Str BinOpSub AttributeLoad NameLoad attr Call NameLoad NameLoad Call AttributeLoad NameLoad attr Num Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpSub AttributeLoad NameLoad attr Num BinOpSub AttributeLoad NameLoad attr Num decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr BinOpAdd AttributeLoad NameLoad attr Num Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr If CompareEq NameLoad AttributeLoad NameLoad attr body Assign AttributeStore NameLoad attr SubscriptLoad AttributeLoad NameLoad attr Slice Num orelse If BoolOpOr CompareEq NameLoad AttributeLoad NameLoad attr CompareEq NameLoad Num body Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr TryExcept body Expr Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr handlers ExceptHandler body Pass Expr Call AttributeLoad AttributeLoad NameLoad attr attr Assign AttributeStore NameLoad attr Str orelse If CompareEq Call NameLoad AttributeLoad NameLoad attr BinOpSub AttributeLoad NameLoad attr Num body Return Assign AttributeStore NameLoad attr BinOpAdd AttributeLoad NameLoad attr Call NameLoad NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpSub AttributeLoad NameLoad attr Num Num BinOpAdd AttributeLoad NameLoad attr BinOpMult Str BinOpSub BinOpSub AttributeLoad NameLoad attr Call NameLoad AttributeLoad NameLoad attr Num Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpSub AttributeLoad NameLoad attr Num Call NameLoad AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr BinOpAdd AttributeLoad NameLoad attr BinOpMod Str Call NameLoad AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr Num Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr decorator_list decorator_list If CompareEq NameLoad Str body Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Assign NameStore Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Str Num NameLoad Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr
N/A N/A 
This is an example of integrating curses with the twisted underlying
select loop. Most of what is in this is insignificant -- the main piece
of interest is the 'CursesStdIO' class.

This class acts as file-descriptor 0, and is scheduled with the twisted
select loop via reactor.addReader (once the curses class extends it
of course). When there is input waiting doRead is called, and any
input-oriented curses calls (ie. getch()) should be executed within this
block.

Remember to call nodelay(1) in curses, to make getch() non-blocking.

To run the script::

    $ python cursesclient.py

 N/A curses time traceback sys N/A curses.wrapper twisted.internet reactor twisted.internet.protocol ClientFactory twisted.words.protocols.irc IRCClient twisted.python log TextTooLongError N/A Exception N/A N/A N/A CursesStdIO N/A N/A N/A fake fd to be registered as a reader with the twisted reactor.
       Curses classes needing input should extend this fileno N/A N/A self N/A N/A N/A  We want to select on FD 0  N/A 0 N/A doRead N/A N/A self N/A N/A N/A called when input is ready N/A logPrefix N/A N/A self N/A N/A N/A CursesClient N/A N/A IRC N/A IRCClient N/A N/A  A protocol object for IRC  N/A nickname testcurses __init__ N/A N/A self screenObj N/A N/A N/A N/A self screenObj screenObj N/A N/A N/A self screenObj irc self N/A lineReceived N/A N/A self line N/A N/A N/A  When receiving a line, add it to the output buffer  N/A N/A N/A N/A self screenObj addLine line N/A connectionMade N/A N/A self N/A N/A N/A N/A N/A IRCClient connectionMade self N/A N/A N/A N/A self screenObj addLine * CONNECTED N/A clientConnectionLost N/A N/A self connection reason N/A N/A N/A N/A N/A IRCFactory N/A ClientFactory N/A N/A 
    Factory used for creating IRC protocol objects 
     N/A protocol IRC __init__ N/A N/A self screenObj N/A N/A N/A N/A self irc N/A N/A self protocol screenObj N/A buildProtocol N/A N/A self addr N/A None N/A N/A N/A self irc N/A clientConnectionLost N/A N/A self conn reason N/A N/A N/A N/A N/A Screen N/A CursesStdIO N/A __init__ N/A N/A self stdscr N/A N/A N/A N/A self timer 0 N/A N/A self statusText TEST CURSES APP - N/A N/A self searchText N/A N/A self stdscr stdscr N/A N/A N/A N/A self stdscr nodelay 1 N/A N/A N/A curses cbreak N/A N/A N/A N/A self stdscr keypad 1 N/A N/A N/A curses curs_set 0 N/A N/A N/A self rows N/A self cols N/A N/A N/A self stdscr getmaxyx N/A N/A self lines N/A N/A N/A N/A curses start_color N/A N/A N/A curses init_pair 1 N/A curses COLOR_BLACK N/A curses COLOR_WHITE N/A N/A N/A curses init_pair 2 N/A curses COLOR_CYAN N/A curses COLOR_BLACK N/A N/A N/A self paintStatus N/A self statusText N/A connectionLost N/A N/A self reason N/A N/A N/A N/A N/A self close N/A addLine N/A N/A self text N/A N/A N/A  add a line to the internal list of lines N/A N/A N/A N/A self lines append text N/A N/A N/A self redisplayLines N/A redisplayLines N/A N/A self N/A N/A N/A  method for redisplaying lines 
            based on internal list of lines  N/A N/A N/A N/A self stdscr clear N/A N/A N/A self paintStatus N/A self statusText N/A i 0 N/A index N/A N/A len N/A self lines 1 N/A N/A N/A i N/A N/A self rows 3 N/A index 0 N/A N/A N/A N/A N/A self stdscr addstr N/A N/A N/A self rows 3 i 0 N/A N/A self lines N/A index N/A N/A curses color_pair 2 N/A i N/A i 1 N/A index N/A index 1 N/A N/A N/A N/A self stdscr refresh N/A paintStatus N/A N/A self text N/A N/A N/A N/A N/A len text N/A self cols N/A N/A TextTooLongError N/A N/A N/A N/A self stdscr addstr N/A N/A self rows 2 0 N/A text N/A N/A N/A self cols N/A len text N/A N/A curses color_pair 1 N/A N/A N/A N/A self stdscr move N/A N/A self rows 1 N/A N/A self cols 1 N/A doRead N/A N/A self N/A N/A N/A  Input is ready!  N/A N/A N/A curses noecho N/A N/A self timer N/A N/A self timer 1 N/A c N/A N/A N/A self stdscr getch N/A N/A c N/A curses KEY_BACKSPACE N/A N/A N/A self searchText N/A N/A self searchText N/A -1 N/A N/A N/A N/A c N/A curses KEY_ENTER N/A c 10 N/A N/A N/A N/A self addLine N/A self searchText N/A N/A N/A N/A N/A N/A self irc sendLine N/A self searchText N/A N/A N/A N/A N/A N/A N/A N/A self stdscr refresh N/A N/A self searchText N/A N/A N/A N/A len N/A self searchText N/A N/A self cols 2 N/A N/A N/A N/A self searchText N/A N/A self searchText N/A chr c N/A N/A N/A N/A self stdscr addstr N/A N/A self rows 1 0 N/A N/A self searchText N/A N/A N/A N/A self cols N/A len N/A self searchText 2 N/A N/A N/A N/A self stdscr move N/A N/A self rows 1 N/A len N/A self searchText N/A N/A N/A self paintStatus N/A N/A self statusText N/A  %d N/A len N/A self searchText N/A N/A N/A N/A self stdscr refresh N/A close N/A N/A self N/A N/A N/A  clean up  N/A N/A N/A curses nocbreak N/A N/A N/A N/A self stdscr keypad 0 N/A N/A N/A curses echo N/A N/A N/A curses endwin N/A N/A N/A N/A __name__ __main__ N/A N/A stdscr N/A N/A curses initscr N/A screen N/A Screen stdscr N/A N/A N/A stdscr refresh N/A ircFactory N/A IRCFactory screen N/A N/A N/A reactor addReader screen N/A N/A N/A reactor connectTCP irc.freenode.net 6667 ircFactory N/A N/A N/A reactor run N/A N/A N/A screen close