diff --git a/examples/shell_command/shell_command_bash.ui b/examples/shell_command/shell_command_full_shell.ui similarity index 87% rename from examples/shell_command/shell_command_bash.ui rename to examples/shell_command/shell_command_full_shell.ui index 7653570c6..25e900464 100644 --- a/examples/shell_command/shell_command_bash.ui +++ b/examples/shell_command/shell_command_full_shell.ui @@ -6,8 +6,8 @@ 0 0 - 379 - 358 + 458 + 386 @@ -23,7 +23,7 @@ - The PyDMShellCommand button with run your command through a Bash shell if you enable the "runCommandsInBash" option. + <html><head/><body><p>The PyDMShellCommand button with run your command through a full shell if you enable the 'runCmdsInFullShell' option. This allows you to use some additional features such as shell syntax ('|', '&amp;', ';', etc), environment variables ($VAR), glob expansion ('*', '?', etc), and some other features.</p><p><br/></p></body></html> true @@ -96,7 +96,7 @@ - You also can run through Bash (without needing to enable the option) by specifying "bash -c" at the start of your command or by having the shell command call a script the runs multiple commands. + You can run through a Bash shell (without needing to enable any options) by specifying "bash -c" at the start of your command. true @@ -166,6 +166,16 @@ + + + + You can also call a shell script. For this button to work correctly, run pydm from dir 'examples/shell_command' so it can find the script file. + + + true + + + diff --git a/pydm/widgets/shell_command.py b/pydm/widgets/shell_command.py index 82b958f2e..5d90e9873 100644 --- a/pydm/widgets/shell_command.py +++ b/pydm/widgets/shell_command.py @@ -68,7 +68,8 @@ def __init__( self.process = None self._show_icon = True self._redirect_output = False - # shell allows for more options such as command chaining ("cmd1;cmd2", "cmd1 && cmd2", etc ...) + # shell allows for more options such as command chaining ("cmd1;cmd2", "cmd1 && cmd2", etc ...), + # use of environment variables, glob expansion ('ls *.txt'), etc... self._run_cmds_in_full_shell = False self._password_protected = False @@ -129,7 +130,7 @@ def showConfirmDialog(self, value: bool) -> None: self._show_confirm_dialog = value @Property(bool) - def runCommandsInFullShell(self) -> bool: + def runCmdsInFullShell(self) -> bool: """ Whether or not to run cmds with Popen's option for running them through a shell subprocess. @@ -139,8 +140,8 @@ def runCommandsInFullShell(self) -> bool: """ return self._run_cmds_in_full_shell - @runCommandsInFullShell.setter - def runCommandsInFullShell(self, value: bool) -> None: + @runCmdsInFullShell.setter + def runCmdsInFullShell(self, value: bool) -> None: """ Whether or not to run cmds with Popen's option for running them through a shell subprocess. @@ -551,7 +552,7 @@ def execute_command(self, command: str) -> None: if (self.process is None or self.process.poll() is not None) or self._allow_multiple: cmd = os.path.expanduser(os.path.expandvars(command)) args = shlex.split(cmd, posix="win" not in sys.platform) - # when Bash enabled, Popen takes the cmds as a single string (not list) + # when shell enabled, Popen should take the cmds as a single string (not list) if self._run_cmds_in_full_shell: args = cmd try: