Commit 6ea932db authored by Ahmad Reza's avatar Ahmad Reza
Browse files

missing returns False and True have been inserted into some

methods of particle.py
parent f8fdde9f
...@@ -903,9 +903,10 @@ class Particle(matter.Matter): ...@@ -903,9 +903,10 @@ class Particle(matter.Matter):
logging.info("is going to delete a particle with id %s", str(id)) logging.info("is going to delete a particle with id %s", str(id))
if self.world.remove_particle(id): if self.world.remove_particle(id):
self.csv_particle_writer.write_particle(particle_deleted=1) self.csv_particle_writer.write_particle(particle_deleted=1)
return return True
else: else:
logging.info("Could not delet particle with particle id %s", str(id)) logging.info("Could not delet particle with particle id %s", str(id))
return False
def delete_particle_in(self, direction=None): def delete_particle_in(self, direction=None):
""" """
...@@ -920,8 +921,10 @@ class Particle(matter.Matter): ...@@ -920,8 +921,10 @@ class Particle(matter.Matter):
if self.world.remove_particle_on(coords): if self.world.remove_particle_on(coords):
logging.info("Deleted particle with particle on coords %s", str(coords)) logging.info("Deleted particle with particle on coords %s", str(coords))
self.csv_particle_writer.write_particle(particle_deleted=1) self.csv_particle_writer.write_particle(particle_deleted=1)
return True
else: else:
logging.info("Could not delet particle on coords %s", str(coords)) logging.info("Could not delet particle on coords %s", str(coords))
return False
def delete_particle_on(self, x=None, y=None): def delete_particle_on(self, x=None, y=None):
""" """
...@@ -1140,8 +1143,12 @@ class Particle(matter.Matter): ...@@ -1140,8 +1143,12 @@ class Particle(matter.Matter):
:param new_coords: new coorindation points :param new_coords: new coorindation points
:return: None :return: None
""" """
particle.coords = new_coords if check_values_are_coordinates(new_coords[0], new_coords[1]):
self.particle_map_coords[new_coords] = particle particle.coords = new_coords
self.particle_map_coords[new_coords] = particle
return True
else:
return False
def create_marker(self, color=black, alpha=1): def create_marker(self, color=black, alpha=1):
""" """
...@@ -1156,7 +1163,7 @@ class Particle(matter.Matter): ...@@ -1156,7 +1163,7 @@ class Particle(matter.Matter):
self.csv_particle_writer.write_particle(marker_created=1) self.csv_particle_writer.write_particle(marker_created=1)
self.world.csv_round.update_markers_num(len(self.world.get_marker_list())) self.world.csv_round.update_markers_num(len(self.world.get_marker_list()))
self.world.csv_round.update_metrics( marker_created=1) self.world.csv_round.update_metrics( marker_created=1)
return new_marker return new_marker
else: else:
return False return False
...@@ -1237,9 +1244,10 @@ class Particle(matter.Matter): ...@@ -1237,9 +1244,10 @@ class Particle(matter.Matter):
logging.info("is going to delete a marker with id %s", str(marker_id)) logging.info("is going to delete a marker with id %s", str(marker_id))
if self.world.remove_marker(marker_id): if self.world.remove_marker(marker_id):
self.csv_particle_writer.write_particle(marker_deleted=1) self.csv_particle_writer.write_particle(marker_deleted=1)
return return True
else: else:
logging.info("Could not delet marker with marker id %s", str(marker_id)) logging.info("Could not delet marker with marker id %s", str(marker_id))
return False
def delete_marker_in(self, direction=None): def delete_marker_in(self, direction=None):
""" """
...@@ -1257,8 +1265,10 @@ class Particle(matter.Matter): ...@@ -1257,8 +1265,10 @@ class Particle(matter.Matter):
if self.world.remove_marker_on(coords): if self.world.remove_marker_on(coords):
logging.info("Deleted marker with marker on coords %s", str(coords)) logging.info("Deleted marker with marker on coords %s", str(coords))
self.csv_particle_writer.write_particle(marker_deleted=1) self.csv_particle_writer.write_particle(marker_deleted=1)
return True
else: else:
logging.info("Could not delet marker on coords %s", str(coords)) logging.info("Could not delet marker on coords %s", str(coords))
return False
def delete_marker_on(self, x=None, y=None): def delete_marker_on(self, x=None, y=None):
""" """
...@@ -1281,5 +1291,4 @@ class Particle(matter.Matter): ...@@ -1281,5 +1291,4 @@ class Particle(matter.Matter):
else: else:
return False return False
else: else:
return False return False
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment