From 4df9c4aae994d138e6292630b9910574fe62670e Mon Sep 17 00:00:00 2001 From: jens persson Date: Fri, 4 Jun 2021 21:00:56 +0200 Subject: [PATCH] Add labels to Ottobody Using the label interface, render identifying labels on the Ottobody --- boxes/generators/ottobody.py | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/boxes/generators/ottobody.py b/boxes/generators/ottobody.py index aa57edb..a6ff548 100644 --- a/boxes/generators/ottobody.py +++ b/boxes/generators/ottobody.py @@ -14,6 +14,12 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +try: + from gettext import gettext as _ +except ImportError: + def _(message): + return message + from boxes import * @@ -116,27 +122,31 @@ class OttoBody(Boxes): # sides self.moveTo(hx) - self.rectangularWall(x, h-hx, "FfOf", ignore_widths=[2], move="up") - self.rectangularWall(x, hl-hx2, "pfFf", ignore_widths=[1], move="up") + self.rectangularWall(x, h-hx, "FfOf", ignore_widths=[2], move="up", label=_("Left bottom side")) + self.rectangularWall(x, hl-hx2, "pfFf", ignore_widths=[1], move="up", label=_("Left top side")) self.moveTo(-hx) self.rectangularWall(x, h-hx, "Ffof", ignore_widths=[5], callback=[ lambda: self.rectangularHole(y-7.5, h-4-7.5, 6.2, 7.)], - move="up") + move="up", label=_("Right bottom side")) self.rectangularWall(x, hl-hx2, "PfFf", ignore_widths=[6], - callback=[None, None, self.IOCB], move="up") + callback=[None, None, self.IOCB], move="up", + label=_("Right top side")) # lower walls self.rectangularWall(y, h, "FFeF", callback=[ - None, None, self.frontCB], move="up") - self.rectangularWall(y, h, e_back, move="up") + None, None, self.frontCB], move="up", + label=_("Lower front")) + self.rectangularWall(y, h, e_back, move="up", + label=_("Lower back")) + # upper walls - self.rectangularWall(y, hl, "FFeF", callback=[self.eyeCB], move="up") - self.rectangularWall(y, hl-hx2, "FFqF", move="up") + self.rectangularWall(y, hl, "FFeF", callback=[self.eyeCB], move="up", label=_("Upper front")) + self.rectangularWall(y, hl-hx2, "FFqF", move="up", label=_("Upper back")) # top - self.rectangularWall(x, y, "ffff", move="up") + self.rectangularWall(x, y, "ffff", move="up", label=_("Top")) # bottom - self.rectangularWall(x, y, "ffff", callback=[self.bottomCB], move="up") + self.rectangularWall(x, y, "ffff", callback=[self.bottomCB], move="up", label=_("Bottom")) # PCB mounts with self.saved_context(): self.PCB_Clamp(y-53.5, 4.5, hl, move="right") @@ -147,9 +157,11 @@ class OttoBody(Boxes): # servo mounts self.moveTo(0, 50) self.rectangularWall(y, 14, callback=[None, None, None, - self.leftBottomCB], move="up") + self.leftBottomCB], move="up", + label=_("Servo mount")) self.rectangularWall(y-5.6, 14, callback=[ - None, None, None, self.rightBottomCB], move="up") + None, None, None, self.rightBottomCB], move="up", + label=_("Servo mount"))