В Птн, 06/07/2007 в 21:00 +0200, Sebastian Pölsterl пишет: > >>>> Hi! > >>>> > > Now I don't know where to search for the cause of this problem :( Please > help me !!! > > Some more details on how it should work: > If the user types in something and the text didn't change for 250 ms > each module is queried. Querying the modules works asynchronously (for > each module the query method is called in a thread) and each module > emits a signal if it collected the results. A callback function connects > to those signals and adds the results to the TreeView/TreeStore. If the > entry changed, the TreeView/TreeStore is cleared. > Hm, it seems that with the patch you sent me (in attachment for others) ThreadPool doesn't work correctly. It's just blocking - threads are created but don't start. I'm not sure what is the reason of this bug yet.
Index: /home/sebp/workspace/GSOC_2007/deskbar/core/ThreadPool.py
===================================================================
--- /home/sebp/workspace/GSOC_2007/deskbar/core/ThreadPool.py (revision 1351)
+++ /home/sebp/workspace/GSOC_2007/deskbar/core/ThreadPool.py (working copy)
@@ -87,7 +87,9 @@
self._startSomeWorkers()
def stats(self):
- print self.q.qsize()
+ print "Queue size: %i" % self.q.qsize()
+ print "Working: "
print self.working
- print self.workers
+ print "Workers: %i" % self.workers
+ print "Threads: "
print self.threads
Index: /home/sebp/workspace/GSOC_2007/deskbar/gsoc_deskbar.py
===================================================================
--- /home/sebp/workspace/GSOC_2007/deskbar/gsoc_deskbar.py (revision 1350)
+++ /home/sebp/workspace/GSOC_2007/deskbar/gsoc_deskbar.py (working copy)
@@ -49,7 +49,7 @@
locale.textdomain('deskbar-applet')
# Enable locking
-gtk.gdk.threads_init()
+#gtk.gdk.threads_init()
# Parse commandline options
usage = "deskbar-applet [OPTIONS]"
Index: /home/sebp/workspace/GSOC_2007/deskbar/ui/cuemiac/CuemiacModel.py
===================================================================
--- /home/sebp/workspace/GSOC_2007/deskbar/ui/cuemiac/CuemiacModel.py (revision 1350)
+++ /home/sebp/workspace/GSOC_2007/deskbar/ui/cuemiac/CuemiacModel.py (working copy)
@@ -77,7 +77,7 @@
Automagically append a match or list of matches
to correct category(s), or create a new one(s) if needed.
"""
- gtk.gdk.threads_enter()
+ #gtk.gdk.threads_enter()
if isinstance(match_obj, list):
for hit in match_obj:
self.__append ( (query_string, hit) )
@@ -85,7 +85,7 @@
self.__append ( (query_string, match_obj) )
else:
raise RuntimeError("Unknown Match type")
- gtk.gdk.threads_leave()
+ #gtk.gdk.threads_leave()
def __append (self, match):
qstring, match_obj = match
Index: /home/sebp/workspace/GSOC_2007/deskbar/ui/CuemiacWindowView.py
===================================================================
--- /home/sebp/workspace/GSOC_2007/deskbar/ui/CuemiacWindowView.py (revision 1350)
+++ /home/sebp/workspace/GSOC_2007/deskbar/ui/CuemiacWindowView.py (working copy)
@@ -1,4 +1,5 @@
import gtk
+import gobject
from gettext import gettext as _
import deskbar.interfaces.View
import deskbar.core.Utils
@@ -44,7 +45,8 @@
self.set_position(gtk.WIN_POS_CENTER_ALWAYS)
self.connect("configure-event", self._controller.on_window_resized)
- self._model.connect("query-ready", self.append_matches)
+ #self._model.connect("query-ready", self.append_matches)
+ self._model.connect("query-ready", lambda s,m: gobject.idle_add(self.append_matches, s, m))
# self.completion = gtk.EntryCompletion()
# self.completion.set_model(self._model.get_history())
Attachment:
signature.asc
Description: =?koi8-r?Q?=FC=D4=C1?= =?koi8-r?Q?_=DE=C1=D3=D4=D8?= =?koi8-r?Q?_=D3=CF=CF=C2=DD=C5=CE=C9=D1?= =?koi8-r?Q?_=D0=CF=C4=D0=C9=D3=C1=CE=C1?= =?koi8-r?Q?_=C3=C9=C6=D2=CF=D7=CF=CA?= =?koi8-r?Q?_=D0=CF=C4=D0=C9=D3=D8=C0?=