Browse Source

added code editor background color

Bachir Soussi Chiadmi 7 years ago
parent
commit
cea10ce3b7
1 changed files with 14 additions and 8 deletions
  1. 14 8
      libriis/classes/design.py

+ 14 - 8
libriis/classes/design.py

@@ -318,8 +318,8 @@ class CodeEditor(QPlainTextEdit):
       self.core = core
       self.tabs = tabs
       self.file = file
-      self.hl= highlighter.Highlighter(self.document(),mode)
-      # TODO: set code editor background color to dark
+      self.mode = mode
+      self.setStyle()
       self.setText()
       self.setTabStopWidth(15)
 
@@ -328,6 +328,18 @@ class CodeEditor(QPlainTextEdit):
       self.save_shortcut = QShortcut(QKeySequence("Ctrl+s"), self)
       self.save_shortcut.activated.connect(self.save)
 
+   def setStyle(self):
+      font = QFont()
+      font.setFamily("Droid Sans Mono")
+      font.setFixedPitch(True)
+      font.setPointSize(12)
+      self.setFont(font)
+
+      self.hl= highlighter.Highlighter(self.document(),self.mode)
+
+      self.setStyleSheet("QPlainTextEdit { background-color: #282828; }")
+
+
    def setText(self):
       # try:
       #    self.textChanged.disconnect(self.onTextChanged)
@@ -339,12 +351,6 @@ class CodeEditor(QPlainTextEdit):
       self.insertPlainText(open(self.filepath, 'r').read())
       self.changed = False
 
-      font = QFont()
-      font.setFamily("Droid Sans Mono")
-      font.setFixedPitch(True)
-      font.setPointSize(12)
-      self.setFont(font)
-
 
    def onTextChanged(self):
       print('textChanged')