Content
Introduction
The re-implementation of the LogBookGrabber
was intended keeping in mind a few goals for improvement:
- use
pyqt4
in stead oftk
as a GUI backend - add loading of graphical files from disk
- add the region editor of graphical files
- selection of tags from the list of available in db
- enable submission of the message copy to the instrumental ELog
- generate child message with results of processing the command in option "-c"
- make properly re-sizable GUI: the graphic window should be the only re-sizable object
- save/restore the configuration file defined by the option "-f" with parameters:
- tag
- description of image
- input and output file names for loading and saving images, respectively
GUI layout
Application uses a minimal set of windows and popping-up boxes. At first start of the application with default configuration parameters, it shows the short version of the main GUI. A check box may extend the number of control fields. Optional windows appear at click on "Help" and "Logger" buttons. These windows live as long as they needed. Warning message box may appear in case of incomplete or in-consistent input parameters, when
- the message box is empty
- the run number is shown together with response ID number.
Standard GUI for file selection/saving dialog may also pop-up when necessary. The typical layout of application specific windows is shown in plots for - Default GUI
- Extended GUI
- Internal logger
- Help box
- Warning message box
Functionality
LogBookGrabber
main GUI contains buttons, check box, edit and info fields, graphical viewer/editor window, which functionality is explained below.
Buttons
Buttons in short GUI (default):
Grab
– click on this button activates cursor to select the window or grab any rectangular area on monitor.Load
– activates the file selection menu to load the image from file. Image will appear in theAttachement
window.Reset
– clears the graphicalAttachement
window.Submit
– submits entire message in ELogExit
– closes the window, save current configuration parameters, closes all open windows, and exit application. The "x" button in the top right corner does the same operations, but does not save configuration file.Select tag
– activates the drop-down menu to select the tag from the list of known in the DB.Logger
– opens the internal logger window.Help
– displays in theLogger
help message about navigation in graphical window.
Additional button in extended GUI:
Save img.
– saves image in file. Image is saved in full format in limits as displayed in the graphicalAttachement
window. TheSave img.
button is visible if the image window is not empty.
Check box
Copy to ins. ELog
on/off the message copy to the instrumental ELog with appropriate information fields.
Edit fields
Message:
– window for message which will be sent to ELog.Run number:
– run number, which will be associated with this message (theResp. to ID:
should be empty).Resp. to ID:
– previous message ID number, which will be used for response(theRun number:
should be empty).Description:
– image will be saved in ELog with this file name.Tag
– tag associated with message, which can be used in ELog for filtering.
Information filds
Author
– user ID, who is an author of this message.Experiment
– experiment name, for exampleamodaq09
Instrument
– instrument name, one of the listAMO
,XPP
,SXR
,XCS
,CXI
,MEC
Last submitted message ID:
the last successfully submitted message ID number.Instrumental ELog
– instrumental ELog name for submission of the message copy, if theCopy to ins. ELog
check box is on.
Image viewer/editor
Attachement
– graphical window for image which will be attached to the message and will show-up in ELog. This window has a simple graphical editor, which allows to crop the significant part of the image. To crop - press left or right mouse button on image, drag, and release it on other point of the image. During mouse dragging, the rectangular with dashed-line boarder will show the selected region for zoom-in. Selected box should be at least 5x5 pixels size in order to be accepted. Click on middle mouse button undo zoom-in and restores previous image. Up to 10 earlier zoomed-in images can be returned by this undo method.
How to run application
Code location
Code resides in the directory: /reg/g/pcds/pds/grabber/bin/
and consists of modules:
LogBookGrabber_qt.py LogBookWebService.py icons/*
Command line
To start the LogBookGrabber
application use commands:
setenv PYTHONPATH ${PYTHONPATH}:/reg/g/pcds/pds/grabber/lib/python2.7/site-packages /reg/g/pcds/pds/grabber/bin/LogBookGrabber_qt.py -i <INSTRUMENT>[:<station>] -e <experiment-name> -u <user-name> -p <password> -w <web-service> -f <configuration-file> -c <child-message-command>
For example:
/reg/g/pcds/pds/grabber/bin/LogBookGrabber_qt.py -i AMO:0 -e amodaq09 -u amoopr -p <password> -w https://pswww.slac.stanford.edu/ws-auth -f config-pars.txt -c "ls -l"
Optional parameters
Optional parameters can be seen using option "-h":
/reg/g/pcds/pds/grabber/bin/LogBookGrabber_qt.py -h
Options: -h, --help show this help message and exit -i INSSTA, --ins=INSSTA the name of an instrument and station <INS>[:<station-number>] -e EXP, --exp=EXP the name of some specific experiment -w URL, --url=URL the base URL of the LogBook web service -u USR, --usr=USR the user name to connect to the web service -p PAS, --pas=PAS the password to connect to the web service -c CMD, --cmd=CMD the command for child message -f CFNAME, --cfg=CFNAME the file name with configuration parameters
option "-i <INSTRUMENT>[:<station>]"
This parameter contains the name of instrument and optional station number, for example AMO
, AMO:0
, etc.
option "-e <experiment-name>"
The experiment name where messages will be submitted, for example amodaq09
.
option "-u <user-name>"
The name of the user, for example amoopr
. User should have a permission to submit messages in the experimental and instrumental ELogs.
option "-p <password>"
User password. User need to pass two authorizations for submission of messages in the experimental and instrumental ELogs, respectively.
option "-w <web-service>"
Currently use <web-service> = https://pswww.slac.stanford.edu/ws-auth
option "-c <child-message-command>"
At click on Submit
button, the regular message is submitted and its ID number is returned.
If this option is specified, the second message is submitted as an attachment to the first message with text produced by the command, specified in this option. For example, <child-message-command> = "ls -l"
.
option "-f <configuration-file>"
If this parameter is missing, the default configuration file name confpars-grabber.txt
is used. If file is missing in local directory, the default parameters will be used. At click on Exit
button, current parameters will be saved in the configuration file, all open windows will be closed. Click on "x"
button in the top right corner of the main window does the same operations, but does not save configuration file.