diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-09-29 19:58:31 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-09-29 19:58:31 +0200 |
commit | 70aac3b744156d9b77b6720b23e63f7f979c7b96 (patch) | |
tree | 944d43feb6c4fbf649db1b671527493ccfa84f1e /src/Gui | |
parent | 93101c6aae7b2aaa1d1533c37cf0b0109689c9e1 (diff) | |
download | abrt-70aac3b744156d9b77b6720b23e63f7f979c7b96.tar.gz abrt-70aac3b744156d9b77b6720b23e63f7f979c7b96.tar.xz abrt-70aac3b744156d9b77b6720b23e63f7f979c7b96.zip |
remove DBusManager::uniq_name
also fix some whitespace damage
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'src/Gui')
-rw-r--r-- | src/Gui/ABRTExceptions.py | 5 | ||||
-rw-r--r-- | src/Gui/ABRTPlugin.py | 6 | ||||
-rw-r--r-- | src/Gui/CCDBusBackend.py | 42 | ||||
-rw-r--r-- | src/Gui/CCDump.py | 2 | ||||
-rw-r--r-- | src/Gui/CCMainWindow.py | 14 | ||||
-rw-r--r-- | src/Gui/CCReporterDialog.py | 4 | ||||
-rw-r--r-- | src/Gui/CC_gui_functions.py | 7 | ||||
-rw-r--r-- | src/Gui/PluginList.py | 11 | ||||
-rw-r--r-- | src/Gui/SettingsDialog.py | 76 |
9 files changed, 80 insertions, 87 deletions
diff --git a/src/Gui/ABRTExceptions.py b/src/Gui/ABRTExceptions.py index 9b1aa32c..791654f5 100644 --- a/src/Gui/ABRTExceptions.py +++ b/src/Gui/ABRTExceptions.py @@ -1,14 +1,15 @@ from abrt_utils import _ + class IsRunning(Exception): def __init__(self): self.what = _("Another client is already running, trying to wake it.") def __str__(self): return self.what - + class WrongData(Exception): def __init__(self): self.what = _("Got unexpected data from daemon (is the database properly updated?).") - + def __str__(self): return self.what diff --git a/src/Gui/ABRTPlugin.py b/src/Gui/ABRTPlugin.py index 4a94e670..c77bd792 100644 --- a/src/Gui/ABRTPlugin.py +++ b/src/Gui/ABRTPlugin.py @@ -23,7 +23,7 @@ class PluginSettings(dict): """Class to represent common plugin info""" class PluginInfo(): - types = {"Analyzer":_("Analyzer plugins"), + types = {"Analyzer":_("Analyzer plugins"), "Action":_("Action plugins"), "Reporter":_("Reporter plugins"), "Database":_("Database plugins")} @@ -48,7 +48,7 @@ class PluginInfo(): def getDescription(self): return self.Description - + def getType(self): return self.Type @@ -57,7 +57,7 @@ class PluginInfo(): def __str__(self): return self.Name - + def __getitem__(self, item): return self.__dict__[item] diff --git a/src/Gui/CCDBusBackend.py b/src/Gui/CCDBusBackend.py index 844b3718..6c91214e 100644 --- a/src/Gui/CCDBusBackend.py +++ b/src/Gui/CCDBusBackend.py @@ -20,7 +20,6 @@ class DBusManager(gobject.GObject): """ Class to provide communication with daemon over dbus """ # and later with policyKit bus = None - uniq_name = None def __init__(self): self.pending_jobs = [] session = None @@ -53,19 +52,19 @@ class DBusManager(gobject.GObject): gobject.GObject.__init__(self) # signal emited when new crash is detected - gobject.signal_new ("crash", self, gobject.SIGNAL_RUN_FIRST,gobject.TYPE_NONE,()) + gobject.signal_new("crash", self, gobject.SIGNAL_RUN_FIRST,gobject.TYPE_NONE,()) # signal emited when new analyze is complete - gobject.signal_new ("analyze-complete", self, gobject.SIGNAL_RUN_FIRST,gobject.TYPE_NONE,(gobject.TYPE_PYOBJECT,)) + gobject.signal_new("analyze-complete", self, gobject.SIGNAL_RUN_FIRST,gobject.TYPE_NONE,(gobject.TYPE_PYOBJECT,)) # signal emited when smth fails - 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,)) + 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.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,()) + gobject.signal_new("show", self, gobject.SIGNAL_RUN_FIRST,gobject.TYPE_NONE,()) # signal emited to show gui if user try to run it again - gobject.signal_new ("daemon-state-changed", self, gobject.SIGNAL_RUN_FIRST,gobject.TYPE_NONE,(gobject.TYPE_PYOBJECT,)) - gobject.signal_new ("report-done", self, gobject.SIGNAL_RUN_FIRST,gobject.TYPE_NONE,(gobject.TYPE_PYOBJECT,)) + gobject.signal_new("daemon-state-changed", self, gobject.SIGNAL_RUN_FIRST,gobject.TYPE_NONE,(gobject.TYPE_PYOBJECT,)) + gobject.signal_new("report-done", self, gobject.SIGNAL_RUN_FIRST,gobject.TYPE_NONE,(gobject.TYPE_PYOBJECT,)) # export the app dbus interface if session: @@ -103,14 +102,12 @@ class DBusManager(gobject.GObject): 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, 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: self.emit("warning", message) @@ -138,7 +135,6 @@ class DBusManager(gobject.GObject): if not self.bus: self.bus = dbus.SystemBus() self.bus.add_signal_receiver(self.owner_changed_cb,"NameOwnerChanged", dbus_interface="org.freedesktop.DBus") - self.uniq_name = self.bus.get_unique_name() if not self.bus: raise Exception(_("Can't connect to dbus")) self.proxy = self.bus.get_object(CC_IFACE, CC_PATH, introspect=False) @@ -173,18 +169,16 @@ class DBusManager(gobject.GObject): 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) + print "Started our job: %s" % job_id + self.addJob(job_id) def jobdone_cb(self, dest, uuid): - if self.uniq_name == dest: - print "Our job for UUID %s is done." % uuid - dump = self.cc.GetJobResult(uuid) - if dump: - self.emit("analyze-complete", dump) - else: - self.emit("abrt-error",_("Daemon did't return valid report info\nDebuginfo is missing?")) + print "Our job for UUID %s is done." % uuid + dump = self.cc.GetJobResult(uuid) + if dump: + self.emit("analyze-complete", dump) + else: + self.emit("abrt-error",_("Daemon did't return valid report info\nDebuginfo is missing?")) def report_done(self, result): self.emit("report-done", result) @@ -225,7 +219,7 @@ class DBusManager(gobject.GObject): #for i in settings.keys(): # print i return settings - + def registerPlugin(self, plugin_name): return self.cc.RegisterPlugin(plugin_name) @@ -237,7 +231,7 @@ class DBusManager(gobject.GObject): def getSettings(self): return self.cc.GetSettings() - + def setSettings(self, settings): # FIXME: STUB!!!! print "setSettings stub" diff --git a/src/Gui/CCDump.py b/src/Gui/CCDump.py index 6993598e..212d4410 100644 --- a/src/Gui/CCDump.py +++ b/src/Gui/CCDump.py @@ -35,7 +35,7 @@ class Dump(): def isReported(self): return self.Reported[CONTENT] == "1" - + def getMessage(self): if not self.Message: return [] diff --git a/src/Gui/CCMainWindow.py b/src/Gui/CCMainWindow.py index d10304c8..a9976a37 100644 --- a/src/Gui/CCMainWindow.py +++ b/src/Gui/CCMainWindow.py @@ -123,18 +123,18 @@ class MainWindow(): self.ccdaemon.connect("show", self.show_cb) self.ccdaemon.connect("daemon-state-changed", self.on_daemon_state_changed_cb) self.ccdaemon.connect("report-done", self.on_report_done_cb) - + # load data #self.load() self.pluginlist = getPluginInfoList(self.ccdaemon) - + def on_daemon_state_changed_cb(self, widget, state): if state == "up": self.hydrate() self.window.set_sensitive(True) elif state == "down": self.window.set_sensitive(False) - + def on_popupActivate(self, widget, event): menu = self.wTree.get_widget("popup_menu") # 3 == right mouse button @@ -150,7 +150,7 @@ class MainWindow(): dialog = PluginsSettingsDialog(self.window,self.ccdaemon) dialog.hydrate() dialog.show() - + def on_miSettings_clicked(self, widget): dialog = SettingsDialog(self.window, self.ccdaemon) dialog.hydrate() @@ -165,7 +165,7 @@ class MainWindow(): pass except Exception, e: pass - gui_error_message("%s" % message,parent_dialog=self.window) + gui_error_message("%s" % message, parent_dialog=self.window) def error_cb(self, daemon, message=None): # try to hide the progressbar, we dont really care if it was visible .. @@ -174,7 +174,7 @@ class MainWindow(): self.pBarWindow.hide() except Exception, e: pass - gui_error_message(_("Unable to finish current task!\n%s" % message),parent_dialog=self.window) + gui_error_message(_("Unable to finish current task!\n%s" % message), parent_dialog=self.window) def update_cb(self, daemon, message, job_id): message = message.replace('\n',' ') @@ -296,7 +296,7 @@ class MainWindow(): try: self.update_pBar = False self.pBarWindow.show_all() - self.timer = gobject.timeout_add (100,self.progress_update_cb) + self.timer = gobject.timeout_add(100, self.progress_update_cb) reporters_settings = {} for plugin in self.pluginlist.getReporterPlugins(): reporters_settings[str(plugin)] = plugin.Settings diff --git a/src/Gui/CCReporterDialog.py b/src/Gui/CCReporterDialog.py index 58ccb2d9..8804eeee 100644 --- a/src/Gui/CCReporterDialog.py +++ b/src/Gui/CCReporterDialog.py @@ -115,9 +115,9 @@ class ReporterDialog(): self.comment_changed = True except Exception, e: pass - + buff.set_text(comment) - + self.tvComment.set_buffer(buff) continue if self.report[item][TYPE] != 's': diff --git a/src/Gui/CC_gui_functions.py b/src/Gui/CC_gui_functions.py index 525841a9..3665d1b4 100644 --- a/src/Gui/CC_gui_functions.py +++ b/src/Gui/CC_gui_functions.py @@ -31,10 +31,9 @@ def gui_report_dialog ( report_status_dict, parent_dialog, builderfile = "%s%sdialogs.glade" % (sys.path[0],"/") builder.add_from_file(builderfile) dialog = builder.get_object("ReportDialog") - - + main_hbox = builder.get_object("main_hbox") - + STATUS = 0 MESSAGE = 1 message = "" @@ -200,7 +199,7 @@ def get_icon_for_package(theme,package): return gtk.gdk.pixbuf_new_from_file_at_size(icon_filename,22,22) else: return None - + if __name__ == "__main__": window = gtk.Window() gui_report_dialog("<b>Bugzilla</b>: <span foreground='red'>CReporterBugzilla::Report(): CReporterBugzilla::Login(): RPC response indicates failure. The username or password you entered is not valid.</span>\n<b>Logger</b>: Report was stored into: /var/log/abrt-logger", window) diff --git a/src/Gui/PluginList.py b/src/Gui/PluginList.py index 431a5f62..13c9537f 100644 --- a/src/Gui/PluginList.py +++ b/src/Gui/PluginList.py @@ -33,20 +33,19 @@ class PluginInfoList(list): return else: print "db == None!" - - + def getEnabledPlugins(self): return [x for x in self if x["Enabled"] == 'yes'] - + def getActionPlugins(self): return [x for x in self if x["Enabled"] == 'yes' and x["Type"] == 'Action'] - + def getDatabasePlugins(self): return [x for x in self if x["Enabled"] == 'yes' and x["Type"] == 'Database'] - + def getAnalyzerPlugins(self): return [x for x in self if x["Enabled"] == 'yes' and x["Type"] == 'Analyzer'] - + def getReporterPlugins(self): return [x for x in self if x["Enabled"] == 'yes' and x["Type"] == 'Reporter'] diff --git a/src/Gui/SettingsDialog.py b/src/Gui/SettingsDialog.py index a0c79f5e..8c9c666d 100644 --- a/src/Gui/SettingsDialog.py +++ b/src/Gui/SettingsDialog.py @@ -8,9 +8,9 @@ from abrt_utils import _ #FIXME: create a better struct, to automatize hydrate/dehydrate process -settings_dict = { "Common": - {"OpenGPGCheck":bool, - "Database":object, +settings_dict = { "Common": + {"OpenGPGCheck":bool, + "Database":object, "EnabledPlugins": list, "BlackList": list, "MaxCrashReportsSize": int, @@ -28,14 +28,14 @@ class SettingsDialog: self.builder.get_object("bSaveSettings").connect("clicked", self.on_ok_clicked) self.builder.get_object("bCancelSettings").connect("clicked", self.on_cancel_clicked) self.builder.get_object("bAddCronJob").connect("clicked", self.on_bAddCronJob_clicked) - + # action plugin list for Cron tab self.actionPluginsListStore = gtk.ListStore(str, object) self.actionPluginsListStore.append([_("<b>Select plugin</b>"), None]) # database plugin list self.databasePluginsListStore = gtk.ListStore(str, object) self.databasePluginsListStore.append([_("<b>Select database backend</b>"), None]) - + self.dbcombo = self.builder.get_object("cbDatabase") self.dbcombo.set_model(self.databasePluginsListStore) cell = gtk.CellRendererText() @@ -43,7 +43,7 @@ class SettingsDialog: self.dbcombo.add_attribute(cell, "markup", 0) # blacklist edit self.builder.get_object("bEditBlackList").connect("clicked", self.on_blacklistEdit_clicked) - + self.builder.get_object("bOpenGPGPublicKeys").connect("clicked", self.on_GPGKeysEdit_clicked) self.builder.get_object("bAddAction").connect("clicked", self.on_bAddAction_clicked) # AnalyzerActionsAndReporters @@ -56,16 +56,16 @@ class SettingsDialog: self.tvGPGKeys.set_model(self.GPGKeysListStore) self.builder.get_object("bCancelGPGKeys").connect("clicked", self.on_bCancelGPGKeys_clicked) self.builder.get_object("bSaveGPGKeys").connect("clicked", self.on_bSaveGPGKeys_clicked) - + gpg_column = gtk.TreeViewColumn() cell = gtk.CellRendererText() gpg_column.pack_start(cell) gpg_column.add_attribute(cell, "text", 0) self.tvGPGKeys.append_column(gpg_column) - + def filter_settings(self, model, miter, data): return True - + def hydrate(self): try: self.settings = self.ccdaemon.getSettings() @@ -76,7 +76,7 @@ class SettingsDialog: self.pluginlist = getPluginInfoList(self.ccdaemon, refresh=True) except Exception, e: print e - + ## hydrate cron jobs: for key,val in self.settings["Cron"].iteritems(): # actionas are separated by ',' @@ -105,7 +105,7 @@ class SettingsDialog: self.gpgkeys = common["OpenGPGPublicKeys"].split(',') for gpgkey in self.gpgkeys: self.GPGKeysListStore.append([gpgkey]) - + ## blacklist self.builder.get_object("eBlacklist").set_text(common["BlackList"]) # hydrate AnalyzerActionsAndReporters @@ -115,46 +115,46 @@ class SettingsDialog: if AnalyzerActionsAndReporters.has_key(analplugin.getName()): action = (AnalyzerActionsAndReporters[analplugin.getName()], it) self.add_AnalyzerAction(action) - + def on_bCancelGPGKeys_clicked(self, button): print "cancel" self.wGPGKeys.hide() - + def on_bSaveGPGKeys_clicked(self, button): print "save" self.wGPGKeys.hide() - + def on_bAddGPGKey_clicked(self, button): print "add GPG key" - + def on_bRemoveGPGKey_clicked(self, button): print "add GPG key" - + def on_blacklistEdit_clicked(self, button): print "edit blacklist" - + def on_GPGKeysEdit_clicked(self, button): self.wGPGKeys.show() - + def on_ok_clicked(self, button): self.dehydrate() self.window.hide() - + def on_cancel_clicked(self, button): self.window.hide() - + def on_remove_CronJob_clicked(self, button, job_hbox): self.removeHBoxWihtChildren(job_hbox) - + def on_remove_Action_clicked(self, button, binding_hbox): self.removeHBoxWihtChildren(binding_hbox) - + def removeHBoxWihtChildren(self, job_hbox): job_hbox.get_parent().remove(job_hbox) for child in job_hbox.get_children(): child.destroy() job_hbox.destroy() - + def add_CronJob(self, job=None): hbox = gtk.HBox() time = gtk.Entry() @@ -164,13 +164,13 @@ class SettingsDialog: remove_button.set_image(remove_image) remove_button.set_tooltip_text(_("Remove this job")) remove_button.connect("clicked", self.on_remove_CronJob_clicked, hbox) - plugins = gtk.ComboBox() + plugins = gtk.ComboBox() cell = gtk.CellRendererText() - + plugins.pack_start(cell) plugins.add_attribute(cell, 'markup', 0) plugins.set_model(self.actionPluginsListStore) - + if job: time.set_text(job[0]) plugins.set_active_iter(job[1]) @@ -180,16 +180,16 @@ class SettingsDialog: hbox.pack_start(time,True) hbox.pack_start(remove_button,False) self.builder.get_object("vbCronJobs").pack_start(hbox,False) - + hbox.show_all() - + def on_bAddCronJob_clicked(self, button): self.add_CronJob() print "add" - + def on_bEditAction_clicked(self, button, data=None): print "edit action" - + def add_AnalyzerAction(self, action=None): #print "add_AnalyzerAction" hbox = gtk.HBox() @@ -200,41 +200,41 @@ class SettingsDialog: edit_image.set_from_stock("gtk-edit", gtk.ICON_SIZE_MENU) edit_actions.set_image(edit_image) edit_actions.connect("clicked", self.on_bEditAction_clicked) - + remove_image = gtk.Image() remove_image.set_from_stock("gtk-remove",gtk.ICON_SIZE_MENU) remove_button = gtk.Button() remove_button.set_image(remove_image) remove_button.set_tooltip_text(_("Remove this action")) remove_button.connect("clicked", self.on_remove_Action_clicked, hbox) - + reporters = gtk.ComboBox() cell = gtk.CellRendererText() reporters.pack_start(cell) reporters.add_attribute(cell, 'markup', 0) reporters.set_model(self.analyzerPluginsListStore) - + if action: action_list.set_text(action[0]) reporters.set_active_iter(action[1]) else: reporters.set_active(0) - + hbox.pack_start(reporters,True) hbox.pack_start(action_list,True) hbox.pack_start(edit_actions,False) hbox.pack_start(remove_button,False) self.builder.get_object("vbActions").pack_start(hbox,False) hbox.show_all() - + def on_bAddAction_clicked(self, button): self.add_AnalyzerAction() - + def on_cancel_clicked(self,button): self.window.hide() - + def dehydrate(self): self.ccdaemon.setSettings(self.settings) - + def show(self): self.window.show() |