def __init__(self, name, qty=1, color='orange', loop=False): Block.__init__(self, name, Block.STATEMENT_BLOCK) self.mb = 52 + (qty - 1) * 52 self.setStyleAttribute('marginBottom', self.mb) self.height = 20 self.maxA = 0 self.qty = qty self.color = color drawStatementBlock(self, color) self.holderSiblingUp = BlockHolder( StatementArgument(StatementArgument.UP_ARG), self, True) self.tl.append(self.holderSiblingUp) Block.drawBlock(self) statement = self for i in range(qty): drawCompoundStatementBlock(statement, color, loop=(loop and i == qty - 1)) statement.holderChild = BlockHolder( StatementArgument(StatementArgument.CHILD_ARG, i), self) statement.code.append(statement.holderChild) self.holderChildren.append(statement.holderChild) statement = statement.block if i != qty - 1: statement.setStyleAttribute('marginBottom', '0px') self.holderSiblingDown = BlockHolder( StatementArgument(StatementArgument.DOWN_ARG), self) statement.bl.append(self.holderSiblingDown)
def resizeCompoundStatementBlock(self): self.maxA = self.maxArgs() if self.maxA == 0: self.height = 20 else: self.height = 28 + (self.maxA - 1) * 6 self.mb = 52 + (self.qty - 1) * 52 for i in range(len(self.holderChildren)): if self.holderChildren[i] is not None: if self.holderChildren[i].subBlock is not None: if 'invisible' not in self.holderChildren[ i].subBlock.getStyleName(): self.mb = self.mb + self.holderChildren[ i].subBlock.mb + 5 + self.holderChildren[ i].subBlock.maxA * 6 if self.holderChildren[i].subBlock.maxA > 0: self.mb = self.mb + 2 if self.holderSiblingDown is not None: if self.holderSiblingDown.subBlock is not None: if 'invisible' not in self.holderSiblingDown.subBlock.getStyleName( ): self.mb = self.mb + self.holderSiblingDown.subBlock.mb + 5 + self.holderSiblingDown.subBlock.height self.setStyleAttribute('marginBottom', self.mb) Block.resize(self)
def __init__(self, name, color='orange'): Block.__init__(self, name, Block.STATEMENT_BLOCK, StyleName='hat') self.color = color drawStatementBlock(self, color) self.holderSiblingDown = BlockHolder( StatementArgument(StatementArgument.DOWN_ARG), self) self.bl.append(self.holderSiblingDown) Block.drawBlock(self) DOM.setAttribute(self.getElement(), 'draggable', False)
def resize(self): self.maxA = self.maxArgs() if self.maxA == 0: self.height = 20 else: self.height = 28 + (self.maxA - 1) * 6 self.mb = 6 if self.dropDownVarName is not None: # gambiarra pq blocos com dropdownmenu sao mais altos self.height += 1 self.mb += 1 if self.holderSiblingDown.subBlock is not None: if 'invisible' not in self.holderSiblingDown.subBlock.getStyleName( ): self.mb = self.mb + self.holderSiblingDown.subBlock.mb + 5 + self.holderSiblingDown.subBlock.height #20 self.setStyleAttribute('marginBottom', self.mb) Block.resize(self)
def __init__(self, name, color='blue'): Block.__init__(self, name, Block.STATEMENT_BLOCK) self.mb = 6 self.setStyleAttribute('marginBottom', self.mb) self.height = 20 self.maxA = 0 self.color = color drawStatementBlock(self, color) self.holderSiblingDown = BlockHolder( StatementArgument(StatementArgument.DOWN_ARG), self) self.holderSiblingUp = BlockHolder(StatementArgument( StatementArgument.UP_ARG), self, up=True) self.tl.append(self.holderSiblingUp) self.bl.append(self.holderSiblingDown) Block.drawBlock(self)
def __init__(self, name, color='orange'): Block.__init__(self, name, Block.END_BLOCK) self.mb = 52 self.setStyleAttribute('marginBottom', self.mb) self.height = 20 self.maxA = 0 self.qty = 1 self.color = color drawStatementBlock(self, color) self.holderSiblingUp = BlockHolder( StatementArgument(StatementArgument.UP_ARG), self, True) self.tl.append(self.holderSiblingUp) drawCompoundStatementBlock(self, color, hasBn=False, loop=True) self.holderChild = BlockHolder( StatementArgument(StatementArgument.CHILD_ARG, 0), self) self.code.append(self.holderChild) self.holderChildren.append(self.holderChild) Block.drawBlock(self)
def resize(self): resizeBooleanBlock(self, self.maxArgs()) Block.resize(self)
def __init__(self, name, color='green'): Block.__init__(self, name, Block.BOOLEAN_BLOCK) self.color = color drawBooleanBlock(self, color) Block.drawBlock(self) self.resize()
def __init__(self, name, color='green'): Block.__init__(self, name, Block.STRING_BLOCK) self.color = color drawNumberBlock(self, color, '') Block.drawBlock(self) resizeNumberBlock(self)
def resize(self): resizeNumberBlock(self) Block.resize(self)
def __init__(self, name, color='green'): Block.__init__(self, name, Block.NUMBER_BLOCK) self.color = color drawNumberBlock(self, color) Block.drawBlock(self) resizeNumberBlock(self)
def changeTexts(self): Block.changeTexts(self) self.block.changeTexts()