Skip to content

Commit

Permalink
Add some missed files
Browse files Browse the repository at this point in the history
  • Loading branch information
inorton committed Jul 14, 2020
1 parent 0ff3c60 commit 57bf27d
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 22 deletions.
49 changes: 49 additions & 0 deletions EDMCOverlay/EDMCOverlay/WindowUtils.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using System;
using System.Text;
using System.Runtime.InteropServices;


namespace EDMCOverlay
{
[StructLayout(LayoutKind.Sequential)]
public struct RECT
{
public int Left;
public int Top;
public int Right;
public int Bottom;
}


public class WindowUtils
{
public const Int32 WS_EX_LAYERED = 0x00080000;
public const Int32 WS_EX_TRANSPARENT = 0x00000020;
public const Int32 WS_EX_NOACTIVATE = 0x08000000;

public const int GWL_EXSTYLE = -20;

public const int DWMWA_TRANSITIONS_FORCEDISABLED = 3;

[DllImport("dwmapi.dll")]
public static extern UInt32 DwmSetWindowAttribute(IntPtr hWnd, UInt32 attr, ref int value, UInt32 attrLen);

[DllImport("user32.dll")]
public static extern Int32 SetWindowLong(IntPtr hWnd, int nIndex, Int32 dwNewLong);

[DllImport("user32.dll", SetLastError = true)]
public static extern Int32 GetWindowLong(IntPtr hWnd, int nIndex);

[DllImport("user32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool GetWindowRect(IntPtr hWnd, ref RECT lpRect);


[DllImport("user32.dll")]
public static extern IntPtr GetForegroundWindow();

[DllImport("user32.dll")]
public static extern int GetWindowText(IntPtr hWnd, StringBuilder text, int count);
}

}
3 changes: 3 additions & 0 deletions edmcoverlay.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ def send_raw(self, msg):
:param msg:
:return:
"""
if not self.connnection:
return None

assert isinstance(msg, dict)

try:
Expand Down
25 changes: 3 additions & 22 deletions load.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,18 @@
"""
Plugin for EDMCOverlay
"""
import time
import os
from edmcoverlay import ensure_service, Overlay, trace


HERE = os.path.dirname(os.path.abspath(__file__))
PLUGDIR = os.path.dirname(HERE)
client = Overlay()


def notify_old_hits():
"""
If an old copy of HITS is installed, notify the user
:return:
"""
if notify_old_hits.done:
return
notify_old_hits.done = True
hits_overlay_dist = os.path.join(PLUGDIR, "HITS", "EDMCOverlay", "EDMCOverlay.exe")
if os.path.exists(hits_overlay_dist):
client.send_message("warning",
trace("An older version of the HITS plugin is installed, please update it"),
"#ffcc00", 30, 30, ttl=10
)
notify_old_hits.done = False


def plugin_start3(plugin_dir):
return plugin_start()


def plugin_start():
"""
Start our plugin, add this dir to the search path so others can use our module
Expand All @@ -39,9 +21,8 @@ def plugin_start():
ensure_service()
try:
client.send_message("edmcintro", trace("EDMC Ready"), "yellow", 30, 165, ttl=6)
notify_old_hits()
except Exception:
pass
except Exception as err:
print("Error sending message in plugin_start() : {}".format(err))
return "EDMCOverlay"


Expand Down

0 comments on commit 57bf27d

Please sign in to comment.