Skip to content

Commit

Permalink
Merge branch 'xcratch-dev' into xcratch
Browse files Browse the repository at this point in the history
- Fix crash of the backpack for un-supported image
- Add script to link vm and make editor debug with vscode
- Add open project from URL by query parameter
- Show whole shape of blocks when mouse over the pallet
- Merge LLK/scratch-gui #0.1.0-prerelease.20220223164758
  • Loading branch information
yokobond committed Feb 26, 2022
2 parents d596b93 + 2620d44 commit 5c7b4ad
Show file tree
Hide file tree
Showing 15 changed files with 269 additions and 62 deletions.
61 changes: 59 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,42 @@ aliases:
working_directory: ~/repo

jobs:
build-test-no-cache:
<<: *defaults
environment:
JEST_JUNIT_OUTPUT_DIR: test-results
NODE_OPTIONS: --max-old-space-size=4000
steps:
- *restore_git_cache
- checkout
- run: npm ci
- run:
name: Lint
command: npm run test:lint -- --quiet --output-file test-results/eslint-results.xml --format junit
- run:
name: Unit
environment:
JEST_JUNIT_OUTPUT_NAME: unit-results.xml
command: npm run test:unit -- --reporters="default" --reporters="jest-junit" --coverage --coverageReporters=text --coverageReporters=lcov --maxWorkers="2"
- run:
name: Build
environment:
NODE_ENV: production
command: npm run build
- run:
name: Integration
environment:
JEST_JUNIT_OUTPUT_NAME: integration-results.xml
command: npm run test:integration -- --reporters="default" --reporters="jest-junit"
- store_artifacts:
path: coverage
- store_test_results:
path: test-results
setup:
<<: *defaults
steps:
- *restore_git_cache
- checkout
- *restore_npm_cache
- run: npm ci
- *save_git_cache
- *save_npm_cache
Expand Down Expand Up @@ -187,9 +217,24 @@ workflows:
requires:
- setup

build-test-no-deploy:
jobs:
- build-test-no-cache:
filters:
branches:
ignore:
- master
- develop
- /^hotfix\/.*/
build-test-deploy:
jobs:
- setup
- setup:
filters:
branches:
only:
- master
- develop
- /^hotfix\/.*/
- lint:
requires:
- setup
Expand All @@ -205,9 +250,21 @@ workflows:
- store_build:
requires:
- build
filters:
branches:
only:
- master
- develop
- /^hotfix\/.*/
- store_dist:
requires:
- build
filters:
branches:
only:
- master
- develop
- /^hotfix\/.*/
- deploy-npm:
requires:
- lint
Expand Down
64 changes: 32 additions & 32 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@
"redux": "3.7.2",
"redux-throttle": "0.1.1",
"scratch-audio": "0.1.0-prerelease.20200528195344",
"scratch-blocks": "0.1.0-prerelease.20211022094652",
"scratch-l10n": "3.14.20211022031531",
"scratch-paint": "0.2.0-prerelease.20211022045744",
"scratch-render": "0.1.0-prerelease.20210819221425",
"scratch-blocks": "0.1.0-prerelease.20220223064322",
"scratch-l10n": "3.14.20220223031520",
"scratch-paint": "0.2.0-prerelease.20211027080909",
"scratch-render": "0.1.0-prerelease.20211028200436",
"scratch-render-fonts": "1.0.0-prerelease.20210401210003",
"scratch-storage": "1.3.5",
"scratch-svg-renderer": "0.2.0-prerelease.20210727023023",
Expand Down
9 changes: 9 additions & 0 deletions src/components/monitor/monitor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,14 @@ const MonitorComponent = props => (
id="gui.monitor.contextMenu.export"
/>
</MenuItem>}
{props.onHide &&
<BorderedMenuItem onClick={props.onHide}>
<FormattedMessage
defaultMessage="hide"
description="Menu item to hide the monitor"
id="gui.monitor.contextMenu.hide"
/>
</BorderedMenuItem>}
</ContextMenu>
), document.body)}
</ContextMenuTrigger>
Expand All @@ -127,6 +135,7 @@ MonitorComponent.propTypes = {
onDragEnd: PropTypes.func.isRequired,
onExport: PropTypes.func,
onImport: PropTypes.func,
onHide: PropTypes.func,
onNextMode: PropTypes.func.isRequired,
onSetModeToDefault: PropTypes.func,
onSetModeToLarge: PropTypes.func,
Expand Down
19 changes: 16 additions & 3 deletions src/components/prompt/prompt.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ const messages = defineMessages({
description: 'A message that displays in a variable modal when the stage is selected indicating ' +
'that the variable being created will available to all sprites.',
id: 'gui.gui.variablePromptAllSpritesMessage'
},
listAvailableToAllSpritesMessage: {
defaultMessage: 'This list will be available to all sprites.',
description: 'A message that displays in a list modal when the stage is selected indicating ' +
'that the list being created will available to all sprites.',
id: 'gui.gui.listPromptAllSpritesMessage'
}
});

Expand Down Expand Up @@ -58,9 +64,15 @@ const PromptComponent = props => (
<div>
{props.isStage ?
<div className={styles.infoMessage}>
<FormattedMessage
{...messages.availableToAllSpritesMessage}
/>
{props.showListMessage ? (
<FormattedMessage
{...messages.listAvailableToAllSpritesMessage}
/>
) : (
<FormattedMessage
{...messages.availableToAllSpritesMessage}
/>
)}
</div> :
<Box className={styles.optionsRow}>
<label>
Expand Down Expand Up @@ -141,6 +153,7 @@ PromptComponent.propTypes = {
defaultValue: PropTypes.string,
globalSelected: PropTypes.bool.isRequired,
isStage: PropTypes.bool.isRequired,
showListMessage: PropTypes.bool.isRequired,
label: PropTypes.string.isRequired,
onCancel: PropTypes.func.isRequired,
onChange: PropTypes.func.isRequired,
Expand Down
21 changes: 21 additions & 0 deletions src/containers/blocks.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class Blocks extends React.Component {
'onScriptGlowOff',
'onBlockGlowOn',
'onBlockGlowOff',
'handleMonitorsUpdate',
'handleExtensionAdded',
'handleBlocksInfoUpdate',
'onTargetsUpdate',
Expand Down Expand Up @@ -259,6 +260,7 @@ class Blocks extends React.Component {
this.props.vm.addListener('VISUAL_REPORT', this.onVisualReport);
this.props.vm.addListener('workspaceUpdate', this.onWorkspaceUpdate);
this.props.vm.addListener('targetsUpdate', this.onTargetsUpdate);
this.props.vm.addListener('MONITORS_UPDATE', this.handleMonitorsUpdate);
this.props.vm.addListener('EXTENSION_ADDED', this.handleExtensionAdded);
this.props.vm.addListener('BLOCKSINFO_UPDATE', this.handleBlocksInfoUpdate);
this.props.vm.addListener('PERIPHERAL_CONNECTED', this.handleStatusButtonUpdate);
Expand Down Expand Up @@ -397,6 +399,24 @@ class Blocks extends React.Component {
// workspace to be 'undone' here.
this.workspace.clearUndo();
}
handleMonitorsUpdate (monitors) {
// Update the checkboxes of the relevant monitors.
// TODO: What about monitors that have fields? See todo in scratch-vm blocks.js changeBlock:
// https://github.com/LLK/scratch-vm/blob/2373f9483edaf705f11d62662f7bb2a57fbb5e28/src/engine/blocks.js#L569-L576
const flyout = this.workspace.getFlyout();
for (const monitor of monitors.values()) {
const blockId = monitor.get('id');
const isVisible = monitor.get('visible');
flyout.setCheckboxState(blockId, isVisible);
// We also need to update the isMonitored flag for this block on the VM, since it's used to determine
// whether the checkbox is activated or not when the checkbox is re-displayed (e.g. local variables/blocks
// when switching between sprites).
const block = this.props.vm.runtime.monitorBlocks.getBlock(blockId);
if (block) {
block.isMonitored = isVisible;
}
}
}
handleExtensionAdded (categoryInfo) {
const defineBlocks = blockInfoArray => {
if (blockInfoArray && blockInfoArray.length > 0) {
Expand Down Expand Up @@ -544,6 +564,7 @@ class Blocks extends React.Component {
<Prompt
defaultValue={this.state.prompt.defaultValue}
isStage={vm.runtime.getEditingTarget().isStage}
showListMessage={this.state.prompt.varType === this.ScratchBlocks.LIST_VARIABLE_TYPE}
label={this.state.prompt.message}
showCloudOption={this.state.prompt.showCloudOption}
showVariableOptions={this.state.prompt.showVariableOptions}
Expand Down
8 changes: 8 additions & 0 deletions src/containers/monitor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class Monitor extends React.Component {
super(props);
bindAll(this, [
'handleDragEnd',
'handleHide',
'handleNextMode',
'handleSetModeToDefault',
'handleSetModeToLarge',
Expand Down Expand Up @@ -115,6 +116,12 @@ class Monitor extends React.Component {
y: newY
}));
}
handleHide () {
this.props.vm.runtime.requestUpdateMonitor(Map({
id: this.props.id,
visible: false
}));
}
handleNextMode () {
const modes = availableModes(this.props.opcode);
const modeIndex = modes.indexOf(this.props.mode);
Expand Down Expand Up @@ -210,6 +217,7 @@ class Monitor extends React.Component {
onDragEnd={this.handleDragEnd}
onExport={isList ? this.handleExport : null}
onImport={isList ? this.handleImport : null}
onHide={this.handleHide}
onNextMode={this.handleNextMode}
onSetModeToDefault={isList ? null : this.handleSetModeToDefault}
onSetModeToLarge={isList ? null : this.handleSetModeToLarge}
Expand Down
2 changes: 2 additions & 0 deletions src/containers/prompt.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class Prompt extends React.Component {
defaultValue={this.props.defaultValue}
globalSelected={this.state.globalSelected}
isStage={this.props.isStage}
showListMessage={this.props.showListMessage}
label={this.props.label}
showCloudOption={this.props.showCloudOption}
showVariableOptions={this.props.showVariableOptions}
Expand All @@ -79,6 +80,7 @@ class Prompt extends React.Component {
Prompt.propTypes = {
defaultValue: PropTypes.string,
isStage: PropTypes.bool.isRequired,
showListMessage: PropTypes.bool.isRequired,
label: PropTypes.string.isRequired,
onCancel: PropTypes.func.isRequired,
onOk: PropTypes.func.isRequired,
Expand Down
Loading

0 comments on commit 5c7b4ad

Please sign in to comment.