summaryrefslogtreecommitdiffstats
path: root/src/Gui
diff options
context:
space:
mode:
authorJiri Moskovcak <jmoskovc@redhat.com>2009-08-27 14:00:31 +0200
committerJiri Moskovcak <jmoskovc@redhat.com>2009-08-27 14:00:31 +0200
commit1dbb6423000e2fcd3fe9a1b6ddbf6200d522d470 (patch)
treed08261580175c8ad796d86bacbbc094c7aa08636 /src/Gui
parentbc17e32391578ee0128fe73719d1f691613d18fe (diff)
downloadabrt-1dbb6423000e2fcd3fe9a1b6ddbf6200d522d470.tar.gz
abrt-1dbb6423000e2fcd3fe9a1b6ddbf6200d522d470.tar.xz
abrt-1dbb6423000e2fcd3fe9a1b6ddbf6200d522d470.zip
added signal JobStarted => removed the ugly sleep() hack
Diffstat (limited to 'src/Gui')
-rw-r--r--src/Gui/CCDBusBackend.py17
-rw-r--r--src/Gui/CCMainWindow.py2
2 files changed, 15 insertions, 4 deletions
diff --git a/src/Gui/CCDBusBackend.py b/src/Gui/CCDBusBackend.py
index 34a30005..864b3669 100644
--- a/src/Gui/CCDBusBackend.py
+++ b/src/Gui/CCDBusBackend.py
@@ -60,7 +60,7 @@ class DBusManager(gobject.GObject):
gobject.signal_new ("abrt-error", self, gobject.SIGNAL_RUN_FIRST,gobject.TYPE_NONE,(gobject.TYPE_PYOBJECT,))
gobject.signal_new ("warning", self, gobject.SIGNAL_RUN_FIRST,gobject.TYPE_NONE,(gobject.TYPE_PYOBJECT,))
# signal emited to update gui with current status
- gobject.signal_new ("update", self, gobject.SIGNAL_RUN_FIRST,gobject.TYPE_NONE,(gobject.TYPE_PYOBJECT,))
+ gobject.signal_new ("update", self, gobject.SIGNAL_RUN_FIRST,gobject.TYPE_NONE,(gobject.TYPE_PYOBJECT,gobject.TYPE_PYOBJECT))
# signal emited to show gui if user try to run it again
gobject.signal_new ("show", self, gobject.SIGNAL_RUN_FIRST,gobject.TYPE_NONE,())
# signal emited to show gui if user try to run it again
@@ -101,12 +101,14 @@ class DBusManager(gobject.GObject):
self.emit("crash")
def update_cb(self, message, job_id=0):
+ print "Update >>%s<< for job: %s" % (message, job_id)
# FIXME: use dest instead of 0 once we implement it in daemon
#if self.uniq_name == dest:
if job_id == 0 or job_id in self.pending_jobs:
- self.emit("update", message)
+ self.emit("update", message, job_id)
def warning_cb(self, message, job_id=0):
+ print "Warning >>%s<< for job: %s" % (message, job_id)
# FIXME: use dest instead of 0 once we implement it in daemon
#if self.uniq_name == dest:
if job_id == 0 or job_id in self.pending_jobs:
@@ -156,14 +158,22 @@ class DBusManager(gobject.GObject):
self.acconnection = self.proxy.connect_to_signal("Warning",self.warning_cb,dbus_interface=CC_IFACE)
# watch for job-done signals
self.acconnection = self.proxy.connect_to_signal("JobDone",self.jobdone_cb,dbus_interface=CC_IFACE)
+ self.acconnection = self.proxy.connect_to_signal("JobStarted",self.jobstarted_cb,dbus_interface=CC_IFACE)
else:
raise Exception(_("Please check if abrt daemon is running."))
def addJob(self, job_id):
self.pending_jobs.append(job_id)
+ def jobstarted_cb(self, dest, job_id):
+ # the job belongs to this client
+ if self.uniq_name == dest:
+ print "Started our job: %s" % job_id
+ self.addJob(job_id)
+
def jobdone_cb(self, dest, job_id):
if self.uniq_name == dest:
+ print "Our job: %s is done." % job_id
dump = self.cc.GetJobResult(job_id)
if dump:
self.emit("analyze-complete", dump)
@@ -178,7 +188,8 @@ class DBusManager(gobject.GObject):
# let's try it async
# even if it's async it timeouts, so let's try to set the timeout to 60sec
#self.cc.CreateReport(UUID, reply_handler=self.addJob, error_handler=self.error_handler, timeout=60)
- self.addJob(self.cc.CreateReport(UUID, timeout=60))
+ # we don't need the return value, as the job_id is sent via JobStarted signal
+ self.cc.CreateReport(UUID, timeout=60)
except dbus.exceptions.DBusException, e:
raise Exception(e)
diff --git a/src/Gui/CCMainWindow.py b/src/Gui/CCMainWindow.py
index d1eaff73..2b1dc784 100644
--- a/src/Gui/CCMainWindow.py
+++ b/src/Gui/CCMainWindow.py
@@ -155,7 +155,7 @@ class MainWindow():
pass
gui_error_message(_("Unable to get report!\n%s" % message),parent_dialog=self.window)
- def update_cb(self, daemon, message):
+ def update_cb(self, daemon, message, job_id):
message = message.replace('\n',' ')
self.wTree.get_widget("lStatus").set_text(message)