|
1 | 1 | # !/usr/bin/env python |
2 | 2 | # -*- coding: utf-8 -*- |
| 3 | +import sublime |
| 4 | +from sublime_plugin import WindowCommand |
| 5 | + |
3 | 6 | from .. import requests |
4 | 7 | from os import path, makedirs |
5 | | -from sublime import version, active_window |
6 | 8 |
|
7 | 9 | from ..tools.boards import get_boards_list |
8 | 10 | from ..tools.command import run_command |
@@ -41,7 +43,8 @@ def get_headers(): |
41 | 43 | headers for urllib request |
42 | 44 | """ |
43 | 45 |
|
44 | | - user_agent = 'uPIOT/{0} (Sublime-Text/{1})'.format(__version__, version()) |
| 46 | + user_agent = 'uPIOT/{0} (Sublime-Text/{1})'.format(__version__, |
| 47 | + sublime.version()) |
45 | 48 | headers = {'User-Agent': user_agent} |
46 | 49 | return headers |
47 | 50 |
|
@@ -95,13 +98,17 @@ def download_file(file_url, dst_path, callback=None): |
95 | 98 |
|
96 | 99 |
|
97 | 100 | def erase_flash(): |
| 101 | + """Erase flash memory |
| 102 | +
|
| 103 | + Erase the flash memory from the current selected device |
| 104 | + """ |
98 | 105 | from ..tools import serial |
99 | 106 |
|
100 | 107 | port = serial.selected_port() |
101 | 108 | if(not port): |
102 | 109 | return |
103 | 110 |
|
104 | | - options = ['--port', port, 'erase_flash'] |
| 111 | + options = ['esptool', '--port', port, 'erase_flash'] |
105 | 112 | run_command(options) |
106 | 113 |
|
107 | 114 |
|
@@ -192,18 +199,32 @@ def check_sidebar_folder(folder): |
192 | 199 |
|
193 | 200 |
|
194 | 201 | def set_status(text): |
| 202 | + """Set the status bar |
| 203 | +
|
| 204 | + Sets a message/text in the status bar |
| 205 | +
|
| 206 | + Arguments: |
| 207 | + text {str} -- text to add |
| 208 | + """ |
195 | 209 | if(ACTIVE_VIEW): |
196 | 210 | ACTIVE_VIEW.set_status('_upiot_', text) |
197 | 211 |
|
198 | 212 |
|
199 | 213 | def clean_status(): |
| 214 | + """Remove status bar text |
| 215 | +
|
| 216 | + Removes the status bar text related to the plugin |
| 217 | + """ |
200 | 218 | if(ACTIVE_VIEW): |
201 | 219 | ACTIVE_VIEW.erase_status('_upiot_') |
202 | 220 |
|
203 | 221 |
|
204 | 222 | def show_console(): |
205 | | - options = {'panel': 'console', 'toggle': True} |
206 | | - active_window().run_command('show_panel', options) |
| 223 | + """Open ST console |
207 | 224 |
|
| 225 | + Opens the Sublime Text console |
| 226 | + """ |
| 227 | + options = {'panel': 'console', 'toggle': True} |
| 228 | + sublime.active_window().run_command('show_panel', options) |
208 | 229 |
|
209 | 230 | __version__ = versionize(VERSION) |
0 commit comments