diff --git a/scripts/lndchannelbalance.py b/scripts/lndchannelbalance.py index 4d55fdb..3856a62 100644 --- a/scripts/lndchannelbalance.py +++ b/scripts/lndchannelbalance.py @@ -47,7 +47,7 @@ def __init__(self): self._defaultattr("nodes", [{}]) self._defaultattr("pageSize", 8) self._defaultattr("watermarkAnchor", "bottom") - + # Initialize super().__init__(name="lndchannelbalance") @@ -166,7 +166,9 @@ def run(self): # local balance is filled portion percentage = float(local_balance)/float(capacity) barWidth = int(float(self.width - aliasWidth - outlineWidth) * percentage) - self.draw.rounded_rectangle(xy=(aliasWidth + outlineWidth, dataRowTop + dataRowPadding + outlineWidth, aliasWidth + outlineWidth + barWidth, dataRowBottom - outlineWidth), radius=3, fill=ImageColor.getrgb(self.barFilledColor)) + radius = 2 + if barWidth < radius: barWidth = radius + self.draw.rounded_rectangle(xy=(aliasWidth + outlineWidth, dataRowTop + dataRowPadding + outlineWidth, aliasWidth + outlineWidth + barWidth, dataRowBottom - outlineWidth), radius=radius, fill=ImageColor.getrgb(self.barFilledColor)) # labels if self.displayBalancesEnabled: vicarioustext.drawlefttext(self.draw, str(local_balance), nodeFontSize, aliasWidth+outlineWidth+1, dataRowTop + (dataRowHeight//2) + outlineWidth + 1, ImageColor.getrgb(self.backgroundColor))