[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    [PyQt] =?cp1256?q?Embed_PyQt_scripting_in_PyQt_app=FE?=
From:       <adri-from-59 () hotmail ! fr>
Date:       2015-10-18 17:10:23
Message-ID: DUB117-W1376A681D9913AB056D6ABBBE3B0 () phx ! gbl
[Download RAW message or body]

Hi all,


I have added scripting support to my application by using the Python primitives \
compile() and exec() on code passed by the user, and I selectively hand a couple of \
my app intrinsics that are to be mutated in the global variables passed to exec() – \
so far so good. Now, I would like to be able to run the event loop on the script as \
if it were the top-level window. Currently if you spawn a parent-less QWidget window \
in that embedded scripting engine, it will just close immediately. How to make it \
work as a top-level script?

Right now what I am doing is passing a reference to the parent window in the global \
variables of the executed script so users have to use that as parent widget, but I \
would like to run scripts that are made to run as top-level.

I considered spawning a separate thread but scripts mutate app data that wasn't made \
to be thread-safe, so it's not exactly what I want to resort to... any idea? how to \
make a scripting engine that runs the event loop as top-level?

The application in question is TruFont (a font editor), by the way: \
http://trufont.github.io/

My scripting facility is here: \
https://github.com/trufont/trufont/blob/master/Lib/defconQt/scriptingWindow.py

Thanks,


Adrien Tétar  		 	   		  
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
https://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