Index: palm/trunk/SCRIPTS/palm_wd
===================================================================
--- palm/trunk/SCRIPTS/palm_wd	(revision 1612)
+++ palm/trunk/SCRIPTS/palm_wd	(revision 1613)
@@ -20,5 +20,7 @@
 # Current revisions:
 # -----------------
-# 
+# Bugfix: tooltip for queuing name did not show up on first update.
+# New: added contect menu for showing the parameter file and the run control
+# output
 # 
 # Former revisions:
@@ -87,4 +89,32 @@
 job_data_list = []
 
+class MessageBoxScroll(QtGui.QMessageBox):
+    def __init__(self):
+        QtGui.QMessageBox.__init__(self)
+        self.setSizeGripEnabled(True)
+
+    def event(self, e):
+        result = QtGui.QMessageBox.event(self, e)
+
+        self.setMinimumHeight(100)
+        self.setMaximumHeight(16777215)
+        self.setMinimumWidth(400)
+        self.setMaximumWidth(16777215)
+        self.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
+
+        textEdit = self.findChild(QtGui.QTextEdit)
+        if textEdit != None :
+            textEdit.setMinimumHeight(800)
+            textEdit.setMaximumHeight(16777215)
+            textEdit.setMinimumWidth(1000)
+            textEdit.setMaximumWidth(16777215)
+            textEdit.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
+            f = QtGui.QFont('not_a_font') # 
+            f.setStyleHint(f.TypeWriter, f.PreferDefault)
+            textEdit.setFont(f)
+
+        return result
+
+
 # MainWindow class
 class Watchdog(QtGui.QMainWindow):
@@ -112,5 +142,5 @@
         self.table.setColumnHidden(6, True)
         self.table.setRowCount(0) 
-        
+    
         # Display MainWindow
         self.show()
@@ -145,8 +175,17 @@
        
         # "Show details" -> fetch details for the selected job
-        detailsjobAction = menu.addAction('Show details')     
+        detailsjobAction = menu.addAction('Show job details')     
         detailsjobAction.setStatusTip('Display detailed info for job')
         detailsjobAction.triggered.connect(self.ShowDetails)
 
+        # "Show parameter file" -> show the contents of PARIN
+        parinAction = menu.addAction('Show parameter file')     
+        parinAction.setStatusTip('Display the parameter file of the job (e.g. PARIN / _p3d)')
+        parinAction.triggered.connect(self.ShowPARIN)
+        
+        rcAction = menu.addAction('Show run control file')     
+        rcAction.setStatusTip('Display the current run control file (e.g. RUN_CONTROL / _rc)')
+        rcAction.triggered.connect(self.ShowRC)
+        
         # "Cancel job" -> remove job from queuing system
         canceljobAction = menu.addAction('Cancel job')
@@ -154,10 +193,10 @@
         canceljobAction.triggered.connect(self.CancelJob)
         
-        # "Force stop" -> remove job from queuing system
+        # "Force stop" -> force termination of job
         stopjobAction = menu.addAction('Force stop')
         stopjobAction.setStatusTip('Terminate job properly')
         stopjobAction.triggered.connect(self.DoStop)
    
-        # "Force restart" -> remove job from queuing system
+        # "Force restart" -> force rermination and restart of job
         restartjobAction = menu.addAction('Force restart')
         restartjobAction.setStatusTip('Terminate job properly and initiate restart')
@@ -184,8 +223,12 @@
 	    stopjobAction.setEnabled(True) 
             restartjobAction.setEnabled(True)   
+            parinAction.setEnabled(True)
+            rcAction.setEnabled(True)          
         else:
 	    stopjobAction.setEnabled(False) 
             restartjobAction.setEnabled(False)   
-   
+            parinAction.setEnabled(False)
+            rcAction.setEnabled(False)  
+            
         # Show the context menu
         action = menu.exec_(self.table.mapToGlobal(position))
@@ -373,5 +416,4 @@
                 item.setToolTip("Queuing name: " + job_data[to_display[j]][6])
                 self.table.setItem(i, 0, item)   
-                self.table.setItem(i, 0, QtGui.QTableWidgetItem(job_data[to_display[j]][0]))            
                 self.table.setItem(i, 1, QtGui.QTableWidgetItem(job_data[to_display[j]][1])) 
                 self.table.setItem(i, 2, QtGui.QTableWidgetItem(job_data[to_display[j]][2]))   
@@ -607,4 +649,71 @@
             notify = QtGui.QMessageBox.information(self,'Terminate job for restart',"Restart for job" + jobname + " was initiated!\n\nServer message:\n" + ''.join(result))
             
+
+    # Read the PARIN file of the job
+    def ShowPARIN(self):
+
+        # Return internal jobname
+        jobname = self.table.item(self.table.currentRow(),6).text()
+        jobrealname = self.table.item(self.table.currentRow(),0).text()     
+ 
+        # Check description of job in order to login on the correct host
+        descr = self.table.item(self.table.currentRow(),1).text()
+        for h in range(0,len(description)):
+	    if ( descr == description[h] ):
+                host = username[h] + "@" + hostname[h]
+                user = username[h]
+
+        ssh = sub.Popen(["ssh", "%s" % host, "/sw/tools/python/2.7.6/generic/bin/python palm_wdd parin " + user + " " + jobname],
+                           shell=False,
+                           stdout=sub.PIPE,
+                           stderr=sub.PIPE)
+        result = ssh.stdout.readlines()
+        result = filter(None, result)
+        
+        # In case of error display a warning message
+        if ( len(result) == 0 ):
+            error = ssh.stderr.readlines()
+            notify = QtGui.QMessageBox.warning(self,'Showing parameter file',"Error. Could not fetch parameter file for job " + jobrealname + " (" + jobname + ").\n\nError message:\n" + ''.join(error))
+
+        # Otherwise inform the user and mark the job in the table
+        else:
+	   mb = MessageBoxScroll()
+           mb.setText("Parameter file for job: " + jobrealname + "")
+           mb.setDetailedText(''.join(result))
+           mb.exec_()
+
+    # Read the PARIN file of the job
+    def ShowRC(self):
+
+        # Return internal jobname and real job name
+        jobname = self.table.item(self.table.currentRow(),6).text()
+        jobrealname = self.table.item(self.table.currentRow(),0).text()      
+ 
+        # Check description of job in order to login on the correct host
+        descr = self.table.item(self.table.currentRow(),1).text()
+        for h in range(0,len(description)):
+	    if ( descr == description[h] ):
+                host = username[h] + "@" + hostname[h]
+                user = username[h]
+
+        ssh = sub.Popen(["ssh", "%s" % host, "/sw/tools/python/2.7.6/generic/bin/python palm_wdd rc " + user + " " + jobname],
+                           shell=False,
+                           stdout=sub.PIPE,
+                           stderr=sub.PIPE)
+        result = ssh.stdout.readlines()
+        result = filter(None, result)
+        
+        # In case of error display a warning message
+        if ( len(result) == 0 ):
+            error = ssh.stderr.readlines()
+            notify = QtGui.QMessageBox.warning(self,'Showing run control',"Error. Could not fetch run control file for job " + jobrealname + "(" + jobname + ").\n\nError message:\n" + ''.join(error))
+
+        # Otherwise inform the user and mark the job in the table
+        else:
+	   mb = MessageBoxScroll()
+	   lastline = result[len(result)-2].split()[2]
+           mb.setText("Simulated time for job " + jobrealname + " is currently: " + lastline)
+           mb.setDetailedText(''.join(result))
+           mb.exec_()
 
     # Remove a job from list - removes the current row from the table and from
