Skip to content

Commit 9d2d05b

Browse files
committed
move settings API under plugin_loaded() as required by ST3
1 parent be29a10 commit 9d2d05b

File tree

1 file changed

+24
-11
lines changed

1 file changed

+24
-11
lines changed

PythonBreakpoints.py

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,44 @@
1414
import sublime_plugin
1515

1616

17+
debug = lambda *a: None # replace with debug = print if needed
18+
19+
1720
############
1821
# Settings #
1922
############
2023

21-
settings = sublime.load_settings("PythonBreakpoints.sublime-settings")
24+
settings = None
25+
pdb_block = ''
26+
tab_size = 4
2227

23-
tab_size = settings.get('tab_size')
24-
if tab_size == 'auto' or tab_size is None:
25-
g_settings = sublime.load_settings('Preferences.sublime-settings')
26-
tab_size = g_settings.get('tab_size', 4)
2728

28-
debug = lambda *a: None # replace with debug = print if needed
29+
def plugin_loaded():
30+
global settings
31+
settings = sublime.load_settings("PythonBreakpoints.sublime-settings")
2932

33+
global tab_size
34+
tab_size = settings.get('tab_size')
35+
if tab_size == 'auto' or tab_size is None:
36+
g_settings = sublime.load_settings('Preferences.sublime-settings')
37+
tab_size = g_settings.get('tab_size', 4)
3038

31-
#############
32-
# Constants #
33-
#############
34-
35-
pdb_block = """\
39+
global pdb_block
40+
pdb_block = """\
3641
# do not edit! added by PythonBreakpoints
3742
from %s import set_trace as _breakpoint
3843
3944
4045
""" % settings.get('debugger', 'pdb')
4146

47+
# for ST2
48+
plugin_loaded()
49+
50+
51+
#############
52+
# Constants #
53+
#############
54+
4255
bp_regex = r"^[\t ]*_breakpoint\(\) # ([a-f0-9]{8})"
4356
bp_re = re.compile(bp_regex, re.DOTALL)
4457

0 commit comments

Comments
 (0)