Add labels to Ottobody

Using the label interface, render identifying labels on the Ottobody
This commit is contained in:
jens persson 2021-06-04 21:00:56 +02:00 committed by Florian Festi
parent 2d262dacdd
commit 4df9c4aae9
1 changed files with 24 additions and 12 deletions

View File

@ -14,6 +14,12 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
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"))