Skip to content

[Bug] GUI generated by Simple Python Editor reopens instead of executing the command if default settings are used #5524

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

Closed
klimesm opened this issue Apr 10, 2025 · 3 comments · Fixed by #5603
Assignees
Labels
bug Something isn't working GUI wxGUI related Python Related code is in Python
Milestone

Comments

@klimesm
Copy link

klimesm commented Apr 10, 2025

Describe the bug

When using the Simple Python Editor to create a custom GRASS module with a GUI interface, there's an issue when running the module without changing any of the default values in the GUI. Instead of executing the command, the GUI simply reopens, and the command is not run. If any parameter is changed, the module runs correctly.

To reproduce

  1. Create a module using Simple Python Editor.
  2. Leave all parameters in their default state.
  3. Run the module via GUI.
  4. the GUI reopens instead of executing the command.

Expected behavior

The module should execute with the default parameters, without requiring the user to change any values.

@klimesm klimesm added the bug Something isn't working label Apr 10, 2025
@petrasovaa
Copy link
Contributor

Could you provide an example when this happens?

@klimesm
Copy link
Author

klimesm commented Apr 26, 2025

Yes, for clarification, it happens only if none of the parameters are required and left unchanged at the same time. If some of the parameters are required, it works normally.

#!/usr/bin/env python3

#

##############################################################################

#

# MODULE:       model

#

# AUTHOR(S):    martin

#

# PURPOSE:      Script generated by wxGUI Graphical Modeler.

#

# DATE:         Wed Apr  3 22:01:42 2024

#

##############################################################################



# %module

# % description: Script generated by wxGUI Graphical Modeler.

# %end

# %option

# % key: resolution

# % description: Target resolution

# % required: no

# % type: integer

# % answer: 5

# %end



import sys



from grass.script import parser



def cleanup():

    pass



def collect_files(path):

    pass



def main(options, flags):

    pass



def process_product(name):

    pass



if __name__ == "__main__":

    options, flags = parser()

    sys.exit(main(options, flags))


@pesekon2
Copy link
Contributor

The issue is much worse. The same happens if you run the script provided by @klimesm from gconsole. And with the --ui option on, it happens also for required parameters.

I should have a fix though. I'll just test it a bit more and open a PR.

@pesekon2 pesekon2 self-assigned this Apr 28, 2025
@pesekon2 pesekon2 added GUI wxGUI related Python Related code is in Python labels Apr 28, 2025
pesekon2 added a commit to pesekon2/grass that referenced this issue Apr 28, 2025
pesekon2 added a commit that referenced this issue Apr 28, 2025
@neteler neteler added this to the 8.4.2 milestone Apr 29, 2025
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 Python Related code is in Python
Projects
None yet
4 participants