def autoIndentBlock(self, block, char = '\n'):
        """Indent block after Enter pressed or trigger character typed
        """
        cursor = QTextCursor(block)
        currentText = block.text()
        spaceAtStartLen = len(currentText) - len(currentText.lstrip())
        currentIndent = currentText[:spaceAtStartLen]
        indent = self._smartIndenter.computeIndent(block, char)
        if indent is not None and indent != currentIndent:
            self._qpart.replaceText(block.position(), spaceAtStartLen, indent)
def __init__(self, container):
		self.x = container.x+randint(1, floor(container.w/3))
		self.y = container.y+randint(1, floor(container.h/3))
		self.w = container.w-(self.x-container.x)
		self.h = container.h-(self.y-container.y)
		self.w -= randint(0,floor(self.w/3))
		self.h -= randint(0,floor(self.w/3))
		self.environment = int(min(4,10*(container.distance_from_center/MAP_WIDTH)+random()*2-1))
		roll = random()*0.9+(2*container.distance_from_center/MAP_WIDTH)*0.1
		self.biome = next(n for n,b in enumerate(self.biomes_CDF) if roll<b)