Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add color to links in Console Log of Test Runner, since 7.1rc #2866

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to http://semver.org/spec/v2.0.0.html[Semantic Versioni

=== Added

- Added color to Test Runner Console Log final output, report and log since RF v7.1rc1.
- Added Korean language support for UI, experimental.
- Added option ``caret style`` to change insert caret to `block` or `line` in Text Editor, by editing ``settings.cfg``.
The color of the caret is the same as `setting` and will be adjusted for better contrast with the background.
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.1, but RIDE is known to work w

`pip install -U robotframework-ride`

(3.8 <= python <= 3.12) Install current development version (**2.1dev72**) with:
(3.8 <= python <= 3.12) Install current development version (**2.1dev73**) with:

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

Expand Down
2 changes: 2 additions & 0 deletions src/robotide/application/CHANGELOG.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!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 color to Test Runner Console Log final output, report and log since RF v7.1rc1.
</li><li class="listitem">
Added Korean language support for UI, experimental.
</li><li class="listitem">
Added option ``caret style`` to change insert caret to <code class="literal">block</code> or <code class="literal">line</code> in Text Editor, by editing ``settings.cfg``.
Expand Down
3 changes: 2 additions & 1 deletion src/robotide/application/releasenotes.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ def set_content(self, html_win, content):
</ul>
<p><strong>New Features and Fixes Highlights</strong></p>
<ul class="simple">
<li>Added color to Test Runner Console Log final output, report and log since RF v7.1rc1.</li>
<li>Fixed on Text Editor when Saving the selection of tests to run in Test Suites (Tree) is cleared.</li>
<li>Added Korean language support for UI, experimental.</li>
<li>Fixed wrong item selection, like Test Suite, when doing right-click actions in Project Explorer.</li>
Expand Down Expand Up @@ -326,7 +327,7 @@ def set_content(self, html_win, content):
<pre class="literal-block">
python -m robotide.postinstall -install
</pre>
<p>RIDE {VERSION} was released on 31/August/2024.</p>
<p>RIDE {VERSION} was released on 03/September/2024.</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
29 changes: 24 additions & 5 deletions src/robotide/contrib/testrunner/testrunnerplugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
STYLE_PASS = 1
STYLE_SKIP = 3
STYLE_FAIL = 4
STYLE_LINK = 5
FILE_MANAGER = 'file manager'

ATEXIT_LOCK = threading.RLock()
Expand Down Expand Up @@ -634,6 +635,8 @@ def _append_text(self, text_ctrl, text, source="stdout"):
style = STYLE_PASS
elif item[1] == 'YELLOW':
style = STYLE_SKIP
elif item[1] == 'BLUE':
style = STYLE_LINK
elif item[1] is None:
style = STYLE_DEFAULT
if style:
Expand All @@ -660,7 +663,9 @@ def parse_colors(self, txt):
# print(f"{str(txt[idx])}")
if txt[idx] == 27: # .startswith('\033[32m'):
color = False
# print(f"DEBUG: parse_colors got ESC, {txt[idx+1:idx+5]}")
if txt[idx + 1:idx+5] == b']8;;' and txt[idx+6] != 27: # New file:// URI in RF 7.1, Start
color = True
self.store_color(idx, 'BLUE')
if txt[idx + 1:idx+5] == b'[34m':
color = True
self.store_color(idx, 'BLUE')
Expand All @@ -681,6 +686,12 @@ def parse_colors(self, txt):
# print(f"DEBUG: parse_colors reset to NORMAL")
self.store_color(idx, None)
txt = txt[:idx] + txt[idx+4:]
elif txt[idx + 1] == 92:
self.store_color(idx, None)
txt = txt[:idx] + txt[idx+2:]
elif txt[idx + 1:idx + 7] == b']8;;\x1b\\': # New file:// URI in RF 7.1, End
self.store_color(idx, None)
txt = txt[:idx] + txt[idx + 7:]
elif color:
txt = txt[:idx] + txt[idx+5:]
if idx >= len(txt):
Expand Down Expand Up @@ -1127,7 +1138,7 @@ def __init__(self, parent, fail_color='#FF8E8E', pass_color="#9FCC9F", skip_colo
self._gauge = wx.Gauge(self, size=(100, 15), style=wx.GA_HORIZONTAL)
self._label = Label(self)
self._sizer.Add(self._label, 1, wx.EXPAND | wx.LEFT, 10)
self._sizer.Add(self._gauge, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 15)
self._sizer.Add(self._gauge, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 20)
self._sizer.Layout()
self.SetSizer(self._sizer)
self._gauge.Hide()
Expand Down Expand Up @@ -1305,6 +1316,7 @@ def _set_styles(self):
self.fail_color = self.settings.get('fail color', '#FF8E8E')
self.pass_color = self.settings.get('pass color', '#9FCC9F')
self.skip_color = self.settings.get('skip color', 'yellow')
self.link_color = self.settings.get('link color', '#1E1EFF')

default_style = self._get_style_string(
fore=self.settings.get('foreground', 'black'), back=background,
Expand All @@ -1315,20 +1327,27 @@ def _set_styles(self):
fail_style = self._get_style_string(fore=self.fail_color, back=background, size=font_size, face=font_face)
pass_style = self._get_style_string(fore=self.pass_color, back=background, size=font_size, face=font_face)
skip_style = self._get_style_string(fore=self.skip_color, back=background, size=font_size, face=font_face)
link_style = self._get_style_string(fore=self.link_color, back=background, size=font_size, face=font_face,
bold='bold')

self.editor.StyleSetSpec(STYLE_DEFAULT, default_style)
self.editor.StyleSetSpec(STYLE_STDERR, error_style)
self.editor.StyleSetSpec(STYLE_FAIL, fail_style)
self.editor.StyleSetSpec(STYLE_PASS, pass_style)
self.editor.StyleSetSpec(STYLE_SKIP, skip_style)
self.editor.StyleSetSpec(STYLE_LINK, link_style)
self.editor.StyleSetSpec(7, error_style)
self.editor.StyleSetBackground(wx.stc.STC_STYLE_DEFAULT, background)
self.editor.Refresh()

@staticmethod
def _get_style_string(back, fore, size, face):
return ','.join('%s:%s' % (name, value)
for name, value in locals().items() if value)
def _get_style_string(back, fore, size, face, bold=None):
# print(f"DEBUG: testrunnerplugin.py get_style_string locals={locals().items()}")
style = ','.join('%s:%s' % (name, value)
for name, value in locals().items() if value and name!='bold')
if bold is not None:
style += ',bold'
return style

def _ensure_default_font_is_valid(self):
"""Checks if default font is installed"""
Expand Down
2 changes: 1 addition & 1 deletion src/robotide/lib/robot/parsing/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,5 +477,5 @@ def _populate(self, item_class, data, comment):

class MetadataList(_DataList):

def populate(self, name, value, comment):
def populate(self, name, value, comment=''):
self._add(Metadata(self._parent, name, value, comment, joined=True))
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.1dev72'
VERSION = 'v2.1dev73'
1 change: 1 addition & 0 deletions utest/resources/robotdata/language/en/full_test_en.robot
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ ${myvar} 123 # This is a comment
*** Comments ***
This is a comments block
Second line of comments
# Comment inside second comments block

*** Test Cases ***
first test
Expand Down
2 changes: 1 addition & 1 deletion utest/resources/robotdata/language/pt/full_task_pt.robot
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Documentação This is the documentation
... A continued line of documentation
Inicialização de Suíte No Operation
Finalização de Suíte No Operation
Metadados Nome Value
Metadados Nome Value # A comment
Biblioteca Process
Recurso full_pt.resource
Variável full_pt.yaml
Expand Down
12 changes: 4 additions & 8 deletions utest/resources/robotdata/language/pt/full_test_pt.robot
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,18 @@ Biblioteca Process
Recurso full_pt.resource
Variável full_pt.yaml
Variável full_pt.json
Variável full_pt.py
# Comment inside settings block, next is empty line followed by documention
Variável full_pt.py # Comment inside settings block, next is empty line followed by documention

Documentação This is the documentation
... A continued line of documentation

Metadados Nome Value
# Comment inside settings block after metadata, next is empty line followed by suite setup
Metadados Nome Value # Comment inside settings block after metadata, next is empty line followed by suite setup

Inicialização de Suíte No Operation
Finalização de Suíte No Operation
# Comment inside settings block after suite teardown, next is empty line followed by variables section
Finalização de Suíte No Operation # Comment inside settings block after suite teardown, next is empty line followed by variables section

*** Variáveis ***
${myvar} 123
# Comment inside variables, next is empty line followed by a comments section
${myvar} 123 # Comment inside variables, next is empty line followed by a comments section

*** Comentários ***
This is a comments block
Expand Down
24 changes: 24 additions & 0 deletions utest/resources/robotdata/testsuite/resuja/resource.resource
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
*** Settings ***
Resource resource.robot

*** Variables ***
${RESOURCE var} Foo

*** Keywords ***
Resource UK
[Documentation] This is a user keyword from resource file
[Timeout]
No Operation

Parametrized UK
[Arguments] ${arg} ${defarg}=def val @{vararg}
[Timeout]
Log Many ${arg} ${defarg} @{vararg}

Funny Def Value
[Arguments] ${arg}=${None} ${urg}=${myvar=foo}
[Timeout]
Log Many ${arg} ${urg}

Duplicate UK
No Operation
Loading