Just for interest, here is how I have been adding a method to an existing
instance (here, c), rather than also to its parent class:
def select_card(self, gnx):
#... body of function
c.select_card = select_card.__get__(c)
On Sunday, August 1, 2021 at 12:15:58 PM UTC-4 Edward K. Ream wrote:
> On Sun, Aug 1, 2021 at 10:21 AM [email protected] <[email protected]>
> wrote:
>
>> I was thinking that the server would put up its own console window just
>> for this purpose. It could do this when it discovers that vs-code has gone
>> away (or whenever else it liked, really).
>>
>
> Good idea! It should be a better fallback than using Tk.
>
> Happily, monkey-patching a Qt dialog into the NullGui class is
> straightforward:
>
> 1: Copy LeoQtGui.runAskYesNoCancelDialog into the server, along with the
> necessary Qt-related imports.
>
> 2: The actual monkey-patch is:
>
> # Create a minimal qt application.
> g.app.use_splash_screen = False # Suppress the splash screen.
> qt_app = LeoQtGui()
> g.funcToMethod(runAskYesNoCancelDialog, NullGui)
>
> This works with zero changes to Leo's core.
>
> 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 view this discussion on the web visit
https://groups.google.com/d/msgid/leo-editor/c247c20c-be81-43a7-a4c4-bc6be8be0ce1n%40googlegroups.com.