Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feature/10706_indirect_python_refactor
Conflicts: Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectResolution.py Refs #10706
- Loading branch information
Showing
66 changed files
with
4,179 additions
and
1,098 deletions.
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
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
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
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,25 @@ | ||
SysMon | ||
====== | ||
|
||
Python qt system monitor which utilizes the Python psutil and platform modules to provide system information for display. | ||
|
||
This application has been adapted to work with psutil version 1 and version 2 modules as there are some command syntax changes between these two versions. | ||
|
||
The SysMon user interface has been divided into a main window which imports the tabs to make a standalone application, or the tabs can be imported into other applications as a QWidget. Thus there are separate .ui files corresponding to each. | ||
|
||
The code which imports the tabs into the main program resides in SysMon.pyw. This is where to look to see how to include the tabs into your own application. All files except SysMon.pyw and ui_sysmonMainWindow.* will be required when tabs are incorporated in other applications. | ||
|
||
The following command line arguments have been added: | ||
--help to print out the help message. | ||
--nompl to run the application minus matplotlib in support of the current MantidPlot (removes those tabs requiring matplotlib). | ||
--custom to enable the custom menubar item in the standalone application (currently supports checking Matlab license status on SNS analysis computers). | ||
|
||
To run as a standalone application via the corresponding command lines: | ||
*Change to the folder containing the Sysmon software, then: | ||
*DOS: python SysMon.pyw | ||
*Linux: ./SysMon.pyw | ||
|
||
The standalone application been tested on Windows and RHEL Linux, but not on Mac yet. | ||
|
||
Note that configuration and global constants and variables now reside in config.py. | ||
|
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,114 @@ | ||
#!/usr/bin/python | ||
""" | ||
SysMon.pyw | ||
Initial application development 03Sep14 by S. Miller | ||
The application utilizes the psutil and platform python modules to provide system information | ||
for display via text fields, a table and Matplotlib plots. | ||
The application utilizes a timer with user selectable timer intervals to update information | ||
provided to the application. | ||
""" | ||
import config | ||
import sys | ||
|
||
__version__="unknown" | ||
try: | ||
from _version import __version__ | ||
except ImportError: | ||
#_version.py file not found - version not known in this case so use | ||
#the default previously given. | ||
pass | ||
|
||
#parse args - doing it here as config structure needs to be filled prior to importing sysmon | ||
if ['--nompl'] == [s for s in sys.argv if '--nompl' in s]: | ||
#case to not use matplotlib | ||
config.nompl=True | ||
else: | ||
#case to use matplotlib (default case) | ||
config.nompl=False | ||
|
||
if ['--help'] == [s for s in sys.argv if '--help' in s]: | ||
print "SysMon Help" | ||
print "--help - this message" | ||
print "--nompl - flag to disable using matplotlib, also disables History and Users tabs" | ||
print "--custom: - flag to use facility specific options" | ||
sys.exit() | ||
|
||
if ['--custom'] == [s for s in sys.argv if '--custom' in s]: | ||
config.custom=True | ||
|
||
from PyQt4 import QtGui | ||
|
||
from ui_sysmonMainWindow import * | ||
#from ui_sysmonTabs import * | ||
from sysmon import * | ||
|
||
class SysMonMainWindow(QtGui.QMainWindow): | ||
|
||
def __init__(self, parent=None): | ||
#setup main window | ||
QtGui.QMainWindow.__init__(self, parent) | ||
self.setWindowTitle("System Status") | ||
self.ui = Ui_MainWindow() #defined from ui_sysmon.py | ||
self.ui.setupUi(self) | ||
#setup tabs - class imported from sysmon.py | ||
self.sysmontabs=SysMon(self) | ||
self.setCentralWidget(self.sysmontabs) | ||
|
||
#setup menu bar actions | ||
self.connect(self.ui.actionExit, QtCore.SIGNAL('triggered()'), self.confirmExit) #define function to confirm and perform exit | ||
self.connect(self.ui.actionAbout, QtCore.SIGNAL('triggered()'), self.About) | ||
self.connect(self.ui.actionCheck_Matlab_Licenses, QtCore.SIGNAL('triggered()'), self.updateMatlab) | ||
|
||
#check if custom menu bar enabled via command line flag --custom and if not, remove it as it's built by default from Qt | ||
if not(config.custom): | ||
self.ui.menubar.removeAction(self.ui.menuCustom.menuAction()) | ||
|
||
|
||
#define methods for menu bar options | ||
def confirmExit(self): | ||
reply = QtGui.QMessageBox.question(self, 'Message', | ||
"Are you sure to quit?", QtGui.QMessageBox.Yes | | ||
QtGui.QMessageBox.No, QtGui.QMessageBox.No) | ||
|
||
if reply == QtGui.QMessageBox.Yes: | ||
#close application | ||
self.close() | ||
else: | ||
#do nothing and return | ||
pass | ||
|
||
def About(self): | ||
dialog=QtGui.QMessageBox(self) | ||
dialog.setText("PyQt4 System Monitoring Application "+__version__) | ||
info='Application Info: \n\r * Changing the Update Rate Clears plots \n\r * It may take one full new update cycle for changes to take effect \n\r * Update rate shown in History plot xaxis label \n\r * Process tab CPU percentage can be greater than 100 when more than a single core is involved' | ||
dialog.setDetailedText(info) #give full info in detailed text | ||
dialog.exec_() | ||
|
||
def updateMatlab(self): | ||
#run license server command to extract license info | ||
info=commands.getstatusoutput(config.matlabchk) | ||
info=str(info[1]) #seem to need to make this a string for Linux to work properly | ||
#test if info string contains MATLAB info | ||
if info.find("MATLAB") < 0: | ||
#case where no license server found | ||
outstr="No Matlab License Server Found to Check" | ||
else: | ||
indx0=info.find("Users of MATLAB:") | ||
indx1=info.find("licenses in use") | ||
if indx0 > -1 and indx1 > -1: | ||
outstr=info[indx0:indx1+15+1] | ||
else: | ||
outstr="Unable to determine Matlab license information" | ||
dialog=QtGui.QMessageBox(self) | ||
#print "outstr: "+outstr | ||
dialog.setText(outstr) | ||
dialog.setDetailedText(info) #give full info in detailed text | ||
dialog.exec_() | ||
|
||
if __name__=="__main__": | ||
app = QtGui.QApplication(sys.argv) | ||
sysmon = SysMonMainWindow() | ||
sysmon.show() | ||
|
||
sys.exit(app.exec_()) |
Empty file.
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,4 @@ | ||
#File to identify the current version of the software | ||
#Note that this file must be manually updated to contain the same | ||
#version number as the git tag for the check-in. | ||
__version__="v0.29" |
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,20 @@ | ||
|
||
#global definitions for constants and variables | ||
|
||
#Tab indices - based upon the order of the tabs as built via Qt and these must be the same as the Qt GUI. | ||
SYST_TAB=0 | ||
HIST_TAB=1 | ||
PROC_TAB=2 | ||
USER_TAB=3 | ||
OPTS_TAB=4 | ||
|
||
#Global Variables: | ||
psutilVer=0 #flag for the version of psutil being used | ||
nompl=False #Flag to indicate if using matplotlib - True, then do not use plots, False, then try to use matplotlib plots | ||
mplLoaded=False #flag for matplotlib loading | ||
custom=False #flag to indicate if the custom interface is to be used (usually not) | ||
matlabchk='lmstat -S -c 27010@licenses1.sns.gov' #text command to status the Matlab license server (only for custom mode with SysMon.pyw) | ||
basefontsize=9 #basic font size when GUI is at minimum size | ||
fscl=0.5 #scale factor for font size change with GUI resizing - less than one, font size slower than GUI size change, and greater than one font size faster than GUI size change | ||
pltFont=9 #initial font size for matplotlib plots | ||
linewidth=1 #initial line widths for matplotlib plots |
Oops, something went wrong.