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 | |
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>
-rw-r--r-- | doc/DESIGN | 4 | ||||
-rw-r--r-- | lib/Plugins/CCpp.cpp | 2 | ||||
-rw-r--r-- | lib/Plugins/FileTransfer.cpp | 43 | ||||
-rw-r--r-- | lib/Plugins/abrt-FileTransfer.7 | 2 | ||||
-rw-r--r-- | lib/Utils/Polkit.cpp | 4 | ||||
-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 |
14 files changed, 109 insertions, 113 deletions
@@ -93,9 +93,9 @@ The key dbus calls served by abrt-process are: After it returns, when report creation thread has finished, JobDone(client_dbus_ID,UUID) dbus signal is emitted. [Problem: how to do privilegged plugin specific actions?] - Solution: if plugin needs an access to some root only accessible dir then + Solution: if plugin needs an access to some root only accessible dir then abrt should be run by root anyway - - debuginfo gets installed using pkg-debug-install, which cares about + - debuginfo gets installed using pkg-debug-install, which cares about privileges itself, so no problem here - GetJobResult(UUID): returns map_crash_report_t (map_vector_string_t) - Report(map_crash_report_t (map_vector_string_t)): diff --git a/lib/Plugins/CCpp.cpp b/lib/Plugins/CCpp.cpp index a294941b..515659f7 100644 --- a/lib/Plugins/CCpp.cpp +++ b/lib/Plugins/CCpp.cpp @@ -192,7 +192,7 @@ static std::string GetIndependentBacktrace(const std::string& pBacktrace) Thread 1 (Thread 30750): #0 0x00007f047e21af70 in __nanosleep_nocancel () from /lib64/libc-2.10.1.so No symbol table info available. - #1 0x00000000004037bb in rpl_nanosleep (requested_delay=0x7fff8999e400, + #1 0x00000000004037bb in rpl_nanosleep (requested_delay=0x7fff8999e400, remaining_delay=0x0) at nanosleep.c:69 r = -516 delay = {tv_sec = 1260, tv_nsec = 0} diff --git a/lib/Plugins/FileTransfer.cpp b/lib/Plugins/FileTransfer.cpp index 5eb7646d..08d915dc 100644 --- a/lib/Plugins/FileTransfer.cpp +++ b/lib/Plugins/FileTransfer.cpp @@ -63,7 +63,7 @@ void CFileTransfer::SendFile(const std::string& pURL, } protocol = ""; i = 0; - while(pURL[i] != ':') + while (pURL[i] != ':') { protocol += pURL[i]; i++; @@ -77,7 +77,7 @@ void CFileTransfer::SendFile(const std::string& pURL, snprintf(buffer, 1024, _("Sending archive %s via %s"), pFilename.c_str(), protocol.c_str()); update_client(std::string(buffer)); - if( pURL[len-1] == '/' ) + if (pURL[len-1] == '/') { wholeURL = pURL + pFilename; } @@ -89,7 +89,7 @@ void CFileTransfer::SendFile(const std::string& pURL, do { f = fopen(pFilename.c_str(),"r"); - if(!f) + if (!f) { throw CABRTException(EXCEP_PLUGIN, "CFileTransfer::SendFile(): cannot open archive file "+pFilename); } @@ -98,7 +98,7 @@ void CFileTransfer::SendFile(const std::string& pURL, throw CABRTException(EXCEP_PLUGIN, "CFileTransfer::SendFile(): cannot stat archive file "+pFilename); } curl = curl_easy_init(); - if(!curl) + if (!curl) { throw CABRTException(EXCEP_PLUGIN, "CFileTransfer::SendFile(): Curl library error."); } @@ -126,7 +126,7 @@ parameter "something" to each filename, now used in create_zip, but can be useful for some future archivers as well */ -static void traverse_directory(const char * directory, void * something, +static void traverse_directory(const char * directory, void * something, void (*func)(void *,const char *) ) { DIR * dp; @@ -135,12 +135,13 @@ static void traverse_directory(const char * directory, void * something, char * end; dp = opendir(directory); - while(dirp = readdir(dp)) - if(dirp->d_type == DT_REG) + while ((dirp = readdir(dp)) != NULL) + { + if (dirp->d_type == DT_REG) { complete_name[0] = '\0'; end = stpcpy(complete_name, directory); - if( end[-1] != '/' ) + if (end[-1] != '/') { end = stpcpy(end, "/"); } @@ -148,6 +149,7 @@ static void traverse_directory(const char * directory, void * something, func(something, complete_name); } + } closedir(dp); } @@ -171,10 +173,11 @@ static void create_zip(const char * archive_name, const char * directory) static void create_tar(const char * archive_name, const char * directory) { - TAR *tar; + TAR *tar; tar_open(&tar, (char *)archive_name, NULL, O_WRONLY | O_CREAT, 0644, TAR_GNU); tar_append_tree(tar, (char *)directory, "."); +//why not tar_close(tar)?? close(tar_fd(tar)); } @@ -193,7 +196,7 @@ static void create_targz(const char * archive_name, const char * directory) f = fopen(name_wo_gz, "r"); gz = gzopen(archive_name, "w"); - while( (bytesRead = fread(buf, 1, BUFSIZ, f)) > 0 ) + while ((bytesRead = fread(buf, 1, BUFSIZ, f)) > 0) { gzwrite(gz, buf, bytesRead); } @@ -221,7 +224,7 @@ static void create_tarbz2(const char * archive_name, const char * directory) f = fopen(archive_name, "w"); bz = BZ2_bzWriteOpen(&bzError, f, BLOCK_MULTIPLIER, 0, 0); - while ( (bytesRead = read(tarFD,buf,BUFSIZ)) > 0) + while ((bytesRead = read(tarFD,buf,BUFSIZ)) > 0) { BZ2_bzWrite(&bzError, bz, buf, bytesRead); } @@ -234,19 +237,19 @@ static void create_tarbz2(const char * archive_name, const char * directory) void CFileTransfer::CreateArchive(const std::string& pArchiveName, const std::string& pDir) { - if(m_sArchiveType == ".tar") + if (m_sArchiveType == ".tar") { create_tar(pArchiveName.c_str(), pDir.c_str()); } - else if(m_sArchiveType == ".tar.gz") + else if (m_sArchiveType == ".tar.gz") { create_targz(pArchiveName.c_str(), pDir.c_str()); } - else if(m_sArchiveType == ".tar.bz2") + else if (m_sArchiveType == ".tar.bz2") { create_tarbz2(pArchiveName.c_str(), pDir.c_str()); } - else if(m_sArchiveType == ".zip") + else if (m_sArchiveType == ".zip") { create_zip(pArchiveName.c_str(), pDir.c_str()); } @@ -263,12 +266,12 @@ std::string CFileTransfer::DirBase(const std::string& pStr) int i; i = pStr.length() - 1; - if(pStr[i] == '/') + if (pStr[i] == '/') { i--; } result=""; - for(; pStr[i] != '/'; i--) + for (; pStr[i] != '/'; i--) { result = pStr[i] + result; } @@ -313,14 +316,14 @@ void CFileTransfer::Run(const std::string& pActiveDir, const std::string& pArgs) gethostname(hostname,HBLEN); dirlist.open(FILETRANSFER_DIRLIST, fstream::in); - if(dirlist.fail()) + if (dirlist.fail()) { /* this means there are no reports to send (no crashes, hurray) which is perfectly OK */ return; } - while(getline(dirlist,dirname), !dirlist.eof()) + while (getline(dirlist,dirname), !dirlist.eof()) { archivename = std::string(hostname) + "-" + DirBase(dirname) + m_sArchiveType; @@ -368,7 +371,7 @@ void CFileTransfer::SetSettings(const map_plugin_settings_t& pSettings) if (pSettings.find("ArchiveType") != pSettings.end()) { /* currently supporting .tar, .tar.gz, .tar.bz2 and .zip */ - m_sArchiveType =pSettings.find("ArchiveType")->second; + m_sArchiveType = pSettings.find("ArchiveType")->second; if(m_sArchiveType[0] != '.') { m_sArchiveType = "." + m_sArchiveType; diff --git a/lib/Plugins/abrt-FileTransfer.7 b/lib/Plugins/abrt-FileTransfer.7 index 93cc9ee7..132bfcde 100644 --- a/lib/Plugins/abrt-FileTransfer.7 +++ b/lib/Plugins/abrt-FileTransfer.7 @@ -47,7 +47,7 @@ the user name and the password, for example: URL = ftp://user:passwd@server.com/path .SS ArchiveType The type of the archive in which to pack the crash data. -Currently, \fI.tar\fP, \fI.tar.gz\fP, \fI.tar.bz2\fP and \fI.zip\fP +Currently, \fI.tar\fP, \fI.tar.gz\fP, \fI.tar.bz2\fP and \fI.zip\fP are supported. The plugin uses archive creation libraries for this. The default is diff --git a/lib/Utils/Polkit.cpp b/lib/Utils/Polkit.cpp index bb3e9b41..c868e1a7 100644 --- a/lib/Utils/Polkit.cpp +++ b/lib/Utils/Polkit.cpp @@ -48,8 +48,8 @@ static PolkitResult do_check(PolkitSubject *subject, const char *action_id) authority = polkit_authority_get(); cancellable = g_cancellable_new(); - - g_timeout_add (POLKIT_TIMEOUT * 1000, + + g_timeout_add(POLKIT_TIMEOUT * 1000, (GSourceFunc) do_cancel, cancellable); 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() |