forked from randy3k/Terminus
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
88 lines (74 loc) · 2.52 KB
/
main.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import sublime
import sys
import logging
from .terminus.commands import (
TerminusCommandsEventListener,
TerminusOpenCommand,
TerminusCloseCommand,
TerminusKeypressCommand,
TerminusCopyCommand,
TerminusPasteCommand,
TerminusPasteFromHistoryCommand,
TerminusDeleteWordCommand,
ToggleTerminusPanelCommand,
TerminusSendStringCommand
)
from .terminus.edit_settings import (
TerminusEditSettingsListener,
TerminusEditSettingsCommand
)
from .terminus.mouse import (
TerminusMouseEventListener,
TerminusOpenContextUrlCommand,
TerminusClickCommand,
TerminusOpenImageCommand
)
from .terminus.query import TerminusQueryContextListener
from .terminus.theme import (
TerminusSelectThemeCommand,
TerminusGenerateThemeCommand,
plugin_loaded as theme_plugin_loaded
)
from .terminus.utils import settings_on_change
from .terminus.view import (
TerminusViewEventListener,
TerminusActivateCommand,
TerminusRenderCommand,
TerminusShowCursor,
TerminusInsertCommand
)
__all__ = [
"TerminusCommandsEventListener", "TerminusOpenCommand", "TerminusCloseCommand",
"TerminusKeypressCommand", "TerminusCopyCommand", "TerminusPasteCommand",
"TerminusPasteFromHistoryCommand", "TerminusDeleteWordCommand", "ToggleTerminusPanelCommand",
"TerminusSendStringCommand",
"TerminusSelectThemeCommand", "TerminusGenerateThemeCommand",
"TerminusEditSettingsListener", "TerminusEditSettingsCommand",
"TerminusMouseEventListener", "TerminusOpenContextUrlCommand", "TerminusClickCommand",
"TerminusOpenImageCommand",
"TerminusQueryContextListener",
"TerminusViewEventListener", "TerminusActivateCommand", "TerminusRenderCommand",
"TerminusShowCursor", "TerminusInsertCommand"
]
logger = logging.getLogger('Terminus')
def plugin_loaded():
theme_plugin_loaded()
if not logger.hasHandlers():
ch = logging.StreamHandler(sys.stdout)
logger.addHandler(ch)
settings = sublime.load_settings("Terminus.sublime-settings")
def on_change(debug):
if debug:
logger.setLevel(logging.DEBUG)
else:
logger.setLevel(logging.WARNING)
on_change(settings.get("debug", False))
settings_on_change(settings, "debug")(on_change)
def plugin_unloaded():
# close all terminals
for w in sublime.windows():
w.destroy_output_panel("Terminus")
for view in w.views():
if view.settings().get("terminus_view"):
w.focus_view(view)
w.run_command("close")