From 4f0d41e98c9c5e917ec9b5d5d1b622782d19d9d8 Mon Sep 17 00:00:00 2001
From: Martyn Gigg <martyn.gigg@gmail.com>
Date: Sun, 14 Jan 2018 20:36:22 +0000
Subject: [PATCH] Use 4 spaces for editor indentation.

Refs #21251
---
 qt/python/mantidqt/widgets/codeeditor/interpreter.py | 7 ++++++-
 qt/python/mantidqt/widgets/src/_widgetscore.sip      | 2 ++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/qt/python/mantidqt/widgets/codeeditor/interpreter.py b/qt/python/mantidqt/widgets/codeeditor/interpreter.py
index 847070ff1fc..6d0c2efe8ed 100644
--- a/qt/python/mantidqt/widgets/codeeditor/interpreter.py
+++ b/qt/python/mantidqt/widgets/codeeditor/interpreter.py
@@ -33,8 +33,9 @@ from mantidqt.widgets.codeeditor.execution import PythonCodeExecution
 IDLE_STATUS_MSG = "Status: Idle"
 RUNNING_STATUS_MSG = "Status: Running"
 
-# Editor colors
+# Editor
 CURRENTLINE_BKGD_COLOR = QColor(247, 236, 248)
+TAB_WIDTH = 4
 
 
 class PythonFileInterpreter(QWidget):
@@ -71,6 +72,10 @@ class PythonFileInterpreter(QWidget):
     def _setup_editor(self, default_content):
         editor = self.editor
 
+        # use tabs not spaces for indentation
+        editor.setIndentationsUseTabs(False)
+        editor.setTabWidth(TAB_WIDTH)
+
         # show current editing line but in a softer color
         editor.setCaretLineBackgroundColor(CURRENTLINE_BKGD_COLOR)
         editor.setCaretLineVisible(True)
diff --git a/qt/python/mantidqt/widgets/src/_widgetscore.sip b/qt/python/mantidqt/widgets/src/_widgetscore.sip
index b50084aff3d..06ef1537e53 100644
--- a/qt/python/mantidqt/widgets/src/_widgetscore.sip
+++ b/qt/python/mantidqt/widgets/src/_widgetscore.sip
@@ -86,10 +86,12 @@ public:
 
   void setCaretLineBackgroundColor (const QColor & col);
   void setCaretLineVisible(bool enable);
+  void setIndentationsUseTabs(bool tabs);
   void setFileName(const QString &filename);
   void setMarginWidth(int margin, int width);
   void setReadOnly(bool ro);
   void setSelection(int lineFrom, int indexFrom, int lineTo, int indexTo);
+  void setTabWidth(int width);
   void setText(const QString &text);
 
 public slots:
-- 
GitLab