thread.js 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /**
  2. * @license
  3. * Visual Blocks Editor
  4. *
  5. * Copyright 2012 Google Inc.
  6. * https://developers.google.com/blockly/
  7. *
  8. * Licensed under the Apache License, Version 2.0 (the "License");
  9. * you may not use this file except in compliance with the License.
  10. * You may obtain a copy of the License at
  11. *
  12. * http://www.apache.org/licenses/LICENSE-2.0
  13. *
  14. * Unless required by applicable law or agreed to in writing, software
  15. * distributed under the License is distributed on an "AS IS" BASIS,
  16. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17. * See the License for the specific language governing permissions and
  18. * limitations under the License.
  19. */
  20. /**
  21. * @fileoverview Colour blocks for Blockly.
  22. * @author fraser@google.com (Neil Fraser)
  23. */
  24. 'use strict';
  25. goog.provide('Blockly.Blocks.Thread');
  26. goog.require('Blockly.Blocks');
  27. /**
  28. * Common HSV hue for all blocks in this category.
  29. */
  30. Blockly.Blocks.Thread.HUE = "#5cd3db";
  31. Blockly.Blocks['Thread_import'] = {
  32. /**
  33. * Block for log setup.
  34. * @this Blockly.Block
  35. */
  36. init: function() {
  37. this.setColour(Blockly.Blocks.Thread.HUE);
  38. this.appendDummyInput()
  39. .appendField(Blockly.Msg.THREAD_IMPORT);
  40. // this.setInputsInline(false);
  41. // this.setOutput(true);
  42. this.setPreviousStatement(true);
  43. this.setNextStatement(true);
  44. },
  45. };
  46. Blockly.Blocks['Thread_start_output'] = {
  47. /**
  48. * Block for log setup.
  49. * @this Blockly.Block
  50. */
  51. init: function() {
  52. this.setColour(Blockly.Blocks.Thread.HUE);
  53. this.appendValueInput("INPUT")
  54. .appendField(Blockly.Msg.THREAD_THREADING)
  55. this.appendDummyInput()
  56. .appendField(Blockly.Msg.THREAD_START)
  57. this.setInputsInline(true);
  58. this.setOutput(true);
  59. // this.setPreviousStatement(true);
  60. // this.setNextStatement(true);
  61. },
  62. };
  63. Blockly.Blocks['Thread_start_preNext'] = {
  64. /**
  65. * Block for log setup.
  66. * @this Blockly.Block
  67. */
  68. init: function() {
  69. this.setColour(Blockly.Blocks.Thread.HUE);
  70. this.appendValueInput("INPUT")
  71. .appendField(Blockly.Msg.THREAD_THREADING)
  72. this.appendDummyInput()
  73. .appendField(Blockly.Msg.THREAD_START)
  74. this.setInputsInline(true);
  75. // this.setOutput(true);
  76. this.setPreviousStatement(true);
  77. this.setNextStatement(true);
  78. },
  79. };
  80. Blockly.Blocks['Thread_set_target'] = {
  81. init: function() {
  82. this.setColour(Blockly.Blocks.Thread.HUE);
  83. this.appendValueInput("TARGET")
  84. .appendField(Blockly.Msg.THREAD_SET_TARGET)
  85. this.setInputsInline(true);
  86. this.setOutput(true);
  87. }
  88. }