Example #1
0
    def layout(self, x, y):
        """
        Places the Checkbox.

        @param x X coordinate of lower left corner
        @param y Y coordinate of lower left corner
        """
        Control.layout(self, x, y)
        if self.align == HALIGN_RIGHT:  # label goes on right
            self.checkbox.update(
                x, y + self.height / 2 - self.checkbox.height / 2,
                self.checkbox.width, self.checkbox.height)
            self.label.x = x + self.checkbox.width + self.padding
        else:  # label goes on left
            self.label.x = x
            self.checkbox.update(
                x + self.label.content_width + self.padding,
                y + self.height / 2 - self.checkbox.height / 2,
                self.checkbox.width, self.checkbox.height)

        if self.highlight is not None:
            self.highlight.update(self.x, self.y, self.width, self.height)

        font = self.label.document.get_font()
        height = font.ascent - font.descent
        self.label.y = y + self.height / 2 - height / 2 - font.descent
Example #2
0
File: menu.py Project: isS/sy-game
    def layout(self, x, y):
        Control.layout(self, x, y)

        self.field.update(x, y, self.width, self.height)
        x, y, width, height = self.field.get_content_region()

        font = self.label.document.get_font()
        height = font.ascent - font.descent
        self.label.x = x
        self.label.y = y - font.descent
Example #3
0
    def layout(self, x, y):
        Control.layout(self, x, y)

        self.field.update(x, y, self.width, self.height)
        x, y, width, height = self.field.get_content_region()

        font = self.label.document.get_font()
        height = font.ascent - font.descent
        self.label.x = x
        self.label.y = y - font.descent
Example #4
0
    def layout(self, x, y):
        """
        Places the Button.

        @param x X coordinate of lower left corner
        @param y Y coordinate of lower left corner
        """
        Control.layout(self, x, y)
        self.button.update(self.x, self.y, self.width, self.height)
        if self.highlight is not None:
            self.highlight.update(self.x, self.y, self.width, self.height)
        x, y, width, height = self.button.get_content_region()
        font = self.label.document.get_font()
        self.label.x = x + width / 2 - self.label.content_width / 2
        self.label.y = y + height / 2 - font.ascent / 2 - font.descent
Example #5
0
    def layout(self, x, y):
        """
        Places the Button.

        @param x X coordinate of lower left corner
        @param y Y coordinate of lower left corner
        """
        Control.layout(self, x, y)
        self.button.update(self.x, self.y, self.width, self.height)
        if self.highlight is not None:
            self.highlight.update(self.x, self.y, self.width, self.height)
        x, y, width, height = self.button.get_content_region()
        font = self.label.document.get_font()
        self.label.x = x + width/2 - self.label.content_width/2
        self.label.y = y + height/2 - font.ascent/2 - font.descent
    def layout(self, x, y):
        """
        Places the Checkbox.

        @param x X coordinate of lower left corner
        @param y Y coordinate of lower left corner
        """
        Control.layout(self, x, y)
        if self.align == HALIGN_RIGHT:  # label goes on right
            self.checkbox.update(x, y + self.height/2 - self.checkbox.height/2,
                                 self.checkbox.width, self.checkbox.height)
            self.label.x = x + self.checkbox.width + self.padding
        else: # label goes on left
            self.label.x = x
            self.checkbox.update(x + self.label.content_width + self.padding,
                                 y + self.height/2 - self.checkbox.height/2,
                                 self.checkbox.width, self.checkbox.height)

        if self.highlight is not None:
            self.highlight.update(self.x, self.y, self.width, self.height)

        font = self.label.document.get_font()
        height = font.ascent - font.descent
        self.label.y = y + self.height/2 - height/2 - font.descent