Skip to content
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

Merged
merged 3 commits into from Oct 23, 2017

Conversation

kdschlosser
Copy link
Member

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

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.
@kdschlosser kdschlosser changed the title [Enhancement] - EventGhost - Adds Event before the loading of the plugins. [EventGhost ] - Enhancement - Adds Event before the loading of the plugins. Oct 14, 2017
@kdschlosser kdschlosser changed the title [EventGhost ] - Enhancement - Adds Event before the loading of the plugins. [EventGhost] - Enhancement - Adds Event before the loading of the plugins. Oct 14, 2017
t_fmt = t_fmt.format('th')
else:
t_fmt = t_fmt.format(
["st", "nd", "rd"][t.tm_mday % 10 - 1]
Copy link
Contributor

@topic2k topic2k Oct 21, 2017

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?

Copy link
Member Author

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.

@kdschlosser
Copy link
Member Author

OK sir. I have fixed the traceback issue.

@topic2k topic2k changed the title [EventGhost] - Enhancement - Adds Event before the loading of the plugins. Add Event before the loading of the plugins. Oct 23, 2017
@topic2k topic2k merged commit 1544219 into EventGhost:master Oct 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants