-
Notifications
You must be signed in to change notification settings - Fork 0
/
CDNUtils.py
34 lines (27 loc) · 1.18 KB
/
CDNUtils.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
"""CDNUpdates' utils module"""
from sublime import active_window, load_settings
def clear_view(view):
"""Removes the passed `view` object all traces of our elements (known identifiers)"""
if view:
# We just remove each regions containing icons in the gutter...
view.erase_regions('up_to_date')
view.erase_regions('to_update')
view.erase_regions('not_found')
# ... and our phantoms objects containing the latest versions...
view.erase_phantoms('latest_versions')
# ... and "specify version" advices...
view.erase_phantoms('specify_versions')
# ... and "specify HTTPS" advices.
view.erase_phantoms('specify_https')
def log_message(message):
"""When debug mode is enabled in configuration, logs the passed message in the console"""
if load_settings('CDNUpdates.sublime-settings').get('debug', False):
if active_window().active_panel() != 'console':
active_window().run_command(
'show_panel',
{
'panel': 'console',
'toggle': True
}
)
print("[DEBUG] CDNUpdates : {0}".format(message))