Skip to content

Commit

Permalink
Allow non-rendering modules to run
Browse files Browse the repository at this point in the history
  • Loading branch information
HuidaeCho committed Mar 14, 2024
1 parent 594f59e commit 915659f
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions display/d.mon/render_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@
from grass.script import task as gtask
from grass.exceptions import CalledModuleError

non_rendering_modules = (
"d.colorlist",
"d.font",
"d.fontlist",
"d.frame",
"d.info",
"d.mon",
"d.out.file",
"d.to.rast",
"d.what.rast",
"d.what.vect",
"d.where",
)


# read environment variables from file
def read_env_file(env_file):
Expand Down Expand Up @@ -49,19 +63,7 @@ def render(cmd, mapfile):

# update cmd file
def update_cmd_file(cmd_file, cmd, mapfile):
if cmd[0] in (
"d.colorlist",
"d.font",
"d.fontlist",
"d.frame",
"d.info",
"d.mon",
"d.out.file",
"d.to.rast",
"d.what.rast",
"d.what.vect",
"d.where",
):
if cmd[0] in non_rendering_modules:
return

mode = "w" if cmd[0] == "d.erase" else "a"
Expand Down Expand Up @@ -165,8 +167,10 @@ def read_stdin(cmd):

read_stdin(cmd)

# wx monitors will render new layers internally
if not mon.startswith("wx"):
# wx monitors will render new layers internally so don't render them here;
# also, some display modules print information to the terminal rather than
# rendering any contents on the monitor so allow them to run here
if not mon.startswith("wx") or cmd[0] in non_rendering_modules:
render(cmd, mapfile)

update_cmd_file(os.path.join(path, "cmd"), cmd, mapfile)
Expand Down

0 comments on commit 915659f

Please sign in to comment.