4
4
import re
5
5
import serial
6
6
import serial .tools .list_ports
7
+ from io import StringIO
7
8
8
9
import threading
9
10
import queue
@@ -26,7 +27,7 @@ def escape_ansi(line):
26
27
QDialog ,
27
28
QFileDialog ,
28
29
QSplitter ,
29
- QTextEdit ,
30
+ QPlainTextEdit ,
30
31
QVBoxLayout ,
31
32
)
32
33
@@ -36,7 +37,6 @@ def escape_ansi(line):
36
37
import csv
37
38
from tabs import Tabs
38
39
39
-
40
40
class MainWindow (QMainWindow ):
41
41
42
42
from menubar import (
@@ -108,7 +108,7 @@ def __init_font__(self):
108
108
109
109
def __get_editor_stylesheet__ (self ):
110
110
return """
111
- QTextEdit {
111
+ QPlainTextEdit {
112
112
background: rgb(27,27,28); border-color: gray; color: rgb(255, 255, 255);
113
113
}
114
114
QScrollBar {
@@ -129,7 +129,7 @@ def __get_editor_stylesheet__(self):
129
129
def __init_ui__ (self ):
130
130
QApplication .setStyle (QStyleFactory .create ("Cleanlooks" ))
131
131
self .__init_font__ ()
132
- self .log_editor = QTextEdit ()
132
+ self .log_editor = QPlainTextEdit ()
133
133
self .log_editor .setFont (self .font )
134
134
self .log_editor .setStyleSheet (self .__get_editor_stylesheet__ ())
135
135
@@ -158,7 +158,7 @@ def __init_ui__(self):
158
158
159
159
self .setStyleSheet ("QMainWindow { background-color: rgb(27,27,28); }" )
160
160
161
- self .output_editor = QTextEdit ()
161
+ self .output_editor = QPlainTextEdit ()
162
162
self .output_editor .setFont (self .font )
163
163
self .output_editor .setStyleSheet (self .__get_editor_stylesheet__ ())
164
164
@@ -399,9 +399,10 @@ def __open_raw__(self):
399
399
self .plot_tab .setToolTip (path )
400
400
401
401
with open (path , "r" ) as csvfile :
402
- self .output (csvfile .read ())
403
- csvfile .seek (0 , 0 ) # go back to the beginning
404
- reader = csv .reader (csvfile )
402
+ filedata = csvfile .read ()
403
+ filedata = escape_ansi (filedata )
404
+ self .output (filedata )
405
+ reader = csv .reader (StringIO (filedata ))
405
406
406
407
# Clear existing plot and set new header
407
408
self .__clear_plot__ ()
0 commit comments