|
40 | 40 | class SourceCodeEditor(PythonSTC): |
41 | 41 | def __init__(self, parent, options, style=wx.BORDER_NONE): |
42 | 42 | PythonSTC.__init__(self, parent, -1, options, style=style) |
43 | | - self.SetUpEditor() |
| 43 | + self.SetUpEditor(options) |
44 | 44 |
|
45 | 45 | # Some methods to make it compatible with how the wxTextCtrl is used |
46 | 46 | def SetValue(self, value): |
@@ -90,7 +90,7 @@ def SelectLine(self, line): |
90 | 90 | end = self.GetLineEndPosition(line) |
91 | 91 | self.SetSelection(start, end) |
92 | 92 |
|
93 | | - def SetUpEditor(self): |
| 93 | + def SetUpEditor(self, eoptions: dict): |
94 | 94 | """ |
95 | 95 | This method carries out the work of setting up the Code editor. |
96 | 96 | It's seperate so as not to clutter up the init code. |
@@ -122,13 +122,13 @@ def SetUpEditor(self): |
122 | 122 | self.SetTabWidth(4) # Proscribed tab size for wx |
123 | 123 | self.SetUseTabs(False) # Use spaces rather than tabs, or TabTimmy will complain! |
124 | 124 | # White space |
125 | | - self.SetViewWhiteSpace(False) # Don't view white space |
| 125 | + self.SetViewWhiteSpace(eoptions['visible spaces']) # Don't view white space |
126 | 126 |
|
127 | 127 | # EOL: Since we are loading/saving ourselves, and the |
128 | 128 | # strings will always have \n's in them, set the STC to |
129 | 129 | # edit them that way. |
130 | 130 | self.SetEOLMode(wx.stc.STC_EOL_LF) |
131 | | - self.SetViewEOL(False) |
| 131 | + self.SetViewEOL(eoptions['visible EOL']) |
132 | 132 |
|
133 | 133 | # No right-edge mode indicator |
134 | 134 | self.SetEdgeMode(stc.STC_EDGE_NONE) |
@@ -232,7 +232,8 @@ def __init__(self, parent, main_frame, filepath=None): |
232 | 232 | self.parent = parent |
233 | 233 | wx.Panel.__init__(self, parent, size=wx.Size(1, 1)) |
234 | 234 | self.mainFrame = main_frame |
235 | | - self.editor = SourceCodeEditor(self, options={'tab markers':True, 'fold symbols':2}) |
| 235 | + self.editor = SourceCodeEditor(self, options={'tab markers':True, 'fold symbols':2, |
| 236 | + 'visible spaces':True, 'visible EOL':False}) |
236 | 237 | self.editor.RegisterModifiedEvent(self.on_code_modified) |
237 | 238 | parent.SetName(f'Code Editor: {filepath}') |
238 | 239 | """ |
|
0 commit comments