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

Creating Preview Mode For CLUE #303

Merged
merged 24 commits into from
Apr 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
845ad8e
first commit
vandyliu Apr 8, 2020
5f62cb5
refactored ispreviewmode function
vandyliu Apr 8, 2020
01a6728
Merge branch 'dev' into users/t-vali/clue-preview-mode
xnkevinnguyen Apr 8, 2020
9e9e52b
Merge branch 'dev' into users/t-vali/clue-preview-mode
vandyliu Apr 8, 2020
4d9ab3e
updated for getting started
vandyliu Apr 8, 2020
b45726e
updated frontend testfor getting started
vandyliu Apr 8, 2020
f6104b2
fixed test
vandyliu Apr 8, 2020
00a869c
Merge branch 'dev' into users/t-vali/clue-preview-mode
vandyliu Apr 8, 2020
5318ed6
fixed test
vandyliu Apr 8, 2020
b95dd02
Merge branch 'users/t-vali/clue-preview-mode' of https://github.com/m…
vandyliu Apr 8, 2020
e26ac7b
Updated keyboard pressing icons
vandyliu Apr 8, 2020
f853f34
Updated to use code for commands
vandyliu Apr 8, 2020
278d1fb
updated images
vandyliu Apr 8, 2020
cc5c1a5
Made SHIFT and CTRL lowercase
vandyliu Apr 8, 2020
699a393
Merge branch 'dev' into users/t-vali/clue-preview-mode
vandyliu Apr 9, 2020
21b8a38
Updated JEST tests
vandyliu Apr 9, 2020
a16b0cd
updated jest tests
vandyliu Apr 9, 2020
9b66345
fixed bug in test
vandyliu Apr 9, 2020
4ca1223
Merge branch 'dev' into users/t-vali/clue-preview-mode
andreamah Apr 9, 2020
7e6479d
Merge branch 'dev' into users/t-vali/clue-preview-mode
andreamah Apr 9, 2020
0c6b804
New way to format CLUE getting started
vandyliu Apr 9, 2020
537df12
Merge branch 'users/t-vali/clue-preview-mode' of https://github.com/m…
vandyliu Apr 9, 2020
d8e99ac
New CLUE photo that fits README better
vandyliu Apr 9, 2020
45ec0e4
Updated tests again
vandyliu Apr 9, 2020
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
Binary file modified assets/readmeFiles/clue/clue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion locales/en/package.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
"deviceSimulatorExpressExtension.configuration.title": "Device Simulator Express configuration",
"deviceSimulatorExpressExtension.configuration.properties.configEnvOnChange": "When you change the Python interpreter, the Device Simulator Express will automatically configure itself for the required dependencies.",
"deviceSimulatorExpressExtension.configuration.properties.debuggerPort": "The port the Server will listen on for communication with the debugger.",
"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."
"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.",
"deviceSimulatorExpressExtension.configuration.properties.previewMode": "Enable this to test out and play with the new Adafruit CLUE simulator!"
}
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,12 @@
"default": 5577,
"description": "%deviceSimulatorExpressExtension.configuration.properties.debuggerPort%",
"scope": "resource"
},
"deviceSimulatorExpress.previewMode": {
"type": "boolean",
"default": false,
"description": "%deviceSimulatorExpressExtension.configuration.properties.previewMode%",
"scope": "resource"
}
}
},
Expand Down
3 changes: 2 additions & 1 deletion package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
"deviceSimulatorExpressExtension.configuration.title": "Device Simulator Express configuration",
"deviceSimulatorExpressExtension.configuration.properties.configEnvOnChange": "When you change the Python interpreter, the Device Simulator Express will automatically configure itself for the required dependencies.",
"deviceSimulatorExpressExtension.configuration.properties.debuggerPort": "The port the Server will listen on for communication with the debugger.",
"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."
"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.",
"deviceSimulatorExpressExtension.configuration.properties.previewMode": "Enable this to test out and play with the new Adafruit CLUE simulator!"
}
1 change: 1 addition & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const CONFIG = {
PYTHON_PATH: "python.pythonPath",
SHOW_DEPENDENCY_INSTALL: "deviceSimulatorExpress.showDependencyInstall",
SHOW_NEW_FILE_POPUP: "deviceSimulatorExpress.showNewFilePopup",
ENABLE_PREVIEW_MODE: "deviceSimulatorExpress.previewMode",
};

export const CONSTANTS = {
Expand Down
31 changes: 28 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,14 @@ export async function activate(context: vscode.ExtensionContext) {
const openSimulator: vscode.Disposable = vscode.commands.registerCommand(
"deviceSimulatorExpress.common.openSimulator",
async () => {
const isPreviewMode = getIsPreviewMode();

const chosen_device = await vscode.window.showQuickPick(
Object.values(CONSTANTS.DEVICE_NAME_FORMAL)
Object.values(CONSTANTS.DEVICE_NAME_FORMAL).filter(
device =>
isPreviewMode ||
device !== CONSTANTS.DEVICE_NAME_FORMAL.CLUE
)
);

if (!chosen_device) {
Expand Down Expand Up @@ -411,8 +417,14 @@ export async function activate(context: vscode.ExtensionContext) {
const newFile: vscode.Disposable = vscode.commands.registerCommand(
"deviceSimulatorExpress.common.newFile",
async () => {
const isPreviewMode = getIsPreviewMode();

const chosen_device = await vscode.window.showQuickPick(
Object.values(CONSTANTS.DEVICE_NAME_FORMAL)
Object.values(CONSTANTS.DEVICE_NAME_FORMAL).filter(
device =>
isPreviewMode ||
device !== CONSTANTS.DEVICE_NAME_FORMAL.CLUE
)
);

if (!chosen_device) {
Expand Down Expand Up @@ -782,8 +794,14 @@ export async function activate(context: vscode.ExtensionContext) {
const deployToDevice: vscode.Disposable = vscode.commands.registerCommand(
"deviceSimulatorExpress.common.deployToDevice",
async () => {
const isPreviewMode = getIsPreviewMode();

const chosen_device = await vscode.window.showQuickPick(
Object.values(CONSTANTS.DEVICE_NAME_FORMAL)
Object.values(CONSTANTS.DEVICE_NAME_FORMAL).filter(
device =>
isPreviewMode ||
device !== CONSTANTS.DEVICE_NAME_FORMAL.CLUE
)
);

if (!chosen_device) {
Expand Down Expand Up @@ -1003,6 +1021,13 @@ export async function activate(context: vscode.ExtensionContext) {
}
);

const getIsPreviewMode = (): boolean => {
vandyliu marked this conversation as resolved.
Show resolved Hide resolved
const isPreviewMode: boolean = vscode.workspace
.getConfiguration()
.get(CONFIG.ENABLE_PREVIEW_MODE);
return isPreviewMode;
};

context.subscriptions.push(
installDependencies,
runSimulator,
Expand Down
52 changes: 52 additions & 0 deletions src/view/pages/__snapshots__/gettingStarted.spec.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,58 @@ exports[`GettingStartedPage component should render correctly 1`] = `
<h2>
Tutorial for CLUE
</h2>
<h3>
0. Enable Preview Mode to use the CLUE (This is required)
</h3>
<p>
a. Access your settings:
</p>
<img
alt="Open settings"
src="https://raw.githubusercontent.com/microsoft/vscode-python-devicesimulator/dev/assets/readmeFiles/clue/open_settings.PNG"
/>
<ul>
<li>
Windows or Linux: press
<kbd>
Ctrl
</kbd>
+
<kbd>
,
</kbd>
or go to
<code>
File -&gt; Preferences -&gt; Settings
</code>
</li>
<li>
Mac: press
<kbd>
Cmd
</kbd>
+
<kbd>
,
</kbd>
or go to
<code>
Code -&gt; Preferences -&gt; Settings
</code>
.
</li>
</ul>
<p>
b. Check the
<code>
"Device Simulator Express: Preview Mode"
</code>
setting.
</p>
<img
alt="Enable preview mode"
src="https://raw.githubusercontent.com/microsoft/vscode-python-devicesimulator/dev/assets/readmeFiles/clue/check_preview_mode.gif"
/>
<h3>
1. Import the the main CLUE library (This is required)
</h3>
Expand Down
9 changes: 9 additions & 0 deletions src/view/pages/gettingStarted.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,15 @@ export class GettingStartedPage extends React.Component {
{/* prettier-ignore */}
<div id="CLUE" className="inv">
<h2> Tutorial for CLUE </h2>
<h3> 0. Enable Preview Mode to use the CLUE (This is required)</h3>
<p> a. Access your settings:</p>
<img alt='Open settings' src='https://raw.githubusercontent.com/microsoft/vscode-python-devicesimulator/dev/assets/readmeFiles/clue/open_settings.PNG'></img>
<ul>
vandyliu marked this conversation as resolved.
Show resolved Hide resolved
<li>Windows or Linux: press <kbd>Ctrl</kbd> + <kbd>,</kbd> or go to <code>File -> Preferences -> Settings</code></li>
<li>Mac: press <kbd>Cmd</kbd> + <kbd>,</kbd> or go to <code>Code -> Preferences -> Settings</code>.</li>
</ul>
<p> b. Check the <code>"Device Simulator Express: Preview Mode"</code> setting.</p>
<img alt='Enable preview mode' src='https://raw.githubusercontent.com/microsoft/vscode-python-devicesimulator/dev/assets/readmeFiles/clue/check_preview_mode.gif'></img>
<h3>
1. Import the the main CLUE library (This is
required)
Expand Down