Preferences: added an option to configure the REPL pane line wrap mode. micropython

Tue, 30 Jul 2019 19:26:56 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 30 Jul 2019 19:26:56 +0200
branch
micropython
changeset 7099
89f11ae6bec3
parent 7098
fbdf76af88ed
child 7100
c4d9c28ebcd8

Preferences: added an option to configure the REPL pane line wrap mode.

eric6/Preferences/ConfigurationPages/MicroPythonPage.py file | annotate | diff | comparison | revisions
eric6/Preferences/ConfigurationPages/MicroPythonPage.ui file | annotate | diff | comparison | revisions
eric6/Preferences/__init__.py file | annotate | diff | comparison | revisions
--- a/eric6/Preferences/ConfigurationPages/MicroPythonPage.py	Tue Jul 30 19:25:23 2019 +0200
+++ b/eric6/Preferences/ConfigurationPages/MicroPythonPage.py	Tue Jul 30 19:26:56 2019 +0200
@@ -35,22 +35,26 @@
         self.colorSchemeComboBox.addItems(sorted(AnsiColorSchemes.keys()))
         
         # set initial values
+        self.timeoutSpinBox.setValue(
+            Preferences.getMicroPython("SerialTimeout") / 1000)
+        # converted to seconds
         self.colorSchemeComboBox.setCurrentIndex(
             self.colorSchemeComboBox.findText(
                 Preferences.getMicroPython("ColorScheme")))
-        self.timeoutSpinBox.setValue(
-            Preferences.getMicroPython("SerialTimeout") / 1000)
-        # converted to seconds
+        self.replWrapCheckBox.setChecked(
+            Preferences.getMicroPython("ReplLineWrap"))
     
     def save(self):
         """
         Public slot to save the MicroPython configuration.
         """
         Preferences.setMicroPython(
+            "SerialTimeout", self.timeoutSpinBox.value() * 1000)
+        # converted to milliseconds
+        Preferences.setMicroPython(
             "ColorScheme", self.colorSchemeComboBox.currentText())
         Preferences.setMicroPython(
-            "SerialTimeout", self.timeoutSpinBox.value() * 1000)
-        # converted to milliseconds
+            "ReplLineWrap", self.replWrapCheckBox.isChecked())
     
 
 def create(dlg):
--- a/eric6/Preferences/ConfigurationPages/MicroPythonPage.ui	Tue Jul 30 19:25:23 2019 +0200
+++ b/eric6/Preferences/ConfigurationPages/MicroPythonPage.ui	Tue Jul 30 19:26:56 2019 +0200
@@ -32,71 +32,91 @@
     </widget>
    </item>
    <item>
-    <layout class="QGridLayout" name="gridLayout">
-     <item row="0" column="0">
-      <widget class="QLabel" name="label">
-       <property name="text">
-        <string>Color Scheme for ANSI Escape Codes:</string>
-       </property>
-      </widget>
-     </item>
-     <item row="0" column="1">
-      <widget class="QComboBox" name="colorSchemeComboBox">
-       <property name="sizePolicy">
-        <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
-         <horstretch>0</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
-       </property>
-       <property name="toolTip">
-        <string>Select the color scheme to be applied for ANSI color escape codes</string>
-       </property>
-      </widget>
-     </item>
-     <item row="1" column="0">
-      <widget class="QLabel" name="label_2">
-       <property name="text">
-        <string>Timeout for Serial Link Communication:</string>
-       </property>
-      </widget>
-     </item>
-     <item row="1" column="1">
-      <layout class="QHBoxLayout" name="horizontalLayout">
-       <item>
-        <widget class="QSpinBox" name="timeoutSpinBox">
-         <property name="toolTip">
-          <string>Enter the timout value</string>
-         </property>
-         <property name="alignment">
-          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-         </property>
-         <property name="suffix">
-          <string> s</string>
-         </property>
-         <property name="minimum">
-          <number>1</number>
-         </property>
-         <property name="maximum">
-          <number>30</number>
-         </property>
-        </widget>
-       </item>
-       <item>
-        <spacer name="horizontalSpacer">
-         <property name="orientation">
-          <enum>Qt::Horizontal</enum>
-         </property>
-         <property name="sizeHint" stdset="0">
-          <size>
-           <width>108</width>
-           <height>20</height>
-          </size>
-         </property>
-        </spacer>
-       </item>
-      </layout>
-     </item>
-    </layout>
+    <widget class="QGroupBox" name="groupBox_2">
+     <property name="title">
+      <string>Serial Link</string>
+     </property>
+     <layout class="QHBoxLayout" name="horizontalLayout">
+      <item>
+       <widget class="QLabel" name="label_2">
+        <property name="text">
+         <string>Timeout for Serial Link Communication:</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QSpinBox" name="timeoutSpinBox">
+        <property name="toolTip">
+         <string>Enter the timout value</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </property>
+        <property name="suffix">
+         <string> s</string>
+        </property>
+        <property name="minimum">
+         <number>1</number>
+        </property>
+        <property name="maximum">
+         <number>30</number>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <spacer name="horizontalSpacer">
+        <property name="orientation">
+         <enum>Qt::Horizontal</enum>
+        </property>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>195</width>
+          <height>20</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <widget class="QGroupBox" name="groupBox">
+     <property name="title">
+      <string>REPL Pane</string>
+     </property>
+     <layout class="QGridLayout" name="gridLayout">
+      <item row="0" column="0">
+       <widget class="QLabel" name="label">
+        <property name="text">
+         <string>Color Scheme for ANSI Escape Codes:</string>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1">
+       <widget class="QComboBox" name="colorSchemeComboBox">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="toolTip">
+         <string>Select the color scheme to be applied for ANSI color escape codes</string>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="0" colspan="2">
+       <widget class="QCheckBox" name="replWrapCheckBox">
+        <property name="toolTip">
+         <string>Select to wrap long line in the REPL pane</string>
+        </property>
+        <property name="text">
+         <string>Wrap long lines</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
    </item>
    <item>
     <spacer name="verticalSpacer">
@@ -113,6 +133,11 @@
    </item>
   </layout>
  </widget>
+ <tabstops>
+  <tabstop>timeoutSpinBox</tabstop>
+  <tabstop>colorSchemeComboBox</tabstop>
+  <tabstop>replWrapCheckBox</tabstop>
+ </tabstops>
  <resources/>
  <connections/>
 </ui>
--- a/eric6/Preferences/__init__.py	Tue Jul 30 19:25:23 2019 +0200
+++ b/eric6/Preferences/__init__.py	Tue Jul 30 19:26:56 2019 +0200
@@ -1593,6 +1593,7 @@
     # defaults for MicroPython
     microPythonDefaults = {
         "SerialTimeout": 10000,         # timeout in milliseconds
+        "ReplLineWrap": True,           # wrap the REPL lines
     }
     if Globals.isWindowsPlatform():
         microPythonDefaults["ColorScheme"] = "Windows 10"
@@ -3826,6 +3827,10 @@
         return int(prefClass.settings.value(
             "MicroPython/" + key,
             prefClass.microPythonDefaults[key]))
+    elif key in ["ReplLineWrap"]:
+        return toBool(prefClass.settings.value(
+            "MicroPython/" + key,
+            prefClass.microPythonDefaults[key]))
     else:
         return prefClass.settings.value(
             "MicroPython/" + key,

eric ide

mercurial