QScintilla/Editor.py

branch
maintenance
changeset 5752
1860eca908e4
parent 5730
6422afc7adc4
parent 5736
000ea446ff4b
child 5885
5228afbb870f
--- a/QScintilla/Editor.py	Sat May 06 13:44:26 2017 +0200
+++ b/QScintilla/Editor.py	Sat Jun 03 13:08:50 2017 +0200
@@ -18,7 +18,7 @@
 import difflib
 
 from PyQt5.QtCore import QDir, QTimer, QModelIndex, QFileInfo, pyqtSignal, \
-    pyqtSlot, QCryptographicHash, QEvent, QDateTime, QRegExp, Qt, qVersion
+    pyqtSlot, QCryptographicHash, QEvent, QDateTime, QRegExp, Qt
 from PyQt5.QtGui import QCursor, QPalette, QFont, QPixmap, QPainter
 from PyQt5.QtWidgets import QLineEdit, QActionGroup, QDialog, QInputDialog, \
     QApplication, QMenu
@@ -34,6 +34,7 @@
 import Preferences
 import Utilities
 from Utilities import MouseUtilities
+from Globals import qVersionTuple
 
 import UI.PixmapCache
 
@@ -293,10 +294,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 +4014,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 +4086,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.
@@ -6500,7 +6532,7 @@
         
         @param evt reference to the wheel event (QWheelEvent)
         """
-        if qVersion() >= "5.0.0":
+        if qVersionTuple() >= (5, 0, 0):
             delta = evt.angleDelta().y()
         else:
             delta = evt.delta()

eric ide

mercurial