Beispiel #1
0
 def _set_opacity_with_hex_edge(self, input_opacity):
     """
     Set the opacity of the stored QPixmap image and display it
     """
     # Store the opacity
     self.stored_opacity = input_opacity
     # Create and initialize the QImage from the stored QPixmap
     button_image = self.stored_pixmap
     # Resize the button image to scale
     button_image = button_image.scaled(
         functions.create_size(
             math.ceil(button_image.size().width() * self.scale[0]),
             math.ceil(button_image.size().height() * self.scale[1]),
         ),
         transformMode=data.Qt.SmoothTransformation)
     # Scale the hex image
     hex_image = self.stored_hex
     scaled_size = functions.create_size(
         math.ceil(hex_image.size().width() * self.scale[0]),
         math.ceil(hex_image.size().height() * self.scale[1]),
     )
     image = data.QImage(
         scaled_size,
         data.QImage.Format_ARGB32_Premultiplied,
     )
     image.fill(data.Qt.transparent)
     #        image.fill(data.theme.Context_Menu_Background)
     # Create and initialize the QPainter that will manipulate the QImage
     button_painter = data.QPainter(image)
     button_painter.setCompositionMode(
         data.QPainter.CompositionMode_SourceOver)
     button_painter.setOpacity(input_opacity)
     # Resize the hex image to scale
     hex_image = hex_image.scaled(
         functions.create_size(
             math.ceil(hex_image.size().width() * self.scale[0]),
             math.ceil(hex_image.size().height() * self.scale[1]),
         ),
         transformMode=data.Qt.SmoothTransformation)
     # Adjust inner button positioning according to the scale
     button_painter.drawPixmap(0, 0, hex_image)
     x_scaled = math.ceil(self.scale[0] * self.INNER_IMAGE_OFFSET[0])
     y_scaled = math.ceil(self.scale[1] * self.INNER_IMAGE_OFFSET[1])
     button_painter.drawPixmap(x_scaled, y_scaled, button_image)
     button_painter.end()
     # Display the manipulated image
     self.setPixmap(data.QPixmap.fromImage(image))
     # Set the button mask, which sets the button area to the shape of
     # the button image instead of a rectangle
     self.setMask(hex_image.mask())
Beispiel #2
0
 def init_extra_button(self,
                       parent,
                       main_form,
                       input_extra_pixmap,
                       input_extra_function=None,
                       input_extra_function_text=""):
     #Store the parent and main form references
     self._parent = parent
     self.main_form = main_form
     #Initialize the extra button
     self.extra_button = data.QLabel(self)
     width = int(self.geometry().width() * self.extra_button_size_factor)
     height = int(self.geometry().height() * self.extra_button_size_factor)
     self.extra_button_position = functions.create_point(
         int(self.geometry().width() * 2 / 3 - width),
         int(self.geometry().height() * 1 / 4))
     rectangle = functions.create_rect(self.extra_button_position,
                                       functions.create_size(width, height))
     self.extra_button.setGeometry(rectangle)
     self.extra_button_stored_pixmap = input_extra_pixmap
     self.extra_button.setPixmap(input_extra_pixmap)
     self.extra_button.setScaledContents(True)
     #Store the function options
     self.extra_button_function = input_extra_function
     self.extra_button_function_text = input_extra_function_text
     #Set the extra button opacity to low
     self._set_extra_button_opacity(self.OPACITY_LOW)
     #Overridden the extra buttons events
     self.extra_button.mousePressEvent = self.extra_button_click
     self.extra_button.enterEvent = self.extra_button_enter_event
     self.extra_button.leaveEvent = self.extra_button_leave_event
Beispiel #3
0
 def resizeEvent(self, event):
     """Overridden resize event"""
     #Execute the superclass resize function
     super().resizeEvent(event)
     #Update the extra button geometry
     width = int(self.geometry().width() * self.extra_button_size_factor)
     height = int(self.geometry().height() * self.extra_button_size_factor)
     rectangle = functions.create_rect(self.extra_button_position,
                                       functions.create_size(width, height))
     self.extra_button.setGeometry(rectangle)
Beispiel #4
0
 def customize_tab_bar(self):
     if data.custom_menu_scale != None and data.custom_menu_font != None:
         components.TheSquid.customize_menu_style(self.tabBar())
         self.tabBar().setFont(data.QFont(*data.custom_menu_font))
         new_icon_size = functions.create_size(data.custom_menu_scale,
                                               data.custom_menu_scale)
         self.setIconSize(new_icon_size)
     else:
         components.TheSquid.customize_menu_style(self.tabBar())
         self.tabBar().setFont(data.get_current_font())
         self.setIconSize(self.default_icon_size)
     self.tabBar().set_style()
Beispiel #5
0
 def scale(self, width_scale_factor=1, height_scale_factor=1):
     """Scale the size of the function wheel and all of its child widgets"""
     #Scale the function wheel form
     geo = self.geometry()
     new_width = int(geo.width() * width_scale_factor)
     new_height = int(geo.height() * height_scale_factor)
     rectangle = functions.create_rect(
         geo.topLeft(), functions.create_size(new_width, new_height))
     self.setGeometry(rectangle)
     #Scale all of the function wheel child widgets
     for button in self.children():
         geo = button.geometry()
         new_topLeft = functions.create_point(
             int(geo.topLeft().x() * width_scale_factor),
             int(geo.topLeft().y() * height_scale_factor))
         new_width = int(geo.width() * width_scale_factor)
         new_height = int(geo.height() * height_scale_factor)
         new_size = functions.create_size(new_width, new_height)
         rectangle = functions.create_rect(new_topLeft, new_size)
         button.setGeometry(rectangle)
     #Center to main form
     self.center(self.size())
Beispiel #6
0
 def init_markers(self):
     """Initialize all markers for showing diff symbols"""
     #Set the images
     image_scale_size = functions.create_size(16, 16)
     image_unique_1 = functions.create_pixmap(
         'tango_icons/diff-unique-1.png')
     image_unique_2 = functions.create_pixmap(
         'tango_icons/diff-unique-2.png')
     image_similar = functions.create_pixmap('tango_icons/diff-similar.png')
     #Scale the images to a smaller size
     image_unique_1 = image_unique_1.scaled(image_scale_size)
     image_unique_2 = image_unique_2.scaled(image_scale_size)
     image_similar = image_similar.scaled(image_scale_size)
     #Markers for editor 1
     self.marker_unique_1 = self.editor_1.markerDefine(
         data.QsciScintillaBase.SC_MARK_BACKGROUND, 0)
     self.marker_unique_symbol_1 = self.editor_1.markerDefine(
         image_unique_1, 1)
     self.marker_similar_1 = self.editor_1.markerDefine(
         data.QsciScintillaBase.SC_MARK_BACKGROUND, 2)
     self.marker_similar_symbol_1 = self.editor_1.markerDefine(
         image_similar, 3)
     #Set background colors only for the background markers
     self.editor_1.setMarkerBackgroundColor(self.Indicator_Unique_1_Color,
                                            self.marker_unique_1)
     self.editor_1.setMarkerBackgroundColor(self.Indicator_Similar_Color,
                                            self.marker_similar_1)
     #Margins for editor 1
     self.init_margin(self.editor_1, self.marker_unique_1,
                      self.marker_unique_symbol_1, self.marker_similar_1,
                      self.marker_similar_symbol_1)
     #Markers for editor 2
     self.marker_unique_2 = self.editor_2.markerDefine(
         data.QsciScintillaBase.SC_MARK_BACKGROUND, 0)
     self.marker_unique_symbol_2 = self.editor_2.markerDefine(
         image_unique_2, 1)
     self.marker_similar_2 = self.editor_2.markerDefine(
         data.QsciScintillaBase.SC_MARK_BACKGROUND, 2)
     self.marker_similar_symbol_2 = self.editor_2.markerDefine(
         image_similar, 3)
     #Set background colors only for the background markers
     self.editor_2.setMarkerBackgroundColor(self.Indicator_Unique_2_Color,
                                            self.marker_unique_2)
     self.editor_2.setMarkerBackgroundColor(self.Indicator_Similar_Color,
                                            self.marker_similar_2)
     #Margins for editor 2
     self.init_margin(self.editor_2, self.marker_unique_2,
                      self.marker_unique_symbol_2, self.marker_similar_2,
                      self.marker_similar_symbol_2)
Beispiel #7
0
 def check_position_offset(self,
                           inner_buttons=True,
                           outer_buttons=True,
                           horizontal_buttons=False):
     button_positions = []
     if inner_buttons == True:
         button_positions.extend(ContextMenu.inner_button_positions)
     if outer_buttons == True:
         button_positions.extend(ContextMenu.outer_button_positions)
     if horizontal_buttons == True:
         button_positions.extend(self.horizontal_button_positions)
     hex_x_size = self.ContextButton.HEX_IMAGE_SIZE[0] * self.x_scale
     hex_y_size = self.ContextButton.HEX_IMAGE_SIZE[1] * self.y_scale
     window_size = self.parent().size() - functions.create_size(
         hex_x_size, hex_y_size)
     min_x = 0
     min_y = 0
     max_x = 0
     max_y = 0
     for b in button_positions:
         x = self.offset[0] + b[0] * self.x_scale / 0.8 + self.total_offset[
             0]
         y = self.offset[1] + b[1] * self.y_scale / 0.8 + self.total_offset[
             1]
         if x < min_x:
             min_x = x
         if x > window_size.width():
             new_max = x - window_size.width()
             if new_max > max_x:
                 max_x = new_max
         if y < min_y:
             min_y = y
         if y > window_size.height():
             new_max = y - window_size.height()
             if new_max > max_y:
                 max_y = new_max
     if min_x != 0:
         self.offset = (self.offset[0] - min_x, self.offset[1])
     if max_x != 0:
         self.offset = (self.offset[0] - max_x, self.offset[1])
     if min_y != 0:
         self.offset = (self.offset[0], self.offset[1] - min_y)
     if max_y != 0:
         self.offset = (self.offset[0], self.offset[1] - max_y)
Beispiel #8
0
 def _set_wait_animation(self, index, show):
     tabBar = self.tabBar()
     if show:
         lbl = data.QLabel(self)
         movie = data.QMovie(os.path.join(data.resources_directory,
                                          "animations/wait.gif"),
                             parent=lbl)
         movie.setCacheMode(data.QMovie.CacheAll)
         if data.custom_menu_scale != None:
             size = tuple([(x * data.custom_menu_scale / 16)
                           for x in (16, 16)])
         else:
             size = (16, 16)
         movie.setScaledSize(functions.create_size(*size))
         lbl.setMovie(movie)
         movie.start()
         tabBar.setTabButton(index, data.QTabBar.LeftSide, lbl)
     else:
         tabBar.setTabButton(index, data.QTabBar.LeftSide, None)
Beispiel #9
0
 def create_base_image():
     hex_image = data.QImage(
         functions.create_size(width, height),
         data.QImage.Format_ARGB32_Premultiplied)
     hex_image.fill(data.Qt.transparent)
     qpainter = data.QPainter(hex_image)
     qpainter.setRenderHints(data.QPainter.Antialiasing
                             | data.QPainter.TextAntialiasing
                             | data.QPainter.SmoothPixmapTransform)
     hb = components.HexBuilder(
         qpainter,
         (width / 2, height / 2),
         self.DEFAULT_SIZE,
         self.scale_factor,
         fill_color=data.theme.Settings_Hex_Background,
         line_width=2,
         line_color=data.QColor(64, 64, 64),
     )
     hb.create_grid(False)
     qpainter.end()
     return data.QPixmap.fromImage(hex_image)
Beispiel #10
0
 def __init__(self, parent=None, main_form=None):
     # Initialize the superclass
     super().__init__(parent)
     # Store the reference to the main form
     self.main_form = main_form
     # Set default font
     self.setFont(data.get_current_font())
     # Set the shown property to False
     self.shown = False
     # Initialize button list
     self.buttons = []
     # Initialize the background image
     self._init_background()
     # Position the overlay to the center of the screen
     self.center(functions.create_size(*self.DEFAULT_SIZE))
     # Scale the size if needed
     self._init_scaling()
     # Initialize the display label that will display the various information
     self._init_info_label()
     # Initialize the buttons
     self._init_key_shortcut_buttons()
Beispiel #11
0
        def set_color(self, color):
            if not (color in self.valid_colors):
                raise Exception("Invalid EnlargeButton color selected!")
            elif color == "red":
                selected_image = self.hex_image_red
            elif color == "green":
                selected_image = self.hex_image_green
            elif color == "default":
                selected_image = None

            self.current_color = color

            scaled_size = functions.create_size(
                self.hex_image.size().width(),
                self.hex_image.size().height(),
            )
            image = data.QImage(
                scaled_size,
                data.QImage.Format_ARGB32_Premultiplied,
            )
            image.fill(data.Qt.transparent)
            button_painter = data.QPainter(image)
            button_painter.setCompositionMode(
                data.QPainter.CompositionMode_SourceOver)
            button_painter.setOpacity(1.0)
            # Adjust inner button positioning according to the scale
            x = (self.hex_image.width() - self.button_image.width()) / 2
            y = (self.hex_image.height() - self.button_image.height()) / 2
            button_painter.drawPixmap(0, 0, self.hex_image)
            if selected_image != None:
                button_painter.drawPixmap((5 * (self.scale_factor - 1.0)),
                                          (5 * (self.scale_factor - 1.0)),
                                          selected_image)
            button_painter.drawPixmap(x, y, self.button_image)
            button_painter.end()
            # Set the image as the pixmap
            self.setPixmap(data.QPixmap.fromImage(image))
Beispiel #12
0
    def init_layout(self, text, dialog_type):
        # Setup the image
        # First create the background image using the hex builder
        back_image = data.QImage(functions.create_size(246, 211),
                                 data.QImage.Format_ARGB32_Premultiplied)
        back_image.fill(data.Qt.transparent)
        painter = data.QPainter(back_image)
        painter.setRenderHints(data.QPainter.Antialiasing
                               | data.QPainter.TextAntialiasing
                               | data.QPainter.SmoothPixmapTransform)
        hex_builder = components.HexBuilder(
            painter,
            (123, 28),
            30,
            1.0,
            fill_color=data.theme.YesNoDialog_Background,
            line_width=3,
            line_color=data.theme.YesNoDialog_Edge,
        )
        hex_builder.create_grid(
            False,
            2,
            2,
            3,
            4,
            0,
            5,
            3,
            (3, True),
            5,
            0,
            0,
            4,
            3  # OkDialog
        )
        painter.end()
        original_dialog_image = data.QPixmap.fromImage(back_image)

        # Now add the images according to the type of dialog
        dialog_image = original_dialog_image.scaled(
            original_dialog_image.size() * self.scale,
            transformMode=data.Qt.SmoothTransformation)
        self.image = data.QLabel(self)
        self.image.setPixmap(dialog_image)
        self.image.setGeometry(
            0,
            0,
            int(dialog_image.rect().width() * self.scale),
            int(dialog_image.rect().height() * self.scale),
        )
        self.image.setScaledContents(True)
        # Set the dialog mask to match the image mask
        self.setMask(dialog_image.mask())
        # Setup the image behind the label
        if dialog_type != None:
            if dialog_type == "question":
                type_pixmap = data.QPixmap(
                    os.path.join(data.resources_directory,
                                 "various/dialog-question.png"))
            elif dialog_type == "warning":
                type_pixmap = data.QPixmap(
                    os.path.join(data.resources_directory,
                                 "various/dialog-warning.png"))
            elif dialog_type == "error":
                type_pixmap = data.QPixmap(
                    os.path.join(data.resources_directory,
                                 "various/dialog-error.png"))
            else:
                raise Exception("Wrong dialog type!")
            image = data.QImage(type_pixmap.size(),
                                data.QImage.Format_ARGB32_Premultiplied)
            image.fill(data.Qt.transparent)
            painter = data.QPainter(image)
            painter.setOpacity(0.2)
            painter.drawPixmap(0, 0, type_pixmap)
            painter.end()
            type_pixmap = data.QPixmap.fromImage(image)
            type_pixmap = type_pixmap.scaled(
                type_pixmap.size() * 2.0 * self.scale,
                transformMode=data.Qt.SmoothTransformation)
            self.type_label = data.QLabel(self)
            self.type_label.setPixmap(type_pixmap)
            type_label_rect = functions.create_rect(
                (self.image.rect().width() - type_pixmap.rect().width()) / 2 *
                self.scale,
                (self.image.rect().height() - type_pixmap.rect().height()) /
                2 * self.scale,
                type_pixmap.rect().width() * self.scale,
                type_pixmap.rect().height() * self.scale,
            )
            self.type_label.setGeometry(type_label_rect)
        # Setup the text label
        self.text = text
        self.label = data.QLabel(self)
        self.label.setFont(
            data.QFont('Segoe UI', int(12 * self.scale), data.QFont.Bold))
        self.label.setWordWrap(True)
        self.label.setAlignment(data.Qt.AlignCenter)
        self.label.setStyleSheet('color: rgb({}, {}, {})'.format(
            data.theme.Font.Default.red(),
            data.theme.Font.Default.green(),
            data.theme.Font.Default.blue(),
        ))
        self.label.setText(text)
        width_diff = self.image.rect().width() - original_dialog_image.width()
        height_diff = self.image.rect().height(
        ) - original_dialog_image.height()
        x_offset = 20 * (self.scale - 1.0)
        y_offset = 60 * (self.scale - 1.0)
        label_rect = functions.create_rect(
            dialog_image.rect().x() + 20 + x_offset,
            dialog_image.rect().y() + 60 + y_offset,
            dialog_image.rect().width() - (40 * self.scale),
            dialog_image.rect().height() - (120 * self.scale),
        )
        self.label.setGeometry(label_rect)
        # Shrink text if needed
        for i in range(10):
            label_width = label_rect.width()
            label_height = label_rect.height()
            font_metrics = data.QFontMetrics(self.label.font())
            bounding_rectangle = font_metrics.boundingRect(
                functions.create_rect(0, 0, label_width, label_height),
                self.label.alignment() | data.Qt.TextWordWrap, text)
            if (bounding_rectangle.width() > label_width
                    or bounding_rectangle.height() > label_height):
                self.label.setFont(
                    data.QFont('Segoe UI', int((12 - i) * self.scale),
                               data.QFont.Bold))
            else:
                break
        # Setup the buttons
        self.button_no = self.Button(
            self, os.path.join(data.resources_directory,
                               "various/hex-red.png"), "OK",
            data.QMessageBox.No, self.scale)
        x_offset = 93 * (self.scale - 1.0)
        y_offset = 158 * (self.scale - 1.0)
        self.button_no.setGeometry(int(93 + x_offset), int(158 + y_offset),
                                   int(59 * self.scale), int(50 * self.scale))
        self.button_no.on_signal.connect(self.update_state_off)
        self.button_no.off_signal.connect(self.update_state_reset)
        # Setup the layout
        self.layout = data.QGridLayout()
        self.layout.setSpacing(0)
        self.layout.setContentsMargins(data.QMargins(0, 0, 0, 0))
        self.layout.addWidget(self.image)
        self.setLayout(self.layout)
        # Setup tranparency and borders
        if data.on_rpi == True:
            self.image.setStyleSheet("border:0;" + "background-color:white;")
        else:
            self.image.setAttribute(data.Qt.WA_TranslucentBackground)
            self.image.setStyleSheet("border:0;" +
                                     "background-color:transparent;")
        self.setAttribute(data.Qt.WA_TranslucentBackground)
        self.setStyleSheet("border:0;" + "background-color:transparent;")

        self.setGeometry(dialog_image.rect())
        self.center()
        self.setWindowFlags(data.Qt.FramelessWindowHint)
Beispiel #13
0
        def __init__(self,
                     name,
                     picture,
                     scale_factor=1.0,
                     function=None,
                     key_combination=None,
                     starting_position=None,
                     end_position=None,
                     parent=None):
            super().__init__(parent)

            self.name = name
            self.scale_factor = scale_factor
            self.key_combination = key_combination
            self.animating = False
            self.starting_position = starting_position
            self.end_position = end_position
            self.disable()
            self.properties = {}
            # Set default font
            self.setFont(data.get_current_font())
            # Button image
            self.button_image = data.QPixmap(
                os.path.join(data.resources_directory, picture))
            adjusted_size = self.DEFAULT_SIZE * self.scale_factor
            self.button_image = self.button_image.scaled(
                functions.create_size(
                    math.ceil(adjusted_size),
                    math.ceil(adjusted_size),
                ),
                transformMode=data.Qt.SmoothTransformation)

            width, height = components.HexBuilder.get_single_hex_size(
                adjusted_size, 2)

            def create_base_image():
                hex_image = data.QImage(
                    functions.create_size(width, height),
                    data.QImage.Format_ARGB32_Premultiplied)
                hex_image.fill(data.Qt.transparent)
                qpainter = data.QPainter(hex_image)
                qpainter.setRenderHints(data.QPainter.Antialiasing
                                        | data.QPainter.TextAntialiasing
                                        | data.QPainter.SmoothPixmapTransform)
                hb = components.HexBuilder(
                    qpainter,
                    (width / 2, height / 2),
                    self.DEFAULT_SIZE,
                    self.scale_factor,
                    fill_color=data.theme.Settings_Hex_Background,
                    line_width=2,
                    line_color=data.QColor(64, 64, 64),
                )
                hb.create_grid(False)
                qpainter.end()
                return data.QPixmap.fromImage(hex_image)

            self.hex_image = create_base_image()
            self.hex_image = self.hex_image.scaled(
                functions.create_size(
                    math.ceil(self.hex_image.size().width() *
                              self.scale_factor),
                    math.ceil(self.hex_image.size().height() *
                              self.scale_factor),
                ),
                transformMode=data.Qt.SmoothTransformation)

            # Green hex background
            def create_color_image(color):
                hex_image = data.QImage(
                    functions.create_size(width, height),
                    data.QImage.Format_ARGB32_Premultiplied)
                hex_image.fill(data.Qt.transparent)
                qpainter = data.QPainter(hex_image)
                qpainter.setRenderHints(data.QPainter.Antialiasing
                                        | data.QPainter.TextAntialiasing
                                        | data.QPainter.SmoothPixmapTransform)
                hb = components.HexBuilder(
                    qpainter,
                    (width / 2, height / 2),
                    self.DEFAULT_SIZE,
                    self.scale_factor,
                    fill_color=color,
                    line_width=0,
                    line_color=data.QColor(0, 0, 0),
                )
                hb.create_grid(False)
                qpainter.end()
                return data.QPixmap.fromImage(hex_image)

            self.hex_image_green = create_color_image(data.QColor(
                138, 226, 52))
            self.hex_image_green = self.hex_image_green.scaled(
                functions.create_size(
                    math.ceil(self.hex_image_green.size().width() *
                              self.scale_factor) - 1,
                    math.ceil(self.hex_image_green.size().height() *
                              self.scale_factor) - 1,
                ),
                transformMode=data.Qt.SmoothTransformation)
            # Red hex background
            self.hex_image_red = create_color_image(data.QColor(239, 41, 41))
            self.hex_image_red = self.hex_image_red.scaled(
                functions.create_size(
                    math.ceil(self.hex_image_red.size().width() *
                              self.scale_factor) - 1,
                    math.ceil(self.hex_image_red.size().height() *
                              self.scale_factor) - 1,
                ),
                transformMode=data.Qt.SmoothTransformation)

            scaled_size = functions.create_size(
                self.hex_image.size().width(),
                self.hex_image.size().height(),
            )
            image = data.QImage(
                scaled_size,
                data.QImage.Format_ARGB32_Premultiplied,
            )
            image.fill(data.Qt.transparent)
            button_painter = data.QPainter(image)
            button_painter.setCompositionMode(
                data.QPainter.CompositionMode_SourceOver)
            button_painter.setOpacity(1.0)
            # Adjust inner button positioning according to the scale
            x = (self.hex_image.width() - self.button_image.width()) / 2
            y = (self.hex_image.height() - self.button_image.height()) / 2
            button_painter.drawPixmap(0, 0, self.hex_image)

            button_painter.drawPixmap(x, y, self.button_image)
            button_painter.end()

            # Set properites
            self.setParent(parent)
            self.setPixmap(data.QPixmap.fromImage(image))
            self.setGeometry(0, 0, int(image.width() * self.scale_factor),
                             int(image.height() * self.scale_factor))
            self.setMask(self.hex_image.mask())
            self.setScaledContents(True)
            # Set the non-enlarged dimensions
            self.original_size = (self.geometry().width(),
                                  self.geometry().height())

            # Set the initial color state
            self.current_color = "default"
Beispiel #14
0
    def create_background_image(in_scale=1.0):
        """
        Dinamically create the settings manipulator's background image
        """
        # Check if the QPixmap has been created already
        if SettingsGuiManipulator.settings_background_image == None:
            scale = in_scale
            edge_length = 27
            scaled_edge_diff = (edge_length -
                                (edge_length * scale)) / edge_length
            back_color = data.theme.Settings_Background
            edge_color = data.QColor(data.theme.Settings_Hex_Edge)

            SettingsGuiManipulator.theme_name = data.theme.name

            def add_offset(offset):
                x_add = 64.0
                y_add = 20.0
                return (offset[0] + x_add, offset[1] + y_add)

            settings_background_image = data.QImage(
                functions.create_size(*SettingsGuiManipulator.DEFAULT_SIZE),
                data.QImage.Format_ARGB32_Premultiplied)
            settings_background_image.fill(data.Qt.transparent)
            #            settings_background_image.fill(data.QColor(255,255,255))
            qpainter = data.QPainter(settings_background_image)
            qpainter.setRenderHints(data.QPainter.Antialiasing
                                    | data.QPainter.TextAntialiasing
                                    | data.QPainter.SmoothPixmapTransform)

            # Corner options
            x = edge_length + 205
            y = 1.8 * edge_length + 30
            offset = (x, y)
            hb = components.HexBuilder(
                qpainter,
                offset,
                edge_length,
                scale,
                fill_color=back_color,
                line_width=2,
                line_color=edge_color,
            )
            grid_list = [
                (3, True),
                (4, True),
                (4, True),
                (4, True),
                (5, True),
                (1, True),
            ]
            hb.create_grid(*grid_list)
            # Label field
            last_step = hb.get_last_position()
            hb = components.HexBuilder(
                qpainter,
                offset,
                edge_length,
                scale,
                fill_color=data.theme.Settings_Label_Background,
                line_width=3,
                line_color=data.QColor(146, 146, 146),
            )
            hb.set_first_position(last_step)
            hb.create_grid(5, 5, 0, 2, 0, 2, 3, 1, 0, 2, 3, 4)

            # Editor buttons
            offset = (90, 280)
            offset = add_offset(offset)
            row_length = 6
            editor_button_count = 30
            hb = components.HexBuilder(
                qpainter,
                offset,
                edge_length,
                scale,
                fill_color=back_color,
                line_width=2,
                line_color=edge_color,
            )
            grid_list = hb.generate_square_grid_list(row_length,
                                                     editor_button_count)
            hb.create_grid(*grid_list)
            # Editor edge
            hb.next_step_move(3)
            first_edge_hex_position = hb.get_last_position()
            hb = components.HexBuilder(
                qpainter,
                first_edge_hex_position,
                edge_length,
                scale,
                fill_color=back_color,
                line_width=2,
                line_color=edge_color,
            )
            grid_list = [
                (4, True),
                (5, True),
                (4, True),
                (5, True),
                (4, True),
                (5, True),
                (0, True),
                (0, True),
                (0, True),
                (0, True),
                (0, True),
                (1, True),
                (1, True),
                (2, True),
                (1, True),
                (2, True),
                (1, True),
                (2, True),
                (3, True),
                (3, True),
                (3, True),
                (3, True),
                (3, True),
            ]
            hb.create_grid(*grid_list)

            # General buttons
            offset = (offset[0] + (8 * hb.horizontal_step),
                      offset[1] - (6 * hb.vertical_step))
            row_length = 7
            general_button_count = 56
            hb = components.HexBuilder(
                qpainter,
                offset,
                edge_length,
                scale,
                fill_color=back_color,
                line_width=2,
                line_color=edge_color,
            )
            grid_list = hb.generate_square_grid_list(row_length,
                                                     general_button_count)
            hb.create_grid(*grid_list)
            # General edge
            hb.next_step_move(3)
            first_edge_hex_position = hb.get_last_position()
            hb = components.HexBuilder(
                qpainter,
                first_edge_hex_position,
                edge_length,
                scale,
                fill_color=back_color,
                line_width=2,
                line_color=edge_color,
            )
            grid_list = [
                (1, True),
                (2, True),
                (1, True),
                (2, True),
                (1, True),
                (2, True),
                (1, True),
                (0, True),
                (0, True),
                (0, True),
                (0, True),
                (0, True),
                (0, True),
                (0, True),
                (0, True),
                (5, True),
                (5, True),
                (4, True),
                (5, True),
                (4, True),
                (5, True),
                (4, True),
                (4, True),
                (3, True),
                (3, True),
                (3, True),
                (3, True),
                (3, True),
                (3, True),
                (3, True),
                (3, True),
            ]
            hb.create_grid(*grid_list)

            qpainter.end()
            SettingsGuiManipulator.settings_background_image = data.QPixmap.fromImage(
                settings_background_image)
        return SettingsGuiManipulator.settings_background_image