Skip to content

Commit

Permalink
Merge pull request robotframework#2886 from HelioGuilherme66/misc_fixes
Browse files Browse the repository at this point in the history
Misc fixes
  • Loading branch information
HelioGuilherme66 committed Sep 16, 2024
2 parents 0c3cbf9 + c9287f4 commit 864c33d
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 25 deletions.
6 changes: 3 additions & 3 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ See the https://github.com/robotframework/RIDE/blob/master/doc/releasenotes/ride

**The current development version is based on 2.1a3, supports Python from 3.8 up to 3.12 (29th July 2024).**

Currently the unit tests are tested on Python 3.10, and 3.12 (which is the recommended version).
Likewise, the current version of wxPython, is 4.2.1, but RIDE is known to work with 4.0.7 and 4.1.1 versions.
Currently, the unit tests are tested on Python 3.10, and 3.12 (which is the recommended version).
Likewise, the current version of wxPython, is 4.2.2, but RIDE is known to work with 4.0.7 and 4.1.1 versions.

(3.6 <= python <= 3.11) Install current released version (*2.0.8.1*) with:

`pip install -U robotframework-ride`

(3.8 <= python <= 3.12) Install current development version (**2.1dev79**) with:
(3.8 <= python <= 3.12) Install current development version (**2.1dev80**) with:

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

Expand Down
4 changes: 2 additions & 2 deletions src/robotide/application/releasenotes.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def set_content(self, html_win, content):
<p><a class="reference external" href="https://github.com/robotframework/RIDE/">RIDE (Robot Framework IDE)</a>
{VERSION} is a new release with important enhancements and bug fixes. The reference for valid arguments is
<a class="reference external" href="https://robotframework.org/">Robot Framework</a> installed version, which is at this
moment 7.0.1. However, internal library code is originally based on version 3.1.2, but adapted for new versions.</p>
moment 7.1. However, internal library code is originally based on version 3.1.2, but adapted for new versions.</p>
<p></p>
<ul class="simple">
<li>This version supports Python 3.8 up to 3.12.</li>
Expand Down Expand Up @@ -188,7 +188,7 @@ def set_content(self, html_win, content):
suggestions with keys ARROW_LEFT or ARROW_RIGHT.</li>
<li>✔ - Newlines in Grid Editor can be made visible with the <b>filter newlines</b> set to False.</li>
<li>🐞 - Problems with COPY/PASTE in Text Editor have been reported when using wxPython 4.2.0, but not with
version 4.2.1, which we now <em>recommend</em>.</li>
version 4.2.1 and 4.2.2, which we now <em>recommend</em>.</li>
<li>🐞 - Some argument types detection (and colorization) is not correct in Grid Editor.</li>
<li>🐞 - RIDE <strong>DOES NOT KEEP</strong> Test Suites formatting or structure, causing differences in files when used
on other IDE or Editors.</li>
Expand Down
4 changes: 2 additions & 2 deletions src/robotide/editor/texteditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2470,9 +2470,9 @@ def set_language(self, dlanguage):
self.language = obtain_language(dlanguage, content)
except ValueError:
# wx.MessageBox(f"Error when selecting Language: {e}", 'Error')
self.language = 'En'
self.language = 'English'
else:
self.language = 'En'
self.language = 'English'
self.stylizer = RobotStylizer(self, self._settings, self.readonly, self.language)

@property
Expand Down
60 changes: 43 additions & 17 deletions src/robotide/lib/robot/parsing/robotreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def read(self, file, populator, path=None):
process = table_start = preamble = False
# print(f"DEBUG: RFLib RobotReader start Reading file language={self.language}")
for lineno, line in enumerate(Utf8Reader(file).readlines(), start=1):
if not self._separator_check:
if not self._separator_check or line.startswith('*'): # Do recheck in new table
self.check_separator(line.rstrip())
cells = self.split_row(line.rstrip())
if cells and cells[0].strip().startswith('*') and \
Expand All @@ -64,15 +64,17 @@ def read(self, file, populator, path=None):
def sharp_strip(self, line):
if self._separator_check:
row = self._space_splitter.split(line)
row = self.aggregate_empty_cells(row)
# print(f"DEBUG: RFLib RobotReader sharp_strip after cells split spaces={self._spaces} row={row[:]}")
return [c.strip() for c in row]
# return [c.strip() for c in row]
return row
row = []
start = end = no_spc = spc = 0
start = no_spc = spc = 0
for idx in range(len(line)):
if line[idx] != ' ':
no_spc += 1
end = idx
if spc > max(2, self._spaces - 1) or idx == len(line) - 1:
if spc > max(1, self._spaces - 1) or idx == len(line) - 1:
if idx == len(line) - 1:
end = None
segmt = line[start:end].strip() # Spaces cell
Expand All @@ -97,17 +99,28 @@ def sharp_strip(self, line):
cells = r.split(' ') # Use two spaces, because some settings could be lost
spc_row.extend(cells)
# spc_row.extend(self._space_splitter.split(r))
# Remove empty cells after first identation or content
content = False
for idx, r in enumerate(spc_row):
if r != '':
content = True
if r == '' and content:
spc_row.pop(idx)
spc_row = self.aggregate_empty_cells(spc_row)
# print(f"DEBUG: robotreader.py sharp_strip splitted line={spc_row[:]}[{len(''.join(spc_row))}]\n"
# f"original line={line}[{len(line)}]")
return spc_row

@staticmethod
def aggregate_empty_cells(row: list) -> list:
# Remove empty cells after first indentation or content
content = previous_empty = False
for idx, r in enumerate(row):
cell = r.strip()
if cell != '':
content = True
# previous_empty = False
row[idx] = cell
elif cell == '':
if content and previous_empty: # Keep indentation
row.pop(idx)
# content = False
previous_empty = True
return row

def split_row(self, row):
if row[:2] in self._pipe_starts:
row = row[1:-1] if row[-2:] in self._pipe_ends else row[1:]
Expand Down Expand Up @@ -143,24 +156,37 @@ def check_separator(self, line):
if line.startswith('*'): # DEBUG: we want to recheck for new sections, was: and not self._cell_section:
row = line.strip('*').strip().lower()
# print(f"DEBUG: robotreader.check_separator SECTION CHECK row={row} lang={self.language}")
# Removed from cells detection 'variable', 'variables'
if row in language.get_headers_for(self.language, ['keyword', 'keywords', 'test case',
'test cases', 'task', 'tasks', 'variable', 'variables']):
'test cases', 'task', 'tasks']):
# print(f"DEBUG: robotreader.check_separator detection of cell section row={row}")
self._cell_section = True
self._separator_check = False
if not line.startswith('*') and not line.startswith('#'):
return
if not line.startswith('#'):
if not self._separator_check and line[:2] in self._pipe_starts:
self._separator_check = True
# print(f"DEBUG: RFLib RobotReader check_separator PIPE separator")
return
if not self._cell_section:
return
idx = 0
spc = idx = nospc = 0
for idx in range(0, len(line)):
if line[idx] != ' ':
break
if 2 <= idx <= 10: # This max limit is reasonable
self._spaces = idx
nospc += 1
# if spc <= 2:
# spc = -1
#
if spc >= 2:
break
spc = 0
elif line[idx] == ' ': # and nospc > 0:
spc += 1
if nospc > 0 and spc < 2: # We need a step, not test case or kw name (nospc == 0 and spc <= 2 or )
return
spc = max(2, spc)
if 2 <= spc <= 10: # This max limit is reasonable
self._spaces = spc
self._space_splitter = re.compile(r"[ \t\xa0]{" + f"{self._spaces}" + "}|\t+")
self._separator_check = True
# print(f"DEBUG: RFLib RobotReader check_separator changed spaces={self._spaces}")
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.1dev79'
VERSION = 'v2.1dev80'

0 comments on commit 864c33d

Please sign in to comment.