New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update event model #120
Comments
Interesting way of running loops: https://gist.github.com/niccokunzmann/8673951 |
Some good discussion on threading in tkinter: http://stackoverflow.com/questions/16745507/tkinter-how-to-use-threads-to-preventing-main-event-loop-from-freezing |
An additional function |
NB. The docs are VERY misleading - |
#120 - make sure afters/threads are cleared up. Cancel the processQueue after, loop through maps and stop their threads/afters. Remove priority queue. Big change to sub-classing, changed all supers to use different syntax. Updated maps #174 - removed location loop, gets location once at start, causes some delay. Only map downloads are in threads. Also added some code for geoLocating. Updated testing to try threads.
We now have a few new features.
This is a fairly complex model, but should allow for a reliable process. The threads are set as Daemon threads - so if the GUI is quit, the threads will be terminated. In an attempt to support as many versions of Python as possible, the threading is fairly basic - there's no limit on thread numbers, and each time the thread function is called a new thread is instantiated. Both of these could be improved. There's also currently no thread monitoring - it would be nice to subclass Thread, and have threads store a running time and call something on completion... |
Tidied up some broken references Added defaults for Queue size & processing speed #120
Improve the way users register events
At the moment, it's only possible to have one event loop, and the user has to manage how many times it gets called.
Would be nice to offer a better model:
So,
.registerEvent(function)
could have additional parameters:Becoming:
.registerEvent(function, sleep=1, repeat=None. checkResult=False)
.setPollTime()
then becomes deprecated - but will adjust the default delay time above.Also, some way to sleep for x amount of time. This could be provided as:
.sleep(time)
. It would wait the specified amount of time before returning control back to the calling function. But it won't block the main loop, so the UI will remain responsive.The text was updated successfully, but these errors were encountered: