Skip to content

Commit

Permalink
replace is_set with isSet for backwards compatibility with Python 2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
heldersepu committed Aug 17, 2013
1 parent 2401a51 commit 3a295a3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions gmapcatcher/mapGPS.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def run(self):
global available
if self.gps_type == mapConst.TYPE_GPSD and self.gps_session:
try:
while not self.finished.is_set():
while not self.finished.isSet():
self.gps_session.next()
if time.time() - self.lastUpdate > self.interval:
self.function(self.gps_session.fix)
Expand All @@ -131,7 +131,7 @@ def run(self):
elif self.gps_type == mapConst.TYPE_SERIAL and self.serial_port and self.baudrate:
sergps = serialGPS.SerialGPS(self.serial_port, self.baudrate)
sergps.start()
while not self.finished.is_set():
while not self.finished.isSet():
time.sleep(self.interval)
available = sergps.available
if not available:
Expand Down
2 changes: 1 addition & 1 deletion gmapcatcher/serialGPS.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def __init__(self, port='/dev/ttyS0', baudrate=9600, timeout=3):
def run(self):
try:
# read buffer while stop is called
while not self.__stop.is_set():
while not self.__stop.isSet():
# if the serial port connection exists...
if self.ser:
try:
Expand Down
10 changes: 5 additions & 5 deletions gmapcatcher/widgets/mapDrawingArea.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,10 @@ def __init__(self, da, gc, unit, tracks, zl, track_width, draw_distance=False):
self.setDaemon(True)

def run(self):
while not self.__stop.is_set():
while not self.__stop.isSet():
self.update.wait() # Wait for update signal to start updating
self.update.clear() # Clear the signal straight away to allow stopping of the update
if self.update_all.is_set():
if self.update_all.isSet():
rect = self.da.get_allocation()
self.base_point = mapUtils.pointer_to_coord(rect, (0, 0), self.da.center, self.zl)
for track in self.tracks:
Expand Down Expand Up @@ -250,7 +250,7 @@ def coord_to_screen(c):

for j in range(len(screen_coords) - 1):
# If update or __stop was set while we're in the loop, break
if self.update.is_set() or self.update_all.is_set() or self.__stop.is_set():
if self.update.isSet() or self.update_all.isSet() or self.__stop.isSet():
return
if abs(screen_coords[j][0] + mod_x) < threshold_x \
and abs(screen_coords[j][1] + mod_y) < threshold_y:
Expand Down Expand Up @@ -295,7 +295,7 @@ def __init__(self, da, zl, marker, coord, conf, pixDim):
self.img = self.marker.get_marker_pixbuf(zl)

def run(self):
while not self.__stop.is_set():
while not self.__stop.isSet():
self.update.wait()
self.update.clear()
self.draw_markers()
Expand All @@ -306,7 +306,7 @@ def stop(self):

def draw_markers(self):
for string in self.marker.positions.keys():
if self.update.is_set() or self.__stop.is_set():
if self.update.isSet() or self.__stop.isSet():
break
mpos = self.marker.positions[string]
if (self.zl <= mpos[2]) and (mpos[0], mpos[1]) != (self.coord[0], self.coord[1]):
Expand Down

0 comments on commit 3a295a3

Please sign in to comment.