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

Improve code #2880

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
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.1dev76**) with:
(3.8 <= python <= 3.12) Install current development version (**2.1dev77**) 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 @@ -328,7 +328,7 @@ def set_content(self, html_win, content):
<pre class="literal-block">
python -m robotide.postinstall -install
</pre>
<p>RIDE {VERSION} was released on 06/September/2024.</p>
<p>RIDE {VERSION} was released on 08/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
14 changes: 9 additions & 5 deletions src/robotide/editor/gridcolorizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import wx
from wx import Colour

from ..controller.cellinfo import CellType

Expand Down Expand Up @@ -83,7 +82,8 @@ def _get_cell_font(self, row, col, cell_info):
font.SetWeight(self._get_weight(cell_info))
return font

def _get_weight(self, cell_info):
@staticmethod
def _get_weight(cell_info):
if cell_info.cell_type == CellType.KEYWORD:
return wx.FONTWEIGHT_BOLD
return wx.FONTWEIGHT_NORMAL
Expand All @@ -100,12 +100,12 @@ def __init__(self, settings=None):
def get_background_color(self, elem_type):
if not self._settings:
return self.DEFAULT_BACKGROUND
return self._get('background %s' % elem_type)
return self._get(f'background {elem_type}')

def get_text_color(self, elem_type):
if not self._settings:
return self.DEFAULT_TEXT
return self._get('text %s' % elem_type)
return self._get(f'text {elem_type}')

def get_highlight_color(self):
return self.get_background_color('highlight')
Expand All @@ -114,4 +114,8 @@ def get_error_color(self):
return self.get_background_color('error')

def _get(self, name):
return self._settings[name.lower().replace('_', ' ')]
color_setting = name.lower().replace('_', ' ')
if color_setting in self._settings:
return self._settings[color_setting]
else:
return CellType.UNKNOWN
218 changes: 123 additions & 95 deletions src/robotide/editor/texteditor.py

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions src/robotide/localization/bg_BG/restore_keywords.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"fix_list":[
["No Operation", "Не Operation"],
["Run Keyword And Continue On Failure", "Run Keyword And Continue Включен Failure"],
["Run Keyword And Warn On Failure", "Run Keyword And Warn Включен Failure"],
["Should Be True", "Should Be Вярно"],
["Should Not Be True", "Should Not Be Вярно"]
]
}

10 changes: 10 additions & 0 deletions src/robotide/localization/cs_CZ/restore_keywords.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"fix_list":[
["No Operation", "Ne Operation"],
["Run Keyword And Continue On Failure", "Run Keyword And Continue Zapnuto Failure"],
["Run Keyword And Warn On Failure", "Run Keyword And Warn Zapnuto Failure"],
["Should Be True", "Should Be Pravda"],
["Should Not Be True", "Should Not Be Pravda"]
]
}

10 changes: 10 additions & 0 deletions src/robotide/localization/de_DE/restore_keywords.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"fix_list":[
["No Operation", "Nein Operation"],
["Run Keyword And Continue On Failure", "Run Keyword And Continue An Failure"],
["Run Keyword And Warn On Failure", "Run Keyword And Warn An Failure"],
["Should Be True", "Should Be Wahr"],
["Should Not Be True", "Should Not Be Wahr"]
]
}

7 changes: 7 additions & 0 deletions src/robotide/localization/es_ES/restore_keywords.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"fix_list":[
["Should Be True", "Should Be Verdadero"],
["Should Not Be True", "Should Not Be Verdadero"]
]
}

10 changes: 10 additions & 0 deletions src/robotide/localization/fi_FI/restore_keywords.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"fix_list":[
["No Operation", "Ei Operation"],
["Run Keyword And Continue On Failure", "Run Keyword And Continue Päällä Failure"],
["Run Keyword And Warn On Failure", "Run Keyword And Warn Päällä Failure"],
["Should Be True", "Should Be Tosi"],
["Should Not Be True", "Should Not Be Tosi"]
]
}

10 changes: 10 additions & 0 deletions src/robotide/localization/fr_FR/restore_keywords.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"fix_list":[
["No Operation", "Non Operation"],
["Run Keyword And Continue On Failure", "Run Keyword And Continue Actif Failure"],
["Run Keyword And Warn On Failure", "Run Keyword And Warn Actif Failure"],
["Should Be True", "Should Be Vrai"],
["Should Not Be True", "Should Not Be Vrai"]
]
}

10 changes: 10 additions & 0 deletions src/robotide/localization/hi_IN/restore_keywords.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"fix_list":[
["No Operation", "नहीं Operation"],
["Run Keyword And Continue On Failure", "Run Keyword And Continue हां Failure"],
["Run Keyword And Warn On Failure", "Run Keyword And Warn हां Failure"],
["Should Be True", "Should Be यथार्थ"],
["Should Not Be True", "Should Not Be यथार्थ"]
]
}

7 changes: 7 additions & 0 deletions src/robotide/localization/it_IT/restore_keywords.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"fix_list":[
["Should Be True", "Should Be Vero"],
["Should Not Be True", "Should Not Be Vero"]
]
}

10 changes: 10 additions & 0 deletions src/robotide/localization/ja_JP/restore_keywords.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"fix_list":[
["No Operation", "無効 Operation"],
["Run Keyword And Continue On Failure", "Run Keyword And Continue はい Failure"],
["Run Keyword And Warn On Failure", "Run Keyword And Warn はい Failure"],
["Should Be True", "Should Be 真"],
["Should Not Be True", "Should Not Be 真"]
]
}

10 changes: 10 additions & 0 deletions src/robotide/localization/ko_KR/restore_keywords.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"fix_list":[
["No Operation", "아니오 Operation"],
["Run Keyword And Continue On Failure", "Run Keyword And Continue 켜기 Failure"],
["Run Keyword And Warn On Failure", "Run Keyword And Warn 켜기 Failure"],
["Should Be True", "Should Be 참"],
["Should Not Be True", "Should Not Be 참"]
]
}

10 changes: 10 additions & 0 deletions src/robotide/localization/nl_NL/restore_keywords.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"fix_list":[
["No Operation", "Nee Operation"],
["Run Keyword And Continue On Failure", "Run Keyword And Continue Aan Failure"],
["Run Keyword And Warn On Failure", "Run Keyword And Warn Aan Failure"],
["Should Be True", "Should Be Waar"],
["Should Not Be True", "Should Not Be Waar"]
]
}

10 changes: 10 additions & 0 deletions src/robotide/localization/pl_PL/restore_keywords.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"fix_list":[
["No Operation", "Nie Operation"],
["Run Keyword And Continue On Failure", "Run Keyword And Continue Włączone Failure"],
["Run Keyword And Warn On Failure", "Run Keyword And Warn Włączone Failure"],
["Should Be True", "Should Be Prawda"],
["Should Not Be True", "Should Not Be Prawda"]
]
}

10 changes: 10 additions & 0 deletions src/robotide/localization/pt_BR/restore_keywords.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"fix_list":[
["No Operation", "Não Operation"],
["Run Keyword And Continue On Failure", "Run Keyword And Continue Sim Failure"],
["Run Keyword And Warn On Failure", "Run Keyword And Warn Sim Failure"],
["Should Be True", "Should Be Verdadeiro"],
["Should Not Be True", "Should Not Be Verdadeiro"]
]
}

10 changes: 10 additions & 0 deletions src/robotide/localization/pt_PT/restore_keywords.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"fix_list":[
["No Operation", "Não Operation"],
["Run Keyword And Continue On Failure", "Run Keyword And Continue Sim Failure"],
["Run Keyword And Warn On Failure", "Run Keyword And Warn Sim Failure"],
["Should Be True", "Should Be Verdadeiro"],
["Should Not Be True", "Should Not Be Verdadeiro"]
]
}

10 changes: 10 additions & 0 deletions src/robotide/localization/ro_RO/restore_keywords.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"fix_list":[
["No Operation", "Nu Operation"],
["Run Keyword And Continue On Failure", "Run Keyword And Continue Cand Failure"],
["Run Keyword And Warn On Failure", "Run Keyword And Warn Cand Failure"],
["Should Be True", "Should Be Adevarat"],
["Should Not Be True", "Should Not Be Adevarat"]
]
}

10 changes: 10 additions & 0 deletions src/robotide/localization/sv_SE/restore_keywords.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"fix_list":[
["No Operation", "Nej Operation"],
["Run Keyword And Continue On Failure", "Run Keyword And Continue På Failure"],
["Run Keyword And Warn On Failure", "Run Keyword And Warn På Failure"],
["Should Be True", "Should Be Sant"],
["Should Not Be True", "Should Not Be Sant"]
]
}

10 changes: 10 additions & 0 deletions src/robotide/localization/tr_TR/restore_keywords.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"fix_list":[
["No Operation", "Hayir Operation"],
["Run Keyword And Continue On Failure", "Run Keyword And Continue Açik Failure"],
["Run Keyword And Warn On Failure", "Run Keyword And Warn Açik Failure"],
["Should Be True", "Should Be Doğru"],
["Should Not Be True", "Should Not Be Doğru"]
]
}

10 changes: 10 additions & 0 deletions src/robotide/localization/vi_VN/restore_keywords.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"fix_list":[
["No Operation", "Không Operation"],
["Run Keyword And Continue On Failure", "Run Keyword And Continue Mở Failure"],
["Run Keyword And Warn On Failure", "Run Keyword And Warn Mở Failure"],
["Should Be True", "Should Be Đúng"],
["Should Not Be True", "Should Not Be Đúng"]
]
}

10 changes: 10 additions & 0 deletions src/robotide/localization/zh_CN/restore_keywords.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"fix_list":[
["No Operation", "否 Operation"],
["Run Keyword And Continue On Failure", "Run Keyword And Continue 开 Failure"],
["Run Keyword And Warn On Failure", "Run Keyword And Warn 开 Failure"],
["Should Be True", "Should Be 真"],
["Should Not Be True", "Should Not Be 真"]
]
}

10 changes: 10 additions & 0 deletions src/robotide/localization/zh_TW/restore_keywords.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"fix_list":[
["No Operation", "否 Operation"],
["Run Keyword And Continue On Failure", "Run Keyword And Continue 開 Failure"],
["Run Keyword And Warn On Failure", "Run Keyword And Warn 開 Failure"],
["Should Be True", "Should Be 真"],
["Should Not Be True", "Should Not Be 真"]
]
}

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.1dev76'
VERSION = 'v2.1dev77'
43 changes: 41 additions & 2 deletions utest/editor/test_gridcolorizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
import unittest
import random

from robotide.editor.gridbase import GridEditor

# wx needs to imported last so that robotide can select correct wx version.
import os
import pytest

from robotide.lib.robot.libraries.String import String
Expand All @@ -24,6 +28,35 @@
from robotide.editor.gridcolorizer import Colorizer


DISPLAY = os.getenv('DISPLAY')
if not DISPLAY:
pytest.skip("Skipped because of missing DISPLAY", allow_module_level=True) # Avoid failing unit tests in system without X11
import wx

DATA = [['kw1', '', ''],
['kw2', 'arg1', ''],
['kw3', 'arg1', 'arg2']]

myapp = wx.App(None)


class _FakeMainFrame(wx.Frame):
myapp = wx.App(None)

def __init__(self):
wx.Frame.__init__(self, None)
self.plugin = None


def EditorWithData():
myapp = wx.App(None)
grid = GridEditor(_FakeMainFrame(), 5, 5)
for ridx, rdata in enumerate(DATA):
for cidx, cdata in enumerate(rdata):
grid.write_cell(ridx, cidx, cdata, update_history=False)
return grid


class MockGrid(object):
noop = lambda *args: None
SetCellTextColour = SetCellBackgroundColour = SetCellFont = noop
Expand Down Expand Up @@ -83,15 +116,21 @@ def _get_data(self):
return self._string.generate_random_string(50)


@pytest.mark.skip('It is getting unexpected data')
# @pytest.mark.skip('It is getting unexpected data')
class TestPerformance(unittest.TestCase):
_data = ['Keyword', 'Some longer data in cell', '${variable}',
'#asdjaskdkjasdkjaskdjkasjd', 'asdasd,asdasd,as asd jasdj asjd asjdj asd']

def setUp(self):
self._editor = EditorWithData()

def test_colorizing_performance(self):
colorizer = Colorizer(MockGrid(), ControllerWithCellInfo())
for _ in range(0, 500):
colorizer._colorize_cell(1,1, self._data[random.randint(0, 4)])
rdata = self._data[random.randint(0, 4)]
self._editor.SetCellValue(1, 1, rdata)
cdata = self._editor.GetCellValue(1, 1)
colorizer._colorize_cell(1,1, cdata)


class TestColorIdentification(unittest.TestCase):
Expand Down
Loading
Loading