I have sorted out a couple of bugs that I have happened across.
I also added an Event Manager Dialog that will show you what events are running and if there are Events that are in queue to be run.
the dialog shows
thread id - the identifier of the thread for the event
queue time - the time the event came in
start time - the time the event actually started being processed
stop time - the time when the event finished being processed
run time - how long it took the event to be processed, in milliseconds
result - this would be eg.result
payload - the payload data the event has
macro complete - how much of the current macro that is being processed is complete. this is based on the number of actions in a macro
event complete - how much of the event that is being processed has been completed. this is based on the number of macros that have to be processed
running action - name of the action that is currently being processed
running macro - the name of the macro that is currently being processed
The dialog also gives you the ability to stop an event from being processed. Now you can keep a specific thread in a loop and I have designed a method to loop properly and I will explain that below.
The dialog will only hold information for an ended event while the dialog is open. as soon as you close the dialog any event that has finished will not be able to be viewed once you reopen the dialog.
The dialog defaults to being sorted by the event name. it groups the events together if they are like events (ones that are in queue) by clicking on the header for a specific column it will regroup the items based on the columns you have selected. it will only group together like items in that column. so for instance if you click on the thread id column since no 2 thread id's are the same it will not group any of them together.
I also changed the tray icon and the icon in the UI that shows the processing state of EG. I did this because of the more complex manner of the threading system. but to also be able to give the user some choices with this.
The tray icon and the processing indicator inside the UI is now going to be 2 vertical 5 segment "UV meters" the left meter will show the progress of a running macro. and the right will show the progress of the event. as of the moment it will select a random color for the right side for each event. the color of it will remain the same through that session of eg for that specific event. I am going to provide a mechanism so the user will be able to choose a color for a specific event but that is going to be in the near future (this is a specific feature for Snowbird)
I have also changed the tooltip that shows up to list all of the events that are currently running. I will be adding a means to be able to select a specific event from the menu for the tray icon to be able to perform actions like stopping the event. or whatever. I haven't yet decided what else to add.
threaded events and python scripts.
since you now can loop in a macro without it causing EG to hang I have devised a method of properly doing a loop that will allow that thread to close properly. say for things like writing a file we do not want to have any data corruption or hung sockets so these things need to be shutdown properly.
here is an example of how to properly use the loop in a python script
Code: Select all
# put your startup code here while not eg.event.stop: # do your looping code here # if you need to wait a specific amount of time instead of using sleep we # want to use a non blocking way of causing the thread to wait so that if # EG is closing or something caused the event to stop the wait can be exited eg.event.Wait(1.0) # if we want to stop the thread from running because we have the data we need eg.event.stop = True # do closing code here
Code: Select all
# get the other event other_event = eg.EventManager.GetEvent('Some.Other.Event') # checking to make sure the other event is running if other_event.queue: # use the Wait from that event with no time set and it will wait until the stop # has been issued for that event. either by EG closing, the event finishing, or # some other mechanism. other_event.Wait() # do your code here if the other event is not running or the other event has finished
Code: Select all
# get the other event other_event = eg.EventManager.GetEvent('Some.Other.Event') # checking to make sure the other event is running if other_event.queue: # tell that other thread to stop other_event.stop = True # join the other event which will make your current program wait until the other event has finished. other_event.thread.join()
Code: Select all
# get event event = eg.EventManager.GetEvent('Some.Event') # change color to gray (Red, Green, Blue). # Each of the colors can be a number between 0 and 255 event.colour = (125, 125, 125)
I will be adding Actions to handle a lot of the looping bits to make it easier. but those are a little ways off. there is still alot of the core functionality I have fo finish up adding.
well here it is and enough with the changes. I am sure I have not added some of them but I will keep on adding docs on how to use specific things as i go along.
https://ci.appveyor.com/api/buildjobs/t ... _Setup.exe