-
-
Notifications
You must be signed in to change notification settings - Fork 26
/
rr_notify.py
49 lines (36 loc) · 1.29 KB
/
rr_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
39
40
41
42
43
44
45
46
47
48
49
"""
Reg Replace.
Licensed under MIT
Copyright (c) 2011 - 2016 Isaac Muse <[email protected]>
"""
import sublime
try:
from SubNotify.sub_notify import SubNotifyIsReadyCommand as Notify
except Exception:
class Notify(object):
"""Notify fallback."""
@classmethod
def is_ready(cls):
"""Return false to effectively disable `SubNotify`."""
return False
DEPRECATED_DOTALL = '''\
"dotall" setting is deprecated and will be removed in a future release.
Please consider using "(?s)" for case insensitive searches.
'''
def notify(msg):
"""Notify message."""
settings = sublime.load_settings("reg_replace.sublime-settings")
if settings.get("use_sub_notify", False) and Notify.is_ready():
sublime.run_command("sub_notify", {"title": "RegReplace", "msg": msg})
else:
sublime.status_message(msg)
def error(msg):
"""Error message."""
settings = sublime.load_settings("reg_replace.sublime-settings")
if settings.get("use_sub_notify", False) and Notify.is_ready():
sublime.run_command("sub_notify", {"title": "RegReplace", "msg": msg, "level": "error"})
else:
sublime.error_message("RegReplace:\n%s" % msg)
def deprecated(msg):
"""Deprecation warning."""
print('RegReplace: DEPRECATED - %s' % msg)