On Saturday, June 30, 2018 at 3:32:48 AM UTC-5, Edward K. Ream wrote:

>  I'm dithering about what the next step should be.  Perhaps I'll just 
override the pdb.Pdb class to get commands from Leo via the qc channel.

Here is a prototype of the prototype :-)  The QueueStdin class returns 
commands from a table, rather than a Queue, but it was useful for debugging 
the *functional* XPdb class:

g.cls()
import pdb
from leo.core.leoQt import QtCore

class QueueStdin(object):
    
    table = ['n', 'l', 'n', 'n', 'n', 'n', 'n']
    
    def readline(self):
        import time
        time.sleep(1)
        s = self.table.pop(0) if self.table else 'c'
        print(s)
        return s

class XPdb(pdb.Pdb):

    def __init__(self, *args, **kwargs):
        pdb.Pdb.__init__(self, stdin=QueueStdin(), readrc=False)
        self.use_rawinput = False # for cmd.Cmd.
        
# Start the debugger.
QtCore.pyqtRemoveInputHook() # From g.pdb
XPdb().set_trace()
#
# Something to test.
for i in range(6):
    print(i)

Note: the print statement in QueueStdin.readline is correct.

The next step will be to connect QueueStdin to a Queue, filled by a Leo 
command...

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to