Skip to content

Commit

Permalink
Merge pull request #2873 from HelioGuilherme66/misc_fixes
Browse files Browse the repository at this point in the history
Misc fixes
  • Loading branch information
HelioGuilherme66 authored Sep 4, 2024
2 parents 7942068 + d7bbc36 commit 6889df2
Show file tree
Hide file tree
Showing 11 changed files with 84 additions and 55 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.1dev73**) with:
(3.8 <= python <= 3.12) Install current development version (**2.1dev74**) 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 @@ -327,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 03/September/2024.</p>
<p>RIDE {VERSION} was released on 04/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
2 changes: 1 addition & 1 deletion src/robotide/editor/kweditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,6 @@ def on_key_down(self, event):
skip = self._call_alt_function(event, keycode)
else:
skip = self._call_direct_function(event, keycode)
self.SetFocus()
if skip:
event.Skip()

Expand Down Expand Up @@ -941,6 +940,7 @@ def _move_rows(self, keycode):
self.on_move_rows_up()
else:
self.on_move_rows_down()
self.SetFocus()

def _move_grid_cursor(self, event, keycode):
self.DisableCellEditControl()
Expand Down
2 changes: 1 addition & 1 deletion src/robotide/editor/texteditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1106,7 +1106,7 @@ def on_content_assist(self, event):
:param event: Not used
:return:
"""
if not self.is_focused(): # DEBUG was typing text when at Grid Editor
if not (self.is_focused() and self.plugin.is_focused()): # DEBUG was typing text when at Grid Editor
return
__ = event
if self._showing_list:
Expand Down
48 changes: 29 additions & 19 deletions src/robotide/lib/compat/parsing/languages.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# limitations under the License.

import inspect
import re
from itertools import chain
from pathlib import Path
from typing import cast, Iterable, Iterator, Union
Expand Down Expand Up @@ -52,11 +53,19 @@ def __init__(self, languages: 'Iterable[LanguageLike]|LanguageLike|None' = (),
self.languages: 'list[Language]' = []
self.headers: 'dict[str, str]' = {}
self.settings: 'dict[str, str]' = {}
self.bdd_prefixes: 'set[str]' = set()
self.bdd_prefixes: 'set[str]' = set()
self.true_strings: 'set[str]' = {'True', '1'}
self.false_strings: 'set[str]' = {'False', '0', 'None', ''}
for lang in self._get_languages(languages, add_english):
self._add_language(lang)
self._bdd_prefix_regexp = None

@property
def bdd_prefix_regexp(self):
if not self._bdd_prefix_regexp:
prefixes = '|'.join(self.bdd_prefixes).replace(' ', r'\s').lower()
self._bdd_prefix_regexp = re.compile(rf'({prefixes})\s', re.IGNORECASE)
return self._bdd_prefix_regexp

def reset(self, languages: Iterable[LanguageLike] = (), add_english: bool = True):
"""Resets the instance to the given languages."""
Expand Down Expand Up @@ -87,6 +96,7 @@ def add_language(self, lang: LanguageLike):
raise DataError(f'{err1} {err2}') from None
for lang in languages:
self._add_language(lang)
self._bdd_prefix_regexp = None

def _exists(self, path: Path):
try:
Expand Down Expand Up @@ -395,32 +405,32 @@ class Nl(Language):
variables_header = 'Variabelen'
test_cases_header = 'Testgevallen'
tasks_header = 'Taken'
keywords_header = 'Sleutelwoorden'
keywords_header = 'Actiewoorden'
comments_header = 'Opmerkingen'
library_setting = 'Bibliotheek'
resource_setting = 'Resource'
variables_setting = 'Variabele'
name_setting = 'Naam'
documentation_setting = 'Documentatie'
metadata_setting = 'Metadata'
suite_setup_setting = 'Suite Preconditie'
suite_teardown_setting = 'Suite Postconditie'
test_setup_setting = 'Test Preconditie'
test_teardown_setting = 'Test Postconditie'
test_template_setting = 'Test Sjabloon'
test_timeout_setting = 'Test Time-out'
test_tags_setting = 'Test Labels'
task_setup_setting = 'Taak Preconditie'
task_teardown_setting = 'Taak Postconditie'
task_template_setting = 'Taak Sjabloon'
task_timeout_setting = 'Taak Time-out'
task_tags_setting = 'Taak Labels'
keyword_tags_setting = 'Sleutelwoord Labels'
suite_setup_setting = 'Suitevoorbereiding'
suite_teardown_setting = 'Suite-afronding'
test_setup_setting = 'Testvoorbereiding'
test_teardown_setting = 'Testafronding'
test_template_setting = 'Testsjabloon'
test_timeout_setting = 'Testtijdslimiet'
test_tags_setting = 'Testlabels'
task_setup_setting = 'Taakvoorbereiding'
task_teardown_setting = 'Taakafronding'
task_template_setting = 'Taaksjabloon'
task_timeout_setting = 'Taaktijdslimiet'
task_tags_setting = 'Taaklabels'
keyword_tags_setting = 'Actiewoordlabels'
tags_setting = 'Labels'
setup_setting = 'Preconditie'
teardown_setting = 'Postconditie'
setup_setting = 'Voorbereiding'
teardown_setting = 'Afronding'
template_setting = 'Sjabloon'
timeout_setting = 'Time-out'
timeout_setting = 'Tijdslimiet'
arguments_setting = 'Parameters'
given_prefixes = ['Stel', 'Gegeven']
when_prefixes = ['Als']
Expand Down Expand Up @@ -1305,7 +1315,7 @@ class Ja(Language):
class Ko(Language):
"""Korean
New in NEXT Robot Framework after 7.0.1.
New in Robot Framework 7.1.
"""
settings_header = '설정'
variables_header = '변수'
Expand Down
22 changes: 15 additions & 7 deletions src/robotide/lib/robot/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,21 @@
VERSION = '3.1.2' # Original library version
ROBOT_VERSION = getenv('ROBOT_VERSION') # Set the version from environment, like "3.1.2"
if not ROBOT_VERSION:
ROBOT_VERSION = (6, 1, 1) # Define here or use environment variable. Condition library alias with AS
else:
if not isinstance(ROBOT_VERSION, tuple):
try:
ROBOT_VERSION = tuple(int(x) for x in ROBOT_VERSION.replace(',', '.').strip('()').split('.')[:])
except (TypeError, ValueError):
ROBOT_VERSION = (6, 1, 1)
try:
from robot.version import get_version as rf_get_version
except ImportError:
rf_get_version = None
if rf_get_version is not None:
# print(f"DEBUG: lib/version.py RF Version={rf_get_version(naked=True)}")
ROBOT_VERSION = (rf_get_version(naked=True))
else:
ROBOT_VERSION = (7, 0, 1) # Define here or use environment variable. Condition library alias with AS

if not isinstance(ROBOT_VERSION, tuple):
try:
ROBOT_VERSION = tuple(int(x) for x in ROBOT_VERSION.replace(',', '.').strip('()').split('.')[:])
except (TypeError, ValueError):
ROBOT_VERSION = (7, 0, 1)

ALIAS_MARKER = 'AS' if ROBOT_VERSION >= (6, 0, 0) else 'WITH NAME'

Expand Down
2 changes: 1 addition & 1 deletion src/robotide/lib/robot/writer/formatters.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def __init__(self, column_count, split_multiline_doc=True, language=None):
self.language = [set_lang[0]]
else:
self.language = language
except AttributeError:
except (AttributeError, FileNotFoundError):
self.language = ['en']
self._split_multiline_doc = split_multiline_doc
# print(f"DEBUG: formatters.py _DataFileFormatter INIT call _splitter {self._split_multiline_doc=}"
Expand Down
2 changes: 1 addition & 1 deletion src/robotide/lib/robot/writer/rowsplitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __init__(self, cols=8, split_multiline_doc=False, split_multiline_var=True,
self._language = [set_lang[0]]
else:
self._language = language
except AttributeError:
except (AttributeError, FileNotFoundError):
self._language = ['en']
self._table_type = None

Expand Down
11 changes: 8 additions & 3 deletions src/robotide/ui/filedialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from ..controller.ctrlcommands import (CreateNewResource, AddTestDataDirectory, AddTestCaseFile,
CreateNewDirectoryProject, CreateNewFileProject, SetFileFormat,
SetFileFormatRecuresively)
from ..robotapi import ROBOT_VERSION
from ..preferences.general import read_languages, set_colors
from .preferences_dialogs import boolean_editor, StringChoiceEditor
from ..validators import NonEmptyValidator, NewSuitePathValidator, SuiteFileNameValidator
Expand Down Expand Up @@ -129,9 +130,13 @@ def _create_lang_chooser(self, sizer):
languages = read_languages()
if languages[0] != '':
languages.insert(0, '')
# Remove non-existing language, Korean
# Remove non-existing languages
for value in languages:
if value == 'Korean':
if ROBOT_VERSION < (6, 1, 0) and value == 'Vietnamese':
languages.remove(value)
if ROBOT_VERSION < (7, 0, 1) and value == 'Japanese':
languages.remove(value)
if ROBOT_VERSION < (7, 1, ) and value == 'Korean':
languages.remove(value)
if isinstance(lang, list) and len(lang) > 0:
_settings[DOC_LANGUAGE] = lang[0]
Expand Down Expand Up @@ -253,7 +258,7 @@ def selected_language(self):
set_lang[0] = 'en'
return ['en']
else:
return [set_lang[0]]
return ['en'] # [set_lang[0]]
return [mlang.name]

def _get_extension(self):
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.1dev73'
VERSION = 'v2.1dev74'
44 changes: 25 additions & 19 deletions utest/resources/robotdata/language/lang_nl.robot
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@ Language: Dutch
# A blank line

*** Instellingen ***
Documentatie This test data file is used in *RobotIDE* _integration_ tests.\n1-This is another line of the documentation\n2-A continued line of documentation
Suite Preconditie Run Keywords Log To Console Suite Setup
Documentatie This test data file is used in *RobotIDE* _integration_ test.
... 1-This is another line of the documentation
... 2-A continued line of documentation
Suitevoorbereiding Run Keywords Log To Console Suite Setup
... AND Log Test
... AND Log to Console Test
... AND My Suite Setup
Suite Postconditie My Suite Teardown ${scalar} @{LIST}
Test Preconditie My Test Setup
Test Postconditie My Overriding Test Teardown
Test Labels new_tag ride regeression # Comment on Tags
Suite-afronding My Suite Teardown ${scalar} @{LIST}
Testvoorbereiding My Test Setup
Testafronding My Overriding Test Teardown
Testlabels new_tag ride regeression # Comment on Tags
Metadata My Meta data
Bibliotheek seleniumlibrary # Purposefully wrong case | |
Bibliotheek Process # This is a comment
Expand All @@ -38,7 +40,8 @@ Bibliotheek ${operating system} # defined in another_resource.robot | |

*** Variabelen ***
${SCALAR} value
@{LIST} 1 2 3 4 a b c d
@{LIST} 1 2 3 4 a b c
... d
${LIB NAME} Collections
${RES_PATH} ../resources
${ARG} value
Expand All @@ -51,31 +54,32 @@ Second line of comments
My Test
[Documentatie] This is _test_ *case* documentation
[Labels] test 1
[Preconditie] My Overriding Test Setup
[Voorbereiding] My Overriding Test Setup
Log Nothing to see
[Postconditie] My Overriding Test Teardown
[Afronding] My Overriding Test Teardown

first test
[Documentatie] 3-This is the documentation\n4-A continued line of documentation
[Documentatie] 3-This is the documentation
... 4-A continued line of documentation
[Labels] first second
[Preconditie] Log To Console Test Setup
[Time-out] 60
[Voorbereiding] Log To Console Test Setup
[Tijdslimiet] 60
First Keyword nonsense
${first}= Check Logic 'Ja'
${second}= Check Logic 'Uit'
Log Variables
Log Test executed with success, first=${first}, second=${second}
[Postconditie] Log To Console Test Teardown
[Afronding] Log To Console Test Teardown

second test
[Labels] first second # This is a comment
[Preconditie] Log To Console Test Setup # This is a comment
[Voorbereiding] Log To Console Test Setup # This is a comment
[Sjabloon] First Keyword # This is a comment
[Time-out] 60 # This is a comment
[Tijdslimiet] 60 # This is a comment
No Operation
Log this is ddt
Log To Console Test executed with success
[Postconditie] Log To Console Test Teardown # This is a comment
[Afronding] Log To Console Test Teardown # This is a comment

third test
Stel "Mr. Smith" is registered
Expand All @@ -84,7 +88,7 @@ third test
Dan the total is presented and awaits confirmation
Maar it is shown the unavailable payment method

*** Sleutelwoorden ***
*** Actiewoorden ***
My Suite Teardown
[Parameters] ${scalar arg} ${default arg}=default @{list arg}
[Documentatie] This is *user* _keyword_ documentation
Expand All @@ -96,12 +100,14 @@ Duplicate UK
No Operation

My Test Setup
[Time-out]
[Tijdslimiet]
No Operation

First Keyword
[Parameters] ${arg}=None @{no_list} # This is a comment
[Documentatie] 5-This is the documentation\n\n7-A continued line of documentation
[Documentatie] 5-This is the documentation
...
... 7-A continued line of documentation
[Labels] first second # This is a comment
Log To Console This is the first keyword

Expand Down

0 comments on commit 6889df2

Please sign in to comment.