diff --git a/package.json b/package.json index f528e3b..a52767a 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ }, "dependencies": { "bytes": "^2.4.0", - "cncserver": "2.6.1", + "cncserver": "2.6.6", "d3plus": "^1.9.3", "fs-finder": "^1.8.1", "fs-plus": "^2.8.1", diff --git a/resources/_i18n/robopaint.en-US.json b/resources/_i18n/robopaint.en-US.json index 53521a5..4460a76 100644 --- a/resources/_i18n/robopaint.en-US.json +++ b/resources/_i18n/robopaint.en-US.json @@ -86,6 +86,26 @@ "autofill": "Filling path __id__...", "autostroke": "Stroking path __id__...", "autocomplete": "Automatic Paint Complete!", + "manual": { + "status": "Waiting for manual change...", + "notice": "Please insert the __color__ __type__ to continue", + "info": "Motors unlocked for calibration, use the toggle button find the correct draw height, ensure the pen is put back in park position, then click continue to resume drawing.", + "resume": "Now drawing with __color__", + "options": { + "cancel": { + "title": "Cancel Print [Escape]", + "info": "Cancel the current print job, close the mode and return to the home screen." + }, + "continue": { + "title": "Continue with __color__ [Enter]", + "info": "Once you've finished changing to the correct drawing implement, click to continue drawing." + }, + "toggle": { + "title": "Toggle height [Space]", + "info": "Toggle the raising/lowering of the pen to calibrate its height." + } + } + }, "spool": { "stroke": "Tracing stroke path __id__...", "fill": "Tracing fill path __id__...", diff --git a/resources/colorsets/_i18n/colorsets.en-US.json b/resources/colorsets/_i18n/colorsets.en-US.json index 56e4352..78925bf 100644 --- a/resources/colorsets/_i18n/colorsets.en-US.json +++ b/resources/colorsets/_i18n/colorsets.en-US.json @@ -5,14 +5,14 @@ "release": "0.9.2", "basetype": "colorset" }, - + "media":{ "watercolor": "Watercolor", - "pen": "Pen", + "pen": "Pen/Pencil", "engraver": "Diamond Engraver", "wax": "Electro-Kistka" }, - + "colors": { "beige": "Beige", "black": "Black", diff --git a/resources/colorsets/generic/_i18n/generic.en-US.json b/resources/colorsets/generic/_i18n/generic.en-US.json index ff205c6..db4668f 100644 --- a/resources/colorsets/generic/_i18n/generic.en-US.json +++ b/resources/colorsets/generic/_i18n/generic.en-US.json @@ -9,5 +9,15 @@ "manufacturer": "Generic", "name": "Standard", "description": "Set of primary colors in standard order. Use for stock Crayola, store brand or movable primary color pans." + }, + "generic-pen-single": { + "manufacturer": "Generic", + "name": "Single pen/pencil", + "description": "Single color, use when only one implement needed." + }, + "generic-pen-multi": { + "manufacturer": "Generic", + "name": "Multi pen/pencil", + "description": "Standard set of primary color pens/pencils." } } diff --git a/resources/colorsets/generic/generic.json b/resources/colorsets/generic/generic.json index cdc402f..565f93a 100644 --- a/resources/colorsets/generic/generic.json +++ b/resources/colorsets/generic/generic.json @@ -1,19 +1,50 @@ -[{ - "media": "watercolor", - "machineName": "generic", - "weight": -10, - "styles" : { - "src" : "standard.css", - "baseClass": "generic-standard" - }, - "colors": [ - {"black":"#000000"}, - {"red":"#FF0000"}, - {"orange":"#FFA500"}, - {"yellow":"#FFFF00"}, - {"green":"#008000"}, - {"blue":"#0000FF"}, - {"purple":"#800080"}, - {"brown":"#8B4513"} - ] -}] +[{ + "media": "watercolor", + "machineName": "generic", + "weight": -10, + "styles" : { + "src" : "standard.css", + "baseClass": "generic-standard" + }, + "colors": [ + {"black":"#000000"}, + {"red":"#FF0000"}, + {"orange":"#FFA500"}, + {"yellow":"#FFFF00"}, + {"green":"#008000"}, + {"blue":"#0000FF"}, + {"purple":"#800080"}, + {"brown":"#8B4513"} + ] +}, +{ + "media": "pen", + "machineName": "generic-pen-single", + "weight": 20, + "styles" : { + "src" : "standard.css", + "baseClass": "generic-standard" + }, + "colors": [ + {"black":"#000000"} + ] +}, +{ + "media": "pen", + "machineName": "generic-pen-multi", + "weight": 21, + "styles" : { + "src" : "standard.css", + "baseClass": "generic-standard" + }, + "colors": [ + {"black":"#000000"}, + {"red":"#FF0000"}, + {"orange":"#FFA500"}, + {"yellow":"#FFFF00"}, + {"green":"#008000"}, + {"blue":"#0000FF"}, + {"purple":"#800080"}, + {"brown":"#8B4513"} + ] +}] diff --git a/resources/colorsets/generic/standard.css b/resources/colorsets/generic/standard.css index bd5f943..c7933d6 100644 --- a/resources/colorsets/generic/standard.css +++ b/resources/colorsets/generic/standard.css @@ -1,32 +1,32 @@ -.generic-standard #color0 { - background-color: black; /* Black */ -} - -.generic-standard #color1 { - background-color: red; /* Red */ -} - -.generic-standard #color2 { - background-color: orange; /* Orange */ -} - -#colors.generic-standard #color3 { - background-color: yellow; /* Yellow */ - color: black; -} - -.generic-standard #color4 { - background-color: green; /* Green */ -} - -.generic-standard #color5 { - background-color: blue; /* Blue */ -} - -.generic-standard #color6 { - background-color: purple; /* Violet */ -} - -.generic-standard #color7 { - background-color: SaddleBrown; /* Brown */ -} \ No newline at end of file +.generic-standard #color0 { + background-color: black; /* Black */ +} + +.generic-standard #color1 { + background-color: red; /* Red */ +} + +.generic-standard #color2 { + background-color: orange; /* Orange */ +} + +#colors.generic-standard #color3 { + background-color: yellow; /* Yellow */ + color: black; +} + +.generic-standard #color4 { + background-color: green; /* Green */ +} + +.generic-standard #color5 { + background-color: blue; /* Blue */ +} + +.generic-standard #color6 { + background-color: purple; /* Violet */ +} + +.generic-standard #color7 { + background-color: SaddleBrown; /* Brown */ +} diff --git a/resources/main.html b/resources/main.html index 9d5cdf0..df5f8ff 100644 --- a/resources/main.html +++ b/resources/main.html @@ -42,11 +42,11 @@
...
-

+

+

+ libs.manual.notice + +
+ + + +
+

+
diff --git a/resources/main.js b/resources/main.js index 70e7367..17e2fa0 100644 --- a/resources/main.js +++ b/resources/main.js @@ -3,6 +3,7 @@ * central cncserver object to control low-level non-restful APIs, and general * "top-level" UI initialization for settings. */ +/* globals window, document, $*/ // Must use require syntax for including these libs because of node duality. window.$ = window.jQuery = require('jquery'); @@ -73,7 +74,7 @@ try { rpRequire('mediasets') // Colors and other media specific details. } catch(e) { $(function(){ - $('body.home h1').attr('class', 'error').text('Error During Pre-Initialization:') + $('#connection').attr('class', 'error').text('Error During Pre-Initialization:') .append($('').addClass('message').html("
" + e.message + "\n\n" + e.stack + "
")); console.error(e.stack); }); @@ -117,15 +118,15 @@ function startInitialization() { initHistoryload(); // Prep the connection status overlay - $stat = $('body.home h1'); - $options = $('.options', $stat); + $stat = $('#connection'); + $options = $('.options:first', $stat); // Actually try to init the connection and handle the various callbacks startSerial(); bindMainControls(); // Bind all the controls for the main interface } catch(e) { - $('body.home h1').attr('class', 'error').text('Error During Initialization:') + $('#connection').attr('class', 'error').text('Error During Initialization:') .append($('').addClass('message').html("
" + e.message + "\n\n" + e.stack + "
")); console.error(e.stack); } @@ -234,8 +235,7 @@ function destroySubwindow(callback) { */ function bindMainControls() { // Bind the continue/simulation mode button functionality - $('button.continue', $options).click(function(e){ - $stat.fadeOut('slow'); + $('#connection button.continue').click(function(e){ cncserver.continueSimulation(); cncserver.serialReadyInit(); @@ -251,18 +251,18 @@ function bindMainControls() { initializing = false; } - setModal(false); + setModal(false, '#connection'); }); // Bind the reconnect button functionality - $('button.reconnect').click(function(e){ + $('#connection button.reconnect').click(function() { // Reconnect! Resets status and tries to start again $options.hide(); startSerial(); }); // Bind the external server connection button functionality - $('button.external').click(function(e){ + $('#connection button.external').click(function() { if ($('div.external').is(':visible')){ $('div.external').slideUp('slow'); } else { @@ -271,7 +271,7 @@ function bindMainControls() { }); robopaint.statedata.external = false; - $('button#external-go').click(function(e){ + $('#connection button#external-go').click(function() { var $stat = $('#external-status'); $stat.text(robopaint.t('external.status.connect')); @@ -295,6 +295,37 @@ function bindMainControls() { }); }); + // Bind visible buttons to keystrokes ======================================== + $(document).keydown(function(e) { + $('button[data-bind-keycode="' + e.keyCode + '"]:visible:not(:focus)').click(); + }); + + // Bind buttons for manual swap ============================================== + $('#manualswap button').click(function() { + var $this = $(this); + if ($this.is('.toggle')) { + $this.toggleClass('pen-down'); + if ($this.is('.pen-down')) { + cncserver.cmd.run('down', true); + } else { + cncserver.cmd.run('up', true); + } + return; + } + + // Switch between the other two button options that close the window. + if ($this.is('.cancel')) { + // Cancel the print... then go home. + cncserver.fullCancel(); + robopaint.switchMode('home'); + } else if ($this.is('.continue')) { + // Run resume immediately. + cncserver.cmd.run('resume', true); + } + // Hide the window. + setModal(false, '#manualswap'); + }); + window.onbeforeunload = onClose; // Catch close event // Bind links for toolbar =========================== @@ -509,8 +540,7 @@ function startSerial(){ }, connect: function() { setMessage('status.success', 'success'); - $stat.fadeOut('slow'); - setModal(false); + setModal(false, '#connection'); // If caught on startup... if (initializing) { @@ -526,14 +556,13 @@ function startSerial(){ initSocketIO(); }, disconnect: function() { - setModal(true); - $stat.show(); + setModal(true, '#connection'); setMessage('status.disconnect', 'error'); $options.slideDown(); } }); } catch(e) { - $('body.home h1').attr('class', 'error').text('Error During Serial Start:') + $('#connection').attr('class', 'error').text('Error During Serial Start:') .append($('').addClass('message').html("
" + e.message + "\n\n" + e.stack + "
")); console.log(e.stack); } @@ -602,8 +631,12 @@ function initToolTips() { target: $this, // my target, viewport: $(window) }, + hide: { + event: 'click mouseleave' + }, events: { render: function(event, api) { + if (!$this.data('i18n')) return; // Extract the title translation ID var transIDs = $this.data('i18n').split(';'); var titleTransID = transIDs[0].split(']')[1]; @@ -815,8 +848,8 @@ function getColorsets() { $('#colorset').append( $('