Skip to content

Commit

Permalink
[Eventghost] - Enhancement - WindowsVersion, Fixes issue with help (#215
Browse files Browse the repository at this point in the history
)

* Adds constructing eg.WindowsVersion()
  imports Cli to check and see if the args.isMain attribute is true and if so constructs WindowsVersion
* Updates PowerBroadcastNotifier
* Updates doc string
  • Loading branch information
kdschlosser authored and topic2k committed Mar 25, 2017
1 parent 5bec6ec commit 0d00096
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 7 additions & 1 deletion eg/Classes/WindowsVersion.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@
# You should have received a copy of the GNU General Public License along
# with EventGhost. If not, see <http://www.gnu.org/licenses/>.

from .. import Cli

import platform
from collections import OrderedDict


WINDOWS_VERSIONS = OrderedDict()
WINDOWS_VERSIONS["XP"] = [[5, 1], [5, 2]]
WINDOWS_VERSIONS["XP32"] = [5, 1]
Expand Down Expand Up @@ -78,7 +81,7 @@ class WindowsVersion:
In addition to the *IsXY()* methods, you can use comparison like this:
``eg.WindowsVersion() OPERATOR "KEY"``
``eg.WindowsVersion OPERATOR "KEY"``
``OPERATOR`` is one of ``<``, ``<=``, ``==``, ``!=``, ``>=``, ``>``
Expand Down Expand Up @@ -349,3 +352,6 @@ def Is10():
:rtype: bool
"""
return _compare('==', "10")

if Cli.args.isMain:
WindowsVersion = WindowsVersion()
6 changes: 3 additions & 3 deletions plugins/System/PowerBroadcastNotifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
AWY_ENTERING = 0x1


if eg.WindowsVersion() >= 8:
if eg.WindowsVersion >= 8:
GUID_CONSOLE_DISPLAY_STATE = GUID(
'{6fe69556-704a-47a0-8f24-c28d936fda47}'
)
Expand Down Expand Up @@ -198,7 +198,7 @@ def __init__(self, plugin):
self.savingNotify = None
self.schemeNotify = None

if eg.WindowsVersion() >= 'Vista':
if eg.WindowsVersion >= 'Vista':
wx.CallAfter(self.RegisterMessages)

eg.messageReceiver.AddHandler(
Expand All @@ -215,7 +215,7 @@ def RegisterMessages(self):
self.schemeNotify = Register(GUID_POWERSCHEME_PERSONALITY)

def Close(self):
if eg.WindowsVersion() >= 'Vista':
if eg.WindowsVersion >= 'Vista':
Unregister(self.monitorNotify)
Unregister(self.awayNotify)
Unregister(self.sourceNotify)
Expand Down

0 comments on commit 0d00096

Please sign in to comment.