From 7b3a22c4e92cfc38beb1f33cd19bf52c697bf872 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9lio=20Guilherme?= Date: Sat, 21 Oct 2023 22:45:49 +0100 Subject: [PATCH] Minors (#2663) * Improve Tree expanding when running tests * Improves keywords documentation search --- CHANGELOG.adoc | 1 + src/robotide/application/CHANGELOG.html | 4 +++- src/robotide/application/releasenotes.py | 1 + src/robotide/namespace/namespace.py | 18 ++++++++++++++++-- src/robotide/spec/librarymanager.py | 21 ++++++++++++++++++--- src/robotide/spec/xmlreaders.py | 3 ++- src/robotide/ui/treeplugin.py | 6 +++++- src/robotide/version.py | 2 +- 8 files changed, 47 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 9b54aee47..5e0a08438 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -34,6 +34,7 @@ Force Tags settings, after Robot Framework 7.0 === Changed +- Improved keywords documentation search, by adding current dir to search - Improved Move up/down, ``Alt-UpArrow``/``Alt-DownArrow`` in Text Editor, to have proper indentation and selection - Improved **RIDE Log** and **Parser Log** windows to allow Zoom In/Out with ``Ctrl-Mouse Wheel`` - Hide continuation markers in Project Tree diff --git a/src/robotide/application/CHANGELOG.html b/src/robotide/application/CHANGELOG.html index 7ac25de02..ebe021677 100644 --- a/src/robotide/application/CHANGELOG.html +++ b/src/robotide/application/CHANGELOG.html @@ -36,7 +36,9 @@
  • Drag and drop of variables defined with comments between resource files
  • 1.3. Changed

    • -Improved Move up/down, ``Alt-UpArrow``/``Alt-DownArrow`` in Text Editor, to have proper indentation and selection +Improved keywords documentation search, by adding current dir to search +
    • +Improved Move up/down, Alt-UpArrow/Alt-DownArrow in Text Editor, to have proper indentation and selection
    • Improved RIDE Log and Parser Log windows to allow Zoom In/Out with ``Ctrl-Mouse Wheel``
    • diff --git a/src/robotide/application/releasenotes.py b/src/robotide/application/releasenotes.py index 196499806..b888fb601 100644 --- a/src/robotide/application/releasenotes.py +++ b/src/robotide/application/releasenotes.py @@ -168,6 +168,7 @@ def set_content(self, html_win, content):

    New Features and Fixes Highlights

      +
    • Improved keywords documentation search, by adding current dir to search
    • Improved Move up/down, Alt-UpArrow/Alt-DownArrow in Text Editor, to have proper indentation and selection
    • Added auto update check when development version is installed
    • Added menu option Help->Check for Upgrade which allows to force update check and install development version
    • diff --git a/src/robotide/namespace/namespace.py b/src/robotide/namespace/namespace.py index feb118b62..db6b9e95e 100644 --- a/src/robotide/namespace/namespace.py +++ b/src/robotide/namespace/namespace.py @@ -55,13 +55,20 @@ def _set_pythonpath(self): """Add user configured paths to PYTHONAPATH. """ path_idx = 0 + dp = os.getenv('RIDE_DOC_PATH') + if not dp: + doc_paths = ['.'] + else: + doc_paths = dp.split(',') for path in self.settings.get('pythonpath', []): + if os.path.isdir(path): + doc_paths.append(path.replace('/', os.sep)) if path not in sys.path: normalized = path.replace('/', os.sep) sys.path.insert(path_idx, normalized) path_idx += 1 - RideLogMessage(u'Inserted \'{0}\' to sys.path.' - .format(normalized)).publish() + RideLogMessage(u'Inserted \'{0}\' to sys.path.'.format(normalized)).publish() + os.environ['RIDE_DOC_PATH'] = ",".join(doc_paths) def _setting_changed(self, message): section, setting = message.keys @@ -76,6 +83,13 @@ def update_exec_dir_global_var(self, exec_dir): self._context_factory.reload_context_global_vars() def update_cur_dir_global_var(self, cur_dir): + dp = os.getenv('RIDE_DOC_PATH') + parent_cur_dir=os.path.dirname(os.path.abspath(cur_dir)) + if dp: + if cur_dir not in dp: + os.environ['RIDE_DOC_PATH'] = dp + f", {cur_dir}, {parent_cur_dir}" + else: + os.environ['RIDE_DOC_PATH'] = f"{cur_dir}, {parent_cur_dir}" _VariableStash.global_variables['${CURDIR}'] = cur_dir self._context_factory.reload_context_global_vars() diff --git a/src/robotide/spec/librarymanager.py b/src/robotide/spec/librarymanager.py index 8190feb75..27e0b745f 100644 --- a/src/robotide/spec/librarymanager.py +++ b/src/robotide/spec/librarymanager.py @@ -18,6 +18,7 @@ from sqlite3 import OperationalError from threading import Thread +import robotide.robotapi from ..publish import RideLogException, RideLogMessage from ..spec.librarydatabase import LibraryDatabase from ..spec.libraryfetcher import get_import_result @@ -77,9 +78,23 @@ def _handle_fetch_keywords_message(self, message): def _fetch_keywords(self, library_name, library_args): try: - path = get_path( - library_name.replace('/', os.sep), os.path.abspath('.')) - return get_import_result(path, library_args) + doc_paths = os.getenv('RIDE_DOC_PATH') + collection = [] + path = get_path(library_name.replace('/', os.sep), os.path.abspath('.')) + if path: + results = get_import_result(path, library_args) + if results: + return results + if doc_paths: + for p in doc_paths.split(','): + path = get_path(library_name.replace('/', os.sep), p.strip()) + if path: + results = get_import_result(path, library_args) + if results: + collection.extend(results) + if collection: + return collection + raise robotide.robotapi.DataError except Exception as err: try: print('FAILED', library_name, err) diff --git a/src/robotide/spec/xmlreaders.py b/src/robotide/spec/xmlreaders.py index 3f7693a25..9ace7a4bc 100644 --- a/src/robotide/spec/xmlreaders.py +++ b/src/robotide/spec/xmlreaders.py @@ -117,7 +117,8 @@ def _resolve_path(path, basedir): if os.path.isdir(ret) and \ os.path.isfile(os.path.join(ret, '__init__.py')): return ret - raise robotapi.DataError + return None + # DEBUG raise robotapi.DataError def _get_library_name(name): diff --git a/src/robotide/ui/treeplugin.py b/src/robotide/ui/treeplugin.py index 8c59df819..7e64e938f 100644 --- a/src/robotide/ui/treeplugin.py +++ b/src/robotide/ui/treeplugin.py @@ -418,8 +418,12 @@ def _set_icon_from_execution_results(self, controller): self.SetItemWindow(node, self._animctrl, False) self._animctrl.Play() # Make visible the running or paused test - self.EnsureVisible(node.GetParent()) + parent = node.GetParent() + self.EnsureVisible(parent) # DEBUG add animation to parent if suite setup/teardown started + self.ExpandAllChildren(parent) self.EnsureVisible(node) + self.ExpandAllChildren(node) + self.Update() def _get_icon_index_for(self, controller): if not self._execution_results: diff --git a/src/robotide/version.py b/src/robotide/version.py index 245153cee..7b3d9c3cf 100644 --- a/src/robotide/version.py +++ b/src/robotide/version.py @@ -14,4 +14,4 @@ # limitations under the License. # # Automatically generated by `tasks.py`. -VERSION = 'v2.0.8dev24' +VERSION = 'v2.0.8dev25'