Keyboard: clean and column callback spacing default value

This commit is contained in:
Guillaume Collic 2021-02-14 15:27:17 +01:00 committed by Florian Festi
parent 61b85a6aed
commit 72c7fca53e
2 changed files with 7 additions and 6 deletions

View File

@ -71,20 +71,21 @@ class Atreus21(Boxes, Keyboard):
x, y
)
@restore
def rim(self):
x, y = self._case_x_y()
self.moveTo(x * .5, y * .5)
self.rectangularHole(0, 0, x, y, 5)
self.moveTo(x * -.5, y * -.5)
@restore
def outer(self):
x, y = self._case_x_y()
b = self.border
self.moveTo(0, -b)
corner = [90, b]
self.polyline(*([x, corner, y, corner] * 2))
self.moveTo(0, b)
@restore
def half(self, hole_cb=None, reverse=False):
if hole_cb == None:
hole_cb = self.key
@ -92,10 +93,8 @@ class Atreus21(Boxes, Keyboard):
self.apply_callback_on_columns(
hole_cb,
self.columns_definition,
self.STANDARD_KEY_SPACING,
reverse,
reverse=reverse,
)
self.moveTo(-self.half_btn, -self.half_btn)
def support(self):
self.configured_plate_cutout(support=True)

View File

@ -165,7 +165,9 @@ class Keyboard:
grid_hole(-3, -4, led_hole_size)
grid_hole(3, -4, led_hole_size)
def apply_callback_on_columns(self, cb, columns_definition, spacing, reverse=False):
def apply_callback_on_columns(self, cb, columns_definition, spacing=None, reverse=False):
if spacing == None:
spacing = self.STANDARD_KEY_SPACING
if reverse:
columns_definition = list(reversed(columns_definition))