Remove superfluous whitespaces at the end of lines
This commit is contained in:
parent
526695e209
commit
e3f6d56d02
3 changed files with 76 additions and 77 deletions
|
@ -96,8 +96,8 @@ class Subscribe(Route):
|
||||||
|
|
||||||
class WhoAmI(Route):
|
class WhoAmI(Route):
|
||||||
def run(self, data, handler):
|
def run(self, data, handler):
|
||||||
handler.send({"id" : handler.id_,
|
handler.send({"id" : handler.id_,
|
||||||
"user" : pwd.getpwuid(os.getuid()).pw_name},
|
"user" : pwd.getpwuid(os.getuid()).pw_name},
|
||||||
handler.reverse_routes[self])
|
handler.reverse_routes[self])
|
||||||
|
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ class Peers(Route):
|
||||||
for channel in channels:
|
for channel in channels:
|
||||||
self.subscribe(handler, channel)
|
self.subscribe(handler, channel)
|
||||||
# Send on channels and on subscribe
|
# Send on channels and on subscribe
|
||||||
self.send_connected_peers(handler, channels)
|
self.send_connected_peers(handler, channels)
|
||||||
|
|
||||||
|
|
||||||
def send_connected_peers(self, handler, channels):
|
def send_connected_peers(self, handler, channels):
|
||||||
|
@ -184,7 +184,7 @@ class Handler(Server):
|
||||||
def ready(self):
|
def ready(self):
|
||||||
if self.debug:
|
if self.debug:
|
||||||
Logging.info("Handler for '%s:%d' ready." % (self.address, self.port))
|
Logging.info("Handler for '%s:%d' ready." % (self.address, self.port))
|
||||||
|
|
||||||
|
|
||||||
def closed(self, code, reason):
|
def closed(self, code, reason):
|
||||||
if self.debug:
|
if self.debug:
|
||||||
|
|
|
@ -15,11 +15,11 @@ class HostnameNotChangedError(PermissionError):
|
||||||
|
|
||||||
class NotSupportedOnPlatform(OSError):
|
class NotSupportedOnPlatform(OSError):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(OSError, self).__init__("feature not avaliable on OS")
|
super(OSError, self).__init__("feature not avaliable on OS")
|
||||||
|
|
||||||
class PlaybackFailure(OSError):
|
class PlaybackFailure(OSError):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(OSError, self).__init__("audio playback failed")
|
super(OSError, self).__init__("audio playback failed")
|
||||||
|
|
||||||
|
|
||||||
def capture_trace():
|
def capture_trace():
|
||||||
|
@ -40,7 +40,7 @@ def is_darwin():
|
||||||
|
|
||||||
|
|
||||||
def is_windows():
|
def is_windows():
|
||||||
return platform.uname().system == "Windows"
|
return platform.uname().system == "Windows"
|
||||||
|
|
||||||
|
|
||||||
def set_hostname(hostname):
|
def set_hostname(hostname):
|
||||||
|
@ -95,4 +95,4 @@ def play_sound(path):
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
raise PlaybackFailure()
|
raise PlaybackFailure()
|
||||||
else:
|
else:
|
||||||
raise NotSupportedOnPlatform()
|
raise NotSupportedOnPlatform()
|
||||||
|
|
|
@ -51,7 +51,7 @@ views = []
|
||||||
sensor_phantoms = []
|
sensor_phantoms = []
|
||||||
|
|
||||||
def set_status(status, window):
|
def set_status(status, window):
|
||||||
window.active_view().set_status(FL0W_STATUS,
|
window.active_view().set_status(FL0W_STATUS,
|
||||||
"fl0w: %s" % status)
|
"fl0w: %s" % status)
|
||||||
|
|
||||||
class Target:
|
class Target:
|
||||||
|
@ -120,38 +120,38 @@ class Fl0wClient(Client):
|
||||||
utilities_menu = Menu()
|
utilities_menu = Menu()
|
||||||
action_menu.id_ = id_
|
action_menu.id_ = id_
|
||||||
action_menu.name = data[id_]["name"]
|
action_menu.name = data[id_]["name"]
|
||||||
action_menu += Entry("Set Target",
|
action_menu += Entry("Set Target",
|
||||||
"Set controller as target for program execution and sensor readouts",
|
"Set controller as target for program execution and sensor readouts",
|
||||||
action=partial(self.set_target,
|
action=partial(self.set_target,
|
||||||
handler, id_, data[id_]["name"]))
|
handler, id_, data[id_]["name"]))
|
||||||
action_menu += Entry("Run program",
|
action_menu += Entry("Run program",
|
||||||
"Run a botball program on the controller",
|
"Run a botball program on the controller",
|
||||||
action=partial(handler.pipe, None, "list_programs", id_))
|
action=partial(handler.pipe, None, "list_programs", id_))
|
||||||
action_menu += Entry("Stop programs",
|
action_menu += Entry("Stop programs",
|
||||||
"Stop all currently running botball programs",
|
"Stop all currently running botball programs",
|
||||||
action=partial(handler.pipe, None, "stop_programs", id_))
|
action=partial(handler.pipe, None, "stop_programs", id_))
|
||||||
utilities_menu += Entry("Set Name",
|
utilities_menu += Entry("Set Name",
|
||||||
"Sets the hostname of the selected controller",
|
"Sets the hostname of the selected controller",
|
||||||
action=partial(lambda handler, id_: Input("New Hostname:",
|
action=partial(lambda handler, id_: Input("New Hostname:",
|
||||||
initial_text=data[id_]["name"],
|
initial_text=data[id_]["name"],
|
||||||
on_done=lambda hostname: handler.pipe(
|
on_done=lambda hostname: handler.pipe(
|
||||||
{"set" : hostname},
|
{"set" : hostname},
|
||||||
"hostname", id_)).invoke(handler.fl0w.window), handler, id_))
|
"hostname", id_)).invoke(handler.fl0w.window), handler, id_))
|
||||||
utilities_menu += Entry("Processes",
|
utilities_menu += Entry("Processes",
|
||||||
"Lists processes currently running on controller",
|
"Lists processes currently running on controller",
|
||||||
action=partial(handler.pipe, None, "processes", id_))
|
action=partial(handler.pipe, None, "processes", id_))
|
||||||
utilities_menu += Entry("Identify",
|
utilities_menu += Entry("Identify",
|
||||||
"Plays an identification sound on the controller.",
|
"Plays an identification sound on the controller.",
|
||||||
action=partial(handler.pipe, None, "identify", id_))
|
action=partial(handler.pipe, None, "identify", id_))
|
||||||
action_menu += Entry("Utilities", "Stuff you might need but probably won't",
|
action_menu += Entry("Utilities", "Stuff you might need but probably won't",
|
||||||
sub_menu=utilities_menu)
|
sub_menu=utilities_menu)
|
||||||
power_menu += Entry("Shutdown",
|
power_menu += Entry("Shutdown",
|
||||||
"Shutdown the controller",
|
"Shutdown the controller",
|
||||||
action=partial(handler.pipe, None, "shutdown", id_))
|
action=partial(handler.pipe, None, "shutdown", id_))
|
||||||
power_menu += Entry("Reboot",
|
power_menu += Entry("Reboot",
|
||||||
"Reboot the controller",
|
"Reboot the controller",
|
||||||
action=partial(handler.pipe, None, "reboot", id_))
|
action=partial(handler.pipe, None, "reboot", id_))
|
||||||
action_menu += Entry("Power", "Power related actions", sub_menu=power_menu)
|
action_menu += Entry("Power", "Power related actions", sub_menu=power_menu)
|
||||||
action_menu.back = handler.fl0w.controller_menu
|
action_menu.back = handler.fl0w.controller_menu
|
||||||
handler.fl0w.controller_menu += Entry(data[id_]["name"], id_, sub_menu=action_menu,
|
handler.fl0w.controller_menu += Entry(data[id_]["name"], id_, sub_menu=action_menu,
|
||||||
action=self.set_selected_action_menu,
|
action=self.set_selected_action_menu,
|
||||||
|
@ -182,11 +182,11 @@ class Fl0wClient(Client):
|
||||||
def run(self, data, peer, handler):
|
def run(self, data, peer, handler):
|
||||||
program_menu = Menu(subtitles=False)
|
program_menu = Menu(subtitles=False)
|
||||||
for program in data:
|
for program in data:
|
||||||
program_menu += Entry(program,
|
program_menu += Entry(program,
|
||||||
action=partial(self.run_program,
|
action=partial(self.run_program,
|
||||||
handler, handler.routes["peers"].selected_action_menu.id_,
|
handler, handler.routes["peers"].selected_action_menu.id_,
|
||||||
program))
|
program))
|
||||||
program_menu.invoke(handler.fl0w.window,
|
program_menu.invoke(handler.fl0w.window,
|
||||||
back=handler.routes["peers"].selected_action_menu)
|
back=handler.routes["peers"].selected_action_menu)
|
||||||
|
|
||||||
def run_program(self, handler, id_, program):
|
def run_program(self, handler, id_, program):
|
||||||
|
@ -206,7 +206,7 @@ class Fl0wClient(Client):
|
||||||
|
|
||||||
def run(self, data, peer, handler):
|
def run(self, data, peer, handler):
|
||||||
if data == self.__class__.NO_PROGRAMS_RUNNING:
|
if data == self.__class__.NO_PROGRAMS_RUNNING:
|
||||||
sublime.error_message("No programs running.")
|
sublime.error_message("No programs running.")
|
||||||
|
|
||||||
|
|
||||||
class StdStream(Pipe):
|
class StdStream(Pipe):
|
||||||
|
@ -218,7 +218,7 @@ class Fl0wClient(Client):
|
||||||
|
|
||||||
self.handler = None
|
self.handler = None
|
||||||
|
|
||||||
self.fetcher = self.Fetcher(self.buffer, self.write_to_panel,
|
self.fetcher = self.Fetcher(self.buffer, self.write_to_panel,
|
||||||
self.lock)
|
self.lock)
|
||||||
self.fetcher.start()
|
self.fetcher.start()
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ class Fl0wClient(Client):
|
||||||
self.handler = handler
|
self.handler = handler
|
||||||
if type(data) is str:
|
if type(data) is str:
|
||||||
self.lock.acquire()
|
self.lock.acquire()
|
||||||
# try/except is faster than an explicit if as long as the
|
# try/except is faster than an explicit if as long as the
|
||||||
# condition is not met
|
# condition is not met
|
||||||
try:
|
try:
|
||||||
self.buffer[peer].append(data)
|
self.buffer[peer].append(data)
|
||||||
|
@ -252,9 +252,9 @@ class Fl0wClient(Client):
|
||||||
elif type(data) is dict:
|
elif type(data) is dict:
|
||||||
meta_text = ""
|
meta_text = ""
|
||||||
if "exit_code" in data:
|
if "exit_code" in data:
|
||||||
meta_text += "Program finished with exit code: %d\n" % data["exit_code"]
|
meta_text += "Program finished with exit code: %d\n" % data["exit_code"]
|
||||||
self.lock.acquire()
|
self.lock.acquire()
|
||||||
# try/except is faster than an explicit if as long as the
|
# try/except is faster than an explicit if as long as the
|
||||||
# condition is not met
|
# condition is not met
|
||||||
# function call is also slower
|
# function call is also slower
|
||||||
try:
|
try:
|
||||||
|
@ -264,7 +264,7 @@ class Fl0wClient(Client):
|
||||||
self.create_output_panel(handler.fl0w.window, peer)
|
self.create_output_panel(handler.fl0w.window, peer)
|
||||||
self.output_panels[peer] = self.create_output_panel(handler.fl0w.window, peer)
|
self.output_panels[peer] = self.create_output_panel(handler.fl0w.window, peer)
|
||||||
self.buffer[peer].append(meta_text)
|
self.buffer[peer].append(meta_text)
|
||||||
self.lock.release()
|
self.lock.release()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -275,8 +275,8 @@ class Fl0wClient(Client):
|
||||||
self.handler.fl0w.window.run_command("show_panel", {"panel": "output.%s" % peer})
|
self.handler.fl0w.window.run_command("show_panel", {"panel": "output.%s" % peer})
|
||||||
|
|
||||||
|
|
||||||
# Sublime gets quite overwhelmed when faced with typical
|
# Sublime gets quite overwhelmed when faced with typical
|
||||||
# "while (1) { printf(...)}" output.
|
# "while (1) { printf(...)}" output.
|
||||||
# That's why instead of directly writing to the view all received text
|
# That's why instead of directly writing to the view all received text
|
||||||
# is bundled together after a fixed period of time.
|
# is bundled together after a fixed period of time.
|
||||||
class Fetcher(threading.Thread):
|
class Fetcher(threading.Thread):
|
||||||
|
@ -294,7 +294,7 @@ class Fl0wClient(Client):
|
||||||
for peer in self.buffer:
|
for peer in self.buffer:
|
||||||
if len(self.buffer[peer]) > 0:
|
if len(self.buffer[peer]) > 0:
|
||||||
self.write_to_panel(
|
self.write_to_panel(
|
||||||
"".join(self.buffer[peer]),
|
"".join(self.buffer[peer]),
|
||||||
peer)
|
peer)
|
||||||
self.buffer[peer] = []
|
self.buffer[peer] = []
|
||||||
self.lock.release()
|
self.lock.release()
|
||||||
|
@ -310,51 +310,51 @@ class Fl0w:
|
||||||
self.folder = self.folder + "/"
|
self.folder = self.folder + "/"
|
||||||
|
|
||||||
self.connected = False
|
self.connected = False
|
||||||
|
|
||||||
self.subscriptions = {}
|
self.subscriptions = {}
|
||||||
self.subscriptions_lock = threading.Lock()
|
self.subscriptions_lock = threading.Lock()
|
||||||
self._combined_subscriptions = {"analog" : [], "digital" : []}
|
self._combined_subscriptions = {"analog" : [], "digital" : []}
|
||||||
|
|
||||||
self._target = None
|
self._target = None
|
||||||
self._debug = debug
|
self._debug = debug
|
||||||
|
|
||||||
|
|
||||||
self.start_menu = Menu()
|
self.start_menu = Menu()
|
||||||
self.start_menu += Entry("Connect", "Connect to a fl0w server",
|
self.start_menu += Entry("Connect", "Connect to a fl0w server",
|
||||||
action=partial(Input("Address:Port (auto-connect nyi)",
|
action=partial(Input("Address:Port (auto-connect nyi)",
|
||||||
initial_text=self.settings.get("address", "127.0.0.1:3077"),
|
initial_text=self.settings.get("address", "127.0.0.1:3077"),
|
||||||
on_done=self.invoke_connect).invoke, self.window))
|
on_done=self.invoke_connect).invoke, self.window))
|
||||||
self.start_menu += Entry("About", "Information about fl0w",
|
self.start_menu += Entry("About", "Information about fl0w",
|
||||||
action=self.invoke_about)
|
action=self.invoke_about)
|
||||||
|
|
||||||
self.debug_menu = Menu(subtitles=False)
|
self.debug_menu = Menu(subtitles=False)
|
||||||
self.debug_menu += Entry("On",
|
self.debug_menu += Entry("On",
|
||||||
action=lambda: self.set_debug(True))
|
action=lambda: self.set_debug(True))
|
||||||
self.debug_menu += Entry("Off",
|
self.debug_menu += Entry("Off",
|
||||||
action=lambda: self.set_debug(False))
|
action=lambda: self.set_debug(False))
|
||||||
|
|
||||||
|
|
||||||
self.settings_menu = Menu()
|
self.settings_menu = Menu()
|
||||||
self.settings_menu += Entry("Debug", "Toggle debug mode",
|
self.settings_menu += Entry("Debug", "Toggle debug mode",
|
||||||
sub_menu=self.debug_menu)
|
sub_menu=self.debug_menu)
|
||||||
|
|
||||||
|
|
||||||
self.meta = Menu()
|
self.meta = Menu()
|
||||||
self.meta += Entry("Info", "Server info",
|
self.meta += Entry("Info", "Server info",
|
||||||
action=lambda: self.ws.send(None, "info"))
|
action=lambda: self.ws.send(None, "info"))
|
||||||
self.meta_entry = Entry("Meta", "Debug information about fl0w",
|
self.meta_entry = Entry("Meta", "Debug information about fl0w",
|
||||||
sub_menu=self.meta)
|
sub_menu=self.meta)
|
||||||
if self.debug:
|
if self.debug:
|
||||||
self.main_menu += self.meta_entry
|
self.main_menu += self.meta_entry
|
||||||
|
|
||||||
|
|
||||||
self.main_menu = Menu()
|
self.main_menu = Menu()
|
||||||
self.controller_menu = Menu()
|
self.controller_menu = Menu()
|
||||||
self.main_menu += Entry("Controllers", "All connected controllers",
|
self.main_menu += Entry("Controllers", "All connected controllers",
|
||||||
sub_menu=self.controller_menu)
|
sub_menu=self.controller_menu)
|
||||||
self.main_menu += Entry("Settings", "General purpose settings",
|
self.main_menu += Entry("Settings", "General purpose settings",
|
||||||
sub_menu=self.settings_menu)
|
sub_menu=self.settings_menu)
|
||||||
self.main_menu += Entry("Disconnect", "Disconnect from server",
|
self.main_menu += Entry("Disconnect", "Disconnect from server",
|
||||||
action=self.invoke_disconnect)
|
action=self.invoke_disconnect)
|
||||||
|
|
||||||
self.sync_client = behem0th.Client(path=self.folder, verbose_log=True)
|
self.sync_client = behem0th.Client(path=self.folder, verbose_log=True)
|
||||||
|
@ -410,7 +410,7 @@ class Fl0w:
|
||||||
# Could be simplified because only one view can be active at any time.
|
# Could be simplified because only one view can be active at any time.
|
||||||
# This would definetly lead to some major performace improvements on
|
# This would definetly lead to some major performace improvements on
|
||||||
# view switching and less unnecessary unsubscribes.
|
# view switching and less unnecessary unsubscribes.
|
||||||
|
|
||||||
# On the other hand it might be a good idea to leave it in and provide
|
# On the other hand it might be a good idea to leave it in and provide
|
||||||
# an option to disable aggressive unsubscribes
|
# an option to disable aggressive unsubscribes
|
||||||
@property
|
@property
|
||||||
|
@ -442,7 +442,7 @@ class Fl0w:
|
||||||
"""
|
"""
|
||||||
print("Lock will be aquired.")
|
print("Lock will be aquired.")
|
||||||
self.subscriptions_lock.acquire()
|
self.subscriptions_lock.acquire()
|
||||||
print("Lock was aquired.")
|
print("Lock was aquired.")
|
||||||
del self.subscriptions[sensor_phantom]
|
del self.subscriptions[sensor_phantom]
|
||||||
print("Lock will be released.")
|
print("Lock will be released.")
|
||||||
self.subscriptions_lock.release()
|
self.subscriptions_lock.release()
|
||||||
|
@ -459,7 +459,7 @@ class Fl0w:
|
||||||
for sensor_phantom in self.subscriptions:
|
for sensor_phantom in self.subscriptions:
|
||||||
for sensor_type in ("analog", "digital"):
|
for sensor_type in ("analog", "digital"):
|
||||||
combined_subscriptions[sensor_type] = list(
|
combined_subscriptions[sensor_type] = list(
|
||||||
set(combined_subscriptions[sensor_type]) |
|
set(combined_subscriptions[sensor_type]) |
|
||||||
set(self.subscriptions[sensor_phantom][sensor_type])
|
set(self.subscriptions[sensor_phantom][sensor_type])
|
||||||
)
|
)
|
||||||
self.combined_subscriptions = combined_subscriptions
|
self.combined_subscriptions = combined_subscriptions
|
||||||
|
@ -492,15 +492,14 @@ class Fl0w:
|
||||||
webbrowser.open("http://robot0nfire.com")
|
webbrowser.open("http://robot0nfire.com")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def connect(self, address):
|
def connect(self, address):
|
||||||
try:
|
try:
|
||||||
self.ws = Fl0wClient(address)
|
self.ws = Fl0wClient(address)
|
||||||
self.ws.setup({"info" : Fl0wClient.Info(), "peers" : Fl0wClient.Peers(),
|
self.ws.setup({"info" : Fl0wClient.Info(), "peers" : Fl0wClient.Peers(),
|
||||||
"processes" : Fl0wClient.Processes(),
|
"processes" : Fl0wClient.Processes(),
|
||||||
"list_programs" : Fl0wClient.ListPrograms(), "sensor" : Fl0wClient.Sensor(),
|
"list_programs" : Fl0wClient.ListPrograms(), "sensor" : Fl0wClient.Sensor(),
|
||||||
"std_stream" : Fl0wClient.StdStream(), "run_program" : Fl0wClient.RunProgram(),
|
"std_stream" : Fl0wClient.StdStream(), "run_program" : Fl0wClient.RunProgram(),
|
||||||
"stop_programs" : Fl0wClient.StopPrograms()},
|
"stop_programs" : Fl0wClient.StopPrograms()},
|
||||||
self, debug=True)
|
self, debug=True)
|
||||||
self.ws.connect()
|
self.ws.connect()
|
||||||
sublime.set_timeout_async(self.ws.run_forever, 0)
|
sublime.set_timeout_async(self.ws.run_forever, 0)
|
||||||
|
@ -614,10 +613,10 @@ class SensorCommand(sublime_plugin.WindowCommand):
|
||||||
view.sensor_phantom.enabled = not view.sensor_phantom.enabled
|
view.sensor_phantom.enabled = not view.sensor_phantom.enabled
|
||||||
view_file_name = view.file_name()
|
view_file_name = view.file_name()
|
||||||
if view_file_name == None:
|
if view_file_name == None:
|
||||||
view_file_name = "untitled"
|
view_file_name = "untitled"
|
||||||
set_status("%s sensor phantoms for '%s'." % (
|
set_status("%s sensor phantoms for '%s'." % (
|
||||||
"Enabled" if view.sensor_phantom.enabled else "Disabled",
|
"Enabled" if view.sensor_phantom.enabled else "Disabled",
|
||||||
view_file_name),
|
view_file_name),
|
||||||
self.window)
|
self.window)
|
||||||
else:
|
else:
|
||||||
sublime.error_message("fl0w is not connected.")
|
sublime.error_message("fl0w is not connected.")
|
||||||
|
@ -633,7 +632,7 @@ class SensorPhantom(sublime_plugin.ViewEventListener):
|
||||||
if not view in views:
|
if not view in views:
|
||||||
views.append(view)
|
views.append(view)
|
||||||
self.window = view.window()
|
self.window = view.window()
|
||||||
|
|
||||||
# Is patched by the fl0w instance that is in control of the same window
|
# Is patched by the fl0w instance that is in control of the same window
|
||||||
self.fl0w = None
|
self.fl0w = None
|
||||||
self._enabled = False
|
self._enabled = False
|
||||||
|
@ -656,7 +655,7 @@ class SensorPhantom(sublime_plugin.ViewEventListener):
|
||||||
def enabled(self):
|
def enabled(self):
|
||||||
return self._enabled
|
return self._enabled
|
||||||
|
|
||||||
|
|
||||||
@enabled.setter
|
@enabled.setter
|
||||||
def enabled(self, enabled_):
|
def enabled(self, enabled_):
|
||||||
if enabled_:
|
if enabled_:
|
||||||
|
@ -704,7 +703,7 @@ class SensorPhantom(sublime_plugin.ViewEventListener):
|
||||||
if port_candidates[0].isnumeric():
|
if port_candidates[0].isnumeric():
|
||||||
matches[method_name].append(
|
matches[method_name].append(
|
||||||
(
|
(
|
||||||
int(port_candidates[0]),
|
int(port_candidates[0]),
|
||||||
sublime.Region(self.view.line(candidate.a).b)
|
sublime.Region(self.view.line(candidate.a).b)
|
||||||
))
|
))
|
||||||
self.matches = matches
|
self.matches = matches
|
||||||
|
@ -715,12 +714,12 @@ class SensorPhantom(sublime_plugin.ViewEventListener):
|
||||||
self.view.erase_phantoms(sensor_type)
|
self.view.erase_phantoms(sensor_type)
|
||||||
for match in self.matches[sensor_type]:
|
for match in self.matches[sensor_type]:
|
||||||
try:
|
try:
|
||||||
self.view.add_phantom(sensor_type, match[1],
|
self.view.add_phantom(sensor_type, match[1],
|
||||||
STYLE_OPEN + str(readouts[sensor_type][str(match[0])]) + STYLE_CLOSE,
|
STYLE_OPEN + str(readouts[sensor_type][str(match[0])]) + STYLE_CLOSE,
|
||||||
sublime.LAYOUT_INLINE)
|
sublime.LAYOUT_INLINE)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
self.view.add_phantom(sensor_type, match[1],
|
self.view.add_phantom(sensor_type, match[1],
|
||||||
ERROR_OPEN + "!" + ERROR_CLOSE,
|
ERROR_OPEN + "!" + ERROR_CLOSE,
|
||||||
sublime.LAYOUT_INLINE)
|
sublime.LAYOUT_INLINE)
|
||||||
|
|
||||||
|
|
||||||
|
@ -751,7 +750,7 @@ class SensorPhantom(sublime_plugin.ViewEventListener):
|
||||||
self.enabled = True
|
self.enabled = True
|
||||||
|
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
self.enabled = False
|
self.enabled = False
|
||||||
if self in sensor_phantoms:
|
if self in sensor_phantoms:
|
||||||
del sensor_phantoms[sensor_phantoms.index(self)]
|
del sensor_phantoms[sensor_phantoms.index(self)]
|
||||||
|
|
Reference in a new issue