Exemple #1
0
    def textChanged(self, text):
        from blocks.RenderableBlock import RenderableBlock
        from blocks.BlockStub import BlockStub

        if (self.labelType == BlockLabel.Type.NAME_LABEL or self.labelType
                == BlockLabel.Type.PORT_LABEL) and (Block.getBlock(
                    self.blockID).isLabelEditable()):
            if (self.labelType == (BlockLabel.Type.NAME_LABEL)):
                Block.getBlock(self.blockID).setBlockLabel(text)

            plug = Block.getBlock(self.blockID).getPlug()
            # Check if we're connected to a block. If we are and the the block we're connected to
            # has stubs, update them.
            if (plug != None and plug.blockID != Block.NULL):
                if (Block.getBlock(plug.blockID) != None):
                    if (Block.getBlock(plug.blockID).isProcedureDeclBlock()
                            and Block.getBlock(plug.blockID).hasStubs()):
                        # Blocks already store their socket names when saved so it is not necessary
                        # nor desired to call the connectors changed event again.
                        if (Block.getRenderableBlock(
                                plug.blockID).isLoading()):
                            BlockStub.parentConnectorsChanged(
                                self.workspace, plug.blockID)

            rb = RenderableBlock.getRenderableBlock(self.blockID)

            if (rb != None and not rb.isLoading):
                rb.reformBlockShape()
                rb.updateBuffImg()
                #rb.repaint()
                pass
Exemple #2
0
  def textChanged(self, text):
    from blocks.RenderableBlock import RenderableBlock
    from blocks.BlockStub import BlockStub
    
    if (self.labelType == BlockLabel.Type.NAME_LABEL or 
        self.labelType == BlockLabel.Type.PORT_LABEL) and  (Block.getBlock(self.blockID).isLabelEditable()):
      if (self.labelType == (BlockLabel.Type.NAME_LABEL)):
        Block.getBlock(self.blockID).setBlockLabel(text);

      plug = Block.getBlock(self.blockID).getPlug();
      # Check if we're connected to a block. If we are and the the block we're connected to
      # has stubs, update them.
      if (plug != None and plug.blockID != Block.NULL):
        if (Block.getBlock(plug.blockID) != None):
          if(Block.getBlock(plug.blockID).isProcedureDeclBlock() and
            Block.getBlock(plug.blockID).hasStubs()):
            # Blocks already store their socket names when saved so it is not necessary
            # nor desired to call the connectors changed event again.
            if (Block.getRenderableBlock(plug.blockID).isLoading()):
              BlockStub.parentConnectorsChanged(self.workspace, plug.blockID);

      rb = RenderableBlock.getRenderableBlock(self.blockID);

      if(rb != None and not rb.isLoading):
        rb.reformBlockShape()
        rb.updateBuffImg()
        #rb.repaint()
        pass