Skip to content

Commit f5de701

Browse files
committed
stop defaulting to auto, explicitly set with action
1 parent 34c0015 commit f5de701

File tree

5 files changed

+19
-6
lines changed

5 files changed

+19
-6
lines changed

plugins/editor/key-extension.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const { dedent, indent } = require('../../src/actions/text-move');
88
const { print } = require('../../src/actions/system');
99
const { newFile, saveFile } = require('../../src/actions/file');
1010
const { hideOverlays, showSave, showDownload, showProjects } = require('../../src/actions/overlay');
11-
const { disableAuto } = require('../../src/actions/device');
11+
const { disableAuto, enableAuto } = require('../../src/actions/device');
1212

1313
const keyExtension = {
1414
setup: function(app) {
@@ -18,6 +18,7 @@ const keyExtension = {
1818
code: ['F9', 'CTRL_R'],
1919
exec: (evt) => {
2020
evt.preventDefault();
21+
enableAuto();
2122
showDownload();
2223
}
2324
},

plugins/overlays/download.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ class DownloadOverlay extends React.Component {
9696
}
9797

9898
_onReloadDevices(){
99-
disableAuto();
10099
reloadDevices(this.props);
101100
}
102101

plugins/sidebar/file-operations.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,15 @@ const { Menu, MainButton, ChildButton } = require('react-mfb-iceddev');
55

66
const { newFile, saveFile } = require('../../src/actions/file');
77
const { showDelete, showDownload } = require('../../src/actions/overlay');
8+
const { enableAuto } = require('../../src/actions/device');
89

910
require('react-mfb-iceddev/mfb.css');
1011

12+
function download(){
13+
enableAuto();
14+
showDownload();
15+
}
16+
1117
const FileOperations = React.createClass({
1218
render: function(){
1319

@@ -17,7 +23,7 @@ const FileOperations = React.createClass({
1723
iconResting="ion-plus-round"
1824
iconActive="ion-close-round" />
1925
<ChildButton
20-
onClick={showDownload}
26+
onClick={download}
2127
icon="ion-code-download"
2228
label="Download" />
2329
<ChildButton

src/actions/device.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ class DeviceActions {
1212
this.dispatch();
1313
}
1414

15+
enableAuto(){
16+
this.dispatch();
17+
}
18+
1519
updateSelected(device) {
1620
this.dispatch(device);
1721
}

src/stores/device.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const _ = require('lodash');
66
const { rx, tx } = require('../actions/transmission');
77
const { hideDownload, showDownload } = require('../actions/overlay');
88
const { clearOutput, output } = require('../actions/console');
9-
const { disableAuto, reloadDevices, updateSelected } = require('../actions/device');
9+
const { enableAuto, disableAuto, reloadDevices, updateSelected } = require('../actions/device');
1010
const { handleSuccess, handleError } = require('../actions/file');
1111

1212
class DeviceStore {
@@ -15,6 +15,7 @@ class DeviceStore {
1515
this.bindListeners({
1616
onReloadDevices: [reloadDevices, showDownload],
1717
onDisableAuto: disableAuto,
18+
onEnableAuto: enableAuto,
1819
onUpdateSelected: updateSelected
1920
});
2021

@@ -39,6 +40,10 @@ class DeviceStore {
3940
this.setState({ auto: false });
4041
}
4142

43+
onEnableAuto(){
44+
this.setState({ auto: true });
45+
}
46+
4247
onReloadDevices(){
4348

4449
const { scanBoards, workspace } = this.getInstance();
@@ -67,8 +72,6 @@ class DeviceStore {
6772
this._checkDevices();
6873
}
6974
});
70-
71-
this.setState({ auto: true });
7275
}
7376

7477
onUpdateSelected(device) {

0 commit comments

Comments
 (0)