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

wxGUI: Fix command parsing in "add tool" dialog in Graphical Modeler #3022

Merged
merged 2 commits into from
Jun 6, 2023

Conversation

landam
Copy link
Member

@landam landam commented Jun 5, 2023

Steps to reproduce a bug

  1. Add new tool into model
  2. Enter selected GRASS tool in Command
  3. Press Enter

image

It fails with

Traceback (most recent call last):
  File "/home/landa/src/grass/dist.x86_64-pc-linux-gnu/gui/wxpython/gui_core/prompt.py", line 490, in OnKeyPressed
    self._runCmd(self.GetCurLine()[0].strip())
  File "/home/landa/src/grass/dist.x86_64-pc-linux-gnu/gui/wxpython/gui_core/prompt.py", line 138, in _runCmd
    self.promptRunCmd.emit(cmd={"cmd": cmd, "cmdString": str(cmdString)})
  File "/home/landa/src/grass/dist.x86_64-pc-linux-gnu/etc/python/grass/pydispatch/signal.py", line 233, in emit
    dispatcher.send(signal=self, *args, **kwargs)
  File "/home/landa/src/grass/dist.x86_64-pc-linux-gnu/etc/python/grass/pydispatch/dispatcher.py", line 344, in send
    response = robustapply.robustApply(
  File "/home/landa/src/grass/dist.x86_64-pc-linux-gnu/etc/python/grass/pydispatch/robustapply.py", line 60, in robustApply
    return receiver(*arguments, **named)
  File "/home/landa/src/grass/dist.x86_64-pc-linux-gnu/gui/wxpython/gmodeler/dialogs.py", line 328, in OnCommand
    if self.ValidateCmd(cmd):
  File "/home/landa/src/grass/dist.x86_64-pc-linux-gnu/gui/wxpython/gmodeler/dialogs.py", line 314, in ValidateCmd
    if cmd[0] not in globalvar.grassCmd:
KeyError: 0

Reason of failure: GPromptSTC's returns dictionary instead of list (which is expected by Graphical Modeler): https://github.com/OSGeo/grass/blob/main/gui/wxpython/gui_core/prompt.py#L138

@landam landam self-assigned this Jun 5, 2023
@landam landam requested a review from pesekon2 June 5, 2023 10:30
@landam landam added bug Something isn't working GUI wxGUI related labels Jun 5, 2023
@landam landam added this to the 8.3.0 milestone Jun 5, 2023
@landam landam merged commit a5f8548 into OSGeo:main Jun 6, 2023
@landam landam deleted the fix_gmodeler_search_tool branch June 6, 2023 09:05
@wenzeslaus wenzeslaus changed the title Graphical Modeler: fix command parsing in "add tool" dialog wxGUI: Fix command parsing in "add tool" dialog in Graphical Modeler Jun 6, 2023
neteler pushed a commit to nilason/grass that referenced this pull request Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working GUI wxGUI related
Development

Successfully merging this pull request may close these issues.

2 participants