[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyQt] QScintilla code-completion bizarre behavior
From: Brian Kelley <kelley () eyesopen ! com>
Date: 2008-09-23 13:16:52
Message-ID: 44CD67CA-1CE6-4C81-8240-8F9E30BECC7B () eyesopen ! com
[Download RAW message or body]
On Sep 22, 2008, at 8:25 PM, Baz Walter wrote:
> Brian Kelley wrote:
> [snip]
>> def start(self):
>> lexer = self.lexer = QsciLexerPython()
>> api = QsciAPIs(lexer)
>> # write the API to a file
>> self.api = api
>
> you save references to your lexer and api here
>
> then (bizarrely) create a new lexer and api here
This is not as bizarre as you might think. It can take minutes to
prepare an api which is why the editor uses a different
instantiation. The reason it looks odd in this case is because it is
an example after all.
You did point me in the right direction, it looks like the lexer and
api are not reference counted when given to Scintilla, apparently
raising an exception interferes with this mechanism so they aren't
garbage collected which causes the correct behavior.
Brian Kelley
>
>
> [snip]
>> # uncommenting this exception causes code-completion not to
>> work.
>> raise Exception("Why does this exception make code-
>> completion work?")
>
> my guess is that if you hook self.editor up to self.lexer and
> self.api it will all work fine
>
> -
> Regards
> Baz Walter
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic