-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1045 from nstelter-slac/shell_cmd_bash_option
PyDMShellCommand bash option
- Loading branch information
Showing
3 changed files
with
294 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/sh | ||
|
||
# This script can be called by a PyDMShellCommand widget, | ||
# allowing it to make use of command chaining and other shell features. | ||
echo "Hello World!" && echo "Hello Again!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,256 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>Form</class> | ||
<widget class="QWidget" name="Form"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>458</width> | ||
<height>386</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>Form</string> | ||
</property> | ||
<layout class="QVBoxLayout" name="verticalLayout"> | ||
<item> | ||
<widget class="QLabel" name="label"> | ||
<property name="sizePolicy"> | ||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum"> | ||
<horstretch>0</horstretch> | ||
<verstretch>0</verstretch> | ||
</sizepolicy> | ||
</property> | ||
<property name="text"> | ||
<string><html><head/><body><p>The PyDMShellCommand button with run your command through a full shell if you enable the 'runCommandsInFullShell' 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></body></html></string> | ||
</property> | ||
<property name="wordWrap"> | ||
<bool>true</bool> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<widget class="PyDMShellCommand" name="PyDMShellCommand"> | ||
<property name="toolTip"> | ||
<string/> | ||
</property> | ||
<property name="whatsThis"> | ||
<string/> | ||
</property> | ||
<property name="text"> | ||
<string>runCmdsInFullShell Option Enabled</string> | ||
</property> | ||
<property name="alarmSensitiveContent" stdset="0"> | ||
<bool>false</bool> | ||
</property> | ||
<property name="alarmSensitiveBorder" stdset="0"> | ||
<bool>true</bool> | ||
</property> | ||
<property name="PyDMToolTip" stdset="0"> | ||
<string/> | ||
</property> | ||
<property name="channel" stdset="0"> | ||
<string/> | ||
</property> | ||
<property name="showConfirmDialog" stdset="0"> | ||
<bool>false</bool> | ||
</property> | ||
<property name="runCommandsInFullShell" stdset="0"> | ||
<bool>true</bool> | ||
</property> | ||
<property name="confirmMessage" stdset="0"> | ||
<string>Are you sure you want to proceed?</string> | ||
</property> | ||
<property name="environmentVariables" stdset="0"> | ||
<string/> | ||
</property> | ||
<property name="showIcon" stdset="0"> | ||
<bool>true</bool> | ||
</property> | ||
<property name="redirectCommandOutput" stdset="0"> | ||
<bool>true</bool> | ||
</property> | ||
<property name="allowMultipleExecutions" stdset="0"> | ||
<bool>false</bool> | ||
</property> | ||
<property name="titles" stdset="0"> | ||
<stringlist/> | ||
</property> | ||
<property name="commands" stdset="0"> | ||
<stringlist> | ||
<string>echo First; echo Second</string> | ||
</stringlist> | ||
</property> | ||
<property name="passwordProtected" stdset="0"> | ||
<bool>false</bool> | ||
</property> | ||
<property name="password" stdset="0"> | ||
<string/> | ||
</property> | ||
<property name="protectedPassword" stdset="0"> | ||
<string/> | ||
</property> | ||
<property name="runCommandsInBash" stdset="0"> | ||
<bool>true</bool> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<widget class="QLabel" name="label_2"> | ||
<property name="text"> | ||
<string>You can run through a Bash shell (without needing to enable any options) by specifying "bash -c" at the start of your command. </string> | ||
</property> | ||
<property name="wordWrap"> | ||
<bool>true</bool> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<widget class="PyDMShellCommand" name="PyDMShellCommand_3"> | ||
<property name="toolTip"> | ||
<string/> | ||
</property> | ||
<property name="whatsThis"> | ||
<string/> | ||
</property> | ||
<property name="text"> | ||
<string>Using "-c bash"</string> | ||
</property> | ||
<property name="alarmSensitiveContent" stdset="0"> | ||
<bool>false</bool> | ||
</property> | ||
<property name="alarmSensitiveBorder" stdset="0"> | ||
<bool>true</bool> | ||
</property> | ||
<property name="PyDMToolTip" stdset="0"> | ||
<string/> | ||
</property> | ||
<property name="channel" stdset="0"> | ||
<string/> | ||
</property> | ||
<property name="showConfirmDialog" stdset="0"> | ||
<bool>false</bool> | ||
</property> | ||
<property name="confirmMessage" stdset="0"> | ||
<string>Are you sure you want to proceed?</string> | ||
</property> | ||
<property name="environmentVariables" stdset="0"> | ||
<string/> | ||
</property> | ||
<property name="showIcon" stdset="0"> | ||
<bool>true</bool> | ||
</property> | ||
<property name="redirectCommandOutput" stdset="0"> | ||
<bool>true</bool> | ||
</property> | ||
<property name="allowMultipleExecutions" stdset="0"> | ||
<bool>false</bool> | ||
</property> | ||
<property name="titles" stdset="0"> | ||
<stringlist/> | ||
</property> | ||
<property name="commands" stdset="0"> | ||
<stringlist> | ||
<string>bash -c "echo 'Hello One'; echo 'Hello two'"</string> | ||
</stringlist> | ||
</property> | ||
<property name="passwordProtected" stdset="0"> | ||
<bool>false</bool> | ||
</property> | ||
<property name="password" stdset="0"> | ||
<string/> | ||
</property> | ||
<property name="protectedPassword" stdset="0"> | ||
<string/> | ||
</property> | ||
<property name="runCommandsInBash" stdset="0"> | ||
<bool>false</bool> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<widget class="QLabel" name="label_3"> | ||
<property name="text"> | ||
<string>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.</string> | ||
</property> | ||
<property name="wordWrap"> | ||
<bool>true</bool> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<widget class="PyDMShellCommand" name="PyDMShellCommand_2"> | ||
<property name="toolTip"> | ||
<string/> | ||
</property> | ||
<property name="text"> | ||
<string>Calling external script</string> | ||
</property> | ||
<property name="alarmSensitiveContent" stdset="0"> | ||
<bool>false</bool> | ||
</property> | ||
<property name="alarmSensitiveBorder" stdset="0"> | ||
<bool>true</bool> | ||
</property> | ||
<property name="PyDMToolTip" stdset="0"> | ||
<string/> | ||
</property> | ||
<property name="channel" stdset="0"> | ||
<string/> | ||
</property> | ||
<property name="showConfirmDialog" stdset="0"> | ||
<bool>false</bool> | ||
</property> | ||
<property name="confirmMessage" stdset="0"> | ||
<string>Are you sure you want to proceed?</string> | ||
</property> | ||
<property name="environmentVariables" stdset="0"> | ||
<string/> | ||
</property> | ||
<property name="showIcon" stdset="0"> | ||
<bool>true</bool> | ||
</property> | ||
<property name="redirectCommandOutput" stdset="0"> | ||
<bool>true</bool> | ||
</property> | ||
<property name="allowMultipleExecutions" stdset="0"> | ||
<bool>false</bool> | ||
</property> | ||
<property name="titles" stdset="0"> | ||
<stringlist> | ||
<string>Print "Hello, World!" to terminal</string> | ||
<string>Print current working directory to terminal</string> | ||
</stringlist> | ||
</property> | ||
<property name="commands" stdset="0"> | ||
<stringlist> | ||
<string>./example_cmd.sh</string> | ||
</stringlist> | ||
</property> | ||
<property name="passwordProtected" stdset="0"> | ||
<bool>false</bool> | ||
</property> | ||
<property name="password" stdset="0"> | ||
<string/> | ||
</property> | ||
<property name="protectedPassword" stdset="0"> | ||
<string/> | ||
</property> | ||
<property name="runCommandsInBash" stdset="0"> | ||
<bool>false</bool> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</widget> | ||
<customwidgets> | ||
<customwidget> | ||
<class>PyDMShellCommand</class> | ||
<extends>QPushButton</extends> | ||
<header>pydm.widgets.shell_command</header> | ||
</customwidget> | ||
</customwidgets> | ||
<resources/> | ||
<connections/> | ||
</ui> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters