Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/canvas.py
diff options
context:
space:
mode:
authorAlan Aguiar <alanjas@hotmail.com>2012-06-09 01:56:41 (GMT)
committer Alan Aguiar <alanjas@hotmail.com>2012-06-09 01:56:41 (GMT)
commitea63dfebe3a23aac77a006d71062e19b80158384 (patch)
tree2e6ae28f4cc10f1aea86beffc47587cfa52b4556 /canvas.py
parent0396e7ec8c4a2c51ed7f2d2bb672ee74fa539b62 (diff)
put a flag for th threads
Diffstat (limited to 'canvas.py')
-rw-r--r--canvas.py25
1 files changed, 14 insertions, 11 deletions
diff --git a/canvas.py b/canvas.py
index 5aacb83..f46e2ac 100644
--- a/canvas.py
+++ b/canvas.py
@@ -83,6 +83,8 @@ class List(gtk.VBox):
self.thread = None
self.words = ''
+ self.can_search = True
+
self.show_all()
def _add_activity(self, widget):
@@ -99,20 +101,18 @@ class List(gtk.VBox):
child = None
def search(self, entry):
-
- try:
- self.thread.cancel()
- except:
+ #_logger.debug(threading.enumerate())
+ if self.can_search:
+ self.can_search = False
+ self.w = entry.get_text().lower()
+ self._clear()
+ self.thread = threading.Thread(target=self._search)
+ self.thread.start()
+ else:
pass
- self.words = entry.get_text().lower()
- self._clear()
-
- self.thread = threading.Timer(0, self._search)
- self.thread.start()
-
def _search(self):
- w = self.words
+ w = str(self.w)
_id = -1
for activity in self._list:
_id += 1
@@ -121,6 +121,9 @@ class List(gtk.VBox):
if (w in name) or (w in description):
activity_widget = ActivityWidget(_id, self)
self._add_activity(activity_widget)
+ self.can_search = True
+
+
class ActivityWidget(gtk.HBox):