Ignore:
Timestamp:
Jul 22, 2009, 9:22:11 AM (16 years ago)
Author:
rwilson
Message:

Replaced 'print' statements with log.critical() calls.

Location:
anuga_core/source/anuga/pmesh
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/pmesh/graphical_mesh_generator.py

    r5188 r7317  
    1717import load_mesh.loadASCII
    1818from anuga.alpha_shape.alpha_shape import AlphaError
     19import anuga.utilities.log as log
    1920
    2021# CONSTANTS
     
    413414        dialog = AddVertexDialog(self.canvas)
    414415        if dialog.xyValuesOk:
    415             print dialog.x
    416             print dialog.y
     416            log.critical(str(dialog.x))
     417            log.critical(str(dialog.y))
    417418            self.drawVertex(dialog.x*self.SCALE,dialog.y*self.SCALE,None)
    418419            #Since the new vertex may be off screen
    419420            self.ResizeToFit()
    420421        else:
    421             print "bad values"
     422            log.critical("bad values")
    422423   
    423424    def windowDefault (self, parent):
     
    510511                             smooth_indents=dialog.smooth_indents.get(),
    511512                             expand_pinch=dialog.expand_pinch.get())
    512         #print "newsegs",newsegs
    513         #print "ObjectsToVisuallyDelete",ObjectsToVisuallyDelete
    514513           
    515514        for drawOb in ObjectsToVisuallyDelete:
     
    563562       
    564563        if dialog.ValuesOk:
    565             print dialog.minAngle
    566             print dialog.maxArea
     564            log.critical(str(dialog.minAngle))
     565            log.critical(str(dialog.maxArea))
    567566           
    568567            self.clearSelections()
     
    586585            else:
    587586                pass
    588             print "userMeshChanged = False"
     587            log.critical("userMeshChanged = False")
    589588            self.UserMeshChanged = False
    590589            self.visualiseMesh(self.mesh)
    591             print "Mesh Generation finished"
     590            log.critical("Mesh Generation finished")
    592591           
    593592    def MeshGenAreaAngle (self, minAngle, maxArea, mesh):
     
    621620            pass
    622621        meshArea = 0
    623         #print "tempMesh.getTriangulation()", tempMesh.getTriangulation()
    624622        meshArea = tempMesh.tri_mesh.calc_mesh_area()
    625623        maxArea = meshArea/numTriangles
     
    639637        #The screen canvas has y 'flipped'.  -1* unflips it
    640638        self.lasty = self.starty = -1*self.canvas.canvasy(event.y)
    641         print "----------------------"
     639        log.critical "----------------------")
    642640        self.mouseDownCurFunc( self.lastx,
    643641                               self.lasty,event) #!!! remove the event?
     
    651649        if event.widget.find_withtag(CURRENT): # if there's a widget with a tag
    652650            [tag,string] = self.canvas.gettags(CURRENT) # get a list of them
    653             print "tag",tag  #tags ('M*1008', 'current')
     651            log.critical("tag %s" % str(tag))  #tags ('M*1008', 'current')
    654652            if tag[:2] == 'M*':   #!!! this can be removed when there are
    655653                #    only mesh objects on screen
    656654                #key, value = string.split(tag, '*')
    657655                objectID = tag
    658                 print "Found!! objectID:", objectID
     656                log.critical("Found!! objectID: %s" % str(objectID))
    659657               
    660658                meshObjects = self.getAllUserMeshObjects()
     
    663661                    selMeshObject = meshObjects.getMeshObject(objectID)
    664662                    found = True
    665                     print "Found! selMeshObject", selMeshObject
     663                    log.critical("Found! selMeshObject: %s"
     664                                 % str(selMeshObject))
    666665                    #Only select one object at a time
    667666                    if self.selMeshObject:
     
    728727        #x_scaled =  self.SCALE*x
    729728        #y_scaled = -1*self.SCALE*y
    730         #print "x y:", x,y
    731729        vert = self.Vertices.draw(x-self.mesh.geo_reference.get_xllcorner,
    732730                                  y-self.mesh.geo_reference.get_yllcorner,
     
    749747        #x_scaled =  self.SCALE*x
    750748        #y_scaled = -1*self.SCALE*y
    751         #print "x y:", x,y
    752749        vert = self.Vertices.draw(x,y,self.mesh,self.uniqueID,self.SCALE,self.canvas,event)
    753750        self.UserMeshChanged = True
     
    784781        if event.widget.find_withtag(CURRENT): # if there's a widget with a tag
    785782            [tag,string] = self.canvas.gettags(CURRENT) # get a list of them
    786             print "tag",tag  #tags ('M*1008', 'current')
     783            log.critical("tag %s" % str(tag))  #tags ('M*1008', 'current')
    787784            objectID = tag
    788             #print "Found!! objectID:", objectID
    789785            if self.Vertices.hasKey(objectID): #isinstance(self.meshObjects[objectID],mesh.Vertex):
    790786                vertex = self.Vertices.getMeshObject(objectID)
    791787                found = True
    792                 print "Found! vertex", vertex
     788                log.critical("Found! vertex: %s" % str(vertex))
    793789           
    794790        if found and self.selVertex == vertex:
    795             print "The selected vertex has already been selected"
     791            log.critical("The selected vertex has already been selected")
    796792            #The selected vertex has already been selected
    797793            # therefore deselect it
     
    808804                    self.selectVertex(vertex,objectID)
    809805            else:
    810                 print "vertex is the 1st vertex"
     806                log.critical("vertex is the 1st vertex")
    811807                #vertex is the 1st vertex
    812808                self.selectVertex(vertex,objectID)
    813809        else:
    814             print " There are no widgets.  This happen's too much"
     810            log.critical(" There are no widgets.  This happen's too much")
    815811                   
    816812
     
    844840    def printGeoReference(self):
    845841        try:
    846             print "geo reference", self.mesh.geo_reference
     842            log.critical("geo reference %s" % str(self.mesh.geo_reference))
    847843        except:
    848             print "no geo reference"
     844            log.critical("no geo reference")
    849845       
    850846    def visualiseMesh(self,mesh):
     
    10071003        import mesh data from a variety of formats (currently 2!)
    10081004        """
    1009         print "self.currentPath",self.currentPath
     1005        log.critical("self.currentPath %s" % str(self.currentPath))
    10101006        ofile = tkFileDialog.askopenfilename(initialdir=self.currentPath,
    10111007                                             filetypes=[ ("text Mesh",
     
    10211017            newmesh = mesh.importMeshFromFile(ofile)
    10221018            self.currentPath, dummy = os.path.split(ofile)
    1023             #print "be good self.currentPath",self.currentPath
    10241019            self.currentFilePathName = ofile
    10251020            self.clearMesh()
     
    10411036        # Could not get the file name to showup in the title
    10421037        #appname =  ofile + " - " + APPLICATION_NAME
    1043         #print "appname",appname
    10441038       
    10451039        except load_mesh.loadASCII.TitleAmountError:
     
    10861080        Save the current drawing
    10871081        """
    1088         #print "dsg!!! self.currentFilePathName ",self.currentFilePathName
    10891082        if (self.currentFilePathName[-4:] != ".tsh" or
    10901083            self.currentFilePathName[-4:] != ".msh"):
     
    11201113        there is no generated mesh do not prompt.
    11211114        """
    1122         #print "self.UserMeshChanged",self.UserMeshChanged
    1123         #print "self.mesh.isTriangulation()",self.mesh.isTriangulation()
    11241115        if (self.UserMeshChanged) and self.mesh.isTriangulation():
    11251116           
     
    12201211       
    12211212        fd.close()
    1222         print 'returning m'
     1213        log.critical('returning m')
    12231214        return oadtestmesh(ofile)
    12241215         
  • anuga_core/source/anuga/pmesh/mesh.py

    r7276 r7317  
    3434     ensure_geospatial, ensure_absolute, ensure_numeric
    3535from anuga.mesh_engine.mesh_engine import generate_mesh
     36import anuga.utilities.log as log
     37
    3638
    3739try: 
     
    145147        x =  scale*(self.x + xoffset)
    146148        y = -1*scale*(self.y + yoffset)  # - since for a canvas - is up
    147         #print "draw x:", x
    148         #print "draw y:", y
    149149        cornerOffset= self.VERTEXSQUARESIDELENGTH/2
    150150
     
    187187        x =  scale*(self.x + xoffset)
    188188        y = -1*scale*(self.y + yoffset)  # - since for a canvas - is up
    189         #print "draw x:", x
    190         #print "draw y:", y
    191189        cornerOffset= self.HOLECORNERLENGTH/2
    192190        return canvas.create_oval(x-cornerOffset,
     
    612610    # Depreciated
    613611    def addRegionEN(self, x,y):
    614         print "depreciated, use add_region"
     612        log.critical("deprecated, use add_region")
    615613        return self.add_region(x,y)
    616614
     
    22662264        counter = newmesh.removeDuplicatedUserVertices()
    22672265        if (counter >0):
    2268             print "%i duplicate vertices removed from dataset" % (counter)
     2266            log.critical("%i duplicate vertices removed from dataset" % counter)
    22692267    elif (ofile[-4:]== ".tsh" or ofile[-4:]== ".msh"):
    22702268        dict = import_mesh_file(ofile)
     
    23402338            region_list[i] = (region_list[i][0],region_list[i][1],i)
    23412339        else:
    2342             print "The region list has a bad size"
     2340            log.critical("The region list has a bad size")
    23432341            # raise an error ..
    23442342            raise Error
  • anuga_core/source/anuga/pmesh/mesh_interface.py

    r7276 r7317  
    55import numpy as num
    66from anuga.utilities.polygon import inside_polygon
    7 
     7import anuga.utilities.log as log
    88
    99
     
    151151                #raise Exception, msg
    152152                # Fixme: Use proper Python warning
    153                 if verbose: print 'WARNING: ', msg
     153                if verbose: log.critical('WARNING: %s' % msg)
    154154               
    155155
     
    187187                else:
    188188                    msg += ' I will ignore it.'
    189                     print msg
     189                    log.critical(msg)
    190190
    191191            else:
     
    313313        return m
    314314    else:
    315         if verbose: print 'Generating mesh to file "%s"' %filename
     315        if verbose: log.critical("Generating mesh to file '%s'" % filename)
    316316        m.generate_mesh(minimum_triangle_angle=minimum_triangle_angle,
    317317                        verbose=verbose)
Note: See TracChangeset for help on using the changeset viewer.