Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add toggle running command #468

Open
wants to merge 1 commit into
base: Stino-Dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions StinoCommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -1218,6 +1218,32 @@ def is_enabled(self):
return state


class StinoSerialMonitorToggleRunningCommand(sublime_plugin.WindowCommand):
"""."""

def run(self):
"""."""
if stino.arduino_info['init_done']:
serial_port = stino.arduino_info['selected'].get('serial_port', '')
if serial_port:
monitor = \
stino.arduino_info['serial_monitors'].get(serial_port,
None)
if monitor and monitor.is_running():
monitor.stop()
elif not monitor or not monitor.is_running():
stino.start_serial_monitor(serial_port)

def is_enabled(self):
"""."""
state = False
if stino.arduino_info['init_done']:
serial_port = stino.arduino_info['selected'].get('serial_port', '')
if serial_port:
state = True
return state


class StinoSerialMonitorToggleScrollCommand(sublime_plugin.WindowCommand):
"""."""

Expand Down