Browse Source

Changed .name for .getName()/.setName() to be compatible with Pytho 2.5

master
Julio Biason 15 years ago
parent
commit
a4c5b06152
  1. 8
      issues/issue-29419930d0857751427cd66cbb7f18dbf6a341c7.yaml
  2. 17
      mitterlib/ui/ui_pygtk.py

8
issues/issue-29419930d0857751427cd66cbb7f18dbf6a341c7.yaml

@ -5,8 +5,8 @@ type: :bugfix
component: pygtk component: pygtk
release: 1.0.0 release: 1.0.0
reporter: Julio Biason <julio.biason@gmail.com> reporter: Julio Biason <julio.biason@gmail.com>
status: :unstarted status: :closed
disposition: disposition: :fixed
creation_time: 2009-12-22 20:01:36.001876 Z creation_time: 2009-12-22 20:01:36.001876 Z
references: [] references: []
@ -16,3 +16,7 @@ log_events:
- Julio Biason <julio.biason@gmail.com> - Julio Biason <julio.biason@gmail.com>
- created - created
- It's "setName()", it seems. - It's "setName()", it seems.
- - 2009-12-25 22:37:50.686391 Z
- Julio Biason <julio.biason@gmail.com>
- closed with disposition fixed
- ""

17
mitterlib/ui/ui_pygtk.py

@ -108,7 +108,8 @@ class _WorkerThread(threading.Thread, _IdleObject):
def run(self): def run(self):
# call the function # call the function
_log.debug('Thread d %s calling %s', self.name, str(self._function)) _log.debug('Thread d %s calling %s', self.getName(),
str(self._function))
args = self._args args = self._args
kwargs = self._kwargs kwargs = self._kwargs
@ -121,7 +122,7 @@ class _WorkerThread(threading.Thread, _IdleObject):
self.emit("exception", exc) self.emit("exception", exc)
return return
_log.debug('Thread id %s completed', self.name) _log.debug('Thread id %s completed', self.getName())
self.emit("completed", result) self.emit("completed", result)
return return
@ -146,18 +147,18 @@ class _ThreadManager(object):
# not actually a widget. It's the object that emitted the signal, in # not actually a widget. It's the object that emitted the signal, in
# this case, the _WorkerThread object. # this case, the _WorkerThread object.
thread_id = widget.name thread_id = widget.getName()
_log.debug('Thread id %s completed, %d threads in the queue', thread_id, _log.debug('Thread id %s completed, %d threads in the queue',
len(self._thread_pool)) thread_id, len(self._thread_pool))
self._running.remove(thread_id) self._running.remove(thread_id)
if self._thread_pool: if self._thread_pool:
if len(self._running) < self._max_threads: if len(self._running) < self._max_threads:
next = self._thread_pool.pop() next = self._thread_pool.pop()
_log.debug('Dequeuing thread %s', next.name) _log.debug('Dequeuing thread %s', next.getName())
self._running.append(next.name) self._running.append(next.getName())
next.start() next.start()
return return
@ -171,7 +172,7 @@ class _ThreadManager(object):
are parameters passed to the function.""" are parameters passed to the function."""
thread = _WorkerThread(func, *args, **kwargs) thread = _WorkerThread(func, *args, **kwargs)
thread_id = '%s' % (self._thread_id) thread_id = '%s-%s' % (self._thread_id, func.__name__)
thread.connect('completed', complete_cb) thread.connect('completed', complete_cb)
thread.connect('completed', self._remove_thread) thread.connect('completed', self._remove_thread)

Loading…
Cancel
Save