def plugin_start(): """ Start up our EDMC Plugin :return: """ global _overlay global SERVER _overlay = edmcoverlay.Overlay() time.sleep(2) notify("ED:HITS Plugin Loaded") if not SERVER.get(): SERVER.set(DEFAULT_SERVER) config.set(PREFNAME_SERVER, DEFAULT_SERVER) if not OVERLAY_MESSAGE_DURATION.get(): OVERLAY_MESSAGE_DURATION.set(str(DEFAULT_OVERLAY_MESSAGE_DURATION)) config.set(PREFNAME_OVERLAY_DURATION, str(DEFAULT_OVERLAY_MESSAGE_DURATION)) try: check_update() except: notify("Could not connect to server {}".format(SERVER.get())) try: OVERLAY_HITS_MODE.get() except: OVERLAY_HITS_MODE.set("on")
def test_raw_messages(): """ Test sending short messages, this is to test that the server gets all messages (nothing should be left onscreen) :return: """ overlay = edmcoverlay.Overlay() overlay.connect() for i in range(1, 200): overlay.send_raw({ "id": "foo{}".format(i), "x": random.randint(10, 1024), "y": (6 * i) % 960, "color": "#ff0000", "text": "msg{}".format(i), "ttl": 60, }) time.sleep(2) for i in range(1, 200): overlay.send_raw({ "id": "foo{}".format(i), "ttl": 0, }) time.sleep(2)
def __init__(self): self._overlay = edmcoverlay.Overlay() self.cfg = {} self.general_config() self.must_clear = False for kind in self.MESSAGE_KINDS: self.message_config(kind) self.msg_ids = lrucache.LRUCache(1000, 60 * 15)
def plugin_start(): """ Start up our EDMC Plugin :return: """ global _overlay _overlay = edmcoverlay.Overlay() time.sleep(2) notify("EDMC Overlay Demo Plugin Loaded")
def __init__(self): if self._overlay_dir not in sys.path: print("adding {} to sys.path".format(self._overlay_dir)) sys.path.append(self._overlay_dir) try: import edmcoverlay except ImportError: print(sys.path) self._overlay = None raise Exception(str(sys.path)) self._overlay = edmcoverlay.Overlay()
def hits_overlay_notify(message): """ If installed, display a message on EDMCOverlay/HITS :param message: :return: """ try: global __overlay__ if not __overlay__: import edmcoverlay __overlay__ = edmcoverlay.Overlay() __overlay__.send_message("null-track-notify", message, "#339933", 50, 1100, ttl=6, size="normal") except Exception as err: print err
def plugin_start(): """ Start up our EDMC Plugin :return: """ global _overlay global SERVER _overlay = edmcoverlay.Overlay() time.sleep(2) notify("ED:HITS Plugin Loaded") if not SERVER.get(): SERVER.set(DEFAULT_SERVER) config.set("HITSServer", DEFAULT_SERVER) try: check_update() except: notify("Could not connect to server {}".format(SERVER.get()))
def plugin_start(): """ Load this plugin into EDMC """ global _gui global _enable_overlay global _overlay global _latest_ver global _is_latest_ver _gui = Gui() # checking for overlay _enable_overlay = config.getint(oc.ENABLE_OVERLAY_KEY) # enable EDMCOverlay if _enable_overlay: try: import edmcoverlay _overlay = OverlayManager(edmcoverlay.Overlay()) ou.notify("Overlay is on.") except ImportError: ou.warn("Overlay is enabled but EDMCOverlay plugin not installed!") # set gui options if not oc.TTL_FIELD.get(): oc.TTL_FIELD.set(str(oc.TTL_VALUE_DEFAULT)) config.set(oc.TTL_CONFIG_KEY, str(oc.TTL_VALUE_DEFAULT)) oc.ENABLE_OVERLAY_FIELD.set(_enable_overlay) oc.DISABLE_ED_TIME_FIELD.set(config.getint(oc.DISABLE_ED_TIME_KEY)) oc.DISABLE_SERVICE_MSG_FIELD.set(config.getint(oc.DISABLE_SERVICE_MSG_KEY)) try: _latest_ver = ou.get_latest_version() _is_latest_ver = ou.is_latest_version(APP_VERSION, _latest_ver) except Exception as ex: ou.warn(ex) # Set latest version anyway on error _is_latest_ver = True ou.notify("version {} loaded!".format(APP_VERSION))
import os import sys import datetime import time try: import edmcoverlay _overlay = None _overlay = edmcoverlay.Overlay() print "ExTool: EDMCOverlay imported" except ImportError: print "ExTool: EDMCOverlay not imported but that is ok" DEFAULT_OVERLAY_MESSAGE_DURATION = 4 def get_display_ttl(): try: return int(OVERLAY_MESSAGE_DURATION.get()) except: return DEFAULT_OVERLAY_MESSAGE_DURATION time.sleep(2) HEADER = 380 INFO = 420 DETAIL1 = INFO + 25 DETAIL2 = DETAIL1 + 25 DETAIL3 = DETAIL2 + 25