Skip to content

Commit

Permalink
Merge pull request #2862 from HelioGuilherme66/change_doc_language
Browse files Browse the repository at this point in the history
Change doc language
  • Loading branch information
HelioGuilherme66 authored Aug 30, 2024
2 parents 963ca0e + 56c4ec5 commit 4123606
Show file tree
Hide file tree
Showing 42 changed files with 3,567 additions and 199 deletions.
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.1dev70**) with:
(3.8 <= python <= 3.12) Install current development version (**2.1dev71**) with:

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

Expand Down
2 changes: 1 addition & 1 deletion src/robotide/application/releasenotes.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ def set_content(self, html_win, content):
<pre class="literal-block">
python -m robotide.postinstall -install
</pre>
<p>RIDE {VERSION} was released on 16/August/2024.</p>
<p>RIDE {VERSION} was released on 30/August/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
281 changes: 265 additions & 16 deletions src/robotide/editor/texteditor.py

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/robotide/lib/compat/parsing/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ class ErrorReporter(ModelVisitor):

def generic_visit(self, node):
if node.errors:
# print(f"DEBUG: validator.py ErrorReporter: Error on line {node.lineno}:")
print(f"DEBUG: validator.py ErrorReporter: Error on line {node.lineno}:")
for error in node.errors:
# print(f"- {error}")
print(f"- {error}")
raise DataError(message=error,details=node.lineno)
ModelVisitor.generic_visit(self, node)
7 changes: 5 additions & 2 deletions src/robotide/lib/robot/parsing/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ def _report_status(self):
LOGGER.warn("Imported resource file '%s' is empty." % self.source)

def _table_is_allowed(self, table):
if table is self.testcase_table:
if table is self.testcase_table and self.source.endswith('resource'): # Let's allow .robot files to have tests
raise DataError("Resource file '%s' cannot contain tests or "
"tasks." % self.source)
return True
Expand Down Expand Up @@ -536,8 +536,10 @@ class _WithSettings(object):
current_setter = None

def get_setter(self, name):
# print(f"DEBUG: model.py _WithSettings get_setter ENTER name={name} current_setter={self.current_setter}")
if name.startswith('#') or name.startswith('...'):
if self.current_setter is not None:
# print(f"DEBUG: model.py _WithSettings get_setter name={name} RETURNING on # or ... current_setter={self.current_setter}")
return self.current_setter
elif name.endswith(':'):
name = name[:-1]
Expand Down Expand Up @@ -697,6 +699,7 @@ def __init__(self, parent, tasks, language=None):
'Task Timeout' if self.tasks else 'Test Timeout', 'Library',
"""
_SettingTable.__init__(self, parent, tasks)
# print(f"DEBUG: model.py TestCaseFileSettings INIT ENTER language={language} aliases={self._aliases}")

def __iter__(self):
for setting in [self.doc, self.suite_setup, self.suite_teardown,
Expand Down Expand Up @@ -988,7 +991,7 @@ class TestCase(_WithSteps, _WithSettings):
def __init__(self, parent, name, language=None):
self.parent = parent
self.name = name
self.language = language
self.language = language or self.parent.language
# print(f"DEBUG: model.py TestCase INIT language={self.language}")
if self.language:
self._aliases = lang.get_settings_for(language, ['Arguments', 'Documentation', 'Template',
Expand Down
23 changes: 19 additions & 4 deletions src/robotide/lib/robot/parsing/tablepopulators.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def _get_populator(self, row):
if not setter:
return NullPopulator()
if isinstance(setter.__self__, Documentation):
# print(f"DEBUG: tablepopulators.py SettingTablePopulator RETURN DocumentationPopulator {setter}")
return DocumentationPopulator(setter)
if isinstance(setter.__self__, MetadataList):
return MetadataPopulator(setter)
Expand Down Expand Up @@ -214,6 +215,8 @@ def _populating_for_loop(self):
return isinstance(self._populator, ForLoopPopulator)

def _continues(self, row):
# print(f"DEBUG: tablepopulators.py _TestCaseUserKeywordPopulator ENTER _continues {row.is_continuing()}
# populator={self._populator}\n")
return row.is_continuing() and self._populator is not None
# or (self._populating_for_loop() and row.is_indented()))

Expand All @@ -231,13 +234,20 @@ def _get_populator(self, row):
is_setting = row.starts_test_or_user_keyword_setting()
localized_doc = self._test_or_uk.get_localized_setting_name('[Documentation]')
self.row_continue = row.head == '...'
# print(f"DEBUG: tablepopulators.py TestCaseUserKwPopulator _get_populator head={row.head} "
# f"localized_doc={localized_doc} ROW CONTINUE={self.row_continue}")
if is_setting:
self._documentation_setting = row.head == localized_doc
# print(f"DEBUG: tablepopulators.py TestCaseUserKwPopulator head={row.head} localized_doc={localized_doc}")
self._documentation_setting = (row.head == localized_doc or row.head == 'Documentation')
# print(f"DEBUG: tablepopulators.py TestCaseUserKwPopulator head={row.head} localized_doc={localized_doc}"
# f" self._documentation_setting={self._documentation_setting}")
setter = self._setting_setter(row)
if setter and self._documentation_setting:
self._fixture_setting = False
self.current_populator = DocumentationPopulator(setter)
# print(f"DEBUG: tablepopulators.py TestCaseUserKwPopulator head={row.head}"
# f"localized_doc={localized_doc}"
# f" self._documentation_setting={self._documentation_setting}"
# f" current_populator={self.current_populator}")
return self.current_populator
if not setter:
self._documentation_setting = self._fixture_setting = False
Expand Down Expand Up @@ -288,8 +298,9 @@ def __init__(self, setter):
self.row_continue = False

def add(self, row):
if isinstance(self, VariablePopulator):
if isinstance(self, VariablePopulator): # or isinstance(self, DocumentationPopulator):
if row.head == '...':
# print(f"DEBUG: tablepopulators.py _PropertyPopulator add CONTIUNE {row.head=}")
self.row_continue = True
else:
self.row_continue = False
Expand Down Expand Up @@ -359,9 +370,13 @@ def populate(self):
self._setter(self._value, self._comments.value)

def _add(self, row):
# print(f"DEBUG: tablepopulators.py DocumentationPopulator _add ENTER {row.data=}")
if row.cells[0] == '...':
row.cells[0] = '\\n'
self._value.append(''.join(row.data))
self._value.extend(row.cells)
# self._value.append(''.join(row.data))
# self._value.extend(row.data)
# print(f"DEBUG: tablepopulators.py DocumentationPopulator CURRENT VALUE {self._value=}")
else:
self._add_to_value(row.dedent().data)

Expand Down
17 changes: 12 additions & 5 deletions src/robotide/lib/robot/writer/formatters.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

import re

from multiprocessing import shared_memory
from robotide.lib.compat.parsing.language import get_headers_for
from .aligners import FirstColumnAligner, ColumnAligner, NullAligner
from .dataextractor import DataExtractor
from .rowsplitter import RowSplitter
Expand All @@ -26,9 +28,17 @@ class _DataFileFormatter(object):
language = None

def __init__(self, column_count, split_multiline_doc=True, language=None):
if language:
self.language = language
try:
if not language:
set_lang = shared_memory.ShareableList(name="language")
self.language = [set_lang[0]]
else:
self.language = language
except AttributeError:
self.language = ['en']
self._split_multiline_doc = split_multiline_doc
# print(f"DEBUG: formatters.py _DataFileFormatter INIT call _splitter {self._split_multiline_doc=}"
# f" {self.language=}")
self._splitter = RowSplitter(column_count, self._split_multiline_doc, self.language)
self._column_count = column_count
self._extractor = DataExtractor(self._want_names_on_first_content_row)
Expand Down Expand Up @@ -112,9 +122,6 @@ def _pad(self, row):
return row + [''] * (self._column_count - len(row))


from robotide.lib.compat.parsing.language import get_headers_for


def translate_header(header: str, language=None) -> str:
if not language:
return header
Expand Down
12 changes: 10 additions & 2 deletions src/robotide/lib/robot/writer/rowsplitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# limitations under the License.

import itertools
from multiprocessing import shared_memory
from robotide.lib.compat.parsing.language import get_settings_for


Expand All @@ -29,7 +30,14 @@ def __init__(self, cols=8, split_multiline_doc=False, split_multiline_var=True,
self._cols = cols
self._split_multiline_doc = split_multiline_doc
self._split_multiline_var = split_multiline_var
self._language = language
try:
if not language:
set_lang = shared_memory.ShareableList(name="language")
self._language = [set_lang[0]]
else:
self._language = language
except AttributeError:
self._language = ['en']
self._table_type = None

def split(self, row, table_type):
Expand Down Expand Up @@ -84,7 +92,7 @@ def _split_doc(doc):
def _split_row(self, row, indent):
if self._table_type == 'variable' and self._split_multiline_var:
# print(f"DEBUG: rowsplitter.py RowSplitter _split_row tabel Variable row={row}")
split_at = 2
split_at = 8
else:
split_at = None
while row:
Expand Down
7 changes: 6 additions & 1 deletion src/robotide/ui/mainframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,12 @@ def open_suite(self, path):
self._application.workspace_path = path
from ..lib.compat.parsing.language import check_file_language
self.controller.file_language = check_file_language(path)
set_lang = shared_memory.ShareableList(name="language")
set_lang = []
set_lang.append('en')
try:
set_lang = shared_memory.ShareableList(name="language")
except FileNotFoundError:
set_lang[0] = 'en'
if self.controller.file_language:
set_lang[0] = self.controller.file_language[0]
# print(f"DEBUG: project.py Project load_data file_language = {self.controller.file_language}\n"
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.1dev70'
VERSION = 'v2.1dev71'
Loading

0 comments on commit 4123606

Please sign in to comment.