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
Boltex/issue3760 #3761
Boltex/issue3760 #3761
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Big improvements on leoserver for UNL click support and other general improvements to the server! :)
I've made it a draft for now as I'd like to add one more small feature to the server still :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
PR #3762 changes various documentation files, especially LeoDocs.leo
. I've converted leoInteg
to LeoInteg
there. Ditto for leoJS
to LeoJS
.
So please revert LeoDocs.leo
and acknowledgements.html.txt.txt
to devel. That will make it easier for me to merge my branch.
Along with UNL handling, (Thanks to the new server 'open2' event logic) 'goto script' can now find button origin in other files like myLeoSettings and leoSettings.
@edreamleo Even better: I'll wait until you merge #3762 into devel, then I'll pull devel into #3760, making sure any conflicts are resolved and dealt into #3760 by myself, (if any). Then you will be able to merge it into devel without any conflicts for sure. The trouble of providing a branch to be merged smoothly without any conflicts to resolve should rest on the person making the new feature branch. You should not have to worry about annoying merge conflicts on top of the rest! 😆 |
@boltex The documentation changes are live: https://leo-editor.github.io/leo-editor/writingPlugins.html#handling-events |
…e commander nor the node. The docstring now reflects this.
@tbpassin @edreamleo These modifications on leoserver.py enables many new features in leoInteg, among which, the possibility to right-click on an @button originating from another file (myLeoSettings.leo containing @buttons outlines) and choose 'goto-script' to find the @buttons script origin node! 😄 Thanks to @tbpassin for letting me know about this missing feature when he tested LeoJS! (which also now supports this feature) I'll release the new LeoInteg version as soon as Leo 6.7.7. is launched! 🚀 |
I just tested this branch. Here are the results: ft.cmd
..........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................EException in test_most_public_server_methods: 'find_quick_changed' 'Commands' object has no attribute 'patched_quicksearch_controller'
Exception in test_most_public_server_methods: 'find_quick_history' 'Commands' object has no attribute 'patched_quicksearch_controller'
Exception in test_most_public_server_methods: 'find_quick_marked' 'Commands' object has no attribute 'patched_quicksearch_controller'
Exception in test_most_public_server_methods: 'find_quick_timeline' 'Commands' object has no attribute 'patched_quicksearch_controller'
Exception in test_most_public_server_methods: 'get_goto_panel' get_goto_panel: exception doing nav search: 'Commands' object has no attribute 'patched_quicksearch_controller'
Exception in test_most_public_server_methods: 'get_search_settings' 'Commands' object has no attribute 'patched_quicksearch_controller'
Exception in test_most_public_server_methods: 'goto_nav_entry' 'Commands' object has no attribute 'patched_quicksearch_controller'
Exception in test_most_public_server_methods: 'interactive_search' 'NoneType' object has no attribute 'set_find_text'
Exception in test_most_public_server_methods: 'nav_clear' 'Commands' object has no attribute 'patched_quicksearch_controller'
Exception in test_most_public_server_methods: 'nav_headline_search' nav_headline_search: exception doing nav headline search: 'Commands' object has no attribute 'patched_quicksearch_controller'
Exception in test_most_public_server_methods: 'nav_search' 'Commands' object has no attribute 'patched_quicksearch_controller'
Exception in test_most_public_server_methods: 'replace' replace: Running change operation gave exception: 'NoneType' object has no attribute 'get_settings'
Exception in test_most_public_server_methods: 'replace_all' replace_all: Running change operation gave exception: 'NoneType' object has no attribute 'get_settings'
Exception in test_most_public_server_methods: 'replace_then_find' replace_then_find: Running change operation gave exception: 'NoneType' object has no attribute 'get_settings'
.E..................................................................................................................................
======================================================================
ERROR: test_find_commands (leo.unittests.core.test_leoserver.TestLeoServer.test_find_commands)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Repos\leo-editor\leo\core\leoserver.py", line 1937, in find_all
settings = fc.ftm.get_settings()
^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get_settings'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Repos\leo-editor\leo\unittests\core\test_leoserver.py", line 194, in test_find_commands
answer = self._request(method, {"log": log, "find_text": "def"})
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Repos\leo-editor\leo\unittests\core\test_leoserver.py", line 64, in _request
response = server._do_message(d)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Repos\leo-editor\leo\core\leoserver.py", line 4769, in _do_message
result = func(action, param)
^^^^^^^^^^^^^^^^^^^
File "C:\Repos\leo-editor\leo\core\leoserver.py", line 4785, in _do_server_command
return func(param)
^^^^^^^^^^^
File "C:\Repos\leo-editor\leo\core\leoserver.py", line 1940, in find_all
raise ServerError(f"{tag}: exception running 'find all': {e}")
leo.core.leoserver.ServerError: find_all: exception running 'find all': 'NoneType' object has no attribute 'get_settings'
======================================================================
ERROR: test_open_and_close (leo.unittests.core.test_leoserver.TestLeoServer.test_open_and_close)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Repos\leo-editor\leo\unittests\core\test_leoserver.py", line 181, in test_open_and_close
self._request(action, package)
File "C:\Repos\leo-editor\leo\unittests\core\test_leoserver.py", line 64, in _request
response = server._do_message(d)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Repos\leo-editor\leo\core\leoserver.py", line 4769, in _do_message
result = func(action, param)
^^^^^^^^^^^^^^^^^^^
File "C:\Repos\leo-editor\leo\core\leoserver.py", line 4785, in _do_server_command
return func(param)
^^^^^^^^^^^
File "C:\Repos\leo-editor\leo\core\leoserver.py", line 1336, in close_file
c = self._check_c(param)
^^^^^^^^^^^^^^^^^^^^
File "C:\Repos\leo-editor\leo\core\leoserver.py", line 4591, in _check_c
raise ServerError(f"{tag}: no open commander")
leo.core.leoserver.ServerError: _check_c: no open commander
----------------------------------------------------------------------
Ran 895 tests in 6.709s
FAILED (errors=2)
ruff leo\core, leo\commands, leo\plugins\qt...
leo\core\leoserver.py:1606:29: F841 [*] Local variable `e` is assigned to but never used
Found 1 error.
[*] 1 fixable with the `--fix` option.
mypy-leo
Success: no issues found in 260 source files
Done!
C:\Repos\leo-editor> |
@boltex I'll release Leo 6.7.7 as soon as we merge this PR. I'll move all other issues to 6.7.8. |
@edreamleo Do you know why event hooks do not trigger when running all tests but they trigger when running individual tests like I posted above? That would greatly help me resolve this! (thanks in advance, in the meantime i'll investigate some more to see if I can find why - probably a switch that gets turned off by a previous test running in the chain) |
…unitTesting is true.
@edreamleo I found a way! 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Elegant fix at line 1275. However, the test should use isinstance:
if g.unitTesting and isinstance(g.app.pluginsController, NullObject):
@boltex Or probably |
@boltex dc919a5 fixes some quirps. The most serious: pylint pointed out that at lines 5124 and 5128 the code should raise the indicated exceptions. However, running the unit tests raises the exception at line 5128 (marked with '###'). Perhaps What do you think? |
I've looked at what you've tuned up and it looks good. I've also re-tested the new features just to make sure. It all still works, so this looks very good to me 😄 |
@edreamleo Many thanks to you for those fixes! |
Fixes #3760.
The Server now hooks onto 'open2' event to finalize newly created commander that
would normally be added to the window tabs.
This matches the two other source of opened documents in leoApp.py.