Skip to content
This repository was archived by the owner on Dec 23, 2021. It is now read-only.

Commit 25b22c4

Browse files
vandyliuxnkevinnguyenandreamah
authored
Creating Preview Mode For CLUE (#303)
Co-authored-by: Kevin Nguyen <[email protected]> Co-authored-by: Andrea Mah <[email protected]>
1 parent 02d99a3 commit 25b22c4

File tree

8 files changed

+100
-5
lines changed

8 files changed

+100
-5
lines changed

assets/readmeFiles/clue/clue.png

-159 KB
Loading

locales/en/package.i18n.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@
1313
"deviceSimulatorExpressExtension.configuration.title": "Device Simulator Express configuration",
1414
"deviceSimulatorExpressExtension.configuration.properties.configEnvOnChange": "When you change the Python interpreter, the Device Simulator Express will automatically configure itself for the required dependencies.",
1515
"deviceSimulatorExpressExtension.configuration.properties.debuggerPort": "The port the Server will listen on for communication with the debugger.",
16-
"deviceSimulatorExpressExtension.configuration.properties.dependencyChecker": "Whether or not to ask if we can download dependencies. If unchecked, the extension will default to never download dependencies, except when automatically creating a virtual environment in the extension files."
16+
"deviceSimulatorExpressExtension.configuration.properties.dependencyChecker": "Whether or not to ask if we can download dependencies. If unchecked, the extension will default to never download dependencies, except when automatically creating a virtual environment in the extension files.",
17+
"deviceSimulatorExpressExtension.configuration.properties.previewMode": "Enable this to test out and play with the new Adafruit CLUE simulator!"
1718
}

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,12 @@
144144
"default": 5577,
145145
"description": "%deviceSimulatorExpressExtension.configuration.properties.debuggerPort%",
146146
"scope": "resource"
147+
},
148+
"deviceSimulatorExpress.previewMode": {
149+
"type": "boolean",
150+
"default": false,
151+
"description": "%deviceSimulatorExpressExtension.configuration.properties.previewMode%",
152+
"scope": "resource"
147153
}
148154
}
149155
},

package.nls.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@
1313
"deviceSimulatorExpressExtension.configuration.title": "Device Simulator Express configuration",
1414
"deviceSimulatorExpressExtension.configuration.properties.configEnvOnChange": "When you change the Python interpreter, the Device Simulator Express will automatically configure itself for the required dependencies.",
1515
"deviceSimulatorExpressExtension.configuration.properties.debuggerPort": "The port the Server will listen on for communication with the debugger.",
16-
"deviceSimulatorExpressExtension.configuration.properties.dependencyChecker": "Whether or not to ask for dependency downloads. If unchecked, the extension will default to never download dependencies, except when automatically creating a virtual environment in the extension files."
16+
"deviceSimulatorExpressExtension.configuration.properties.dependencyChecker": "Whether or not to ask for dependency downloads. If unchecked, the extension will default to never download dependencies, except when automatically creating a virtual environment in the extension files.",
17+
"deviceSimulatorExpressExtension.configuration.properties.previewMode": "Enable this to test out and play with the new Adafruit CLUE simulator!"
1718
}

src/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export const CONFIG = {
2222
PYTHON_PATH: "python.pythonPath",
2323
SHOW_DEPENDENCY_INSTALL: "deviceSimulatorExpress.showDependencyInstall",
2424
SHOW_NEW_FILE_POPUP: "deviceSimulatorExpress.showNewFilePopup",
25+
ENABLE_PREVIEW_MODE: "deviceSimulatorExpress.previewMode",
2526
};
2627

2728
export const CONSTANTS = {

src/extension.ts

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,14 @@ export async function activate(context: vscode.ExtensionContext) {
307307
const openSimulator: vscode.Disposable = vscode.commands.registerCommand(
308308
"deviceSimulatorExpress.common.openSimulator",
309309
async () => {
310+
const isPreviewMode = getIsPreviewMode();
311+
310312
const chosen_device = await vscode.window.showQuickPick(
311-
Object.values(CONSTANTS.DEVICE_NAME_FORMAL)
313+
Object.values(CONSTANTS.DEVICE_NAME_FORMAL).filter(
314+
device =>
315+
isPreviewMode ||
316+
device !== CONSTANTS.DEVICE_NAME_FORMAL.CLUE
317+
)
312318
);
313319

314320
if (!chosen_device) {
@@ -411,8 +417,14 @@ export async function activate(context: vscode.ExtensionContext) {
411417
const newFile: vscode.Disposable = vscode.commands.registerCommand(
412418
"deviceSimulatorExpress.common.newFile",
413419
async () => {
420+
const isPreviewMode = getIsPreviewMode();
421+
414422
const chosen_device = await vscode.window.showQuickPick(
415-
Object.values(CONSTANTS.DEVICE_NAME_FORMAL)
423+
Object.values(CONSTANTS.DEVICE_NAME_FORMAL).filter(
424+
device =>
425+
isPreviewMode ||
426+
device !== CONSTANTS.DEVICE_NAME_FORMAL.CLUE
427+
)
416428
);
417429

418430
if (!chosen_device) {
@@ -782,8 +794,14 @@ export async function activate(context: vscode.ExtensionContext) {
782794
const deployToDevice: vscode.Disposable = vscode.commands.registerCommand(
783795
"deviceSimulatorExpress.common.deployToDevice",
784796
async () => {
797+
const isPreviewMode = getIsPreviewMode();
798+
785799
const chosen_device = await vscode.window.showQuickPick(
786-
Object.values(CONSTANTS.DEVICE_NAME_FORMAL)
800+
Object.values(CONSTANTS.DEVICE_NAME_FORMAL).filter(
801+
device =>
802+
isPreviewMode ||
803+
device !== CONSTANTS.DEVICE_NAME_FORMAL.CLUE
804+
)
787805
);
788806

789807
if (!chosen_device) {
@@ -1003,6 +1021,13 @@ export async function activate(context: vscode.ExtensionContext) {
10031021
}
10041022
);
10051023

1024+
const getIsPreviewMode = (): boolean => {
1025+
const isPreviewMode: boolean = vscode.workspace
1026+
.getConfiguration()
1027+
.get(CONFIG.ENABLE_PREVIEW_MODE);
1028+
return isPreviewMode;
1029+
};
1030+
10061031
context.subscriptions.push(
10071032
installDependencies,
10081033
runSimulator,

src/view/pages/__snapshots__/gettingStarted.spec.tsx.snap

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,58 @@ exports[`GettingStartedPage component should render correctly 1`] = `
213213
<h2>
214214
Tutorial for CLUE
215215
</h2>
216+
<h3>
217+
0. Enable Preview Mode to use the CLUE (This is required)
218+
</h3>
219+
<p>
220+
a. Access your settings:
221+
</p>
222+
<img
223+
alt="Open settings"
224+
src="https://github.com/raw/microsoft/vscode-python-devicesimulator/dev/assets/readmeFiles/clue/open_settings.PNG"
225+
/>
226+
<ul>
227+
<li>
228+
Windows or Linux: press
229+
<kbd>
230+
Ctrl
231+
</kbd>
232+
+
233+
<kbd>
234+
,
235+
</kbd>
236+
or go to
237+
<code>
238+
File -&gt; Preferences -&gt; Settings
239+
</code>
240+
</li>
241+
<li>
242+
Mac: press
243+
<kbd>
244+
Cmd
245+
</kbd>
246+
+
247+
<kbd>
248+
,
249+
</kbd>
250+
or go to
251+
<code>
252+
Code -&gt; Preferences -&gt; Settings
253+
</code>
254+
.
255+
</li>
256+
</ul>
257+
<p>
258+
b. Check the
259+
<code>
260+
"Device Simulator Express: Preview Mode"
261+
</code>
262+
setting.
263+
</p>
264+
<img
265+
alt="Enable preview mode"
266+
src="https://github.com/raw/microsoft/vscode-python-devicesimulator/dev/assets/readmeFiles/clue/check_preview_mode.gif"
267+
/>
216268
<h3>
217269
1. Import the the main CLUE library (This is required)
218270
</h3>

src/view/pages/gettingStarted.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,15 @@ export class GettingStartedPage extends React.Component {
136136
{/* prettier-ignore */}
137137
<div id="CLUE" className="inv">
138138
<h2> Tutorial for CLUE </h2>
139+
<h3> 0. Enable Preview Mode to use the CLUE (This is required)</h3>
140+
<p> a. Access your settings:</p>
141+
<img alt='Open settings' src='https://github.com/raw/microsoft/vscode-python-devicesimulator/dev/assets/readmeFiles/clue/open_settings.PNG'></img>
142+
<ul>
143+
<li>Windows or Linux: press <kbd>Ctrl</kbd> + <kbd>,</kbd> or go to <code>File -> Preferences -> Settings</code></li>
144+
<li>Mac: press <kbd>Cmd</kbd> + <kbd>,</kbd> or go to <code>Code -> Preferences -> Settings</code>.</li>
145+
</ul>
146+
<p> b. Check the <code>"Device Simulator Express: Preview Mode"</code> setting.</p>
147+
<img alt='Enable preview mode' src='https://github.com/raw/microsoft/vscode-python-devicesimulator/dev/assets/readmeFiles/clue/check_preview_mode.gif'></img>
139148
<h3>
140149
1. Import the the main CLUE library (This is
141150
required)

0 commit comments

Comments
 (0)