Skip to content

Commit bfe60ad

Browse files
Fix colors of line numbers in Text Editor, add folding and tab markers
1 parent 744159e commit bfe60ad

File tree

9 files changed

+44
-47
lines changed

9 files changed

+44
-47
lines changed

CHANGELOG.adoc

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ and this project adheres to http://semver.org/spec/v2.0.0.html[Semantic Versioni
1010

1111
=== Added
1212
- Added syntax colorization for the ``GROUP`` marker.
13+
- Added on Text Editor, tab indentation markers and ``tab markers`` boolean setting with default ``True``.
14+
- Added on Text Editor, folding margin with markers style configurable with ``fold symbols`` in settings.cfg.
1315

1416
=== Changed
1517
- Create directories when needed in New Project dialog.

README.adoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Likewise, the current version of wxPython, is 4.2.2, but RIDE is known to work w
4040

4141
`pip install -U robotframework-ride`
4242

43-
(3.8 <= python <= 3.13) Install current development version (**2.2dev8**) with:
43+
(3.8 <= python <= 3.13) Install current development version (**2.2dev9**) with:
4444

4545
`pip install -U https://github.com/robotframework/RIDE/archive/develop.zip`
4646

src/robotide/application/CHANGELOG.html

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Changelog</title><link rel="stylesheet" type="text/css" href="docbook-xsl.css" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /></head><body><div xml:lang="en" class="article" lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="id1337"></a>Changelog</h2></div></div><hr /></div><p>All notable changes to this project will be documented in this file.</p><p>The format is based on <a class="ulink" href="http://keepachangelog.com/en/1.0.0/" target="_top">Keep a Changelog</a>
33
and this project adheres to <a class="ulink" href="http://semver.org/spec/v2.0.0.html" target="_top">Semantic Versioning</a>.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_ulink_url_https_github_com_robotframework_ride_unreleased_ulink"></a>1. <a class="ulink" href="https://github.com/robotframework/RIDE" target="_top">Unreleased</a></h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_added"></a>1.1. Added</h3></div></div></div><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
44
Added syntax colorization for the ``GROUP`` marker.
5+
</li><li class="listitem">
6+
Added on Text Editor, tab indentation markers and ``tab markers`` boolean setting with default ``True``.
7+
</li><li class="listitem">
8+
Added on Text Editor, folding margin with markers style configurable with ``fold symbols`` in settings.cfg.
59
</li></ul></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_changed"></a>1.2. Changed</h3></div></div></div><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
610
Create directories when needed in New Project dialog.
711
</li><li class="listitem">

src/robotide/application/releasenotes.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@ def set_content(self, html_win, content):
168168
</ul>
169169
<p><strong>New Features and Fixes Highlights</strong></p>
170170
<ul class="simple">
171+
<li>Added on Text Editor, tab indentation markers and <b>tab markers</b> boolean setting with default <b>True</b>.</li>
172+
<li>Added on Text Editor, folding margin with markers style configurable with <b>fold symbols</b> in settings.cfg.</li>
171173
<li>Create directories when needed in New Project dialog.</li>
172174
<li>Improved the recognition of BDD/Gherkin prefixes when localized in autocomplete on Grid Editor.</li>
173175
<li>Added syntax colorization for the <em>GROUP</em> marker. Improved colorization for multiple Gherkin words, for
@@ -229,7 +231,7 @@ def set_content(self, html_win, content):
229231
<pre class="literal-block">python -m robotide.postinstall -install</pre>
230232
<p>or</p>
231233
<pre class="literal-block">ride_postinstall.py -install</pre>
232-
<p>RIDE {VERSION} was released on 17/February/2025.</p>
234+
<p>RIDE {VERSION} was released on 20/February/2025.</p>
233235
<!-- <br/>
234236
<h3>May The Fourth Be With You!</h3>
235237
<h3>Celebrate the bank holiday, 10th June, Day of Portugal, Portuguese Communities and Camões!!</h3>

src/robotide/context/__init__.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,10 @@ def bind_keys_to_evt_menu(target, actions):
414414
<td>CtrlCmd-2</td>
415415
<td>Make list variable body</td>
416416
</tr>
417+
<tr>
418+
<td>CtrlCmd-5</td>
419+
<td>Make dictionary variable body</td>
420+
</tr>
417421
<tr>
418422
<td>Alt-Up</td>
419423
<td>Move row(s) up</td>
@@ -455,8 +459,8 @@ def bind_keys_to_evt_menu(target, actions):
455459
<td>Delete cell(s)</td>
456460
</tr>
457461
<tr>
458-
<td>CtrlCmd-5</td>
459-
<td>Make dictionary variable body</td>
462+
<td>CtrlCmd-Shift Click on Folding marker</td>
463+
<td>Expands or Collapses all Folding markers</td>
460464
</tr>
461465
<tr>
462466
<td>Enter</td>

src/robotide/editor/pythoneditor.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,19 @@
4545

4646
class PythonSTC(stc.StyledTextCtrl):
4747

48-
fold_symbols = 0
49-
50-
def __init__(self, parent, idd, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0):
48+
def __init__(self, parent, idd, options: dict, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0):
5149
stc.StyledTextCtrl.__init__(self, parent, idd, pos, size, style)
5250

5351
# self.CmdKeyAssign(ord('B'), stc.STC_SCMOD_CTRL, stc.STC_CMD_ZOOMIN)
5452
# self.CmdKeyAssign(ord('N'), stc.STC_SCMOD_CTRL, stc.STC_CMD_ZOOMOUT)
55-
53+
# self.tab_markers = options['tab markers']
54+
self.fold_symbols = options['fold symbols']
5655
self.SetLexer(stc.STC_LEX_PYTHON)
5756
self.SetKeyWords(0, " ".join(keyword.kwlist))
5857

5958
self.SetProperty("fold", "1")
6059
self.SetProperty("tab.timmy.whinge.level", "1")
61-
self.SetMargins(0, 0)
60+
self.SetMargins(2, 2)
6261

6362
self.SetViewWhiteSpace(False)
6463
self.SetEdgeMode(stc.STC_EDGE_BACKGROUND)
@@ -162,7 +161,7 @@ def __init__(self, parent, idd, pos=wx.DefaultPosition, size=wx.DefaultSize, sty
162161
# End of line where string is not closed
163162
self.StyleSetSpec(stc.STC_P_STRINGEOL, "fore:#000000,face:%(mono)s,back:#E0C0E0,eol,size:%(size)d" % faces)
164163

165-
self.SetCaretForeground("BLUE")
164+
# self.SetCaretForeground("BLUE")
166165

167166
# register some images for use in the AutoComplete box.
168167
# self.RegisterImage(1, Smiles.GetBitmap()) # DEBUG was images.

src/robotide/editor/texteditor.py

+14-36
Original file line numberDiff line numberDiff line change
@@ -2398,12 +2398,15 @@ class RobotDataEditor(PythonSTC):
23982398
margin = 1
23992399

24002400
def __init__(self, parent, readonly=False, language=None, style=wx.BORDER_NONE):
2401-
PythonSTC.__init__(self, parent, -1, style=style)
24022401
# stc.StyledTextCtrl.__init__(self, parent)
24032402
self.parent = parent
24042403
self.language = language
24052404
self._plugin = parent.plugin
24062405
self._settings = parent.source_editor_parent.app.settings
2406+
self.tab_markers = self._settings[PLUGIN_NAME].get('tab markers', True)
2407+
self.fold_symbols = self._settings[PLUGIN_NAME].get('fold symbols', 2)
2408+
PythonSTC.__init__(self, parent, -1, options={'tab markers':self.tab_markers, 'fold symbols':self.fold_symbols},
2409+
style=style)
24072410
self._information_popup = None
24082411
self._old_details = None
24092412
self.readonly = readonly
@@ -2414,14 +2417,13 @@ def __init__(self, parent, readonly=False, language=None, style=wx.BORDER_NONE):
24142417
caret_colour = self._settings[PLUGIN_NAME].get('setting', 'black')
24152418
self._background = self._settings[PLUGIN_NAME].get('background', 'white')
24162419
caret_colour = self.get_visible_color(caret_colour)
2417-
self.SetCaretForeground(Colour(caret_colour))
24182420
caret_style = self._settings[PLUGIN_NAME].get('caret style', 'block')
24192421
caret_style = stc.STC_CARETSTYLE_BLOCK if caret_style.lower() == 'block' else stc.STC_CARETSTYLE_LINE
24202422
self.SetCaretStyle(caret_style)
2421-
self.SetTabWidth(parent.tab_size)
2422-
margin_background = self._settings['General'].get('secondary background', '')
2423-
margin_foreground = self._settings['General'].get('secondary foreground', '')
2424-
self.SetUpEditor(tab_size=parent.tab_size, m_bg=margin_background, m_fg=margin_foreground)
2423+
margin_background = self._settings['General'].get_without_default('secondary background')
2424+
margin_foreground = self._settings['General'].get_without_default('secondary foreground')
2425+
self.SetUpEditor(tab_size=parent.tab_size, tab_markers=self.tab_markers,
2426+
m_bg=margin_background, m_fg=margin_foreground, caret_fg=caret_colour)
24252427
self.Bind(stc.EVT_STC_STYLENEEDED, self.on_style)
24262428
self.Bind(stc.EVT_STC_ZOOM, self.on_zoom)
24272429
self.Bind(stc.EVT_STC_UPDATEUI, self.on_update_ui)
@@ -2705,7 +2707,7 @@ def get_visible_color(self, colour):
27052707
return Colour(colour)
27062708
return Colour('black')
27072709

2708-
def SetUpEditor(self, tab_size=4, m_bg='', m_fg=''):
2710+
def SetUpEditor(self, tab_size=4, tab_markers=True, m_bg='', m_fg='', caret_fg: Colour = 'BLUE'):
27092711
"""
27102712
This method carries out the work of setting up the Code editor.
27112713
It's seperate so as not to clutter up the init code.
@@ -2732,7 +2734,7 @@ def SetUpEditor(self, tab_size=4, m_bg='', m_fg=''):
27322734

27332735
# Indentation and tab stuff
27342736
self.SetIndent(tab_size) # Proscribed indent size for wx
2735-
self.SetIndentationGuides(True) # Show indent guides
2737+
self.SetIndentationGuides(tab_markers) # Show indent guides
27362738
self.SetBackSpaceUnIndents(True) # Backspace unindents rather than delete 1 space
27372739
self.SetTabIndents(True) # Tab key indents
27382740
self.SetTabWidth(tab_size) # Proscribed tab size for wx
@@ -2782,41 +2784,17 @@ def SetUpEditor(self, tab_size=4, m_bg='', m_fg=''):
27822784
# The rest remains unchanged.
27832785

27842786
# Line numbers in margin
2785-
self.StyleSetSpec(wx.stc.STC_STYLE_LINENUMBER, 'fore:#000000,back:#99A9C2')
2787+
self.StyleSetSpec(wx.stc.STC_STYLE_LINENUMBER, f'fore:{m_fg},back:{m_bg}')
27862788
# Highlighted brace
27872789
self.StyleSetSpec(wx.stc.STC_STYLE_BRACELIGHT, 'fore:#00009D,back:#FFFF00')
27882790
# Unmatched brace
27892791
self.StyleSetSpec(wx.stc.STC_STYLE_BRACEBAD, 'fore:#00009D,back:#FF0000')
27902792
# Indentation guide
2791-
self.StyleSetSpec(wx.stc.STC_STYLE_INDENTGUIDE, "fore:#CDCDCD")
2792-
2793-
# Python styles
2794-
self.StyleSetSpec(wx.stc.STC_P_DEFAULT, 'fore:#000000')
2795-
# Comments
2796-
self.StyleSetSpec(wx.stc.STC_P_COMMENTLINE, 'fore:#008000,back:#F0FFF0')
2797-
self.StyleSetSpec(wx.stc.STC_P_COMMENTBLOCK, 'fore:#008000,back:#F0FFF0')
2798-
# Numbers
2799-
self.StyleSetSpec(wx.stc.STC_P_NUMBER, 'fore:#008080')
2800-
# Strings and characters
2801-
self.StyleSetSpec(wx.stc.STC_P_STRING, 'fore:#800080')
2802-
self.StyleSetSpec(wx.stc.STC_P_CHARACTER, 'fore:#800080')
2803-
# Keywords
2804-
self.StyleSetSpec(wx.stc.STC_P_WORD, 'fore:#000080,bold')
2805-
# Triple quotes
2806-
self.StyleSetSpec(wx.stc.STC_P_TRIPLE, 'fore:#800080,back:#FFFFEA')
2807-
self.StyleSetSpec(wx.stc.STC_P_TRIPLEDOUBLE, 'fore:#800080,back:#FFFFEA')
2808-
# Class names
2809-
self.StyleSetSpec(wx.stc.STC_P_CLASSNAME, 'fore:#0000FF,bold')
2810-
# Function names
2811-
self.StyleSetSpec(wx.stc.STC_P_DEFNAME, 'fore:#008080,bold')
2812-
# Operators
2813-
self.StyleSetSpec(wx.stc.STC_P_OPERATOR, 'fore:#800000,bold')
2814-
# Identifiers. I leave this as not bold because everything seems
2815-
# to be an identifier if it doesn't match the above criterae
2816-
self.StyleSetSpec(wx.stc.STC_P_IDENTIFIER, 'fore:#000000')
2793+
if tab_markers:
2794+
self.StyleSetSpec(wx.stc.STC_STYLE_INDENTGUIDE, "fore:#CDCDCD")
28172795

28182796
# Caret color
2819-
self.SetCaretForeground("BLUE")
2797+
self.SetCaretForeground(Colour(caret_fg))
28202798
# Selection background
28212799
# self.SetSelBackground(1, '#66CCFF')
28222800
"""

src/robotide/preferences/settings.cfg

+8
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ zoom factor = 0
4949
font face = 'Courier New'
5050
# caret style = 'line': or caret style = 'block' (better visibility), it will use the color of 'setting' or better calculated
5151
caret style = 'block'
52+
# Fold symbols are as described at wxPython demo:
53+
# 0 == Arrow pointing right for contracted folders, arrow pointing down for expanded
54+
# 1 == Plus for contracted folders, minus for expanded
55+
# 2 == Like a flattened tree control using circular headers and curved joins
56+
# 3 == Like a flattened tree control using square headers
57+
fold symbols = 2
58+
# Show tab indentation markers
59+
tab markers = True
5260
argument = '#bb8844'
5361
comment = '#613583'
5462
error = '#F66151'

src/robotide/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
#
1616
# Automatically generated by `tasks.py`.
1717

18-
VERSION = 'v2.2dev8'
18+
VERSION = 'v2.2dev9'

0 commit comments

Comments
 (0)