[PyKDE] Does anybody got the same issue?

Laurent Dufréchou laurent.dufrechou at free.fr
Sun Jul 9 00:50:10 BST 2006


Finally I've found why my enter key don't work...

In Shell.py:

self.supportedEditorCommands = {
            QextScintilla.SCI_LINEDELETE : self.clearCurrentLine,
            QextScintilla.SCI_TAB        : self.handleQScintillaTab,
            QextScintilla.SCI_NEWLINE : self.handleQScintillaNewline,

I've modified keyPresEvent to printout ev.key()
and it seems that my 'enter' key generate 4100 instead of SCI_NEWLINE(2329)
I've tried to  add this :)
    4100    : self.handleQScintillaNewline,
but it doesn't work...
In fact 4100 is not recognised in the ENUM of Qscintilla.

So I've modified:

def keyPressEvent(self, ev):
        """
        Re-implemented to handle the user input a key at a time.
       
        @param ev key event (QKeyPressEvent)
        """
        txt = ev.text()
        key = ev.key()
        asc = ev.ascii()
        buf = unicode('')
    #self.insert(str(key))
    # See it is text to insert.
        if txt.length():
        if key == 4100:                                           <--
            self.handleQScintillaNewline(cmd)          <--
        return
            if self.echoInput:
                ac = self.isAutoCompletionActive()
                QextScintillaCompat.keyPressEvent(self, ev, cmd)
                self.incrementalSearchActive = True
                if ac and \
                   self.racEnabled:
                   
self.dbs.remoteCompletion(self.completionText+unicode(txt))
            else:
                self.insertTextNoEcho(txt)
            return
        else:
            ev.ignore()


The fact is that self.handleQScintillaNewline needs 'cmd' that is not in
keyPressEvent scope...
Can you help me to corresct this?
Or perhaps this is not the right way to handle my bug?

(What ? Just update PyQt ? well that a possibility ^_^ )

Laurent




More information about the PyQt mailing list