-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathcustomization.py
71 lines (58 loc) · 2.18 KB
/
customization.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import sublime
import sublime_plugin
OPTIONAL_SETTINGS = {
"meetio_tabs_diff_pencil_icon": {
"default": False,
"description": "Diff pencil if the tab as modified.",
"title": "Show Tab Diff Pencil"
},
"meetio_sidebar_disclosure": {
"default": True,
"description": "An expand/collapse icon present in all tree rows that can be expanded.",
"title": "Show Sidebar Disclosure"
},
"meetio_input_search_icon": {
"default": True,
"description": "The search icon in the text input used by the Quick Panel.",
"title": "Show Search Icon"
},
"meetio_panel_close_button": {
"default": True,
"description": "The button to close the open panel.",
"title": "Show close button in Panel."
},
}
class MeetioSettingsCommand(sublime_plugin.TextCommand):
def run(self, edit, setting, value):
if not isinstance(value, bool):
return
if setting not in OPTIONAL_SETTINGS.keys():
return
s = sublime.load_settings('Preferences.sublime-settings')
s.set(setting, value)
sublime.save_settings('Preferences.sublime-settings')
def input(self, args):
return MeetioSettingsInputHandler()
def is_visible(self):
s = sublime.load_settings('Preferences.sublime-settings')
theme = s.get('theme')
return theme in ['Meetio Theme.sublime-theme', 'Meetio Theme High Contrast.sublime-theme']
class MeetioSettingsInputHandler(sublime_plugin.ListInputHandler):
def name(self):
return 'setting'
def list_items(self):
s = sublime.load_settings('Preferences.sublime-settings')
return [
sublime.ListInputItem(
OPTIONAL_SETTINGS[index]['title'],
index,
'%s' % (OPTIONAL_SETTINGS[index]['description']))
for index in OPTIONAL_SETTINGS
]
def next_input(self, args):
return MeetioBooleanInputHandler()
class MeetioBooleanInputHandler(sublime_plugin.ListInputHandler):
def name(self):
return 'value'
def list_items(self):
return [sublime.ListInputItem(str(item), item) for item in [True, False]]