Rename to Rack19HalfWidth to better fit with other Rack boxes
Move to Box group Support more than one row of equipement Move defaults to arguments to conform with general coding style
This commit is contained in:
parent
681ebbb694
commit
c3185f5129
|
@ -3,32 +3,25 @@
|
||||||
from boxes import Boxes
|
from boxes import Boxes
|
||||||
from boxes.edges import Edge
|
from boxes.edges import Edge
|
||||||
|
|
||||||
class H19Rack(Boxes):
|
class Rack19HalfWidth(Boxes):
|
||||||
"""Half 19inch rack unit for musical equipment."""
|
"""Half width 19inch rack unit for musical equipment."""
|
||||||
ru_count = 1
|
|
||||||
holes = "xxmpwx"
|
|
||||||
z = 20
|
|
||||||
deepz = 124
|
|
||||||
earside = 'r'
|
|
||||||
|
|
||||||
# provided by default via boxes
|
ui_group = "Box"
|
||||||
x, y, = 0, 0
|
|
||||||
thickness = 3
|
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.argparser.add_argument(
|
self.argparser.add_argument(
|
||||||
'--ru_count', action='store', type=float, default=self.ru_count,
|
'--ru_count', action='store', type=float, default=1,
|
||||||
help='number of rack units')
|
help='number of rack units')
|
||||||
self.argparser.add_argument(
|
self.argparser.add_argument(
|
||||||
'--holes', action='store', type=str, default=self.holes,
|
'--holes', action='store', type=str, default="xxmpwx",
|
||||||
help='holes, x=xlr, m=midi, p=9v-power, w=6.5mm-wire')
|
help='mounting patterns: x=xlr, m=midi, p=9v-power, w=6.5mm-wire, space=next row')
|
||||||
self.argparser.add_argument(
|
self.argparser.add_argument(
|
||||||
'--z', action='store', type=float, default=self.z,
|
'--z', action='store', type=float, default=20,
|
||||||
help='depth of the shorter (rackear) side')
|
help='depth of the shorter (rackear) side')
|
||||||
self.argparser.add_argument(
|
self.argparser.add_argument(
|
||||||
'--deepz', action="store", type=float, default=self.deepz,
|
'--deepz', action="store", type=float, default=124,
|
||||||
help='depath of the longer (screwed to another half sized thing) side')
|
help='depth of the longer (screwed to another half sized thing) side')
|
||||||
|
|
||||||
def render(self):
|
def render(self):
|
||||||
"""Render box."""
|
"""Render box."""
|
||||||
|
@ -59,9 +52,12 @@ class H19Rack(Boxes):
|
||||||
|
|
||||||
def util_holes(self):
|
def util_holes(self):
|
||||||
"""Add holes."""
|
"""Add holes."""
|
||||||
self.moveTo(10, self.y / 2 + self.thickness)
|
self.moveTo(10, (44.45 - 4.45)/2)
|
||||||
for hole in self.holes:
|
for line in self.holes.split():
|
||||||
self.hole_map.get(hole, lambda _: None)(self)
|
with self.saved_context():
|
||||||
|
for hole in line:
|
||||||
|
self.hole_map.get(hole, lambda _: None)(self)
|
||||||
|
self.moveTo(0, 44.45)
|
||||||
|
|
||||||
def hole_xlr(self):
|
def hole_xlr(self):
|
||||||
"""Hole for a xlr port."""
|
"""Hole for a xlr port."""
|
Loading…
Reference in New Issue