Skip to content

Commit 86eb469

Browse files
Minor code improvements (#2949)
* Unit test for widgets.HtmlWindow * Improve unit tests on MacOS * Unit test for widgets.HtmlWindow * Improve unit tests on MacOS * Attempt to cover branch in test_htmlwindow. WIP * Improve two 100% tests * Debug test_htmlwnd * Increase low coverage * Add fs_watcher test * Omit non tested files from coverage * Add DEBUG to Grid. Improve kwedito tests * Minor fixes in utests * Improve Grid tests WIP debug failed tests * Improve RF version detection * Exclude files from coverage. Grid tests fail in shell not IDE * Fixes missing context menu in Grid Editor (#2948) * Minor code improvements ---------
1 parent 4afc172 commit 86eb469

24 files changed

+874
-290
lines changed

.coveragerc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ omit =
1515
./src/robotide/lib/robot/*
1616
# ./src/robotide/preferences/configobj/*
1717
*/.venv/*
18+
./src/robotide/__main__.py
19+
./src/robotide/postinstall/__main__.py
20+
./src/robotide/ui/preview.py
1821

1922
[report]
2023
skip_empty = True

README.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Likewise, the current version of wxPython, is 4.2.3, but RIDE is known to work w
4141

4242
`pip install -U robotframework-ride`
4343

44-
(3.8 <= python <= 3.13) Install current development version (**2.2dev24**) with:
44+
(3.8 <= python <= 3.13) Install current development version (**2.2dev25**) with:
4545

4646
`pip install -U https://github.com/robotframework/RIDE/archive/develop.zip`
4747

src/robotide/application/CHANGELOG.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
</li><li class="listitem">
3939
Improved colorization for multiple Gherkin words, for example in the French language.
4040
</li></ul></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_fixed"></a>2.3. Fixed</h3></div></div></div><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
41+
Fixed white blocks on Tree due to failed animation when test execution is too rapid, causing crash on Windows.
42+
</li><li class="listitem">
4143
Fixed not set text color on row labels in Grid Editor. Now the General ``secondary foreground`` is applied.
4244
</li><li class="listitem">
4345
Fixed multiple scroll bars in Grid Editor when editing Test Cases or Keywords. This caused bad navigation on cells.

src/robotide/application/application.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
import builtins
1717
import os
18+
import subprocess
19+
1820
import wx
1921

2022
from contextlib import contextmanager
@@ -342,14 +344,23 @@ def _find_robot_installation():
342344
output = run_python_command(
343345
['import robot; print(robot.__file__ + \", \" + robot.__version__)'])
344346
robot_found = b"ModuleNotFoundError" not in output and output
347+
system_encoding = get_system_encoding()
348+
if not robot_found:
349+
rf_info = subprocess.run(['robot', '--version'], capture_output=True)
350+
print(f"DEBUG: application-py RIDE _find_robot_installation command VERSION={rf_info.stdout}")
351+
if b"Robot Framework" in rf_info.stdout:
352+
rf_version = rf_info.stdout.replace(b"Robot Framework", b"").strip(b" ").split(b" ")[0]
353+
publish.RideLogMessage(_("Found Robot Framework version %s from %s.") % (
354+
str(rf_version, system_encoding), "PATH")).publish()
355+
return rf_version
345356
if robot_found:
346-
system_encoding = get_system_encoding()
347357
rf_file, rf_version = output.strip().split(b", ")
348358
publish.RideLogMessage(_("Found Robot Framework version %s from %s.") % (
349359
str(rf_version, system_encoding), str(os.path.dirname(rf_file), system_encoding))).publish()
350360
return rf_version
351361
else:
352362
publish.RideLogMessage(publish.get_html_message('no_robot'), notify_user=True).publish()
363+
return None
353364

354365
def _get_latest_path(self):
355366
recent = self._get_recentfiles_plugin()

src/robotide/application/editorprovider.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def add(self, editor, default=True):
5050
self._editors.insert(0, editor)
5151

5252
def set_default(self, editor):
53-
if self._editors.index(editor) != -1:
53+
if self._editors.index(editor) != len(self._editors) - 1:
5454
self._editors.remove(editor)
5555
self._editors.append(editor)
5656

src/robotide/application/releasenotes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ def set_content(self, html_win, content):
237237
<pre class="literal-block">python -m robotide.postinstall -install</pre>
238238
<p>or</p>
239239
<pre class="literal-block">ride_postinstall.py -install</pre>
240-
<p>RIDE {VERSION} was released on 03/May/2025.</p>
240+
<p>RIDE {VERSION} was released on 15/May/2025.</p>
241241
<!-- <br/>
242242
<h3>May The Fourth Be With You!</h3>
243243
<h3>Celebrate the bank holiday, 10th June, Day of Portugal, Portuguese Communities and Camões!!</h3>

src/robotide/editor/editors.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class EditorPanel(wx.lib.scrolledpanel.ScrolledPanel):
6060
= show_content_assist = lambda self: None
6161

6262
def __init__(self, plugin, parent, controller, tree):
63-
wx.lib.scrolledpanel.ScrolledPanel.__init__(self, parent)
63+
wx.lib.scrolledpanel.ScrolledPanel.__init__(self, parent, style=wx.HSCROLL|wx.VSCROLL|wx.ALWAYS_SHOW_SB)
6464
from ..preferences import RideSettings
6565
_settings = RideSettings()
6666
self.general_settings = _settings['General']
@@ -312,6 +312,7 @@ class _FileEditor(_RobotTableEditor):
312312

313313
def __init__(self, *args):
314314
_RobotTableEditor.__init__(self, *args)
315+
# DEBUG
315316
self.SetupScrolling()
316317
self.plugin.subscribe(
317318
self._update_source_and_name, RideFileNameChanged)

src/robotide/editor/gridbase.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class GridEditor(grid.Grid):
3333
_popup_items_nt = []
3434

3535
def __init__(self, parent, num_rows, num_cols, popup_creator=None):
36-
grid.Grid.__init__(self, parent)
36+
grid.Grid.__init__(self, parent.frame if isinstance(parent, wx.App) else parent)
3737
try:
3838
self.settings = parent.plugin.global_settings['Grid']
3939
self.general_settings = parent.plugin.global_settings['General']

src/robotide/namespace/cache.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,14 @@ def _build_default_kws(self):
184184
from robotide.context import APP
185185
try:
186186
robot_version = APP.robot_version
187-
except AttributeError:
187+
except (AttributeError, TypeError):
188+
robot_version = b'7.0.1'
189+
if not robot_version:
188190
robot_version = b'7.0.1'
189191
try:
190192
rbt_version = int(str(robot_version, encoding='UTF-8').replace('.', ''))
191193
rbt_version = rbt_version if rbt_version > 99 else rbt_version * 10
192-
except ValueError:
194+
except (ValueError, TypeError):
193195
rbt_version = 701
194196
var_note = "*NOTE:* This marker exists since version 7.0" + (f" and is an error to use because your "
195197
f"version of Robot Framework is"

src/robotide/utils/noconflict.py

Lines changed: 0 additions & 78 deletions
This file was deleted.

0 commit comments

Comments
 (0)