QScintilla/Editor.py

changeset 5733
aed3e558407f
parent 5706
59458b006d76
child 5736
000ea446ff4b
--- a/QScintilla/Editor.py	Sat May 06 14:59:26 2017 +0200
+++ b/QScintilla/Editor.py	Thu May 11 18:26:56 2017 +0200
@@ -293,10 +293,15 @@
             UI.PixmapCache.getPixmap("warning.png"))
         
         # define the line markers
-        self.currentline = self.markerDefine(
-            UI.PixmapCache.getPixmap("currentLineMarker.png"))
-        self.errorline = self.markerDefine(
-            UI.PixmapCache.getPixmap("errorLineMarker.png"))
+        if Preferences.getEditor("LineMarkersBackground"):
+            self.currentline = self.markerDefine(QsciScintilla.Background)
+            self.errorline = self.markerDefine(QsciScintilla.Background)
+            self.__setLineMarkerColours()
+        else:
+            self.currentline = self.markerDefine(
+                UI.PixmapCache.getPixmap("currentLineMarker.png"))
+            self.errorline = self.markerDefine(
+                UI.PixmapCache.getPixmap("errorLineMarker.png"))
         
         self.breakpointMask = (1 << self.breakpoint) | \
                               (1 << self.cbreakpoint) | \
@@ -4008,6 +4013,19 @@
         if QSCINTILLA_VERSION() >= 0x020301:
             self.__unifiedMargins = Preferences.getEditor("UnifiedMargins")
         
+        # set the line marker colours or pixmap
+        if Preferences.getEditor("LineMarkersBackground"):
+            self.markerDefine(QsciScintilla.Background, self.currentline)
+            self.markerDefine(QsciScintilla.Background, self.errorline)
+            self.__setLineMarkerColours()
+        else:
+            self.markerDefine(
+                UI.PixmapCache.getPixmap("currentLineMarker.png"),
+                self.currentline)
+            self.markerDefine(
+                UI.PixmapCache.getPixmap("errorLineMarker.png"),
+                self.errorline)
+        
         # set the text display
         self.__setTextDisplay()
         
@@ -4067,6 +4085,19 @@
         
         self.settingsRead.emit()
     
+    def __setLineMarkerColours(self):
+        """
+        Private method to set the line marker colours.
+        """
+        self.setMarkerForegroundColor(
+            Preferences.getEditorColour("CurrentMarker"), self.currentline)
+        self.setMarkerBackgroundColor(
+            Preferences.getEditorColour("CurrentMarker"), self.currentline)
+        self.setMarkerForegroundColor(
+            Preferences.getEditorColour("ErrorMarker"), self.errorline)
+        self.setMarkerBackgroundColor(
+            Preferences.getEditorColour("ErrorMarker"), self.errorline)
+        
     def __setMarginsDisplay(self):
         """
         Private method to configure margins 0 and 2.

eric ide

mercurial