Index: src/sas/guiframe/gui_statusbar.py
===================================================================
--- src/sas/guiframe/gui_statusbar.py	(revision b3efb7dfc293a955756eccf52e0bbd30d3a2c32d)
+++ src/sas/guiframe/gui_statusbar.py	(revision 1805b875b53c85559764ffa46fd07f8eb630ff9f)
@@ -1,4 +1,9 @@
+"""
+Defines and draws the status bar that should appear along the bottom of the
+main SasView window.
+"""
 import wx
 import sys
+import logging
 from wx import StatusBar as wxStatusB
 from wx.lib import newevent
@@ -6,15 +11,17 @@
 from sas.guiframe.gui_style import GUIFRAME_ICON
 
-# Number of fields on the status bar 
+# Number of fields on the status bar
 NB_FIELDS = 4
 #position of the status bar's fields
 ICON_POSITION = 0
-MSG_POSITION  = 1
-GAUGE_POSITION  = 2
-CONSOLE_POSITION  = 3
+MSG_POSITION = 1
+GAUGE_POSITION = 2
+CONSOLE_POSITION = 3
 BUTTON_SIZE = 40
 STATUS_BAR_ICON_SIZE = 12
 CONSOLE_WIDTH = 500
 CONSOLE_HEIGHT = 300
+FRAME_ICON = wx.Icon(GUIFRAME_ICON.FRAME_ICON_PATH,wx.BITMAP_TYPE_ICON)
+
 if sys.platform.count("win32") > 0:
     FONT_VARIANT = 0
@@ -28,23 +35,26 @@
 class ConsolePanel(wx.Panel):
     """
+    Interaction class for adding messages to the Console log.
     """
     def __init__(self, parent, *args, **kwargs):
-        """
-        """
         wx.Panel.__init__(self, parent=parent, *args, **kwargs)
         self.parent = parent
         self.sizer = wx.BoxSizer(wx.VERTICAL)
-        
+
         self.msg_txt = wx.richtext.RichTextCtrl(self, size=(CONSOLE_WIDTH-40,
                                                 CONSOLE_HEIGHT-60),
                                    style=wx.VSCROLL|wx.HSCROLL|wx.NO_BORDER)
-        
+
         self.msg_txt.SetEditable(False)
         self.msg_txt.SetValue('No message available')
         self.sizer.Add(self.msg_txt, 1, wx.EXPAND|wx.ALL, 10)
         self.SetSizer(self.sizer)
-        
+
     def set_message(self, status="", event=None):
         """
+        Adds a message to the console log as well as the main sasview.log
+
+        :param status: A status message to be sent to the console log.
+        :param event: A wx event.
         """
         status = str(status)
@@ -52,19 +62,20 @@
             return
         color = (0, 0, 0) #black
-        icon_bmp =  wx.ArtProvider.GetBitmap(wx.ART_INFORMATION,
-                                             wx.ART_TOOLBAR)
+        icon_bmp = wx.ArtProvider.GetBitmap(wx.ART_INFORMATION, wx.ART_TOOLBAR)
         if hasattr(event, "info"):
             icon_type = event.info.lower()
             if icon_type == "warning":
+                logging.warning(status)
                 color = (0, 0, 255) # blue
-                icon_bmp =  wx.ArtProvider.GetBitmap(wx.ART_WARNING,
-                                                     wx.ART_TOOLBAR)
+                icon_bmp = wx.ArtProvider.GetBitmap(wx.ART_WARNING,
+                                                    wx.ART_TOOLBAR)
             if icon_type == "error":
+                logging.error(status)
                 color = (255, 0, 0) # red
-                icon_bmp =  wx.ArtProvider.GetBitmap(wx.ART_ERROR, 
-                                                     wx.ART_TOOLBAR)
+                icon_bmp = wx.ArtProvider.GetBitmap(wx.ART_ERROR,
+                                                    wx.ART_TOOLBAR)
             if icon_type == "info":
-                icon_bmp =  wx.ArtProvider.GetBitmap(wx.ART_INFORMATION,
-                                                     wx.ART_TOOLBAR)
+                icon_bmp = wx.ArtProvider.GetBitmap(wx.ART_INFORMATION,
+                                                    wx.ART_TOOLBAR)
         self.msg_txt.Newline()
         self.msg_txt.WriteBitmap(icon_bmp)
@@ -73,8 +84,9 @@
         self.msg_txt.AppendText(status)
         self.msg_txt.EndTextColour()
-        
-        
+
+
 class Console(wx.Frame):
     """
+    The main class defining the Console window.
     """
     def __init__(self, parent=None, status="", *args, **kwds):
@@ -86,22 +98,32 @@
         self.panel.set_message(status=status)
         wx.EVT_CLOSE(self, self.Close)
-        
+
     def set_multiple_messages(self, messages=[]):
         """
+        Method to send an arbitrary number of messages to the console log
+
+        :param messages: A list of strings to be sent to the console log. 
         """
         if messages:
             for status in messages:
                 self.panel.set_message(status=status)
-                
+
     def set_message(self, status, event=None):
         """
+        Exposing the base ConsolePanel set_message
+
+        :param status: A status message to be sent to the console log.
+        :param event: A wx event.
         """
         self.panel.set_message(status=str(status), event=event)
-        
+
     def Close(self, event):
         """
+        Calling close on the panel will hide the panel.
+
+        :param event: A wx event.
         """
         self.Hide()
-        
+
 class StatusBar(wxStatusB):
     """
@@ -116,38 +138,39 @@
         width = STATUS_BAR_ICON_SIZE
         height = STATUS_BAR_ICON_SIZE
-        self.SetFieldsCount(NB_FIELDS) 
+        self.SetFieldsCount(NB_FIELDS)
         # Leave some space for the resize handle in the last field
         console_btn_width = 80
         self.SetStatusWidths([width+4, -2, -1, width+console_btn_width])
-        self.SetMinHeight(height)
-        
+        self.SetMinHeight(height + 10)
+
         #display default message
-        self.msg_position = MSG_POSITION 
-        
+        self.msg_position = MSG_POSITION
+
         # Create progress bar
         gauge_width = 5 * width
         self.gauge = wx.Gauge(self, size=(gauge_width, height),
-                               style=wx.GA_HORIZONTAL)
+                              style=wx.GA_HORIZONTAL)
         self.gauge.Hide()
-        
+
         # Create status bar icon reflecting the type of status
         # for the last message
-        self.status_color = wx.StaticText(self, id=wx.NewId(), label="   ", size=wx.Size(15,15))
+        self.status_color = wx.StaticText(self, id=wx.NewId(), label="   ",
+                                          size=wx.Size(15, 15))
         self.status_color.SetBackgroundColour(GREEN)
         self.status_color.SetForegroundColour(GREEN)
 
         # Create the button used to show the console dialog
-        self.console_button = wx.Button(self, wx.NewId(), "Console", 
-                                 size=(console_btn_width, -1))
+        self.console_button = wx.Button(self, wx.NewId(), "Console",
+                                        size=(console_btn_width, -1))
         font = self.console_button.GetFont()
         _, pixel_h = font.GetPixelSize()
-        font.SetPixelSize(wx.Size(0,int(pixel_h*0.9)))
+        font.SetPixelSize(wx.Size(0, int(pixel_h*0.9)))
         self.console_button.SetFont(font)
         self.console_button.SetToolTipString("History of status bar messages")
         self.console_button.Bind(wx.EVT_BUTTON, self._onMonitor,
-                                id=self.console_button.GetId())
-        
+                                 id=self.console_button.GetId())
+
         self.reposition()
-        ## Current progress value of the bar 
+        ## Current progress value of the bar
         self.nb_start = 0
         self.nb_progress = 0
@@ -163,6 +186,4 @@
                 except:
                     try:
-                        FRAME_ICON = wx.Icon(GUIFRAME_ICON.FRAME_ICON_PATH,
-                                              wx.BITMAP_TYPE_ICON)
                         self.frame.SetIcon(FRAME_ICON)
                     except:
@@ -174,12 +195,12 @@
         self.timer_stop = wx.Timer(self, -1)
         self.thread = None
-        self.Bind(wx.EVT_TIMER, self._on_time, self.timer) 
-        self.Bind(wx.EVT_TIMER, self._on_time_stop, self.timer_stop) 
-        self.Bind(wx.EVT_SIZE, self.OnSize)
-        self.Bind(wx.EVT_IDLE, self.OnIdle)
-        
+        self.Bind(wx.EVT_TIMER, self._on_time, self.timer)
+        self.Bind(wx.EVT_TIMER, self._on_time_stop, self.timer_stop)
+        self.Bind(wx.EVT_SIZE, self.on_size)
+        self.Bind(wx.EVT_IDLE, self.on_idle)
+
     def reposition(self):
         """
-            Place the various fields in their proper position
+        Place the various fields in their proper position
         """
         rect = self.GetFieldRect(GAUGE_POSITION)
@@ -189,40 +210,44 @@
         rect = self.GetFieldRect(CONSOLE_POSITION)
         self.console_button.SetPosition((rect.x, rect.y))
-        self.sizeChanged = False
-        
-    def OnIdle(self, event):
-        """
-        """
-        if self.sizeChanged:
+        self.size_changed = False
+
+    def on_idle(self, event):
+        """
+        When the window is idle, check if the window has been resized
+        """
+        if self.size_changed:
             self.reposition()
-            
-    def OnSize(self, evt):
-        """
+
+    def on_size(self, evt):
+        """
+        If the window is resized, redraw the window.
         """
         self.reposition() 
-        self.sizeChanged = True
-        
+        self.size_changed = True
+
     def get_msg_position(self):
         """
+        Get the last known message that was displayed on the console window.
         """
         return self.msg_position
-    
+
     def SetStatusText(self, text="", number=MSG_POSITION, event=None):
         """
-        """
-        wxStatusB.SetStatusText(self, text.split('\n',1)[0], number)
+        Set the text that will be displayed in the status bar.
+        """
+        wxStatusB.SetStatusText(self, text.split('\n', 1)[0], number)
         self.list_msg.append(text)
         self.status_color.SetBackgroundColour(GREEN)
         self.status_color.SetForegroundColour(GREEN)
 
-        if self.frame is not None :
+        if self.frame is not None:
             self.frame.set_message(status=text, event=event)
-        
+
     def PopStatusText(self, *args, **kwds):
         """
-        Override status bar 
+        Override status bar
         """
         wxStatusB.PopStatusText(self, field=MSG_POSITION)
-        
+
     def PushStatusText(self, *args, **kwds):
         """
@@ -231,5 +256,5 @@
         text = "PushStatusText: What is this string?"
         wxStatusB.PushStatusText(self, field=MSG_POSITION, string=text)
-        
+
     def enable_clear_gauge(self):
         """
@@ -242,32 +267,30 @@
         #    flag = True
         return flag
-    
-    def _on_time_stop(self, evt): 
+
+    def _on_time_stop(self, evt):
         """
         Clear the progress bar
-        
-        :param evt: wx.EVT_TIMER 
-  
-        """ 
+
+        :param evt: wx.EVT_TIMER
+        """
         count = 0
-        while(count <= 100):
+        while count <= 100:
             count += 1
-        self.timer_stop.Stop() 
+        self.timer_stop.Stop()
         self.clear_gauge(msg="")
-        self.nb_progress = 0 
-        self.nb_start = 0 
+        self.nb_progress = 0
+        self.nb_start = 0
         self.nb_stop = 0
-       
-    def _on_time(self, evt): 
-        """
-        Update the progress bar while the timer is running 
-        
-        :param evt: wx.EVT_TIMER 
-  
-        """ 
-        # Check stop flag that can be set from non main thread 
-        if self.timer.IsRunning(): 
+
+    def _on_time(self, evt):
+        """
+        Update the progress bar while the timer is running
+
+        :param evt: wx.EVT_TIMER
+        """
+        # Check stop flag that can be set from non main thread
+        if self.timer.IsRunning():
             self.gauge.Pulse()
-   
+
     def clear_gauge(self, msg=""):
         """
@@ -276,6 +299,6 @@
         self.progress = 0
         self.gauge.SetValue(0)
-        self.gauge.Hide() 
-         
+        self.gauge.Hide()
+
     def set_icon(self, event):
         """
@@ -290,9 +313,9 @@
             return
         if not hasattr(event, "info"):
-            return 
-        
+            return
+
         # Get the size of the button images
         height = STATUS_BAR_ICON_SIZE
-        
+
         msg = event.info.lower()
         if msg == "warning":
@@ -305,5 +328,5 @@
             self.status_color.SetBackgroundColour(GREEN)
             self.status_color.SetForegroundColour(GREEN)
-    
+
     def set_dialog(self, event):
         """
@@ -311,5 +334,5 @@
         """
         if not hasattr(event, "info"):
-            return 
+            return
         msg = event.info.lower()
         if msg == "error":
@@ -326,5 +349,5 @@
         if hasattr(event, "status"):
             self.SetStatusText(text=str(event.status), event=event)
-       
+  
     def set_gauge(self, event):
         """
@@ -339,8 +362,8 @@
             #self.timer.Stop()
             self.progress += 5
-            self.gauge.SetValue(int(self.progress)) 
+            self.gauge.SetValue(int(self.progress))
             self.progress += 5
             if self.progress < self.gauge.GetRange() - 20:
-                self.gauge.SetValue(int(self.progress)) 
+                self.gauge.SetValue(int(self.progress))
         if type.lower() == "progress":
             self.nb_progress += 1
@@ -350,5 +373,5 @@
             self.progress += 5
             if self.progress < self.gauge.GetRange()- 20:
-                self.gauge.SetValue(int(self.progress))   
+                self.gauge.SetValue(int(self.progress))
         if type.lower() == "stop":
             self.nb_stop += 1
@@ -357,16 +380,16 @@
                 self.timer.Stop()
                 self.progress = 0
-                self.gauge.SetValue(100) 
-                self.timer_stop.Start(5) 
-                    
+                self.gauge.SetValue(100)
+                self.timer_stop.Start(5)
+
     def set_status(self, event):
         """
         Update the status bar .
-        
+
         :param type: type of message send.
             type  must be in ["start","progress","update","stop"]
         :param msg: the message itself  as string
-        :param thread: if updatting using a thread status 
-        
+        :param thread: if updatting using a thread status
+
         """
         self.set_message(event=event)
@@ -375,5 +398,5 @@
         # dialog on error
         self.set_dialog(event=event)
-        
+
     def _onMonitor(self, event):
         """
@@ -382,13 +405,13 @@
         self.frame.Show(False)
         self.frame.Show(True)
-        
-        
+
+
 class SPageStatusbar(wxStatusB):
     def __init__(self, parent, timeout=None, *args, **kwds):
         wxStatusB.__init__(self, parent, *args, **kwds)
-        self.SetFieldsCount(1) 
+        self.SetFieldsCount(1)
         self.timeout = timeout
         width, height = parent.GetSizeTuple()
-        self.gauge = wx.Gauge(self, style=wx.GA_HORIZONTAL, 
+        self.gauge = wx.Gauge(self, style=wx.GA_HORIZONTAL,
                               size=(width, height/10))
         rect = self.GetFieldRect(0)
@@ -396,21 +419,21 @@
         if self.timeout is not None:
             self.gauge.SetRange(int(self.timeout))
-        self.timer = wx.Timer(self, -1) 
-        self.Bind(wx.EVT_TIMER, self._on_time, self.timer) 
+        self.timer = wx.Timer(self, -1)
+        self.Bind(wx.EVT_TIMER, self._on_time, self.timer)
         self.timer.Start(1)
         self.pos = 0
-       
-    def _on_time(self, evt): 
-        """
-        Update the progress bar while the timer is running 
-        
-        :param evt: wx.EVT_TIMER 
-  
-        """ 
-        # Check stop flag that can be set from non main thread 
-        if self.timeout is None and self.timer.IsRunning(): 
+
+    def _on_time(self, evt):
+        """
+        Update the progress bar while the timer is running
+
+        :param evt: wx.EVT_TIMER
+
+        """
+        # Check stop flag that can be set from non main thread
+        if self.timeout is None and self.timer.IsRunning():
             self.gauge.Pulse()
-            
-        
+
+
 if __name__ == "__main__":
     app = wx.PySimpleApp()
