Merge remote-tracking branch 'origin/develop' into develop

# Conflicts:
#	package-lock.json
This commit is contained in:
casperlamboo 2018-01-29 16:13:45 +01:00
commit 556d2f3eab
2 changed files with 13 additions and 3 deletions

View File

@ -4,12 +4,14 @@ import _defaultSettings from './settings/default.yml';
import printerSettings from './settings/printer.yml';
import materialSettings from './settings/material.yml';
import qualitySettings from './settings/quality.yml';
import infillSettings from './settings/infill.yml';
const defaultSettings = {
default: _defaultSettings,
printer: printerSettings,
material: materialSettings,
quality: qualitySettings
quality: qualitySettings,
infill: infillSettings
};
export {

View File

@ -16,6 +16,7 @@ import defaultSettings from '../settings/default.yml';
import printerSettings from '../settings/printer.yml';
import materialSettings from '../settings/material.yml';
import qualitySettings from '../settings/quality.yml';
import infillSettings from '../settings/infill.yml';
import update from 'react-addons-update';
import SettingsIcon from 'material-ui-icons/Settings';
import validateIp from 'validate-ip';
@ -148,6 +149,7 @@ class Settings extends React.Component {
if (value !== 'add_printer') state = update(state, { localStorage: { active: { $set: value } } });
break;
case 'settings.infill':
case 'settings.quality':
case 'settings.material':
if (!localStorage.active) return this.openAddPrinterDialog();
@ -233,7 +235,7 @@ class Settings extends React.Component {
constructSettings(localStorage) {
if (!localStorage.active) return defaultSettings;
const { ip, settings: { printer, material, quality, advanced } } = localStorage.printers[localStorage.active];
const { ip, settings: { printer, material, quality, infill, advanced } } = localStorage.printers[localStorage.active];
let settings = {
...defaultSettings,
printer,
@ -244,6 +246,7 @@ class Settings extends React.Component {
settings = _.merge({}, settings, printerSettings[printer]);
settings = _.merge({}, settings, qualitySettings[quality]);
settings = _.merge({}, settings, infillSettings[quality]);
settings = _.merge({}, settings, materialSettings[material]);
for (const key in advanced) {
@ -271,7 +274,7 @@ class Settings extends React.Component {
active: id,
printers: {
...this.state.localStorage.printers,
[id]: { name, ip, settings: { printer, material: 'pla', quality: 'medium', advanced: {} } }
[id]: { name, ip, settings: { printer, material: 'pla', infill: '20pct', quality: 'medium', advanced: {} } }
}
};
this.setState({ localStorage });
@ -384,6 +387,11 @@ class Settings extends React.Component {
<MenuItem key={value} value={value} primaryText={title} />
))}
</SelectField>
<SelectField name="settings.infill" floatingLabelText="Infill" fullWidth>
{Object.entries(infillSettings).map(([value, { title }]) => (
<MenuItem key={value} value={value} primaryText={title} />
))}
</SelectField>
</div>
</Tab>
<Tab buttonStyle={{ color: grey800, backgroundColor: 'white' }} label="Advanced">