Index: /branches/numpy_misc/tools/event_selection/EventSelection.py
===================================================================
--- /branches/numpy_misc/tools/event_selection/EventSelection.py	(revision 7199)
+++ /branches/numpy_misc/tools/event_selection/EventSelection.py	(revision 7200)
@@ -14,5 +14,5 @@
 import tempfile
 try:
-    import cpickle
+    import cpickle as pickle
 except:
     import pickle
@@ -536,5 +536,6 @@
                           size=(CTL_WIDTH, CTL_HEIGHT), style=wx.ALIGN_RIGHT)
             self.txtQuakeID = wx.TextCtrl(p, -1, size=(100, 20),
-                                          pos=(GEN_TEXTXOFFSET, Y_OFFSET))
+                                          pos=(GEN_TEXTXOFFSET, Y_OFFSET),
+                                          style=wx.TE_READONLY)
             Y_OFFSET += GEN_DELTAY 
             x = FORM_WIDTH/2 - BUTTON_WIDTH - DOUBLE_BUTTON_OFFSET
@@ -962,4 +963,8 @@
             multimux_dir = os.path.join(BaseDirectory, region_dir_name, 'multimux')
             grid_dir = os.path.join(BaseDirectory, region_dir_name, 'static_2m')
+            # check that the sub-directory has been created
+            if ResultSubdir == '' or not os.path.isdir(ResultSubdir):
+                self.error("Sorry, you must 'list' earthquakes first.")
+                return
 
             ####################################################################
@@ -1048,5 +1053,6 @@
             out_fd.write('WEIGHT_FACTOR=%f\n' % weight_factor)
             out_fd.write('DATA_PATH=%s\n' % grid_dir)
-            for fn in filenames[1:]:
+            #for fn in filenames[1:]:
+            for fn in filenames:
                 owning_dir = filenames[0].split('-')[0]
                 out_fd.write('GRID=%s\n' % (os.path.join(owning_dir, fn)))
Index: /branches/numpy_misc/tools/event_selection/installer/EventSelection.nsi
===================================================================
--- /branches/numpy_misc/tools/event_selection/installer/EventSelection.nsi	(revision 7199)
+++ /branches/numpy_misc/tools/event_selection/installer/EventSelection.nsi	(revision 7200)
@@ -1,4 +1,4 @@
 !define PRODUCT_NAME "EventSelection"
-!define PRODUCT_VERSION "1.0"
+!define PRODUCT_VERSION "1.1"
 !define ICON_FILE "tsunami.ico"
 
Index: /branches/numpy_misc/tools/plotcsv/installer/plotcsv.nsi
===================================================================
--- /branches/numpy_misc/tools/plotcsv/installer/plotcsv.nsi	(revision 7199)
+++ /branches/numpy_misc/tools/plotcsv/installer/plotcsv.nsi	(revision 7200)
@@ -1,4 +1,4 @@
 !define PRODUCT_NAME "plotcsv"
-!define PRODUCT_VERSION "0.5"
+!define PRODUCT_VERSION "0.7"
 !define ICON_FILE "plotcsv.ico"
 
Index: /branches/numpy_misc/tools/plotcsv/plotcsv.py
===================================================================
--- /branches/numpy_misc/tools/plotcsv/plotcsv.py	(revision 7199)
+++ /branches/numpy_misc/tools/plotcsv/plotcsv.py	(revision 7200)
@@ -15,5 +15,5 @@
 import string
 try:
-    import cpickle
+    import cpickle as pickle
 except:
     import pickle
@@ -54,5 +54,5 @@
 # program name and version
 APP_NAME = 'plotcsv'
-APP_VERSION = '0.5'
+APP_VERSION = '0.7'
 
 # name of the configuration filename
@@ -73,5 +73,5 @@
 BOX_CSV_HEIGHT = 265
 BOX_PLOT_WIDTH = 400
-BOX_PLOT_HEIGHT = 140
+BOX_PLOT_HEIGHT = 140+25+25+30
 
 TXT_CSVFILE_WIDTH = 390
@@ -84,5 +84,5 @@
 
 FORM_WIDTH = BOX_WIDTH + 15
-FORM_HEIGHT = 450
+FORM_HEIGHT = 450+25+25+30
 
 START_YOFFSET = 7
@@ -206,4 +206,9 @@
         self.changed = True
 
+    def get(self, key, default=None):
+        """Override to allow: <var> = cfg.get(<key>, default=None)"""
+        
+        return self.cfgdict.get(key, default)
+        
     def __getitem__(self, key):
         """Override to allow: <var> = cfg[<key>]"""
@@ -306,15 +311,31 @@
 # @brief Plot data files.
 # @param filenames List of full pathnames to plot.
-# @param x_hdr The X axis label string.
-# @param y_hdr The Y axis label string.
+# @param x_hdr The X axis data header string.
+# @param y_hdr The Y axis data header string.
 # @param title The string used to title the graph.
 # @param legend True if a legend is to be displayed.
 # @param legend_path True if legend is to contain full file paths.
+# @param grid True if grid is to be displayed.
+# @param fontsize Point size of font.
+# @param plot_width Width of plot lines.
+# @param x_label Override X axis label.
+# @param y_label Override Y axis label.
 def plot_files(filenames, x_hdr, y_hdr, title='', legend=False,
-               legend_path=False):
+               legend_path=False, grid=False, fontsize=10,
+               plot_width=2, x_label=None, y_label=None):
+    if x_label is None:
+        x_label = x_hdr
+    if y_label is None:
+        y_label = y_hdr
+        
     pylab.rc('axes', linewidth=2)
-    pylab.xlabel(x_hdr.title())
-    pylab.ylabel(y_hdr.title())
-    pylab.grid(True)
+    pylab.rc('lines', linewidth=float(plot_width))
+    pylab.rc(('xtick', 'ytick'), labelsize=float(fontsize)*0.75,)
+    pylab.rc(('xtick.major', 'ytick.major'), size=5, pad=5)
+    pylab.rc('axes', labelsize=float(fontsize))
+    pylab.xlabel(x_label)
+    pylab.ylabel(y_label)
+
+    pylab.grid(grid)
 
     for f in filenames:
@@ -328,6 +349,8 @@
 
     if title:
-        pylab.title(title)
+        pylab.title(title, fontsize=float(fontsize)*1.5)
+        
     if legend:
+        pylab.rc('legend', fancybox=True)
         (min_y, max_y) = pylab.ylim()
         range_y = max_y - min_y
@@ -383,5 +406,5 @@
                                      size=(100, BUTTON_HEIGHT))
         x = FORM_WIDTH/2 + DOUBLE_BUTTON_OFFSET
-        self.btnDelCSVFile = wx.Button(p, label="Delete", pos=(x, Y_OFFSET),
+        self.btnDelCSVFile = wx.Button(p, label="Delete All", pos=(x, Y_OFFSET),
                                      size=(100, BUTTON_HEIGHT))
         Y_OFFSET += BUTTON_HEIGHT + MARGIN 
@@ -390,16 +413,33 @@
                      size=(BOX_PLOT_WIDTH, BOX_PLOT_HEIGHT))
         Y_OFFSET += GEN_DELTAY
+
         wx.StaticText(p, -1, 'X-Column',
                       pos=(COLLAB_X_OFFSET, Y_OFFSET+LAB_CTRL_OFFSET), style=wx.ALIGN_LEFT)
-        self.cbXColHdr = wx.Choice(p, -1, pos=(COLLAB_X_OFFSET+65, Y_OFFSET),
+        self.cbXColHdr = wx.Choice(p, -1, pos=(COLLAB_X_OFFSET+50, Y_OFFSET),
                                    size=(80, -1))
         self.XColHdr = []
         wx.StaticText(p, -1, 'Y-Column',
-                      pos=(FORM_WIDTH/2+COLLAB_X_OFFSET,
+                      pos=(FORM_WIDTH/2,
                            Y_OFFSET+LAB_CTRL_OFFSET), style=wx.ALIGN_LEFT)
-        x = FORM_WIDTH/2 + COLLAB_X_OFFSET
-        self.cbYColHdr = wx.Choice(p, -1, pos=(x+65, Y_OFFSET), size=(80, -1))
+        x = FORM_WIDTH/2+50
+        self.cbYColHdr = wx.Choice(p, -1, pos=(x, Y_OFFSET), size=(80, -1))
         self.YColHdr = []
-        Y_OFFSET += GEN_DELTAY*2
+        Y_OFFSET += GEN_DELTAY*1.5
+
+        wx.StaticText(p, -1, 'X-Label',
+                      pos=(COLLAB_X_OFFSET, Y_OFFSET+LAB_CTRL_OFFSET), style=wx.ALIGN_LEFT)
+        self.txtXLabel = wx.TextCtrl(p, -1, "", size=(100, -1),
+                                     pos=(COLLAB_X_OFFSET+50,
+                                          Y_OFFSET+LAB_CTRL_OFFSET),
+                                     style=wx.ALIGN_LEFT)
+        wx.StaticText(p, -1, 'Y-Label',
+                      pos=(FORM_WIDTH/2,
+                           Y_OFFSET+LAB_CTRL_OFFSET), style=wx.ALIGN_LEFT)
+        x = FORM_WIDTH/2 + 50
+        self.txtYLabel = wx.TextCtrl(p, -1, "", size=(100, -1),
+                                     pos=(x,
+                                          Y_OFFSET+LAB_CTRL_OFFSET),
+                                     style=wx.ALIGN_LEFT)
+        Y_OFFSET += GEN_DELTAY*2.5
 
         self.chkLegend = wx.CheckBox(p, -1, " Show graph legend",
@@ -407,4 +447,29 @@
         self.chkLegendPath = wx.CheckBox(p, -1, " Full file path in legend",
                                          pos=(COLLAB_X_OFFSET+180, Y_OFFSET))        
+        Y_OFFSET += GEN_DELTAY*2
+
+        font_sizes = ['10', '12', '14', '16', '18', '20',
+                      '22', '24', '26', '28', '30', '32']
+        self.cbLabFontSize = wx.ComboBox(p, -1, "10",
+                                         (COLLAB_X_OFFSET+20, Y_OFFSET-5), 
+                                         (47, -1), font_sizes,
+                                        wx.CB_DROPDOWN)
+        wx.StaticText(p, -1, 'Label fontsize',
+                      pos=(COLLAB_X_OFFSET+72, Y_OFFSET),
+                      style=wx.ALIGN_LEFT)
+
+        self.chkShowGrid = wx.CheckBox(p, -1, " Show grid",
+                                       pos=(COLLAB_X_OFFSET+180, Y_OFFSET))        
+        
+        Y_OFFSET += GEN_DELTAY*2
+
+        plot_widths = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
+        self.cbPlotWidth = wx.ComboBox(p, -1, "2",
+                                       (COLLAB_X_OFFSET+20, Y_OFFSET-5), 
+                                       (47, -1), plot_widths,
+                                       wx.CB_DROPDOWN)
+        wx.StaticText(p, -1, 'Plot width',
+                      pos=(COLLAB_X_OFFSET+72, Y_OFFSET),
+                      style=wx.ALIGN_LEFT)
         Y_OFFSET += GEN_DELTAY + 3
         
@@ -415,6 +480,5 @@
                                          Y_OFFSET+LAB_CTRL_OFFSET),
                                     style=wx.ALIGN_LEFT)
-        
-        Y_OFFSET += BUTTON_HEIGHT + MARGIN
+        Y_OFFSET += BUTTON_HEIGHT # + MARGIN
         x = FORM_WIDTH/2 - BUTTON_WIDTH/2
         self.btnPlot = wx.Button(p, label="Plot", pos=(x, Y_OFFSET),
@@ -426,4 +490,6 @@
         self.Bind(wx.EVT_BUTTON, self.PlotFiles, self.btnPlot)
         self.Bind(wx.EVT_CHECKBOX, self.ChangeLegend, self.chkLegend)
+        self.Bind(wx.EVT_CHOICE, self.ChangeXLabel, self.cbXColHdr)
+        self.Bind(wx.EVT_CHOICE, self.ChangeYLabel, self.cbYColHdr)
         
         self.Bind(wx.EVT_CLOSE, self.doStateSave)
@@ -434,5 +500,13 @@
         self.doStateRestore()
         self.updateHdrChoices()
-        
+
+    def ChangeXLabel(self, event):
+        sel = self.cbXColHdr.GetCurrentSelection()
+        self.txtXLabel.SetValue(self.cbXColHdr.GetItems()[sel].title())
+    
+    def ChangeYLabel(self, event):
+        sel = self.cbYColHdr.GetCurrentSelection()
+        self.txtYLabel.SetValue(self.cbYColHdr.GetItems()[sel].title())
+    
     def AddCSVFile(self, event):
         """Add a CSV file to the listbox"""
@@ -442,38 +516,36 @@
                             defaultFile='',
                             wildcard=CSVWildcard,
-                            style=wx.OPEN | wx.CHANGE_DIR)
+                            style=wx.OPEN | wx.MULTIPLE | wx.CHANGE_DIR)
 
         if dlg.ShowModal() == wx.ID_OK:
             # This returns a list of  files that were selected.
-            path = dlg.GetPath()
+            files = dlg.GetFilenames()
             self.file_dir = dlg.GetDirectory()
             dlg.Destroy()
-            if path not in self.CSVFiles:
-                headers = self.getHeaders(path)
-                if headers:
-                    common_headers = self.orHeaders(headers)
-                    if not common_headers or len(common_headers) < 2:
-                        self.error("Sorry, file '%s' doesn't have enough headers in common with current files" % path)
+            for f in files:
+                path = os.path.join(self.file_dir, f)
+                if path not in self.CSVFiles:
+                    headers = self.getHeaders(path)
+                    if headers:
+                        common_headers = self.orHeaders(headers)
+                        if not common_headers or len(common_headers) < 2:
+                            self.error("Sorry, file '%s' doesn't have enough headers in common with current files" % path)
+                        else:
+                            self.headers.append(headers)
+                            self.common_headers = common_headers
+                            self.CSVFiles.append(path)
+                            self.txtCSVFiles.Append(path)
                     else:
-                        self.headers.append(headers)
-                        self.common_headers = common_headers
-                        self.CSVFiles.append(path)
-                        self.txtCSVFiles.Append(path)
-                else:
-                    self.error("Sorry, file '%s' doesn't appear to be a CSV file" % path)
-                self.updateHdrChoices()
+                        self.error("Sorry, file '%s' doesn't appear to be a CSV file" % path)
+                    self.updateHdrChoices()
 
     def DelCSVFile(self, event):
-        """Delete a CSV file from the listbox"""
-
-        sel = self.txtCSVFiles.GetSelections()
-        if sel:
-            sel = sel[0]
-            self.txtCSVFiles.Delete(sel)
-            del self.CSVFiles[sel]
-            del self.headers[sel]
-            self.common_headers = self.GenCommonHeaders(self.headers)
-            self.updateHdrChoices()
-
+        """Delete all CSV files from the listbox"""
+        
+        self.txtCSVFiles.Clear()
+        self.CSVFiles = []
+        self.common_headers = None
+        self.updateHdrChoices()
+        
     def ChangeLegend(self, event):
         if self.chkLegend.GetValue():
@@ -494,4 +566,9 @@
         self.cfg['GraphLegend'] = self.chkLegend.GetValue()
         self.cfg['LegendPath'] = self.chkLegendPath.GetValue()
+        self.cfg['ShowGrid'] = self.chkShowGrid.GetValue()
+        self.cfg['FontSize'] = self.cbLabFontSize.GetValue()
+        self.cfg['PlotWidth'] = self.cbPlotWidth.GetValue()
+        self.cfg['XLabel'] = self.txtXLabel.GetValue()
+        self.cfg['YLabel'] = self.txtYLabel.GetValue()
 
         self.cfg.save()
@@ -529,12 +606,12 @@
         if self.YColHdrSelection >= 0:
             self.cbYColHdr.SetSelection(self.YColHdrSelection)
-        title = self.cfg['GraphTitle']
-        if title is None:
-            title = ''
-        self.txtTitle.SetValue(title)
-        if self.cfg['GraphLegend']:
-            self.chkLegend.SetValue(True)
-        if self.cfg['LegendPath']:
-            self.chkLegendPath.SetValue(True)
+        self.txtTitle.SetValue(self.cfg.get('GraphTitle', ''))
+        self.chkLegend.SetValue(self.cfg.get('GraphLegend', False))
+        self.chkLegendPath.SetValue(self.cfg.get('LegendPath', False))
+        self.cbLabFontSize.SetValue(self.cfg.get('FontSize', '14'))
+        self.cbPlotWidth.SetValue(self.cfg.get('PlotWidth', '1'))
+        self.chkShowGrid.SetValue(self.cfg.get('ShowGrid', True))
+        self.txtXLabel.SetValue(self.cfg.get('XLabel', ''))
+        self.txtYLabel.SetValue(self.cfg.get('YLabel', ''))
         self.ChangeLegend(None)
         
@@ -581,7 +658,11 @@
                 index = self.common_headers.index(selected_y)
                 self.cbYColHdr.SetSelection(index)
+            self.txtXLabel.Enable()
+            self.txtYLabel.Enable()
         else:
             self.cbXColHdr.Disable()
             self.cbYColHdr.Disable()
+            self.txtXLabel.Disable()
+            self.txtYLabel.Disable()
             self.btnPlot.Disable()
 
@@ -620,11 +701,23 @@
         selected_y = self.cbYColHdr.GetStringSelection()
 
+        x_label = self.txtXLabel.GetValue()
+        y_label = self.txtYLabel.GetValue()
+
         if selected_x and selected_y:
+            grid_on = self.chkShowGrid.GetValue()
+            fontsize = self.cbLabFontSize.GetValue()
+            plot_width = self.cbPlotWidth.GetValue()
             plot_files(self.CSVFiles, selected_x, selected_y,
+                       x_label=x_label, y_label=y_label,
                        title=self.txtTitle.GetValue(),
                        legend=self.chkLegend.GetValue(),
-                       legend_path=self.chkLegendPath.GetValue())
+                       legend_path=self.chkLegendPath.GetValue(),
+                       grid=grid_on, fontsize=fontsize,
+                       plot_width = plot_width)
+
             # hide problem with wxPython and matplotlib - close app!
             self.Close(True)
+        else:
+            self.error('Sorry, you must select X- and Y-column data values')
             
     def error(self, msg):
