Index: src/sas/sasgui/perspectives/simulation/SimCanvas.py
===================================================================
--- src/sas/sasgui/perspectives/simulation/SimCanvas.py	(revision 959eb0181ad06828a748f04512f953aad5b31659)
+++ src/sas/sasgui/perspectives/simulation/SimCanvas.py	(revision 34f23c81aa61f99e9fa067689ac823e11cfecde3)
@@ -2,5 +2,5 @@
 This software was developed by the University of Tennessee as part of the
 Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-project funded by the US National Science Foundation. 
+project funded by the US National Science Foundation.
 
 See the license text in license.txt
@@ -32,7 +32,7 @@
 except ImportError:
     haveOpenGL = False
-    
+
 # Color set
-DEFAULT_COLOR = [1.0, 1.0, 0.0, .2]    
+DEFAULT_COLOR = [1.0, 1.0, 0.0, .2]
 COLOR_RED     = [1.0, 0.0, 0.0, .2]
 COLOR_GREEN   = [0.0, 1.0, 0.0, .2]
@@ -48,18 +48,18 @@
 class SimPanel(wx.Panel):
     """
-        3D viewer to support real-space simulation. 
+        3D viewer to support real-space simulation.
     """
     window_name = "3dview"
     window_caption = "3D viewer"
-    
+
     def __init__(self, parent, id = -1, plots = None, standalone=False, **kwargs):
         wx.Panel.__init__(self, parent, id = id, **kwargs)
         self.parent = parent
-    
+
         #Add a sizer
         mainSizer = wx.BoxSizer(wx.VERTICAL)
         sliderSizer = wx.BoxSizer(wx.HORIZONTAL)
-    
-        self.canvas    = CanvasBase(self) 
+
+        self.canvas    = CanvasBase(self)
         self.canvas.SetMinSize((200,2100))
 
@@ -72,6 +72,6 @@
         self.SetSizer(mainSizer)
         self.Bind(wx.EVT_CONTEXT_MENU, self._on_context_menu)
-        
- 
+
+
     def _on_context_menu(self, event):
         """
@@ -83,9 +83,9 @@
         slicerpop.Append(id, '&Reset 3D View')
         wx.EVT_MENU(self, id, self.canvas.resetView)
-       
+
         pos = event.GetPosition()
         pos = self.ScreenToClient(pos)
-        self.PopupMenu(slicerpop, pos)        
-    
+        self.PopupMenu(slicerpop, pos)
+
 class CanvasBase(glcanvas.GLCanvas):
     """
@@ -94,5 +94,5 @@
     window_name = "Simulation"
     window_caption = "Simulation"
-    
+
     def __init__(self, parent):
         glcanvas.GLCanvas.__init__(self, parent, -1)
@@ -113,21 +113,21 @@
         self.Bind(wx.EVT_MOTION, self.OnMouseMotion)
         self.Bind(wx.EVT_MOUSEWHEEL, self._onMouseWheel)
-        
+
         self.initialized = False
         self.shapes = []
         self.parent = parent
-        
+
         # Reference vectors
         self.x_vec = [1,0,0]
         self.y_vec = [0,1,0]
-        
+
         self.mouse_down = False
         self.scale = 1.0
         self.zoom  = 1.0
         self.translation = [0,0,0]
-        
+
         # Bind to Edit events
         self.parent.Bind(ShapeParameters.EVT_EDIT_SHAPE, self._onEditShape)
-        
+
     def resetView(self, evt=None):
         """
@@ -140,5 +140,5 @@
         glLoadIdentity()
         self.Refresh()
-                
+
     def _onEditShape(self, evt):
         evt.Skip()
@@ -158,14 +158,14 @@
         event.Skip()
 
-    def OnPaint(self, event):     
+    def OnPaint(self, event):
         size = self.GetClientSize()
         side = size.width
         if size.height<size.width:
             side = size.height
-        
+
         if self.GetContext():
             glViewport(0, 0, side, side)
             self.SetMinSize((side,side))
-            
+
         dc = wx.PaintDC(self)
         self.SetCurrent()
@@ -174,20 +174,20 @@
             self.init = True
         self.OnDraw()
-        event.Skip()        
-        
+        event.Skip()
+
     def _onMouseWheel(self, evt):
         # Initialize mouse position so we don't have unwanted rotation
         self.x, self.y = self.lastx, self.lasty = evt.GetPosition()
         self.tr_x, self.tr_y = self.tr_lastx, self.tr_lasty = evt.GetPosition()
-        
+
         scale = 1.15
         if evt.GetWheelRotation()<0:
             scale = 1.0/scale
-             
-        self.zoom *= scale             
-             
+
+        self.zoom *= scale
+
         glScale(scale, scale, scale)
         self.Refresh(False)
-        
+
     def OnMouseDown(self, evt):
         self.SetFocus()
@@ -214,8 +214,8 @@
         slicerpop.Append(id, '&Reset 3D View')
         wx.EVT_MENU(self, id, self.resetView)
-       
+
         pos = event.GetPosition()
         #pos = self.ScreenToClient(pos)
-        self.PopupMenu(slicerpop, pos)        
+        self.PopupMenu(slicerpop, pos)
 
     def OnMouseMotion(self, evt):
@@ -223,19 +223,19 @@
             self.tr_lastx, self.tr_lasty = self.tr_x, self.tr_y
             x, y = evt.GetPosition()
-            
+
             # Min distance to do anything
             if math.fabs(self.lastx-x)>10 or math.fabs(self.lasty-y)>10:
-                
+
                 self.lastx, self.lasty = self.x, self.y
-        
-                
+
+
                 if math.fabs(self.lastx-x)>math.fabs(self.lasty-y):
                     self.x = x
                 else:
                     self.y = y
-                
+
                 #self.x, self.y = evt.GetPosition()
                 self.Refresh(False)
-                
+
         elif evt.Dragging() and evt.RightIsDown():
             self.lastx, self.lasty = self.x, self.y
@@ -243,19 +243,19 @@
             self.tr_x, self.tr_y = evt.GetPosition()
             self.Refresh(False)
-            
-    def InitGL( self ):      
+
+    def InitGL( self ):
         glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGBA)
         #glShadeModel(GL_FLAT);
-        
+
         glMatrixMode(GL_PROJECTION)
-        
+
         glLight(GL_LIGHT0, GL_AMBIENT, [.2, .2, .2, 0])
-        
+
         # Object color
         #glLight(GL_LIGHT0, GL_DIFFUSE, COLOR_BLUE)
-        
+
         glLight(GL_LIGHT0, GL_POSITION, [1.0, 1.0, -1.0, 0.0])
-        
-        
+
+
         glLightModelfv(GL_LIGHT_MODEL_AMBIENT, [1, 1, 1, 0])
         glEnable(GL_LIGHTING)
@@ -263,10 +263,10 @@
         glEnable(GL_BLEND)
         glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-        
+
         glEnable ( GL_ALPHA_TEST ) ;
         glAlphaFunc ( GL_GREATER, 0 ) ;
         glPixelStorei(GL_PACK_ALIGNMENT, 1)
         glPixelStorei(GL_UNPACK_ALIGNMENT, 1)
-        
+
         glEnable(GL_NORMALIZE)
         glDepthFunc(GL_LESS)
@@ -276,6 +276,6 @@
         #glClear (GL_COLOR_BUFFER_BIT);
         glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
-        
-        
+
+
         gluPerspective(0, 1.0, 0.1, 60.0);
 
@@ -296,5 +296,5 @@
         glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
         # use a fresh transformation matrix
-        
+
         # get the max object size to re-scale
         max_size = 1.0
@@ -305,19 +305,19 @@
             if l>max_size:
                 max_size = l
-        
+
         max_size *= 1.05
         scale = self.scale/max_size
         glScale(scale, scale, scale)
         self.scale = max_size
-        
+
         self.drawAxes()
-        
+
         if self.mouse_down:
             if math.fabs((self.x - self.lastx))>math.fabs((self.y - self.lasty)):
-                angle = 10.0*(self.x - self.lastx) / math.fabs(self.x - self.lastx) 
+                angle = 10.0*(self.x - self.lastx) / math.fabs(self.x - self.lastx)
                 glRotate(angle, self.y_vec[0], self.y_vec[1], self.y_vec[2]);
                 self._rot_y(angle)
             elif math.fabs(self.y - self.lasty)>0:
-                angle = 10.0*(self.y - self.lasty) / math.fabs(self.y - self.lasty) 
+                angle = 10.0*(self.y - self.lasty) / math.fabs(self.y - self.lasty)
                 glRotate(angle, self.x_vec[0], self.x_vec[1], self.x_vec[2]);
                 self._rot_x(angle)
@@ -325,7 +325,7 @@
             self.lasty = self.y
             self.lastx = self.x
-        
-            w,h = self.GetVirtualSizeTuple()
-        
+
+            w, h = self.GetVirtualSize()
+
             # Translate in the x-y plane
             vx = self.x_vec[0] * 2.0*float(self.tr_x - self.tr_lastx)/w \
@@ -335,13 +335,13 @@
             vz = self.x_vec[2] * 2.0*float(self.tr_x - self.tr_lastx)/w \
                + self.y_vec[2] * 2.0*float(self.tr_lasty - self.tr_y)/h
-            
-            glTranslate(self.scale*vx/self.zoom, self.scale*vy/self.zoom, self.scale*vz/self.zoom)    
-                
+
+            glTranslate(self.scale*vx/self.zoom, self.scale*vy/self.zoom, self.scale*vz/self.zoom)
+
         # push into visible buffer
         self.SwapBuffers()
-        
+
     def _matrix_mult(self, v, axis, angle):
         c = math.cos(angle)
-        s = math.sin(angle) 
+        s = math.sin(angle)
         x = axis[0]
         y = axis[1]
@@ -351,13 +351,13 @@
         vz = v[0]*(x*z*(1-c)-y*s) + v[1]*(y*z*(1-c)+x*s) + v[2]*(z*z*(1-c)+c)
         return [vx, vy, vz]
-    
+
     def _rot_y(self, theta):
         """
             Rotate the view by theta around the y-axis
         """
-        angle = theta/180.0*math.pi 
+        angle = theta/180.0*math.pi
         axis = self.y_vec
         self.x_vec = self._matrix_mult(self.x_vec, self.y_vec, -angle)
-        
+
     def _rot_x(self, theta):
         """
@@ -366,6 +366,6 @@
         angle = theta/180.0*math.pi
         self.y_vec = self._matrix_mult(self.y_vec, self.x_vec, -angle)
-        
-        
+
+
     def addShape(self, shape, name=None):
         """
@@ -403,29 +403,29 @@
 
     def drawAxes(self):
-        """ 
+        """
             Draw 3D axes
         """
         pos = self.scale * 0.7
-       
+
         # Z-axis is red
-        zaxis= Arrow(x=pos, y=-pos, z=0, r_cyl=self.scale*0.005, r_cone=self.scale*0.01, 
+        zaxis= Arrow(x=pos, y=-pos, z=0, r_cyl=self.scale*0.005, r_cone=self.scale*0.01,
                      l_cyl=self.scale*0.1, l_cone=self.scale*0.05)
         zaxis.color = COLOR_RED
         zaxis.draw()
-        
+
         # Y-axis is yellow
-        yaxis= Arrow(x=pos, y=-pos, z=0, r_cyl=self.scale*0.005, r_cone=self.scale*0.01, 
+        yaxis= Arrow(x=pos, y=-pos, z=0, r_cyl=self.scale*0.005, r_cone=self.scale*0.01,
                      l_cyl=self.scale*0.1, l_cone=self.scale*0.05)
         yaxis.color = COLOR_YELLOW
         yaxis.rotate(-90,0,0)
         yaxis.draw()
-        
+
         # X-axis is green
-        xaxis= Arrow(x=pos, y=-pos, z=0, r_cyl=self.scale*0.005, r_cone=self.scale*0.01, 
+        xaxis= Arrow(x=pos, y=-pos, z=0, r_cyl=self.scale*0.005, r_cone=self.scale*0.01,
                      l_cyl=self.scale*0.1, l_cone=self.scale*0.05)
         xaxis.color = COLOR_GREEN
         xaxis.rotate(0,-90,0)
         xaxis.draw()
-        
+
         glLight(GL_LIGHT0, GL_DIFFUSE, DEFAULT_COLOR)
 
@@ -445,5 +445,5 @@
         self.theta_y = 0
         self.theta_z = 0
-        
+
         # Params
         self.params = {}
@@ -453,19 +453,19 @@
         self.details['contrast'] = 'A-2'
         self.details['order']    = ' '
-        
+
         self.highlighted = False
         self.color = DEFAULT_COLOR
-    
+
     def get_volume(self):
         return 0
-    
+
     def get_length(self):
         return 1.0
-    
+
     def highlight(self, value=False):
         self.highlighted = value
-        
+
     def rotate(self, alpha, beta, gamma):
-        """ 
+        """
             Set the rotation angles of the shape
             @param alpha: angle around the x-axis [degrees]
@@ -476,17 +476,17 @@
         self.theta_y = beta
         self.theta_z = gamma
-        
+
     def _rotate(self):
         """
             Perform the OpenGL rotation
-            
+
             Note that the rotation order is reversed.
             We do Y, X, Z do be compatible with simulation...
         """
-        
+
         glRotated(self.theta_z, 0, 0, 1)
         glRotated(self.theta_x, 1, 0, 0)
         glRotated(self.theta_y, 0, 1, 0)
-        
+
     def _pre_draw(self):
         if self.highlighted:
@@ -506,10 +506,10 @@
         self.l_cyl = l_cyl
         self.l_cone = l_cone
-           
+
     def draw(self):
         self._pre_draw()
         glPushMatrix()
         glTranslate(self.x, self.y, self.z)
-        
+
         # Perform rotation
         glRotate(self.theta_x, 1, 0, 0)
@@ -520,10 +520,10 @@
         qobj = gluNewQuadric();
         gluCylinder(qobj, self.r_cyl, self.r_cyl, self.l_cyl, 15, 5);
-                
+
         glTranslate(0, 0, self.z+self.l_cyl)
-        
+
         # Draw cone of the arrow
         glutSolidCone(self.r_cone, self.l_cone, 30, 5)
-        
+
         # Translate back to original position
         glTranslate(-self.x, -self.y, -self.z)
@@ -538,5 +538,5 @@
         self.radius = radius
         self.height = height
-        
+
     def draw(self):
         glPushMatrix()
@@ -556,11 +556,11 @@
         self.params['radius'] = radius
         self.details['radius'] = 'A'
-        
+
     def get_volume(self):
         return 4.0/3.0*math.pi*self.params['radius']*self.params['radius']*self.params['radius']
-        
+
     def get_length(self):
         return 2.0*self.params['radius']
-    
+
     def draw(self):
         self._pre_draw()
@@ -584,6 +584,6 @@
     """
         Cylinder shape, by default the cylinder is oriented along
-        the z-axis. 
-        
+        the z-axis.
+
         The reference point of the cylinder is the center of the
         bottom circle.
@@ -596,8 +596,8 @@
         self.details['radius'] = 'A'
         self.details['length'] = 'A'
-        
+
     def get_volume(self):
         return math.pi*self.params['radius']*self.params['radius']*self.params['length']
-        
+
     def get_length(self):
         if self.params['length']>2.0*self.params['radius']:
@@ -605,11 +605,11 @@
         else:
             return 2.0*self.params['radius']
-        
+
     def draw(self):
         self._pre_draw()
         glPushMatrix()
-        
+
         glTranslate(self.x, self.y, self.z)
-        self._rotate() 
+        self._rotate()
         qobj = gluNewQuadric();
         # gluCylinder(qobj, r_base, r_top, L, div around z, div along z)
@@ -619,15 +619,15 @@
         glPopMatrix()
         glLight(GL_LIGHT0, GL_DIFFUSE, DEFAULT_COLOR)
-        
+
     def accept(self, visitor):
         return visitor.fromCylinder(self)
-        
+
     def accept_update(self, visitor):
         return visitor.update_cylinder(self)
-        
+
 # Fill the shape list
 SHAPE_LIST.append(dict(name='Sphere',   id=wx.NewId(), cl=Sphere))
 SHAPE_LIST.append(dict(name='Cylinder', id=wx.NewId(), cl=Cylinder))
-        
+
 def getShapes():
     """
@@ -635,5 +635,5 @@
     """
     return SHAPE_LIST
-    
+
 def getShapeClass(id):
     """
@@ -647,5 +647,5 @@
         return shape[0]['cl']
     return None
-    
+
 def getShapeClassByName(name):
     """
