Пример #1
0
 def drawTrack(self):
     from miro.frontends.widgets import widgetutil
     rect = self.bounds()
     ctx = drawing.DrawingContext(self, rect, rect)
     ctx.set_color((1,1,1), 0.4)
     widgetutil.circular_rect(ctx, 0, 2, rect.size.width, rect.size.height - 4)
     ctx.fill()
Пример #2
0
 def drawRect_(self, dest_rect):
     if self.image is not None:
         source_rect = self.calculateSourceRectFromDestRect_(dest_rect)
         NSGraphicsContext.currentContext().setShouldAntialias_(YES)
         NSGraphicsContext.currentContext().setImageInterpolation_(
             NSImageInterpolationHigh)
         self.image.nsimage.drawInRect_fromRect_operation_fraction_(
             dest_rect, source_rect, NSCompositeSourceOver, 1.0)
     if self.border:
         context = drawing.DrawingContext(self, self.bounds(), dest_rect)
         context.style = drawing.DrawingStyle()
         context.set_line_width(1)
         context.set_color((0, 0, 0))  # black
         context.rectangle(0, 0, context.width, context.height)
         context.stroke()
Пример #3
0
    def drawRect_(self, rect):
        context = drawing.DrawingContext(self, self.bounds(), rect)
        context.style = drawing.DrawingStyle()
        wrapper = wrappermap.wrapper(self)
        wrapper.state = 'normal'
        disabled = wrapper.get_disabled()
        if not disabled:
            if self.state() == NSOnState:
                wrapper.state = 'pressed'
            elif self.mouse_inside:
                wrapper.state = 'hover'
            else:
                wrapper.state = 'normal'

        wrapper.draw(context, self.layout_manager)
        self.layout_manager.reset()
Пример #4
0
 def drawRect_(self, rect):
     context = drawing.DrawingContext(self, self.bounds(), rect)
     context.style = drawing.DrawingStyle()
     wrappermap.wrapper(self).draw(context, self.layout_manager)
     self.layout_manager.reset()