-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathchangestyle.py
30 lines (26 loc) · 1.09 KB
/
changestyle.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
import sublime, sublime_plugin
import os
import shutil
import plistlib
class ChangeStyleCommand(sublime_plugin.WindowCommand):
_is_checked = False
def __init__(self, view):
srcdir = os.path.join(sublime.packages_path(), "LSL")
destdir = os.path.join(sublime.packages_path(), "User")
destfile = os.path.join(destdir, "lsl_settings_style.tmPreferences")
if os.path.exists(destfile):
pl = plistlib.readPlist(destfile)
self._is_checked = (pl['uuid'] == "a775771f-1a8d-4741-a1a3-6f6dc0b01ab4")
else:
shutil.copyfile(os.path.join(srcdir, "settings_style.tmPreferences.allman"), destfile)
def run(self):
srcdir = os.path.join(sublime.packages_path(), "LSL")
destdir = os.path.join(sublime.packages_path(), "User")
destfile = os.path.join(destdir, "lsl_settings_style.tmPreferences")
if not self._is_checked:
shutil.copyfile(os.path.join(srcdir, "settings_style.tmPreferences.kandr"), destfile)
else:
shutil.copyfile(os.path.join(srcdir, "settings_style.tmPreferences.allman"), destfile)
self._is_checked = not self._is_checked
def is_checked(self):
return self._is_checked