Exemplo n.º 1
0
 def layout(self):
   r = self.rect()
   width = r.width()
   height = r.height()
   controller_map = dict()
   i = 0.0
   for number in self._track.controllers:
     controller_map[number] = i
     i += 1.0
   scale_view = self.parentItemWithAttribute('view_scale')
   if (scale_view is not None):
     scale = scale_view.view_scale
     controller_height = scale.controller_height / scale.pitch_height
   else:
     try:
       controller_height = height / float(len(self._track.controllers))
     except ZeroDivisionError:
       controller_height = 1.0
   if (self._views is not None):
     for view in self._views:
       number = view.number
       try:
         y = r.y() + (controller_map[number] * controller_height)
       except KeyError:
         continue
       view.setRect(QRectF(0.0, y, width, controller_height))
Exemplo n.º 2
0
 def layout(self):
   y = self._rect.y()
   x = self._rect.x()
   extents = QRectF()
   moving_unit = False
   for view in self._views:
     unit = view.unit
     r = view.rect()
     view_rect = QRectF(
       # use integer coordinates for sharp antialiasing
       round(x + unit.x - (r.width() / 2.0)), 
       round(y + unit.y - (r.height() / 2.0)), 
       r.width(), r.height())
     view.setRect(view_rect)
     extents = extents.united(view_rect)
     try:
       moving_unit = moving_unit or view.moving
     except AttributeError: pass
   # size the workspace to the units in it plus a margin
   m = 100.0
   extents.adjust(- m, - m, m, m)
   old_extents = self.extents
   if (moving_unit):
     extents = extents.united(old_extents)
   self.extents = extents
Exemplo n.º 3
0
 def layout(self):
     y = self._rect.y()
     r = self.mapRectFromParent(self._rect)
     h = r.height()
     for view in self._views:
         x = view.model.time
         try:
             w = view.model.duration
         except AttributeError:
             w = view.rect().width()
         view.setRect(QRectF(x, y, w, h))
Exemplo n.º 4
0
 def layout(self):
   y = self._rect.y()
   r = self.mapRectFromParent(self._rect)
   h = r.height()
   for view in self._views:
     x = view.model.time
     try:
       w = view.model.duration
     except AttributeError:
       w = view.rect().width()
     view.setRect(QRectF(x, y, w, h))
Exemplo n.º 5
0
 def layout(self):
   y = self._rect.y()
   h = self._rect.height()
   for view in self._views:
     view.setRect(QRectF(view.model.time, y, 0.0, h))