-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathhex_notify.py
38 lines (29 loc) · 1.02 KB
/
hex_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
"""
Hex Viewer.
Licensed under MIT
Copyright (c) 2011-2020 Isaac Muse <[email protected]>
"""
import sublime
try:
from SubNotify.sub_notify import SubNotifyIsReadyCommand as Notify
except Exception:
class Notify(object):
"""Fallback notify class."""
@classmethod
def is_ready(cls):
"""Return false to disable SubNotify."""
return False
def notify(msg):
"""Notify message."""
settings = sublime.load_settings("hex_viewer.sublime-settings")
if settings.get("use_sub_notify", False) and Notify.is_ready():
sublime.run_command("sub_notify", {"title": "HexViewer", "msg": msg})
else:
sublime.status_message(msg)
def error(msg):
"""Error message."""
settings = sublime.load_settings("hex_viewer.sublime-settings")
if settings.get("use_sub_notify", False) and Notify.is_ready():
sublime.run_command("sub_notify", {"title": "HexViewer", "msg": msg, "level": "error"})
else:
sublime.error_message("HexViewer:\n%s" % msg)