Example #1
0
 def set_palette(self, background, foreground):
     """
     Set text editor palette colors:
     background color and caret (text cursor) color
     """
     palette = QPalette()
     palette.setColor(QPalette.Base, background)
     palette.setColor(QPalette.Text, foreground)
     self.setPalette(palette)
Example #2
0
 def set_palette(self, background, foreground):
     """
     Set text editor palette colors:
     background color and caret (text cursor) color
     """
     palette = QPalette()
     palette.setColor(QPalette.Base, background)
     palette.setColor(QPalette.Text, foreground)
     self.setPalette(palette)
Example #3
0
    def set_palette(self, background, foreground):
        """
        Set text editor palette colors:
        background color and caret (text cursor) color
        """
        palette = QPalette()
        palette.setColor(QPalette.Base, background)
        palette.setColor(QPalette.Text, foreground)
        self.setPalette(palette)

        # Set the right background color when changing color schemes
        # or creating new Editor windows. This seems to be a Qt bug.
        # Fixes Issue 2028
        if sys.platform == 'darwin':
            if self.objectName():
                style = "QPlainTextEdit#%s {background: %s; color: %s;}" % \
                        (self.objectName(), background.name(), foreground.name())
                self.setStyleSheet(style)