diff options
author | Jiri Moskovcak <jmoskovc@redhat.com> | 2009-08-17 11:48:18 +0200 |
---|---|---|
committer | Jiri Moskovcak <jmoskovc@redhat.com> | 2009-08-17 11:48:18 +0200 |
commit | 19329569c399e944d24d293c5ee90c945ed482a1 (patch) | |
tree | ed90a82a85a36e614b397a784bda46b91cb7a6e3 | |
parent | 3c226c987f5015e8184bfc4293ee9f9b2f7b8f67 (diff) | |
download | abrt-19329569c399e944d24d293c5ee90c945ed482a1.tar.gz abrt-19329569c399e944d24d293c5ee90c945ed482a1.tar.xz abrt-19329569c399e944d24d293c5ee90c945ed482a1.zip |
GUI now show the status window after report to let user know how did it go.
-rw-r--r-- | lib/CommLayer/CommLayerServer.h | 2 | ||||
-rw-r--r-- | lib/CommLayer/CommLayerServerDBus.cpp | 12 | ||||
-rw-r--r-- | lib/CommLayer/CommLayerServerDBus.h | 3 | ||||
-rw-r--r-- | lib/CommLayer/CommLayerServerSocket.cpp | 7 | ||||
-rw-r--r-- | lib/CommLayer/CommLayerServerSocket.h | 3 | ||||
-rw-r--r-- | lib/CommLayer/DBusCommon.h | 1 | ||||
-rw-r--r-- | lib/CommLayer/DBusServerProxy.cpp | 2 | ||||
-rw-r--r-- | lib/CommLayer/DBusServerProxy.h | 2 | ||||
-rw-r--r-- | lib/CommLayer/Observer.h | 2 | ||||
-rw-r--r-- | src/Daemon/CrashWatcher.cpp | 9 | ||||
-rw-r--r-- | src/Daemon/CrashWatcher.h | 2 | ||||
-rw-r--r-- | src/Gui/ABRTPlugin.py | 3 | ||||
-rw-r--r-- | src/Gui/CCDBusBackend.py | 24 | ||||
-rw-r--r-- | src/Gui/CCDump.py | 4 | ||||
-rw-r--r-- | src/Gui/CCDumpList.py | 3 | ||||
-rw-r--r-- | src/Gui/CCMainWindow.py | 54 | ||||
-rw-r--r-- | src/Gui/CC_gui_functions.py | 28 | ||||
-rw-r--r-- | src/Gui/PluginSettingsUI.py | 1 | ||||
-rw-r--r-- | src/Gui/SettingsDialog.py | 17 | ||||
-rw-r--r-- | src/Gui/settings.GtkBuilder | 2 |
20 files changed, 144 insertions, 37 deletions
diff --git a/lib/CommLayer/CommLayerServer.h b/lib/CommLayer/CommLayerServer.h index 0acb7d7..7601fa1 100644 --- a/lib/CommLayer/CommLayerServer.h +++ b/lib/CommLayer/CommLayerServer.h @@ -37,7 +37,7 @@ class CCommLayerServer { virtual vector_crash_infos_t GetCrashInfos(const std::string &pSender) = 0; virtual map_crash_report_t CreateReport(const std::string &pUUID,const std::string &pSender) = 0; - virtual bool Report(map_crash_report_t pReport,const std::string &pSender) = 0; + virtual report_status_t Report(map_crash_report_t pReport,const std::string &pSender) = 0; virtual bool DeleteDebugDump(const std::string& pUUID, const std::string& pSender) = 0; public: diff --git a/lib/CommLayer/CommLayerServerDBus.cpp b/lib/CommLayer/CommLayerServerDBus.cpp index 5d5972a..90a7878 100644 --- a/lib/CommLayer/CommLayerServerDBus.cpp +++ b/lib/CommLayer/CommLayerServerDBus.cpp @@ -61,11 +61,12 @@ uint64_t CCommLayerServerDBus::CreateReport_t(const std::string &pUUID,const std return job_id; } -bool CCommLayerServerDBus::Report(map_crash_report_t pReport,const std::string &pSender) +report_status_t CCommLayerServerDBus::Report(map_crash_report_t pReport,const std::string &pSender) { + report_status_t rs; unsigned long unix_uid = m_pConn->sender_unix_uid(pSender.c_str()); - m_pObserver->Report(pReport, to_string(unix_uid)); - return true; + rs = m_pObserver->Report(pReport, to_string(unix_uid)); + return rs; } bool CCommLayerServerDBus::DeleteDebugDump(const std::string& pUUID, const std::string& pSender) @@ -108,6 +109,11 @@ void CCommLayerServerDBus::JobDone(const std::string &pDest, uint64_t pJobID) CDBusServer_adaptor::JobDone(pDest, pJobID); } +void CCommLayerServerDBus::Warning(const std::string& pDest, const std::string& pMessage) +{ + CDBusServer_adaptor::Warning(pMessage); +} + vector_map_string_string_t CCommLayerServerDBus::GetPluginsInfo() { //FIXME: simplify? diff --git a/lib/CommLayer/CommLayerServerDBus.h b/lib/CommLayer/CommLayerServerDBus.h index 736a445..d241c63 100644 --- a/lib/CommLayer/CommLayerServerDBus.h +++ b/lib/CommLayer/CommLayerServerDBus.h @@ -23,7 +23,7 @@ class CCommLayerServerDBus /*FIXME: fix CLI and remove this stub*/ virtual map_crash_report_t CreateReport(const std::string &pUUID,const std::string &pSender){map_crash_report_t retval; return retval;}; virtual uint64_t CreateReport_t(const std::string &pUUID,const std::string &pSender); - virtual bool Report(map_crash_report_t pReport,const std::string &pSender); + virtual report_status_t Report(map_crash_report_t pReport,const std::string &pSender); virtual bool DeleteDebugDump(const std::string& pUUID, const std::string& pSender); virtual map_crash_report_t GetJobResult(uint64_t pJobID, const std::string& pSender); virtual vector_map_string_string_t GetPluginsInfo(); @@ -37,5 +37,6 @@ class CCommLayerServerDBus virtual void Error(const std::string& arg1); virtual void Update(const std::string& pDest, const std::string& pMessage); virtual void JobDone(const std::string &pDest, uint64_t pJobID); + virtual void Warning(const std::string& pDest, const std::string& pMessage); }; diff --git a/lib/CommLayer/CommLayerServerSocket.cpp b/lib/CommLayer/CommLayerServerSocket.cpp index dd00489..f5466d4 100644 --- a/lib/CommLayer/CommLayerServerSocket.cpp +++ b/lib/CommLayer/CommLayerServerSocket.cpp @@ -219,10 +219,11 @@ map_crash_report_t CCommLayerServerSocket::CreateReport(const std::string &pUUID return crashReport; } -bool CCommLayerServerSocket::Report(map_crash_report_t pReport, const std::string& pSender) +report_status_t CCommLayerServerSocket::Report(map_crash_report_t pReport, const std::string& pSender) { - m_pObserver->Report(pReport, pSender); - return true; + report_status_t rs; + rs = m_pObserver->Report(pReport, pSender); + return rs; } bool CCommLayerServerSocket::DeleteDebugDump(const std::string& pUUID, const std::string& pSender) diff --git a/lib/CommLayer/CommLayerServerSocket.h b/lib/CommLayer/CommLayerServerSocket.h index 409780f..2dc9a7a 100644 --- a/lib/CommLayer/CommLayerServerSocket.h +++ b/lib/CommLayer/CommLayerServerSocket.h @@ -1,4 +1,5 @@ #include "CommLayerServer.h" +#include "DBusCommon.h" #include <glib.h> #define SOCKET_FILE VAR_RUN"/abrt.socket" @@ -27,7 +28,7 @@ class CCommLayerServerSocket : public CCommLayerServer virtual vector_crash_infos_t GetCrashInfos(const std::string &pSender); virtual map_crash_report_t CreateReport(const std::string &pUUID,const std::string &pSender); - virtual bool Report(map_crash_report_t pReport, const std::string& pSender); + virtual report_status_t Report(map_crash_report_t pReport, const std::string& pSender); virtual bool DeleteDebugDump(const std::string& pUUID, const std::string& pSender); virtual void Crash(const std::string& arg1); diff --git a/lib/CommLayer/DBusCommon.h b/lib/CommLayer/DBusCommon.h index 7ccaa8b..0addf08 100644 --- a/lib/CommLayer/DBusCommon.h +++ b/lib/CommLayer/DBusCommon.h @@ -25,3 +25,4 @@ typedef std::map<std::string, std::string> map_string_string_t; typedef std::vector<map_string_string_t> vector_map_string_string_t; typedef std::map<std::string, std::string> map_plugin_settings_t; +typedef std::map<std::string, vector_strings_t> report_status_t; diff --git a/lib/CommLayer/DBusServerProxy.cpp b/lib/CommLayer/DBusServerProxy.cpp index 5c785ce..5730fd5 100644 --- a/lib/CommLayer/DBusServerProxy.cpp +++ b/lib/CommLayer/DBusServerProxy.cpp @@ -168,7 +168,7 @@ DBus::Message CDBusServer_adaptor::_Report_stub(const DBus::CallMessage &call) DBus::MessageIter ri = call.reader(); map_crash_report_t argin1; ri >> argin1; - bool argout1 = Report(argin1, call.sender()); + report_status_t argout1 = Report(argin1, call.sender()); DBus::ReturnMessage reply(call); DBus::MessageIter wi = reply.writer(); wi << argout1; diff --git a/lib/CommLayer/DBusServerProxy.h b/lib/CommLayer/DBusServerProxy.h index 5f767bc..a68a44f 100644 --- a/lib/CommLayer/DBusServerProxy.h +++ b/lib/CommLayer/DBusServerProxy.h @@ -46,7 +46,7 @@ public: virtual vector_crash_infos_t GetCrashInfos(const std::string &pDBusSender) = 0; virtual map_crash_report_t CreateReport(const std::string &pUUID, const std::string &pDBusSender) = 0; virtual uint64_t CreateReport_t(const std::string &pUUID, const std::string &pDBusSender) = 0; - virtual bool Report(map_crash_report_t pReport, const std::string &pDBusSender) = 0; + virtual report_status_t Report(map_crash_report_t pReport, const std::string &pDBusSender) = 0; virtual bool DeleteDebugDump(const std::string& pUUID, const std::string& pDBusSender) = 0; virtual map_crash_report_t GetJobResult(uint64_t pJobID, const std::string& pDBusSender) = 0; virtual vector_map_string_string_t GetPluginsInfo() = 0; diff --git a/lib/CommLayer/Observer.h b/lib/CommLayer/Observer.h index 46b6226..02b51ce 100644 --- a/lib/CommLayer/Observer.h +++ b/lib/CommLayer/Observer.h @@ -22,7 +22,7 @@ class CObserver { std::cout << "DEFAULT OBSERVER"; return 0; } - virtual bool Report(map_crash_report_t pReport, const std::string &pSender) = 0; + virtual report_status_t Report(map_crash_report_t pReport, const std::string &pSender) = 0; virtual bool DeleteDebugDump(const std::string& pUUID, const std::string& pSender) = 0; virtual map_crash_report_t GetJobResult(uint64_t pJobID, const std::string &pSender) = 0; virtual vector_map_string_string_t GetPluginsInfo() = 0; diff --git a/src/Daemon/CrashWatcher.cpp b/src/Daemon/CrashWatcher.cpp index 5fb4a36..ac33d2e 100644 --- a/src/Daemon/CrashWatcher.cpp +++ b/src/Daemon/CrashWatcher.cpp @@ -809,7 +809,7 @@ uint64_t CCrashWatcher::CreateReport_t(const std::string &pUUID,const std::strin return 0; } -bool CCrashWatcher::Report(map_crash_report_t pReport, const std::string& pUID) +CMiddleWare::report_status_t CCrashWatcher::Report(map_crash_report_t pReport, const std::string& pUID) { //#define FIELD(X) crashReport.m_s##X = pReport[#X]; //crashReport.m_sUUID = pReport["UUID"]; @@ -818,9 +818,10 @@ bool CCrashWatcher::Report(map_crash_report_t pReport, const std::string& pUID) //for (dbus_map_report_info_t::iterator it = pReport.begin(); it!=pReport.end(); ++it) { // std::cerr << it->second << std::endl; //} + CMiddleWare::report_status_t rs; try { - CMiddleWare::report_status_t rs = m_pMW->Report(pReport, pUID); + rs = m_pMW->Report(pReport, pUID); } catch (CABRTException& e) { @@ -830,9 +831,9 @@ bool CCrashWatcher::Report(map_crash_report_t pReport, const std::string& pUID) } Warning(e.what()); Status(e.what()); - return false; + return rs; } - return true; + return rs; } bool CCrashWatcher::DeleteDebugDump(const std::string& pUUID, const std::string& pUID) diff --git a/src/Daemon/CrashWatcher.h b/src/Daemon/CrashWatcher.h index 7851dfd..23e3da1 100644 --- a/src/Daemon/CrashWatcher.h +++ b/src/Daemon/CrashWatcher.h @@ -127,7 +127,7 @@ class CCrashWatcher /*FIXME: fix CLI and remove this stub*/ virtual map_crash_report_t CreateReport(const std::string &pUUID,const std::string &pUID){map_crash_report_t retval; return retval;}; uint64_t CreateReport_t(const std::string &pUUID,const std::string &pUID, const std::string &pSender); - virtual bool Report(map_crash_report_t pReport, const std::string &pUID); + virtual CMiddleWare::report_status_t Report(map_crash_report_t pReport, const std::string &pUID); virtual bool DeleteDebugDump(const std::string& pUUID, const std::string& pUID); virtual map_crash_report_t GetJobResult(uint64_t pJobID, const std::string& pSender); /* plugins related */ diff --git a/src/Gui/ABRTPlugin.py b/src/Gui/ABRTPlugin.py index ff6478b..dc95956 100644 --- a/src/Gui/ABRTPlugin.py +++ b/src/Gui/ABRTPlugin.py @@ -14,7 +14,8 @@ Description class PluginSettings(dict): def __init__(self): - print "Init plugin settings" + #print "Init plugin settings" + pass def __init__(self, settings_dict): for key in settings_dict.keys(): diff --git a/src/Gui/CCDBusBackend.py b/src/Gui/CCDBusBackend.py index d440627..ee99e3d 100644 --- a/src/Gui/CCDBusBackend.py +++ b/src/Gui/CCDBusBackend.py @@ -56,12 +56,14 @@ class DBusManager(gobject.GObject): gobject.signal_new ("analyze-complete", self ,gobject.SIGNAL_RUN_FIRST,gobject.TYPE_NONE,(gobject.TYPE_PYOBJECT,)) # signal emited when smth fails gobject.signal_new ("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,)) # 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 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: @@ -76,6 +78,9 @@ class DBusManager(gobject.GObject): def error_handler_cb(self,arg): self.emit("error",arg) + + def warning_handler_cb(self,arg): + self.emit("warning",arg) def error_handler(self,arg): # used to silently ingore dbus timeouts @@ -98,6 +103,11 @@ class DBusManager(gobject.GObject): #if self.uniq_name == dest: self.emit("update", message) + def warning_cb(self, message, dest=None): + # FIXME: use dest instead of 0 once we implement it in daemon + #if self.uniq_name == dest: + self.emit("warning", message) + def analyze_complete_cb(self,dump): #for arg in args: # print "Analyze complete for: %s" % arg @@ -138,6 +148,8 @@ class DBusManager(gobject.GObject): self.acconnection = self.proxy.connect_to_signal("Error",self.error_handler_cb,dbus_interface=CC_IFACE) # watch for updates self.acconnection = self.proxy.connect_to_signal("Update",self.update_cb,dbus_interface=CC_IFACE) + # watch for warnings + 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) else: @@ -154,6 +166,9 @@ class DBusManager(gobject.GObject): self.emit("analyze-complete", dump) else: self.emit("error","Daemon did't return valid report info\nDebuginfo is missing?") + + def report_done(self, result): + self.emit("report-done", result) def getReport(self, UUID): try: @@ -165,8 +180,8 @@ class DBusManager(gobject.GObject): raise Exception(e) def Report(self,report): - # FIXME async - return self.cc.Report(report) + # map < Plguin_name vec <status, message> > + self.cc.Report(report, reply_handler=self.report_done, error_handler=self.error_handler_cb, timeout=60) def DeleteDebugDump(self,UUID): return self.cc.DeleteDebugDump(UUID) @@ -186,7 +201,10 @@ class DBusManager(gobject.GObject): return self.cc.GetPluginsInfo() def getPluginSettings(self, plugin_name): - return self.cc.GetPluginSettings(plugin_name) + settings = self.cc.GetPluginSettings(plugin_name) + #for i in settings.keys(): + # print i + return settings def registerPlugin(self, plugin_name): return self.cc.RegisterPlugin(plugin_name) diff --git a/src/Gui/CCDump.py b/src/Gui/CCDump.py index 0c7b29c..0ea106f 100644 --- a/src/Gui/CCDump.py +++ b/src/Gui/CCDump.py @@ -15,6 +15,7 @@ class Dump(): self.Package = None self.Time = None self.Description = None + self.Reported = None def getUUID(self): return self.UUID[CONTENT] @@ -31,6 +32,9 @@ class Dump(): def getPackage(self): return self.Package[CONTENT] + def isReported(self): + return self.Reported[CONTENT] == "1" + def getTime(self,format): #print format if format: diff --git a/src/Gui/CCDumpList.py b/src/Gui/CCDumpList.py index 3320af8..7684b46 100644 --- a/src/Gui/CCDumpList.py +++ b/src/Gui/CCDumpList.py @@ -17,7 +17,8 @@ class DumpList(list): for row in rows: entry = Dump() for column in row: - #print "DumpList adding %s:%s" % (column,row[column]) + #if column == "Reported": + # print "DumpList adding %s:%s" % (column,row[column]) entry.__dict__[column] = row[column] self.append(entry) self.ddict[entry.getUUID()] = entry diff --git a/src/Gui/CCMainWindow.py b/src/Gui/CCMainWindow.py index 4b5fed2..895401c 100644 --- a/src/Gui/CCMainWindow.py +++ b/src/Gui/CCMainWindow.py @@ -66,9 +66,9 @@ class MainWindow(): self.dlist = self.wTree.get_widget("tvDumps") if os.getuid() == 0: # root - self.dumpsListStore = gtk.ListStore(gtk.gdk.Pixbuf, str,str,str,str,str, object) + self.dumpsListStore = gtk.ListStore(gtk.gdk.Pixbuf, str,str,str,str,str,bool, object) else: - self.dumpsListStore = gtk.ListStore(gtk.gdk.Pixbuf, str,str,str,str, object) + self.dumpsListStore = gtk.ListStore(gtk.gdk.Pixbuf, str,str,str,str,bool, object) # set filter self.modelfilter = self.dumpsListStore.filter_new() self.modelfilter.set_visible_func(self.filter_dumps, None) @@ -76,9 +76,10 @@ class MainWindow(): # add pixbuff separatelly icon_column = gtk.TreeViewColumn('Icon') icon_column.cell = gtk.CellRendererPixbuf() + icon_column.cell.set_property('cell-background' , "#C9C9C9") n = self.dlist.append_column(icon_column) icon_column.pack_start(icon_column.cell, False) - icon_column.set_attributes(icon_column.cell, pixbuf=(n-1)) + icon_column.set_attributes(icon_column.cell, pixbuf=(n-1), cell_background_set=5) # =============================================== columns = [None]*4 columns[0] = gtk.TreeViewColumn('Package') @@ -93,7 +94,10 @@ class MainWindow(): n = self.dlist.append_column(column) column.cell = gtk.CellRendererText() column.pack_start(column.cell, False) - column.set_attributes(column.cell, text=(n-1)) + #column.set_attributes(column.cell, ) + # FIXME: use some relative indexing + column.cell.set_property('cell-background' , "#C9C9C9") + column.set_attributes(column.cell, text=(n-1), cell_background_set=5) column.set_resizable(True) #connect signals self.dlist.connect("cursor-changed", self.on_tvDumps_cursor_changed) @@ -106,9 +110,11 @@ class MainWindow(): self.ccdaemon.connect("crash", self.on_data_changed_cb, None) self.ccdaemon.connect("analyze-complete", self.on_analyze_complete_cb, self.pBarWindow) self.ccdaemon.connect("error", self.error_cb) + #self.ccdaemon.connect("warning", self.warning_cb) self.ccdaemon.connect("update", self.update_cb) 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() @@ -128,7 +134,17 @@ class MainWindow(): dialog = SettingsDialog(self.window,self.ccdaemon) dialog.hydrate() dialog.show() - + + def warning_cb(self, daemon, message=None): + # try to hide the progressbar, we dont really care if it was visible .. + try: + #gobject.source_remove(self.timer) + #self.pBarWindow.hide() + pass + except Exception, e: + pass + 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 .. try: @@ -139,6 +155,7 @@ class MainWindow(): gui_error_message("Unable to get report!\n%s" % message,parent_dialog=self.window) def update_cb(self, daemon, message): + message = message.replace('\n',' ') self.wTree.get_widget("lStatus").set_text(message) # call to update the progressbar @@ -163,7 +180,7 @@ class MainWindow(): entry.getTime("%Y.%m.%d %H:%M:%S"), entry.getCount(), pwd.getpwuid(int(entry.getUID()))[0], entry]) else: n = self.dumpsListStore.append([icon, entry.getPackage(), entry.getExecutable(), - entry.getTime("%Y.%m.%d %H:%M:%S"), entry.getCount(), entry]) + entry.getTime("%Y.%m.%d %H:%M:%S"), entry.getCount(), entry.isReported(), entry]) # activate the last row if any.. if n: self.dlist.set_cursor(self.dumpsListStore.get_path(n)) @@ -214,6 +231,21 @@ class MainWindow(): return self.dlist.set_cursor(path[0]) + def on_report_done_cb(self, daemon, result): + try: + gobject.source_remove(self.timer) + except: + pass + self.pBarWindow.hide() + STATUS = 0 + MESSAGE = 1 + message = "" + for plugin, res in result.iteritems(): + message += "<b>%s</b>: %s\n" % (plugin, result[plugin][1]) + + gui_info_dialog("<b>Report done!</b>\n%s" % message, self.window) + self.hydrate() + def on_analyze_complete_cb(self, daemon, report, pBarWindow): try: gobject.source_remove(self.timer) @@ -231,7 +263,14 @@ class MainWindow(): report_dialog = ReporterDialog(report) result = report_dialog.run() if result: - self.ccdaemon.Report(result) + try: + self.update_pBar = False + self.pBarWindow.show_all() + self.timer = gobject.timeout_add (100,self.progress_update_cb) + self.ccdaemon.Report(result) + #self.hydrate() + except Exception, e: + gui_error_message("Reporting failed!\n%s" % e) #ret = gui_question_dialog("GUI: Analyze for package %s crash with UUID %s is complete" % (entry.Package, UUID),self.window) #if ret == gtk.RESPONSE_YES: # self.hydrate() @@ -239,7 +278,6 @@ class MainWindow(): # pass #print "got another crash, refresh gui?" - def on_bReport_clicked(self, button): # FIXME don't duplicate the code, move to function dumpsListStore, path = self.dlist.get_selection().get_selected_rows() diff --git a/src/Gui/CC_gui_functions.py b/src/Gui/CC_gui_functions.py index 335d5c4..f12c198 100644 --- a/src/Gui/CC_gui_functions.py +++ b/src/Gui/CC_gui_functions.py @@ -5,6 +5,34 @@ try: import rpm except: rpm = None +def gui_info_dialog ( message, parent_dialog, + message_type=gtk.MESSAGE_INFO, + widget=None, page=0, broken_widget=None ): + + dialog = gtk.MessageDialog( parent_dialog, + gtk.DIALOG_MODAL|gtk.DIALOG_DESTROY_WITH_PARENT, + message_type, gtk.BUTTONS_OK, + message ) + dialog.set_markup(message) + if widget != None: + if isinstance (widget, gtk.CList): + widget.select_row (page, 0) + elif isinstance (widget, gtk.Notebook): + widget.set_current_page (page) + if broken_widget != None: + broken_widget.grab_focus () + if isinstance (broken_widget, gtk.Entry): + broken_widget.select_region (0, -1) + + if parent_dialog: + dialog.set_position (gtk.WIN_POS_CENTER_ON_PARENT) + dialog.set_transient_for(parent_dialog) + else: + dialog.set_position (gtk.WIN_POS_CENTER) + + ret = dialog.run () + dialog.destroy() + return ret def gui_error_message ( message, parent_dialog=None, message_type=gtk.MESSAGE_ERROR, diff --git a/src/Gui/PluginSettingsUI.py b/src/Gui/PluginSettingsUI.py index 0f038ac..c7c2ca0 100644 --- a/src/Gui/PluginSettingsUI.py +++ b/src/Gui/PluginSettingsUI.py @@ -50,6 +50,7 @@ class PluginSettingsUI(gtk.Dialog): #print "dehydrating %s" % self.pluginfo.getName() if self.Settings: for key in self.Settings.keys(): + #print key #print "%s:%s" % (key,value) widget = self.plugin_gui.get_object("conf_%s" % key) if type(widget) == gtk.Entry: diff --git a/src/Gui/SettingsDialog.py b/src/Gui/SettingsDialog.py index f65eb96..2ad67d7 100644 --- a/src/Gui/SettingsDialog.py +++ b/src/Gui/SettingsDialog.py @@ -29,14 +29,14 @@ class SettingsDialog: self.pluginlist.set_model(self.modelfilter) # =============================================== columns = [None]*1 - columns[0] = gtk.TreeViewColumn('Plugins') + columns[0] = gtk.TreeViewColumn('Name') # create list for column in columns: n = self.pluginlist.append_column(column) column.cell = gtk.CellRendererText() column.pack_start(column.cell, False) - column.set_attributes(column.cell, text=(n-1)) + column.set_attributes(column.cell, markup=(n-1)) column.set_resizable(True) # toggle @@ -79,7 +79,7 @@ class SettingsDialog: print e #gui_error_message("Error while loading plugins info, please check if abrt daemon is running\n %s" % e) for entry in pluginlist: - n = self.pluginsListStore.append(["%s\n%s" % (entry.getName(), entry.Description), entry.Enabled == "yes", entry]) + n = self.pluginsListStore.append(["<b>%s</b>\n%s" % (entry.getName(), entry.Description), entry.Enabled == "yes", entry]) def dehydrate(self): # we have nothing to save, plugin's does the work @@ -109,9 +109,12 @@ class SettingsDialog: if response == gtk.RESPONSE_APPLY: ui.dehydrate() if pluginfo.Settings: - self.ccdaemon.setPluginSettings(pluginfo.getName(), pluginfo.Settings) - for key, val in pluginfo.Settings.iteritems(): - print "%s:%s" % (key, val) + try: + self.ccdaemon.setPluginSettings(pluginfo.getName(), pluginfo.Settings) + except Exception, e: + gui_error_message("Can't save plugin settings:\n %s", e) + #for key, val in pluginfo.Settings.iteritems(): + # print "%s:%s" % (key, val) elif response == gtk.RESPONSE_CANCEL: pass else: @@ -124,7 +127,7 @@ class SettingsDialog: def on_tvDumps_cursor_changed(self, treeview): pluginsListStore, path = treeview.get_selection().get_selected_rows() if not path: - self.builder.get_object("lDescription").set_label("ARGH...") + self.builder.get_object("lDescription").set_label("No description") return # this should work until we keep the row object in the last position pluginfo = pluginsListStore.get_value(pluginsListStore.get_iter(path[0]), pluginsListStore.get_n_columns()-1) diff --git a/src/Gui/settings.GtkBuilder b/src/Gui/settings.GtkBuilder index 422b623..9cf4707 100644 --- a/src/Gui/settings.GtkBuilder +++ b/src/Gui/settings.GtkBuilder @@ -106,6 +106,8 @@ <packing> <property name="left_attach">1</property> <property name="right_attach">3</property> + <property name="x_options">GTK_FILL</property> + <property name="y_options"></property> </packing> </child> <child> |