protoboard: Fix bug with empty points in breadboard rendering

merge-requests/4/head
jaseg 2024-07-08 18:08:07 +02:00
rodzic 30878adfb1
commit 1d5f4c8193
1 zmienionych plików z 20 dodań i 18 usunięć

Wyświetl plik

@ -425,28 +425,30 @@ class BreadboardArea:
label = f'{j+1}'
if last_e == 'R':
tx, ty = points[0]
if points:
tx, ty = points[0]
if self.horizontal:
ty -= self.pitch_x/2
yield Text(tx, ty, label, self.font_size, self.font_stroke, 'center', 'top', unit=self.unit)
yield Text(tx, ty, label, self.font_size, self.font_stroke, 'center', 'top', unit=self.unit, flip=True)
else:
tx -= self.pitch_x/2
yield Text(tx, ty, label, self.font_size, self.font_stroke, 'right', 'middle', unit=self.unit)
yield Text(tx, ty, label, self.font_size, self.font_stroke, 'right', 'middle', unit=self.unit, flip=True)
if self.horizontal:
ty -= self.pitch_x/2
yield Text(tx, ty, label, self.font_size, self.font_stroke, 'center', 'top', unit=self.unit)
yield Text(tx, ty, label, self.font_size, self.font_stroke, 'center', 'top', unit=self.unit, flip=True)
else:
tx -= self.pitch_x/2
yield Text(tx, ty, label, self.font_size, self.font_stroke, 'right', 'middle', unit=self.unit)
yield Text(tx, ty, label, self.font_size, self.font_stroke, 'right', 'middle', unit=self.unit, flip=True)
else:
tx, ty = points[-1]
if points:
tx, ty = points[-1]
if self.horizontal:
ty += self.pitch_x/2
yield Text(tx, ty, label, self.font_size, self.font_stroke, 'center', 'bottom', unit=self.unit)
yield Text(tx, ty, label, self.font_size, self.font_stroke, 'center', 'bottom', unit=self.unit, flip=True)
else:
tx += self.pitch_x/2
yield Text(tx, ty, label, self.font_size, self.font_stroke, 'left', 'middle', unit=self.unit)
yield Text(tx, ty, label, self.font_size, self.font_stroke, 'left', 'middle', unit=self.unit, flip=True)
if self.horizontal:
ty += self.pitch_x/2
yield Text(tx, ty, label, self.font_size, self.font_stroke, 'center', 'bottom', unit=self.unit)
yield Text(tx, ty, label, self.font_size, self.font_stroke, 'center', 'bottom', unit=self.unit, flip=True)
else:
tx += self.pitch_x/2
yield Text(tx, ty, label, self.font_size, self.font_stroke, 'left', 'middle', unit=self.unit)
yield Text(tx, ty, label, self.font_size, self.font_stroke, 'left', 'middle', unit=self.unit, flip=True)
last_e = e
if self.num_power_rails == 2 and best_layout.count('P') >= 2: