Skip to content

Commit

Permalink
Fix colors of line numbers in Text Editor, add folding and tab markers
Browse files Browse the repository at this point in the history
  • Loading branch information
HelioGuilherme66 committed Feb 20, 2025
1 parent 744159e commit bfe60ad
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 47 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ and this project adheres to http://semver.org/spec/v2.0.0.html[Semantic Versioni

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

=== Changed
- Create directories when needed in New Project dialog.
Expand Down
2 changes: 1 addition & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Likewise, the current version of wxPython, is 4.2.2, but RIDE is known to work w

`pip install -U robotframework-ride`

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

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

Expand Down
4 changes: 4 additions & 0 deletions src/robotide/application/CHANGELOG.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
<!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>
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">
Added syntax colorization for the ``GROUP`` marker.
</li><li class="listitem">
Added on Text Editor, tab indentation markers and ``tab markers`` boolean setting with default ``True``.
</li><li class="listitem">
Added on Text Editor, folding margin with markers style configurable with ``fold symbols`` in settings.cfg.
</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">
Create directories when needed in New Project dialog.
</li><li class="listitem">
Expand Down
4 changes: 3 additions & 1 deletion src/robotide/application/releasenotes.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ def set_content(self, html_win, content):
</ul>
<p><strong>New Features and Fixes Highlights</strong></p>
<ul class="simple">
<li>Added on Text Editor, tab indentation markers and <b>tab markers</b> boolean setting with default <b>True</b>.</li>
<li>Added on Text Editor, folding margin with markers style configurable with <b>fold symbols</b> in settings.cfg.</li>
<li>Create directories when needed in New Project dialog.</li>
<li>Improved the recognition of BDD/Gherkin prefixes when localized in autocomplete on Grid Editor.</li>
<li>Added syntax colorization for the <em>GROUP</em> marker. Improved colorization for multiple Gherkin words, for
Expand Down Expand Up @@ -229,7 +231,7 @@ def set_content(self, html_win, content):
<pre class="literal-block">python -m robotide.postinstall -install</pre>
<p>or</p>
<pre class="literal-block">ride_postinstall.py -install</pre>
<p>RIDE {VERSION} was released on 17/February/2025.</p>
<p>RIDE {VERSION} was released on 20/February/2025.</p>
<!-- <br/>
<h3>May The Fourth Be With You!</h3>
<h3>Celebrate the bank holiday, 10th June, Day of Portugal, Portuguese Communities and Camões!!</h3>
Expand Down
8 changes: 6 additions & 2 deletions src/robotide/context/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,10 @@ def bind_keys_to_evt_menu(target, actions):
<td>CtrlCmd-2</td>
<td>Make list variable body</td>
</tr>
<tr>
<td>CtrlCmd-5</td>
<td>Make dictionary variable body</td>
</tr>
<tr>
<td>Alt-Up</td>
<td>Move row(s) up</td>
Expand Down Expand Up @@ -455,8 +459,8 @@ def bind_keys_to_evt_menu(target, actions):
<td>Delete cell(s)</td>
</tr>
<tr>
<td>CtrlCmd-5</td>
<td>Make dictionary variable body</td>
<td>CtrlCmd-Shift Click on Folding marker</td>
<td>Expands or Collapses all Folding markers</td>
</tr>
<tr>
<td>Enter</td>
Expand Down
11 changes: 5 additions & 6 deletions src/robotide/editor/pythoneditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,19 @@

class PythonSTC(stc.StyledTextCtrl):

fold_symbols = 0

def __init__(self, parent, idd, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0):
def __init__(self, parent, idd, options: dict, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0):
stc.StyledTextCtrl.__init__(self, parent, idd, pos, size, style)

# self.CmdKeyAssign(ord('B'), stc.STC_SCMOD_CTRL, stc.STC_CMD_ZOOMIN)
# self.CmdKeyAssign(ord('N'), stc.STC_SCMOD_CTRL, stc.STC_CMD_ZOOMOUT)

# self.tab_markers = options['tab markers']
self.fold_symbols = options['fold symbols']
self.SetLexer(stc.STC_LEX_PYTHON)
self.SetKeyWords(0, " ".join(keyword.kwlist))

self.SetProperty("fold", "1")
self.SetProperty("tab.timmy.whinge.level", "1")
self.SetMargins(0, 0)
self.SetMargins(2, 2)

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

self.SetCaretForeground("BLUE")
# self.SetCaretForeground("BLUE")

# register some images for use in the AutoComplete box.
# self.RegisterImage(1, Smiles.GetBitmap()) # DEBUG was images.
Expand Down
50 changes: 14 additions & 36 deletions src/robotide/editor/texteditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2398,12 +2398,15 @@ class RobotDataEditor(PythonSTC):
margin = 1

def __init__(self, parent, readonly=False, language=None, style=wx.BORDER_NONE):
PythonSTC.__init__(self, parent, -1, style=style)
# stc.StyledTextCtrl.__init__(self, parent)
self.parent = parent
self.language = language
self._plugin = parent.plugin
self._settings = parent.source_editor_parent.app.settings
self.tab_markers = self._settings[PLUGIN_NAME].get('tab markers', True)
self.fold_symbols = self._settings[PLUGIN_NAME].get('fold symbols', 2)
PythonSTC.__init__(self, parent, -1, options={'tab markers':self.tab_markers, 'fold symbols':self.fold_symbols},
style=style)
self._information_popup = None
self._old_details = None
self.readonly = readonly
Expand All @@ -2414,14 +2417,13 @@ def __init__(self, parent, readonly=False, language=None, style=wx.BORDER_NONE):
caret_colour = self._settings[PLUGIN_NAME].get('setting', 'black')
self._background = self._settings[PLUGIN_NAME].get('background', 'white')
caret_colour = self.get_visible_color(caret_colour)
self.SetCaretForeground(Colour(caret_colour))
caret_style = self._settings[PLUGIN_NAME].get('caret style', 'block')
caret_style = stc.STC_CARETSTYLE_BLOCK if caret_style.lower() == 'block' else stc.STC_CARETSTYLE_LINE
self.SetCaretStyle(caret_style)
self.SetTabWidth(parent.tab_size)
margin_background = self._settings['General'].get('secondary background', '')
margin_foreground = self._settings['General'].get('secondary foreground', '')
self.SetUpEditor(tab_size=parent.tab_size, m_bg=margin_background, m_fg=margin_foreground)
margin_background = self._settings['General'].get_without_default('secondary background')
margin_foreground = self._settings['General'].get_without_default('secondary foreground')
self.SetUpEditor(tab_size=parent.tab_size, tab_markers=self.tab_markers,
m_bg=margin_background, m_fg=margin_foreground, caret_fg=caret_colour)
self.Bind(stc.EVT_STC_STYLENEEDED, self.on_style)
self.Bind(stc.EVT_STC_ZOOM, self.on_zoom)
self.Bind(stc.EVT_STC_UPDATEUI, self.on_update_ui)
Expand Down Expand Up @@ -2705,7 +2707,7 @@ def get_visible_color(self, colour):
return Colour(colour)
return Colour('black')

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

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

# Line numbers in margin
self.StyleSetSpec(wx.stc.STC_STYLE_LINENUMBER, 'fore:#000000,back:#99A9C2')
self.StyleSetSpec(wx.stc.STC_STYLE_LINENUMBER, f'fore:{m_fg},back:{m_bg}')
# Highlighted brace
self.StyleSetSpec(wx.stc.STC_STYLE_BRACELIGHT, 'fore:#00009D,back:#FFFF00')
# Unmatched brace
self.StyleSetSpec(wx.stc.STC_STYLE_BRACEBAD, 'fore:#00009D,back:#FF0000')
# Indentation guide
self.StyleSetSpec(wx.stc.STC_STYLE_INDENTGUIDE, "fore:#CDCDCD")

# Python styles
self.StyleSetSpec(wx.stc.STC_P_DEFAULT, 'fore:#000000')
# Comments
self.StyleSetSpec(wx.stc.STC_P_COMMENTLINE, 'fore:#008000,back:#F0FFF0')
self.StyleSetSpec(wx.stc.STC_P_COMMENTBLOCK, 'fore:#008000,back:#F0FFF0')
# Numbers
self.StyleSetSpec(wx.stc.STC_P_NUMBER, 'fore:#008080')
# Strings and characters
self.StyleSetSpec(wx.stc.STC_P_STRING, 'fore:#800080')
self.StyleSetSpec(wx.stc.STC_P_CHARACTER, 'fore:#800080')
# Keywords
self.StyleSetSpec(wx.stc.STC_P_WORD, 'fore:#000080,bold')
# Triple quotes
self.StyleSetSpec(wx.stc.STC_P_TRIPLE, 'fore:#800080,back:#FFFFEA')
self.StyleSetSpec(wx.stc.STC_P_TRIPLEDOUBLE, 'fore:#800080,back:#FFFFEA')
# Class names
self.StyleSetSpec(wx.stc.STC_P_CLASSNAME, 'fore:#0000FF,bold')
# Function names
self.StyleSetSpec(wx.stc.STC_P_DEFNAME, 'fore:#008080,bold')
# Operators
self.StyleSetSpec(wx.stc.STC_P_OPERATOR, 'fore:#800000,bold')
# Identifiers. I leave this as not bold because everything seems
# to be an identifier if it doesn't match the above criterae
self.StyleSetSpec(wx.stc.STC_P_IDENTIFIER, 'fore:#000000')
if tab_markers:
self.StyleSetSpec(wx.stc.STC_STYLE_INDENTGUIDE, "fore:#CDCDCD")

# Caret color
self.SetCaretForeground("BLUE")
self.SetCaretForeground(Colour(caret_fg))
# Selection background
# self.SetSelBackground(1, '#66CCFF')
"""
Expand Down
8 changes: 8 additions & 0 deletions src/robotide/preferences/settings.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ zoom factor = 0
font face = 'Courier New'
# caret style = 'line': or caret style = 'block' (better visibility), it will use the color of 'setting' or better calculated
caret style = 'block'
# Fold symbols are as described at wxPython demo:
# 0 == Arrow pointing right for contracted folders, arrow pointing down for expanded
# 1 == Plus for contracted folders, minus for expanded
# 2 == Like a flattened tree control using circular headers and curved joins
# 3 == Like a flattened tree control using square headers
fold symbols = 2
# Show tab indentation markers
tab markers = True
argument = '#bb8844'
comment = '#613583'
error = '#F66151'
Expand Down
2 changes: 1 addition & 1 deletion src/robotide/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
#
# Automatically generated by `tasks.py`.

VERSION = 'v2.2dev8'
VERSION = 'v2.2dev9'

0 comments on commit bfe60ad

Please sign in to comment.