Exemple #1
0
 def set_bounds(self, x, y, width, height):
     if self.native:
         vertical_shift = self.interface.style.padding_top
         horizontal_shift = self.interface.style.padding_left
         horizontal_size_adjustment = self.interface.style.padding_right + horizontal_shift
         vertical_size_adjustment = self.interface.style.padding_bottom + vertical_shift
         self.native.Size = Size(width + horizontal_size_adjustment, height + vertical_size_adjustment)
         self.native.Location = Point(x - horizontal_shift, y - vertical_shift)
Exemple #2
0
    def set_bounds(self, x, y, width, height):
        if self.native:
            # Root level widgets may require vertical adjustment to
            # account for toolbars, etc.
            if self.interface.parent is None:
                vertical_shift = self.frame.vertical_shift
            else:
                vertical_shift = 0

            self.native.Size = Size(width, height)
            self.native.Location = Point(x, y + vertical_shift)
Exemple #3
0
 def set_bounds(self, x, y, width, height):
     if self.native:
         vertical_shift = 0
         try:
             # If the box is the outer widget, we need to shift it to the frame vertical_shift
             vertical_shift = self.frame.vertical_shift - self.interface.style.padding_top
         except AttributeError:
             vertical_shift = self.interface.style.padding_top
         horizontal_shift = self.interface.style.padding_left
         horizontal_size_adjustment = self.interface.style.padding_right + horizontal_shift
         vertical_size_adjustment = self.interface.style.padding_bottom
         self.native.Size = Size(width + horizontal_size_adjustment, height + vertical_size_adjustment)
         self.native.Location = Point(x - horizontal_shift, y + vertical_shift)
Exemple #4
0
    def set_image(self, image):
        if image:
            # Workaround for loading image from url
            if self.interface._image._impl.url:
                self.native.Load(self.interface._image._impl.url)
            else:
                self.native.Image = self.interface._image._impl.native
        else:
            width = 0
            height = 0
            if self.interface.style.width:
                width = self.interface.style.width
            if self.interface.style.height:
                height = self.interface.style.height

            self.native.Size = Size(width, height)
            # Setting background color to white is not necessary, but it shows the
            # picture frame
            self.native.BackColor = Color.White
Exemple #5
0
    def set_image(self, image):
        # If an image already exists, ensure it is destroyed
        if self.native.Image is not None:
            self.native.Image.Dispose()
        if image:
            # Workaround for loading image from url
            if self.interface._image._impl.url:
                self.native.Load(self.interface._image._impl.url)
            else:
                self.native.Image = self.interface._image._impl.native
        else:
            width = 0
            height = 0
            if self.interface.style.width:
                width = self.interface.style.width
            if self.interface.style.height:
                height = self.interface.style.height

            self.native.Size = Size(width, height)
            # Setting background color to white is not necessary, but it shows the
            # picture frame
            self.native.BackColor = Color.White