Index: branches/casa-prerelease/pre-asap/python/asapplotter.py
===================================================================
--- branches/casa-prerelease/pre-asap/python/asapplotter.py	(revision 2052)
+++ branches/casa-prerelease/pre-asap/python/asapplotter.py	(revision 2054)
@@ -55,6 +55,5 @@
         self._ipanel = -1
         self._panelrows = []
-        self._headstring = None
-        self._headsize = None
+        self._headtext={'string': None, 'textobj': None}
 
     def _translate(self, instr):
@@ -847,6 +846,5 @@
 
     def _reset_header(self):
-        self._headsize = None
-        self._headstring = None
+        self._headtext={'string': None, 'textobj': None}
 
     def _plot(self, scan):
@@ -1384,13 +1382,13 @@
     # printing header information
     @asaplog_post_dec
-    def print_header(self, plot=True, fontsize=None, logger=False, selstr='', extrastr=''):
+    def print_header(self, plot=True, fontsize=9, logger=False, selstr='', extrastr=''):
         """
         print data (scantable) header on the plot and/or logger.
         Parameters:
             plot:      whether or not print header info on the plot.
-            fontsize:  header font size (valid only plot=True) default: 9
+            fontsize:  header font size (valid only plot=True)
             logger:    whether or not print header info on the logger.
             selstr:    additional selection string (not verified)
-            extrastr:  additional string to print (not verified)
+            extrastr:  additional string to print at the beginning (not verified)
         """
         if not plot and not logger:
@@ -1402,30 +1400,17 @@
         ssum=self._data.__str__()
         # Print Observation header to the upper-left corner of plot
-        if self._headstring:
-            headstr = self._headstring
-            if extrastr != '': headstr[0]=extrastr+'\n'+headstr[0]
-            if selstr != '': headstr[2] += selstr
-            fontsize = fontsize or self._headsize
-        else:
-            headstr=[ssum[ssum.find('Observer:'):ssum.find('Flux Unit:')]]
-            headstr.append(ssum[ssum.find('Beams:'):ssum.find('Observer:')]
-                           +ssum[ssum.find('Rest Freqs:'):ssum.find('Abcissa:')])
-            if extrastr != '': headstr[0]=extrastr+'\n'+headstr[0]
-            ssel='***Selections***\n'+(selstr+self._data.get_selection().__str__() or 'none')
-            headstr.append(ssel)
-            del ssel
-        fontsize = fontsize or 9
-        self._headsize = fontsize
-        self._headstring = headstr
+        headstr=[ssum[ssum.find('Observer:'):ssum.find('Flux Unit:')]]
+        headstr.append(ssum[ssum.find('Beams:'):ssum.find('Observer:')]
+                       +ssum[ssum.find('Rest Freqs:'):ssum.find('Abcissa:')])
+        if extrastr != '':
+            headstr[0]=extrastr+'\n'+headstr[0]
+            self._headtext['extrastr'] = extrastr
+        if selstr != '': self._headtext['selstr'] = selstr
+        ssel=(selstr+self._data.get_selection().__str__() or 'none')
+        headstr.append('***Selections***\n'+ssel)
 
         if plot:
             self._plotter.hold()
-            nstcol=len(headstr)
-            for i in range(nstcol):
-                self._plotter.figure.text(0.03+float(i)/nstcol,0.98,
-                             headstr[i],
-                             horizontalalignment='left',
-                             verticalalignment='top',
-                             fontsize=fontsize)
+            self._header_plot(headstr,fontsize=fontsize)
             import time
             self._plotter.figure.text(0.99,0.0,
@@ -1435,25 +1420,35 @@
             self._plotter.release()
         if logger:
-            sextra = headstr[0][0:headstr[0].find('Observer:')].rstrip('\n')
-            selstr = "Selections:    "+(headstr[2].lstrip('***Selections***\n') or 'none')+"\n \n"
-                
+            selstr = "Selections:    "+ssel
             asaplog.push("----------------\n  Plot Summary\n----------------")
-            asaplog.push(sextra)
+            asaplog.push(extrastr)
             asaplog.push(ssum[ssum.find('Beams:'):ssum.find('Selection:')]\
                          + selstr + ssum[ssum.find('Scan Source'):])
-        del ssum, headstr
-
-#     def clear_header(self):
-#         if not self._headstring or len(self._plotter.figure.texts) == 0:
-#             asaplog.push("No header has been plotted. Exit without any operation")
-#             asaplog.post("WARN")
-#         else:
-#             self._plotter.hold()
-#             for textobj in self._plotter.figure.texts:
-#                 if textobj.get_text() in self._headstring:
-#                     try:
-#                         textobj.remove()
-#                     except NotImplementedError:
-#                         self._plotter.figure.texts.pop(self._plotter.figure.texts.index(textobj))
-#             self._plotter.release()
-#         self._reset_header()
+        self._headtext['string'] = headstr
+        del ssel, ssum, headstr
+
+    def _header_plot(self, texts, fontsize=9):
+        self._headtext['textobj']=[]
+        nstcol=len(texts)
+        for i in range(nstcol):
+            self._headtext['textobj'].append(
+                self._plotter.figure.text(0.03+float(i)/nstcol,0.98,
+                                          texts[i],
+                                          horizontalalignment='left',
+                                          verticalalignment='top',
+                                          fontsize=fontsize))
+
+    def clear_header(self):
+        if not self._headtext['textobj']:
+            asaplog.push("No header has been plotted. Exit without any operation")
+            asaplog.post("WARN")
+        else:
+            self._plotter.hold()
+            for textobj in self._headtext['textobj']:
+                #if textobj.get_text() in self._headstring:
+                try:
+                    textobj.remove()
+                except NotImplementedError:
+                    self._plotter.figure.texts.pop(self._plotter.figure.texts.index(textobj))
+            self._plotter.release()
+        self._reset_header()
