diff --git a/README.md b/README.md index 0da43101b..5fd02e91c 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,6 @@ The following dependencies are required to install before launching Device Simul You will be prompted to install the Python dependencies during the first use. - _**[Visual Studio Code](https://code.visualstudio.com/)**_ -- _**[Node](https://nodejs.org/en/download/)**_ - _**[Python 3.7+](https://www.python.org/downloads/)**_: Make sure you've added Python and pip to your PATH in your environment variables. (1) - _**[Python VS Code extension](https://marketplace.visualstudio.com/items?itemName=ms-python.python)**_: This will be installed automatically from the marketplace when you install Device Simulator Express. diff --git a/src/base_circuitpython/displayio/group.py b/src/base_circuitpython/displayio/group.py index c5dccf90a..5acc1f2a8 100644 --- a/src/base_circuitpython/displayio/group.py +++ b/src/base_circuitpython/displayio/group.py @@ -3,7 +3,7 @@ from PIL import Image import adafruit_display_text -from .tile_grid import TileGrid +from displayio.tile_grid import TileGrid from . import constants as CONSTANTS import common diff --git a/src/base_circuitpython/displayio/test/test_group.py b/src/base_circuitpython/displayio/test/test_group.py index 4d943ffc8..3e4b3601e 100644 --- a/src/base_circuitpython/displayio/test/test_group.py +++ b/src/base_circuitpython/displayio/test/test_group.py @@ -7,10 +7,10 @@ from common import utils -from ..tile_grid import TileGrid -from ..group import Group -from ..palette import Palette -from ..bitmap import Bitmap +from displayio.tile_grid import TileGrid +from displayio.group import Group +from displayio.palette import Palette +from displayio.bitmap import Bitmap from .. import constants as CONSTANTS from PIL import Image diff --git a/src/debug_user_code.py b/src/debug_user_code.py index 8be4792fb..a1ad6cb16 100644 --- a/src/debug_user_code.py +++ b/src/debug_user_code.py @@ -32,12 +32,12 @@ # Insert absolute path to Circuitpython libraries for CLUE into sys.path sys.path.insert(0, os.path.join(abs_path_to_parent_dir, CONSTANTS.CIRCUITPYTHON)) -# get board so we can get terminal handle -import board - # This import must happen after the sys.path is modified from common import debugger_communication_client +# get board so we can get terminal handle +import board + # get handle to terminal for clue curr_terminal = board.DISPLAY.terminal diff --git a/src/debuggerCommunicationServer.ts b/src/debuggerCommunicationServer.ts index 86a4aeef2..0fa4a65cc 100644 --- a/src/debuggerCommunicationServer.ts +++ b/src/debuggerCommunicationServer.ts @@ -5,6 +5,7 @@ import * as http from "http"; import * as socketio from "socket.io"; import { WebviewPanel } from "vscode"; import { SERVER_INFO } from "./constants"; +import { DeviceSelectionService } from "./service/deviceSelectionService"; export const DEBUGGER_MESSAGES = { EMITTER: { @@ -24,14 +25,14 @@ export class DebuggerCommunicationServer { private serverHttp: http.Server; private serverIo: socketio.Server; private simulatorWebview: WebviewPanel | undefined; - private currentActiveDevice; + private deviceSelectionService: DeviceSelectionService; private isPendingResponse = false; private pendingCallbacks: Function[] = []; constructor( webviewPanel: WebviewPanel | undefined, port = SERVER_INFO.DEFAULT_SERVER_PORT, - currentActiveDevice: string + deviceSelectionService: DeviceSelectionService ) { this.port = port; this.serverHttp = new http.Server(); @@ -42,7 +43,7 @@ export class DebuggerCommunicationServer { this.initEventsHandlers(); console.info(`Server running on port ${this.port}`); - this.currentActiveDevice = currentActiveDevice; + this.deviceSelectionService = deviceSelectionService; } // send the message to start closing the connection @@ -119,12 +120,16 @@ export class DebuggerCommunicationServer { try { const messageToWebview = JSON.parse(data); if (messageToWebview.type === "state") { - console.log(`State recieved: ${messageToWebview.data}`); - if (this.simulatorWebview) { + const messageState = JSON.parse(messageToWebview.data); + if ( + this.simulatorWebview && + messageState.device_name === + this.deviceSelectionService.getCurrentActiveDevice() + ) { this.simulatorWebview.webview.postMessage({ - active_device: this.currentActiveDevice, + active_device: this.deviceSelectionService.getCurrentActiveDevice(), command: "set-state", - state: JSON.parse(messageToWebview.data), + state: messageState, }); } } diff --git a/src/extension.ts b/src/extension.ts index b733129f0..74e2bf1bf 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -947,7 +947,7 @@ export async function activate(context: vscode.ExtensionContext) { new DebuggerCommunicationServer( currentPanel, utils.getServerPortConfig(), - deviceSelectionService.getCurrentActiveDevice() + deviceSelectionService ) ); diff --git a/src/latest_release_note.ts b/src/latest_release_note.ts index 3d9971054..ed9357870 100644 --- a/src/latest_release_note.ts +++ b/src/latest_release_note.ts @@ -5,8 +5,7 @@ export const LATEST_RELEASE_NOTE = `

Device Simulator Express Release Notes LIGHTGESTUREPROXIMITY -

📝 April 21, 2020

- +

📝 April 22, 2020

Changes: