summaryrefslogtreecommitdiffstats
path: root/src/Gui
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-01-13 16:47:39 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2010-01-13 16:47:39 +0100
commit9e3970c52f800739b4f554a2ec4ef236b566fb00 (patch)
tree3d3a113137bd8bc466f58b9f7c273890140d7bcf /src/Gui
parentfc99cb12f0205a24f5f592af837d73b1c1e59034 (diff)
downloadabrt-9e3970c52f800739b4f554a2ec4ef236b566fb00.tar.gz
abrt-9e3970c52f800739b4f554a2ec4ef236b566fb00.tar.xz
abrt-9e3970c52f800739b4f554a2ec4ef236b566fb00.zip
*: disable plugin loading/unloading through GUI. Document keyring a bit
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'src/Gui')
-rw-r--r--src/Gui/ABRTPlugin.py39
-rw-r--r--src/Gui/CCDBusBackend.py16
-rw-r--r--src/Gui/CCReporterDialog.py2
-rw-r--r--src/Gui/ConfBackend.py22
-rw-r--r--src/Gui/PluginList.py4
-rw-r--r--src/Gui/PluginsSettingsDialog.py68
6 files changed, 87 insertions, 64 deletions
diff --git a/src/Gui/ABRTPlugin.py b/src/Gui/ABRTPlugin.py
index ea90b87c..03b61fb6 100644
--- a/src/Gui/ABRTPlugin.py
+++ b/src/Gui/ABRTPlugin.py
@@ -16,39 +16,40 @@ from ConfBackend import ConfBackendGnomeKeyring, ConfBackendInitError
class PluginSettings(dict):
def __init__(self):
dict.__init__(self)
- self.conf = None
+ self.client_side_conf = None
try:
- self.conf = ConfBackendGnomeKeyring()
+ self.client_side_conf = ConfBackendGnomeKeyring()
except ConfBackendInitError, e:
print e
pass
def check(self):
+ # if present, these should be non-empty
for key in ["Password", "Login"]:
if key in self.keys():
- # some of the required keys is missing
if not self[key]:
+ # some of the required keys are missing
return False
# settings are OK
return True
- def load(self, name, default_settings):
+ def load_daemon_settings(self, name, daemon_settings):
# load settings from daemon
- for key in default_settings.keys():
- self[str(key)] = str(default_settings[key])
+ for key in daemon_settings.keys():
+ self[str(key)] = str(daemon_settings[key])
- if self.conf:
- settings = self.conf.load(name)
- # overwrite defaluts with user setting
+ if self.client_side_conf:
+ settings = self.client_side_conf.load(name)
+ # overwrite daemon data with user setting
for key in settings.keys():
- # only rewrite keys needed by the plugin
- # e.g we don't want a pass field for logger
- if key in default_settings.keys():
+ # only rewrite keys which exist in plugin's keys.
+ # e.g. we don't want a password field for logger plugin
+ if key in daemon_settings.keys():
self[str(key)] = str(settings[key])
- def save(self, name):
- if self.conf:
- self.conf.save(name, self)
+ def save_on_client_side(self, name):
+ if self.client_side_conf:
+ self.client_side_conf.save(name, self)
class PluginInfo():
"""Class to represent common plugin info"""
@@ -90,11 +91,11 @@ class PluginInfo():
def __getitem__(self, item):
return self.__dict__[item]
- def load_settings(self, default_settings):
+ def load_daemon_settings(self, daemon_settings):
if self.Name:
- self.Settings.load(self.Name, default_settings)
+ self.Settings.load_daemon_settings(self.Name, daemon_settings)
else:
print _("Plugin name is not set, can't load its settings")
- def save_settings(self):
- self.Settings.save(str(self.Name))
+ def save_settings_on_client_side(self):
+ self.Settings.save_on_client_side(str(self.Name))
diff --git a/src/Gui/CCDBusBackend.py b/src/Gui/CCDBusBackend.py
index 85987e89..ac378f41 100644
--- a/src/Gui/CCDBusBackend.py
+++ b/src/Gui/CCDBusBackend.py
@@ -167,7 +167,10 @@ class DBusManager(gobject.GObject):
def Report(self, report, reporters_settings = None):
# map < Plguin_name vec <status, message> >
- self.daemon().Report(report, reporters_settings, reply_handler=self.report_done, error_handler=self.error_handler_cb, timeout=60)
+ if reporters_settings:
+ self.daemon().Report(report, reporters_settings, reply_handler=self.report_done, error_handler=self.error_handler_cb, timeout=60)
+ else:
+ self.daemon().Report(report, reply_handler=self.report_done, error_handler=self.error_handler_cb, timeout=60)
def DeleteDebugDump(self,UUID):
return self.daemon().DeleteDebugDump(UUID)
@@ -192,11 +195,12 @@ class DBusManager(gobject.GObject):
# print i
return settings
- def registerPlugin(self, plugin_name):
- return self.daemon().RegisterPlugin(plugin_name)
-
- def unRegisterPlugin(self, plugin_name):
- return self.daemon().UnRegisterPlugin(plugin_name)
+# "Enable" toggling in GUI is disabled for now. Grep for PLUGIN_DYNAMIC_LOAD_UNLOAD
+# def registerPlugin(self, plugin_name):
+# return self.daemon().RegisterPlugin(plugin_name)
+#
+# def unRegisterPlugin(self, plugin_name):
+# return self.daemon().UnRegisterPlugin(plugin_name)
def setPluginSettings(self, plugin_name, plugin_settings):
return self.daemon().SetPluginSettings(plugin_name, plugin_settings)
diff --git a/src/Gui/CCReporterDialog.py b/src/Gui/CCReporterDialog.py
index 09a9c914..bba89423 100644
--- a/src/Gui/CCReporterDialog.py
+++ b/src/Gui/CCReporterDialog.py
@@ -131,7 +131,7 @@ class ReporterDialog():
ui.dehydrate()
if plugin.Settings.check():
try:
- plugin.save_settings()
+ plugin.save_settings_on_client_side()
except Exception, e:
gui_error_message(_("Can't save plugin settings:\n %s" % e))
box = image.get_parent()
diff --git a/src/Gui/ConfBackend.py b/src/Gui/ConfBackend.py
index 5e26f3eb..024a1033 100644
--- a/src/Gui/ConfBackend.py
+++ b/src/Gui/ConfBackend.py
@@ -38,6 +38,22 @@ class ConfBackend(object):
raise NotImplementedError
+# We use Gnome keyring in the following way:
+# we store passwords for each plugin in a key named "abrt:<plugin_name>".
+# The value of the key becomes the value of "Password" setting.
+# Other settings (if plugin has them) are stored as attributes of this key.
+#
+# Example: Key "abrt:Bugzilla" with bugzilla password as value, and with attributes:
+#
+# AbrtPluginInfo: Bugzilla
+# NoSSLVerify: yes
+# Login: user@host.com
+# BugzillaURL: https://host.with.bz.com/
+#
+# The attribute "AbrtPluginInfo" is special, it is used for retrieving
+# the key via keyring API find_items_sync() function.
+
+
class ConfBackendGnomeKeyring(ConfBackend):
def __init__(self):
ConfBackend.__init__(self)
@@ -47,7 +63,7 @@ class ConfBackendGnomeKeyring(ConfBackend):
self.default_key_ring = gkey.get_default_keyring_sync()
except:
# could happen if keyring daemon is running, but we run gui under
- # user who is not owner is the running session - using su
+ # user who is not the owner of the running session - using su
raise ConfBackendInitError(_("Can't get default keyring"))
def save(self, name, settings):
@@ -62,7 +78,7 @@ class ConfBackendGnomeKeyring(ConfBackend):
# nothing found
pass
except gkey.DeniedError:
- raise ConfBackendSaveError(_("Acces to gnome-keyring has been denied, plugins settings won't be saved."))
+ raise ConfBackendSaveError(_("Access to gnome-keyring has been denied, plugins settings won't be saved."))
# delete all items containg "AbrtPluginInfo":<plugin_name>, so we always have only 1 item per plugin
for item in item_list:
@@ -79,7 +95,7 @@ class ConfBackendGnomeKeyring(ConfBackend):
password,
True)
except gkey.DeniedError, e:
- raise ConfBackendSaveError(_("Acces to gnome-keyring has been denied, plugins settings won't be saved."))
+ raise ConfBackendSaveError(_("Access to gnome-keyring has been denied, plugins settings won't be saved."))
def load(self, name):
item_list = None
diff --git a/src/Gui/PluginList.py b/src/Gui/PluginList.py
index e57040d1..79df1269 100644
--- a/src/Gui/PluginList.py
+++ b/src/Gui/PluginList.py
@@ -20,8 +20,8 @@ class PluginInfoList(list):
entry.__dict__[column] = row[column]
if entry.Enabled == "yes":
#entry.Settings = PluginSettings(self.dm.getPluginSettings(str(entry)))
- default_settings = self.dm.getPluginSettings(str(entry))
- entry.load_settings(default_settings)
+ daemon_settings = self.dm.getPluginSettings(str(entry))
+ entry.load_daemon_settings(daemon_settings)
self.append(entry)
self.ddict[entry.getName()] = entry
else:
diff --git a/src/Gui/PluginsSettingsDialog.py b/src/Gui/PluginsSettingsDialog.py
index 8453385d..5feda4ac 100644
--- a/src/Gui/PluginsSettingsDialog.py
+++ b/src/Gui/PluginsSettingsDialog.py
@@ -44,20 +44,21 @@ class PluginsSettingsDialog:
column.set_attributes(column.gray_background, visible=3, cell_background=4)
column.set_resizable(True)
- # toggle
- group_name_renderer = gtk.CellRendererText()
- toggle_renderer = gtk.CellRendererToggle()
- toggle_renderer.set_property('activatable', True)
- toggle_renderer.connect( 'toggled', self.on_enabled_toggled, self.pluginsListStore )
- column = gtk.TreeViewColumn(_('Enabled'))
- column.pack_start(toggle_renderer, True)
- column.pack_start(group_name_renderer, True)
- column.add_attribute( toggle_renderer, "active", 1)
- column.add_attribute( toggle_renderer, "visible", 2)
- column.add_attribute( group_name_renderer, "visible", 3)
- column.add_attribute( group_name_renderer, "markup", 0)
- column.add_attribute( group_name_renderer, "cell_background", 4)
- self.pluginlist.insert_column(column, 0)
+# "Enable" toggle column is disabled for now. Grep for PLUGIN_DYNAMIC_LOAD_UNLOAD
+# # toggle
+# group_name_renderer = gtk.CellRendererText()
+# toggle_renderer = gtk.CellRendererToggle()
+# toggle_renderer.set_property('activatable', True)
+# toggle_renderer.connect( 'toggled', self.on_enabled_toggled, self.pluginsListStore )
+# column = gtk.TreeViewColumn(_('Enabled'))
+# column.pack_start(toggle_renderer, True)
+# column.pack_start(group_name_renderer, True)
+# column.add_attribute( toggle_renderer, "active", 1)
+# column.add_attribute( toggle_renderer, "visible", 2)
+# column.add_attribute( group_name_renderer, "visible", 3)
+# column.add_attribute( group_name_renderer, "markup", 0)
+# column.add_attribute( group_name_renderer, "cell_background", 4)
+# self.pluginlist.insert_column(column, 0)
#connect signals
self.pluginlist.connect("cursor-changed", self.on_tvDumps_cursor_changed)
@@ -65,24 +66,25 @@ class PluginsSettingsDialog:
self.builder.get_object("bClose").connect("clicked", self.on_bClose_clicked)
self.builder.get_object("bConfigurePlugin").set_sensitive(False)
- def on_enabled_toggled(self,cell, path, model):
- plugin = model[path][model.get_n_columns()-1]
- if plugin:
- if model[path][1]:
- #print "self.ccdaemon.UnRegisterPlugin(%s)" % (plugin.getName())
- self.ccdaemon.unRegisterPlugin(plugin.getName())
- # FIXME: create class plugin and move this into method Plugin.Enable()
- plugin.Enabled = "no"
- plugin.Settings = None
- else:
- #print "self.ccdaemon.RegisterPlugin(%s)" % (model[path][model.get_n_columns()-1])
- self.ccdaemon.registerPlugin(plugin.getName())
- # FIXME: create class plugin and move this into method Plugin.Enable()
- plugin.Enabled = "yes"
- default_settings = self.ccdaemon.getPluginSettings(plugin.getName())
- plugin.Settings = PluginSettings()
- plugin.Settings.load(plugin.getName(), default_settings)
- model[path][1] = not model[path][1]
+# "Enable" toggle column is disabled for now. Grep for PLUGIN_DYNAMIC_LOAD_UNLOAD
+# def on_enabled_toggled(self,cell, path, model):
+# plugin = model[path][model.get_n_columns()-1]
+# if plugin:
+# if model[path][1]:
+# #print "self.ccdaemon.UnRegisterPlugin(%s)" % (plugin.getName())
+# self.ccdaemon.unRegisterPlugin(plugin.getName())
+# # FIXME: create class plugin and move this into method Plugin.Enable()
+# plugin.Enabled = "no"
+# plugin.Settings = None
+# else:
+# #print "self.ccdaemon.RegisterPlugin(%s)" % (model[path][model.get_n_columns()-1])
+# self.ccdaemon.registerPlugin(plugin.getName())
+# # FIXME: create class plugin and move this into method Plugin.Enable()
+# plugin.Enabled = "yes"
+# default_settings = self.ccdaemon.getPluginSettings(plugin.getName())
+# plugin.Settings = PluginSettings()
+# plugin.Settings.load(plugin.getName(), default_settings)
+# model[path][1] = not model[path][1]
def filter_plugins(self, model, miter, data):
return True
@@ -135,7 +137,7 @@ class PluginsSettingsDialog:
ui.dehydrate()
if pluginfo.Settings:
try:
- pluginfo.save_settings()
+ pluginfo.save_settings_on_client_side()
# FIXME: do we need to call this? all reporters set their settings
# when Report() is called
self.ccdaemon.setPluginSettings(pluginfo.getName(), pluginfo.Settings)