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

[System] Adds Windows XP support and moves the registering of the GUID's to the main thread #204

Merged
merged 6 commits into from Mar 12, 2017

Conversation

kdschlosser
Copy link
Member

Windows XP does not support the use of RegisterPowerNotification and UnregisterPowerNotificatrion it always sends the notification. I want to thank Diz for providing the solution to fix this. Tho I did modify it so that in the future any new Windows versions will force a review of the code. I did this because of how Microsoft likes to change things about. We do want to make sure we have a working plugin. So in the event that there is an unsupported GUID in a new OS it will not register the GUID's because all of the OS checks will return False.

The Registering of the GUID's is much happier being done in the main thread. even tho it does appear to work if done in another thread, it does not function properly. I discovered this issue when working with another part of EG that also uses win32com and when i had an error while working with that it would also cause the PowerBroadcastNotifier to throw a traceback. and only the PowerBroadcastNotifier would even tho the use of win32com is use throughout EG. and one of the traceback has some information in it about not being run in the main thread.

And now since it is done in the main thread there are a couple of new events on startup as well. this is a good indicator it is functioning properly. And I believe this is the fix for #181. Not setting those GUID's in the main thread really mucks up odd parts of pywin32. I feel this is something that we may need to monkey patch pywin32 to have it throw an exception if it is not being done in the main thread as to avoid any future issues, IE: my forgetfulness or even a plugin dev. I suggest this because there is no indication there is a problem just random weird things happening.

Adds support for Windows XP
Adds Windows XP support
Registers message GUID's in main thread.
@kdschlosser
Copy link
Member Author

Do not merge this yet when #208 or a variation of gets merged I will update this to use the eg.WindowsVersion

@kdschlosser
Copy link
Member Author

OK I have made the changes to support the new eg.WindowsVersion. so everything should be good to go on this... I have been using the changes to how the messages are registered for some while without any errors.. and I know that @per1234 has used this as well... I have not heard a report back.. so I am going to take it as no news is good news.

if WIN_7:
monGUID = '{02731015-4510-4526-99e6-e5a17ebd1aea}'

if eg.WindowsVersion >= 8:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs to be: if eg.WindowsVersion() >= 8:


if eg.WindowsVersion >= 'Vista':
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs to be if eg.WindowsVersion() >= 'Vista':

Unregister(self.batteryNotify)
Unregister(self.savingNotify)
Unregister(self.schemeNotify)
if eg.WindowsVersion >= 'Vista':
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs to be if eg.WindowsVersion() >= 'Vista':

@kdschlosser
Copy link
Member Author

see #211

@kdschlosser
Copy link
Member Author

I made the changes... hopefully this is good to go.

@topic2k topic2k added the bugfix label Mar 12, 2017
@topic2k topic2k changed the title [System] - Bugfix - Adds Windows XP support and moves the registering of the GUID's to the main thread [System] Adds Windows XP support and moves the registering of the GUID's to the main thread Mar 12, 2017
@topic2k topic2k merged commit 72c0d51 into EventGhost:master Mar 12, 2017
@kdschlosser kdschlosser deleted the powernotifier-winxp branch March 12, 2017 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants