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
Add Event before the loading of the plugins. #277
Conversation
Adds EventGhost.Started event to take place before the running of the Autostart macro. This is done so that if the user needs to set into place any globals that a script may depend on it can be done before the possibility of a plugin starting and generating an event before the Main.OnInit gets triggered. There is a payload with this event that is an instance of a Time(datetime.datetime) object I subclassed the datetime.datetime class to override the __str__ and __repr__ methods so it would produce a nice date in the log. other then that it functions exactly the same as a datetime.datetime object
Correction: event name is EventGhost.Startup Removed subclassing of the datetime.datetime object as this caused some issues. The object returned is a class that stores the datetime.datetime instance and will returns any attributes to has correctly other then __repr__ and __str__ I also removed adding the execution of the event into the action thread. The Autostart.Execute() was already being run in the action thread. and this caused a hang because it would wait for the event to get run when the Execute was already being run.
eg/Classes/AutostartItem.py
Outdated
t_fmt = t_fmt.format('th') | ||
else: | ||
t_fmt = t_fmt.format( | ||
["st", "nd", "rd"][t.tm_mday % 10 - 1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NameError: global name 't' is not defined
Should t.tm_mday
be self._datetime.day
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could be let me look at the code. i could have messed it up somehow. tho i did test it and it worked. maybe i missed the error when it happened.
OK sir. I have fixed the traceback issue. |
Adds EventGhost.Startup event to take place before the running of the Autostart macro. This is done so that if the user needs to set into place any globals that a script may depend on it can be done before the possibility of a plugin starting and generating an event before the Main.OnInit gets triggered.
There is a payload with this event that is an instance of an AutostartItem.Time() object. I stored a datetime.datetime object and it returns all methods/attributes correctly except str and repr methods so it would produce a nice date in the log.
example: EventGhost.Startup Saturday, October 14th, 2017 @ 01:56:46 AM