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

Commit 5a639fe

Browse files
Merge branch 'dev' into users/t-xunguy/ab-fix
2 parents 879659c + 70f553c commit 5a639fe

File tree

15 files changed

+349
-115
lines changed

15 files changed

+349
-115
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ Device Simulator Express provides several commands in the Command Palette (F1 or
145145

146146
In Device Simulator Express, you can use keyboard to interact with the device:
147147

148-
- Push Button `A & B: A B`
148+
- Push Button `A for A, B for B, C for A & B`
149149
- Capacitive Touch Sensor `A1 – A7: SHIFT + 1~7`
150150
- Slider Switch: `SHIFT + S`
151151
- Refresh the simulator: `SHIFT + R`
@@ -175,7 +175,7 @@ Using the simulator for the micro:bit is similar to using the one for the CPX. T
175175
Please review the CPX's ["How to use" guide](#How-to-use) for more info.
176176

177177
### Keybindings
178-
- Push Button `A & B: A B`
178+
- Push Button `A for A, B for B, C for A & B`
179179
- Refresh the simulator: `SHIFT + R`
180180

181181
## Contribute

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@
171171
"type": "boolean",
172172
"default": false,
173173
"description": "%deviceSimulatorExpressExtension.configuration.properties.previewMode%",
174-
"scope": "resource"
174+
"scope": "resource"
175175
}
176176
}
177177
},
@@ -351,4 +351,4 @@
351351
"extensionDependencies": [
352352
"ms-python.python"
353353
]
354-
}
354+
}

src/adafruit_circuitplayground/constants.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,6 @@
2727

2828
VALID_PIXEL_ASSIGN_ERROR = "The pixel color value should be a tuple with three values between 0 and 255 or a hexadecimal color between 0x000000 and 0xFFFFFF."
2929

30-
TELEMETRY_EVENT_NAMES = {
31-
"TAPPED": "API.TAPPED",
32-
"PLAY_FILE": "API.PLAY.FILE",
33-
"PLAY_TONE": "API.PLAY.TONE",
34-
"START_TONE": "API.START.TONE",
35-
"STOP_TONE": "API.STOP.TONE",
36-
"DETECT_TAPS": "API.DETECT.TAPS",
37-
"ADJUST_THRESHOLD": "API.ADJUST.THRESHOLD",
38-
"RED_LED": "API.RED.LED",
39-
"PIXELS": "API.PIXELS",
40-
}
4130
ERROR_SENDING_EVENT = "Error trying to send event to the process : "
4231

4332
TIME_DELAY = 0.03

src/constants.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,11 @@ export const HELPER_FILES = {
471471
DEVICE_PY: "device.py",
472472
PROCESS_USER_CODE_PY: "process_user_code.py",
473473
PYTHON_EXE: "python.exe",
474+
PYTHON: "python",
475+
};
476+
477+
export const GLOBAL_ENV_VARS = {
478+
PYTHON: "python",
474479
};
475480

476481
export default CONSTANTS;

src/extension.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import * as cp from "child_process";
55
import * as fs from "fs";
66
import * as open from "open";
7+
import * as os from "os";
78
import * as path from "path";
89
import * as vscode from "vscode";
910
import {
@@ -12,6 +13,7 @@ import {
1213
CPX_CONFIG_FILE,
1314
DEFAULT_DEVICE,
1415
DialogResponses,
16+
GLOBAL_ENV_VARS,
1517
HELPER_FILES,
1618
SERVER_INFO,
1719
TelemetryEventName,
@@ -34,7 +36,7 @@ import { registerDefaultFontFaces } from "office-ui-fabric-react";
3436
let currentFileAbsPath: string = "";
3537
let currentTextDocument: vscode.TextDocument;
3638
let telemetryAI: TelemetryAI;
37-
let pythonExecutableName: string = "python";
39+
let pythonExecutablePath: string = GLOBAL_ENV_VARS.PYTHON;
3840
let configFileCreated: boolean = false;
3941
let inDebugMode: boolean = false;
4042
// Notification booleans
@@ -98,7 +100,7 @@ export async function activate(context: vscode.ExtensionContext) {
98100
// doesn't trigger lint errors
99101
updatePylintArgs(context);
100102

101-
pythonExecutableName = await utils.setupEnv(context);
103+
pythonExecutablePath = await utils.setupEnv(context);
102104

103105
try {
104106
utils.generateCPXConfig();
@@ -108,7 +110,7 @@ export async function activate(context: vscode.ExtensionContext) {
108110
configFileCreated = false;
109111
}
110112

111-
if (pythonExecutableName === "") {
113+
if (pythonExecutablePath === "") {
112114
return;
113115
}
114116

@@ -442,7 +444,7 @@ export async function activate(context: vscode.ExtensionContext) {
442444
const installDependencies: vscode.Disposable = vscode.commands.registerCommand(
443445
"deviceSimulatorExpress.common.installDependencies",
444446
async () => {
445-
pythonExecutableName = await utils.setupEnv(context, true);
447+
pythonExecutablePath = await utils.setupEnv(context, true);
446448
telemetryAI.trackFeatureUsage(
447449
TelemetryEventName.COMMAND_INSTALL_EXTENSION_DEPENDENCIES
448450
);
@@ -568,7 +570,7 @@ export async function activate(context: vscode.ExtensionContext) {
568570
active_device: currentActiveDevice,
569571
});
570572

571-
childProcess = cp.spawn(pythonExecutableName, [
573+
childProcess = cp.spawn(pythonExecutablePath, [
572574
utils.getPathToScript(
573575
context,
574576
CONSTANTS.FILESYSTEM.OUTPUT_DIRECTORY,
@@ -727,7 +729,7 @@ export async function activate(context: vscode.ExtensionContext) {
727729
CONSTANTS.INFO.FILE_SELECTED(currentFileAbsPath)
728730
);
729731

730-
const deviceProcess = cp.spawn(pythonExecutableName, [
732+
const deviceProcess = cp.spawn(pythonExecutablePath, [
731733
utils.getPathToScript(
732734
context,
733735
CONSTANTS.FILESYSTEM.OUTPUT_DIRECTORY,
@@ -1030,7 +1032,7 @@ export async function activate(context: vscode.ExtensionContext) {
10301032
const configsChanged = vscode.workspace.onDidChangeConfiguration(
10311033
async () => {
10321034
if (utils.checkConfig(CONFIG.CONFIG_ENV_ON_SWITCH)) {
1033-
pythonExecutableName = await utils.setupEnv(context);
1035+
pythonExecutablePath = await utils.setupEnv(context);
10341036
}
10351037
}
10361038
);

0 commit comments

Comments
 (0)