Exemple #1
0
 def __init__(self, im, pos, handler=None):
     self.handler = handler
     image = pygame.image.load(im).convert()
     size = (image.get_rect().width, image.get_rect().height)
     print size
     self.image = image
     LcarsWidget.__init__(self, None, pos, size)
Exemple #2
0
    def __init__(self, colour, style, pos):
        image = pygame.image.load("assets/tab.png").convert()
        if (style == LcarsTab.STYLE_RIGHT):
            image = pygame.transform.flip(image, False, True)

        size = (image.get_rect().width, image.get_rect().height)
        LcarsWidget.__init__(self, colour, pos, size)
        self.image = image
        self.applyColour(colour)
 def __init__(self, colour, style, pos):
     image = pygame.image.load("assets/tab.png").convert()
     if (style == LcarsTab.STYLE_RIGHT):
         image = pygame.transform.flip(image, False, True)
     
     size = (image.get_rect().width, image.get_rect().height)
     LcarsWidget.__init__(self, colour, pos, size)
     self.image = image
     self.applyColour(colour)
Exemple #4
0
    def __init__(self, colour, pos, message, size=1.0, background=None):
        self.colour = colour
        self.background = background
        self.font = Font("assets/swiss911.ttf", int(19.0 * size))

        self.renderText(message)
        # center the text if needed
        if (pos[1] < 0):
            pos = (pos[0], 400 - self.image.get_rect().width / 2)

        LcarsWidget.__init__(self, colour, pos, None)
 def __init__(self, colour, pos, message, size=1.0, background=None):
     self.colour = colour
     self.background = background
     self.font = Font("assets/swiss911.ttf", int(19.0 * size))
     
     self.renderText(message)
     # center the text if needed 
     if (pos[1] < 0):
         pos = (pos[0], 400 - self.image.get_rect().width / 2)
         
     LcarsWidget.__init__(self, colour, pos, None)
Exemple #6
0
    def __init__(self, colour, style, pos):
        image = pygame.image.load("assets/elbow.png").convert()
        if (style == LcarsElbow.STYLE_BOTTOM_LEFT):
            image = pygame.transform.flip(image, False, True)
        elif (style == LcarsElbow.STYLE_BOTTOM_RIGHT):
            image = pygame.transform.rotate(image, 180)
        elif (style == LcarsElbow.STYLE_TOP_RIGHT):
            image = pygame.transform.flip(image, True, False)

        self.image = image
        size = (image.get_rect().width, image.get_rect().height)
        LcarsWidget.__init__(self, colour, pos, size)
        self.applyColour(colour)
Exemple #7
0
    def handleEvent(self, event, clock):
        handled = False

        if (event.type == MOUSEBUTTONDOWN and self.rect.collidepoint(event.pos)):
            handled = True

        if (event.type == MOUSEBUTTONUP):
            if self.handler:
                self.handler(self, event, clock)
                handled = True

        LcarsWidget.handleEvent(self, event, clock)
        return handled
 def __init__(self, colour, style, pos):
     image = pygame.image.load("assets/elbow.png").convert()
     if (style == LcarsElbow.STYLE_BOTTOM_LEFT):
         image = pygame.transform.flip(image, False, True)
     elif (style == LcarsElbow.STYLE_BOTTOM_RIGHT):
         image = pygame.transform.rotate(image, 180)
     elif (style == LcarsElbow.STYLE_TOP_RIGHT):
         image = pygame.transform.flip(image, True, False)
     
     self.image = image
     size = (image.get_rect().width, image.get_rect().height)
     LcarsWidget.__init__(self, colour, pos, size)
     self.applyColour(colour)
Exemple #9
0
    def __init__(self, colour, pos, text, handler=None):
        self.handler = handler
        image = pygame.image.load("assets/button.png").convert()
        size = (image.get_rect().width, image.get_rect().height)
        font = Font("assets/swiss911.ttf", 19)
        textImage = font.render(text, False, colours.BLACK)
        image.blit(textImage,
                   (image.get_rect().width - textImage.get_rect().width - 10,
                    image.get_rect().height - textImage.get_rect().height - 5))

        self.image = image
        self.colour = colour
        LcarsWidget.__init__(self, colour, pos, size)
        self.applyColour(colour)
        self.highlighted = False
        self.beep = Sound("assets/audio/panel/202.wav")
    def __init__(self, colour, pos, text, handler=None):
        self.handler = handler
        image = pygame.image.load("assets/button.png").convert()
        size = (image.get_rect().width, image.get_rect().height)
        font = Font("assets/swiss911.ttf", 19)
        textImage = font.render(text, False, colours.BLACK)
        image.blit(textImage, 
                   (image.get_rect().width - textImage.get_rect().width - 10,
                    image.get_rect().height - textImage.get_rect().height - 5))

        self.image = image
        self.colour = colour
        LcarsWidget.__init__(self, colour, pos, size)
        self.applyColour(colour)
        self.highlighted = False
        self.beep = Sound("assets/audio/panel/202.wav")
    def handleEvent(self, event, clock):
        handled = False
        
        if (event.type == MOUSEBUTTONDOWN and self.rect.collidepoint(event.pos)):
            self.applyColour(colours.WHITE)
            self.highlighted = True
            self.beep.play()
            handled = True

        if (event.type == MOUSEBUTTONUP and self.highlighted):
            self.applyColour(self.colour)
            if self.handler:
                self.handler(self, event, clock)
                handled = True
            
        LcarsWidget.handleEvent(self, event, clock)
        return handled
Exemple #12
0
    def handleEvent(self, event, clock):
        handled = False

        if (event.type == MOUSEBUTTONDOWN
                and self.rect.collidepoint(event.pos)):
            self.applyColour(colours.WHITE)
            self.highlighted = True
            self.beep.play()
            handled = True

        if (event.type == MOUSEBUTTONUP and self.highlighted):
            self.applyColour(self.colour)
            if self.handler:
                self.handler(self, event, clock)
                handled = True

        LcarsWidget.handleEvent(self, event, clock)
        return handled
Exemple #13
0
 def __init__(self, image):
     self.image = pygame.image.load(image).convert()
     # Screen specific scaling
     self.image = pygame.transform.scale(self.image, (480, 320))
     LcarsWidget.__init__(self, None, (0,0), None)
 def __init__(self, colour, pos):
     size = (100, 20)
     LcarsWidget.__init__(self, colour, pos, size)
Exemple #15
0
 def __init__(self, colour, pos):
     size = (160, 45)
     LcarsWidget.__init__(self, colour, pos, size)
Exemple #16
0
 def __init__(self, colour, pos):
     size = (100, 20)
     LcarsWidget.__init__(self, colour, pos, size)
Exemple #17
0
 def __init__(self, image, pos):
     self.image = pygame.image.load(image).convert()
     LcarsWidget.__init__(self, None, pos, None)
Exemple #18
0
 def __init__(self, image, pos):
     self.image = pygame.image.load(image).convert()
     LcarsWidget.__init__(self, None, pos, None)
 def __init__(self, colour, pos):
     size = (160, 45)
     LcarsWidget.__init__(self, colour, pos, size)