Skip to content

Commit

Permalink
Add support for localized test suites and UI (#2678)
Browse files Browse the repository at this point in the history
* Improve reader. DEBUG

* Improve reader.

* Add check_file_language. Working in project.load_data, but not when opening files.

* Add condition fro lang in model

* First success opening laang_pt and lang_fr tests

* Make unit tests pass

* Improve lang headers, pt and fr

* Add unit tests. All lnguages tests can be opened. Missing lib lang fixes

* Identify where language can be checked from TextEditor

* More tables using language

* Working opening with lang set. Tests for multiple langs

* Working opening directories with different lang files

* Make __init__.robot open with language set. WIP, copy _aliases to _settings

* OK Opens from directories.

* Fixed open test suites directories. Need utests and fix comments

* Fix opening directly __init__.robot

* Cleanup code

* Improve opening of Resource files

* Open pt folder, fail en folder. Failed comment blocks at formatter level

* Add order of sections. Still broken en directories, and missing memory clear on open

* Fix some utests

* Fix unit tests

* Remove inner comments from the en test directory

* Success in multiple Comments sections. Missing isolated comments

* Fix # isolated comments and Comments section

* Settings Dialogs OK. Need localizaation. Variables is debug

* Adjust buttons in table settings to open dialogs for Tests and Tasks

* Fix all settings Edit buttons

* Fix continuation lines in Documentation other than En

* Improve setting of language in TextEditor

* Fix Library translated labels

* I18n colorization (#143)

* Initial modification of pygments. Missing Gerkin

* Remove nolower

* Almost done. Missing Gherkin and Documentation setting color not OK

* Fixed Gherkin calls. Still to fix TestTableSettings Setup/Teardown/Template keywords

* Final fixes for colorization

* Fix error when opening directories with log or report html files

* Update docs and version

* Add validator from RF 6.1.1 to Text Edit. WIP fails to save language files

* Add new validator

* Fix saving modified files with language setting

* Fix help dialog for Pygments

* Add protection to shared_memory language setting

* Remove extra spaces from lines in Comments sections

* Remove support for HTML test files. WIP

* Make own pygments a module

* Fix broken sincronization of changes in Text Editor

* Add minimal protection to RF lower than 6.0

* Add tooltip to settings fields localized names

* Notes about tooltips

* Add language selector to Preferences->General

* Initial structure for localization change

* Add first example de localized strings

* Add test from W2

* Add more debugging for localization

* Fix pause translated commands

* Update translations for TestRunner

* Fix some unit tests

* Fix import failed XML

* Fix unit test

* Fix more translations in in Tests and in Unudrd Keywords

* Fix default ui language, Variables and Metadata editors

* Improvement in language save or RIDE start

* Add pt_BR translation

* DEBUG Save from Text Editor
  • Loading branch information
HelioGuilherme66 authored Jan 1, 2024
1 parent 410e9f9 commit 86d7c88
Show file tree
Hide file tree
Showing 148 changed files with 9,205 additions and 996 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,20 @@ and this project adheres to http://semver.org/spec/v2.0.0.html[Semantic Versioni

== https://github.com/robotframework/RIDE[Unreleased]

=== Added

- Added support for language configured test suites, with installed Robot Framework version 6.0 or higher.
- Fields are shown in the language of the files in Grid Editor (will be configurable if future versions).
- Tooltips for the fields are always shown in English.
- Colorization for language configured files is working in Text Editor.

=== Fixed

- Fixed New User Keyword dialog not allowing empty Arguments field

=== Removed

- Removed support for old Python versions, 3.6 nd 3.7.

== https://github.com/robotframework/RIDE/blob/master/doc/releasenotes/ride-2.0.8.1.rst[2.0.8.1] - 2023-11-01

Expand Down
6 changes: 4 additions & 2 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ If you are looking for the latest released version, you can get the source code

See the https://github.com/robotframework/RIDE/blob/master/doc/releasenotes/ride-2.0.8.1.rst[release notes] for latest release version 2.0.8.1

**Version https://github.com/robotframework/RIDE/tree/release/2.0.8.1[2.0.8.1] was the last release supporting Python 3.6 and 3.7**

**Version https://github.com/robotframework/RIDE/tree/release/1.7.4.2[1.7.4.2] was the last release supporting Python 2.7**


**The current development version is based on 2.0.8.1, supports Python from 3.6 up to 3.11 (1st November 2023).**
**The current development version is based on 2.0.8.1, supports Python from 3.8 up to 3.11 (20th December 2023).**

Currently the unit tests are tested on Python 3.10, and 3.11 (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.
Expand All @@ -32,7 +34,7 @@ Likewise, the current version of wxPython, is 4.2.1, but RIDE is known to work w

`pip install -U robotframework-ride`

Install current development version (**2.0.9dev#**) with:
(3.8 < python <= 3.11) Install current development version (**2.1a1**) with:

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

Expand Down
4 changes: 1 addition & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@
Development Status :: 5 - Production/Stable
License :: OSI Approved :: Apache Software License
Operating System :: OS Independent
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Expand Down Expand Up @@ -94,7 +92,7 @@ def run(self):
package_dir={'': SOURCE_DIR},
packages=find_packages(SOURCE_DIR),
package_data=PACKAGE_DATA,
python_requires='>=3.6',
python_requires='>=3.8, <3.12',
# Robot Framework package data is not included, but RIDE does not need it.
# Always install everything, since we may be switching between versions
options={'install': {'force': True}},
Expand Down
39 changes: 28 additions & 11 deletions src/robotide/action/actioninfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import builtins
import re

import wx

from ..widgets import ImageProvider
from .shortcut import Shortcut

_ = wx.GetTranslation # To keep linter/code analyser happy
builtins.__dict__['_'] = wx.GetTranslation

def action_info_collection(data, event_handler, container=None):

def action_info_collection(data, event_handler, data_nt=None, container=None):
"""Parses the ``data`` into a list of `ActionInfo` and `SeparatorInfo` objects.
The data is parsed based on the simple DSL documented below.
Expand All @@ -32,6 +36,9 @@ def action_info_collection(data, event_handler, container=None):
event_handler
The event handler that implements the actions. See `finding handlers`_
for more information.
data_nt
Since RIDE 2.1, this is the original English menudata, or None which will be a copy of data
This is due to the way menu is created for translations, which will not build the correct handler names.
container
the wxPython element containing the UI components associated with
the `ActionInfo`.
Expand Down Expand Up @@ -91,7 +98,7 @@ def action_info_collection(data, event_handler, container=None):
Specifying container
--------------------
By default the given ``container`` is passed to the `ActionInfo.__init__`
By default, the given ``container`` is passed to the `ActionInfo.__init__`
method directly. This can be altered by prefixing the ``name`` with an
exclamation mark (e.g. ``!Save`` or ``!My Action``) to make that action
global. With these actions the container given to the `ActionInfo.__init__`
Expand All @@ -114,30 +121,41 @@ def action_info_collection(data, event_handler, container=None):
Content Assist (Ctrl-Space or Ctrl-Alt-Space) | Has two shortcuts.
"""

if not data_nt:
data_nt = data
menu = None
actions = []
for row in data.splitlines():
for row, row_nt in zip(data.splitlines(), data_nt.splitlines()):
row = row.strip()
if not row:
row_nt = row_nt.strip()
print(f"DEBUG: actioninfo.py action_info_collection in loop row={row}\noriginal={row_nt} ")
if not row and not row_nt:
continue
elif row.startswith('[') and row.endswith(']'):
menu = row[1:-1].strip()
# print(f"DEBUG: actioninfo.py action_info_collection menu={menu}")
else:
actions.append(_create_action_info(event_handler, menu, container, row))
actions.append(_create_action_info(event_handler, menu, container, row, row_nt))
return actions


def _create_action_info(eventhandler, menu, container, row):
def _create_action_info(eventhandler, menu, container, row, row_nt):
if row.startswith('---'):
return SeparatorInfo(menu)
tokens = [t.strip() for t in row.split('|')]
tokens += [''] * (5-len(tokens))
name, doc, shortcut, icon, position = tokens
if name.startswith('!'):
tokens_nt = [t.strip() for t in row_nt.split('|')]
tokens_nt += [''] * (5-len(tokens_nt))
name_nt, __, __, __, __ = tokens_nt
if name_nt.startswith('!'):
name = name[1:]
name_nt = name_nt[1:]
container = None
eventhandler_name, name = get_eventhandler_name_and_parsed_name(name)
eventhandler_name, name_nt = get_eventhandler_name_and_parsed_name(name_nt)
action = getattr(eventhandler, eventhandler_name)
print(f"DEBUG: actioninfo.py _create_action_info menu={menu} eventhandler_name={eventhandler_name},"
f" name_nt={name_nt}")
return ActionInfo(menu, name, action, container, shortcut, icon, doc, position)


Expand All @@ -152,8 +170,7 @@ def _parse_shortcuts_from_name(name):
eventhandler_name, shortcuts = name.split('(', 1)
shortcuts = shortcuts.split(')')[0]
elements = shortcuts.split(' or ')
name = '%s (%s)' % (eventhandler_name, ' or '.join(Shortcut(e).printable for e in
elements))
name = '%s (%s)' % (eventhandler_name, ' or '.join(Shortcut(e).printable for e in elements))
return eventhandler_name, name
return name, name

Expand Down Expand Up @@ -187,7 +204,7 @@ class ActionInfo(MenuInfo):

def __init__(self, menu_name, name, action=None, container=None,
shortcut=None, icon=None, doc='', position=-1):
"""Initializes information needed to create actions..
"""Initializes information needed to create actions...
:Parameters:
menu_name
Expand Down
Loading

0 comments on commit 86d7c88

Please sign in to comment.