-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
scope_hunter_notify.py
38 lines (29 loc) · 1.06 KB
/
scope_hunter_notify.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
"""
Scope Hunter.
Licensed under MIT
Copyright (c) 2012 - 2016 Isaac Muse <[email protected]>
"""
import sublime
try:
from SubNotify.sub_notify import SubNotifyIsReadyCommand as Notify
except Exception:
class Notify(object):
"""Fallback Notify class if SubNotify is not found."""
@classmethod
def is_ready(cls):
"""Return False to disable SubNotify."""
return False
def notify(msg):
"""Notify message."""
settings = sublime.load_settings("scope_hunter.sublime-settings")
if settings.get("use_sub_notify", False) and Notify.is_ready():
sublime.run_command("sub_notify", {"title": "ScopeHunter", "msg": msg})
else:
sublime.status_message(msg)
def error(msg):
"""Error message."""
settings = sublime.load_settings("scope_hunter.sublime-settings")
if settings.get("use_sub_notify", False) and Notify.is_ready():
sublime.run_command("sub_notify", {"title": "ScopeHunter", "msg": msg, "level": "error"})
else:
sublime.error_message("ScopeHunter:\n%s" % msg)