summaryrefslogtreecommitdiffstats
path: root/src/Gui
diff options
context:
space:
mode:
authorJiri Moskovcak <jmoskovc@redhat.com>2009-10-13 13:43:38 +0200
committerJiri Moskovcak <jmoskovc@redhat.com>2009-10-13 13:43:38 +0200
commitde2413718bdc0c236cff1ee84afe5bd6f0b247df (patch)
tree003c589ced716ee6d0d16581a882a607431aec5e /src/Gui
parent750129e963816a59103bdb2ea461c66f26e98343 (diff)
downloadabrt-de2413718bdc0c236cff1ee84afe5bd6f0b247df.tar.gz
abrt-de2413718bdc0c236cff1ee84afe5bd6f0b247df.tar.xz
abrt-de2413718bdc0c236cff1ee84afe5bd6f0b247df.zip
GUI: added refresh button, added sanity check to plugin settings
- added refresh button to reporter dialog, so user can "recreate" the backtrace after he install the necessary debuginfos - gui will warn the user if he tries to ue reporter which requires login/password and if those are not filled properly (next step is to implement test_settings() into plugins, so we can test if the settings are ok before we try to report something)
Diffstat (limited to 'src/Gui')
-rw-r--r--src/Gui/CCDBusBackend.py4
-rw-r--r--src/Gui/CCMainWindow.py34
-rw-r--r--src/Gui/CCReporterDialog.py108
-rw-r--r--src/Gui/Makefile.am2
-rw-r--r--src/Gui/report.glade25
-rw-r--r--src/Gui/settings_wizard.glade104
6 files changed, 237 insertions, 40 deletions
diff --git a/src/Gui/CCDBusBackend.py b/src/Gui/CCDBusBackend.py
index 70db9fff..30c51038 100644
--- a/src/Gui/CCDBusBackend.py
+++ b/src/Gui/CCDBusBackend.py
@@ -157,9 +157,9 @@ class DBusManager(gobject.GObject):
def report_done(self, result):
self.emit("report-done", result)
- def getReport(self, UUID):
+ def getReport(self, UUID, force=0):
# 2nd param is "force recreating of backtrace etc"
- self.daemon().CreateReport(UUID, 0, timeout=60)
+ self.daemon().CreateReport(UUID, force, timeout=60)
def Report(self, report, reporters_settings = None):
# map < Plguin_name vec <status, message> >
diff --git a/src/Gui/CCMainWindow.py b/src/Gui/CCMainWindow.py
index 853a753f..eee68844 100644
--- a/src/Gui/CCMainWindow.py
+++ b/src/Gui/CCMainWindow.py
@@ -291,9 +291,11 @@ class MainWindow():
if not report:
gui_error_message(_("Unable to get report!\nDebuginfo is missing?"))
return
- report_dialog = ReporterDialog(report)
- result = report_dialog.run()
- if result:
+ report_dialog = ReporterDialog(report, self.ccdaemon)
+ # (response, report)
+ response, result = report_dialog.run()
+
+ if response == gtk.RESPONSE_APPLY:
try:
self.update_pBar = False
self.pBarWindow.show_all()
@@ -306,12 +308,26 @@ class MainWindow():
#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()
- #else:
- # pass
- #print "got another crash, refresh gui?"
+ # -50 == REFRESH
+ elif response == -50:
+ self.refresh_report(report)
+
+ def refresh_report(self, report):
+ self.update_pBar = False
+ self.pBarWindow.show_all()
+ self.timer = gobject.timeout_add (100,self.progress_update_cb)
+
+ # show the report window with selected report
+ try:
+ self.ccdaemon.getReport(report["_MWUUID"][2], force=1)
+ except Exception, e:
+ # FIXME #3 dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NoReply: Did not receive a reply
+ # do this async and wait for yum to end with debuginfoinstal
+ if self.timer:
+ gobject.source_remove(self.timer)
+ self.pBarWindow.hide()
+ gui_error_message(_("Error getting the report: %s" % e))
+ return
def on_bReport_clicked(self, button):
dumpsListStore, path = self.dlist.get_selection().get_selected_rows()
diff --git a/src/Gui/CCReporterDialog.py b/src/Gui/CCReporterDialog.py
index 8804eeee..15604644 100644
--- a/src/Gui/CCReporterDialog.py
+++ b/src/Gui/CCReporterDialog.py
@@ -8,6 +8,9 @@ import sys
from CC_gui_functions import *
from CCReport import Report
import CellRenderers
+from ABRTPlugin import PluginInfo
+from PluginSettingsUI import PluginSettingsUI
+from PluginList import getPluginInfoList
#from CCDumpList import getDumpList, DumpList
from abrt_utils import _
@@ -15,10 +18,12 @@ from abrt_utils import _
TYPE = 0
EDITABLE = 1
CONTENT = 2
+# response
+REFRESH = -50
class ReporterDialog():
"""Reporter window"""
- def __init__(self, report):
+ def __init__(self, report, daemon):
self.editable = []
self.row_dict = {}
self.report = report
@@ -29,6 +34,7 @@ class ReporterDialog():
#Get the Main Window, and connect the "destroy" event
self.window = self.wTree.get_widget("reporter_dialog")
self.window.set_default_size(640, 480)
+ self.window.connect("response", self.on_response, daemon)
# comment textview
self.tvComment = self.wTree.get_widget("tvComment")
@@ -65,13 +71,19 @@ class ReporterDialog():
column.add_attribute( toggle_renderer, "visible", 4)
self.tvReport.insert_column(column,0)
# connect the signals
- self.wTree.get_widget("bApply").connect("clicked", self.on_apply_clicked, self.tvReport)
- #self.wTree.get_widget("bCancel").connect("clicked", self.on_cancel_clicked, self.tvReport)
-
self.tvReport.connect_after("size-allocate", self.on_window_resize)
-
+ self.wTree.get_widget("bSend").connect("clicked", self.on_send_clicked)
self.hydrate()
+ # this callback is called when user press Cancel or Report button in Report dialog
+ def on_response(self, dialog, response_id, daemon ):
+ # thu button has been pressed (probably)
+ if response_id == gtk.RESPONSE_APPLY:
+ if not self.check_settings(daemon):
+ print "smth is wrong"
+ dialog.stop_emission("response")
+ self.wTree.get_widget("bApply").stop_emission("clicked")
+
def on_send_toggled(self, cell, path, model):
model[path][3] = not model[path][3]
@@ -90,21 +102,66 @@ class ReporterDialog():
model[path][1] = new_text
return
- def on_apply_clicked(self, button, treeview):
- attributes = ["item", "content", "editable", "send", "attachment"]
- for row in self.reportListStore:
- rowe = dict(zip(attributes, row))
- if (rowe["attachment"] or (rowe["editable"] and rowe["attachment"])) and rowe["send"]:
- result = gui_question_dialog(_("<b>WARNING</b>, you're about to send data which might contain sensitive information.\n"
- "Do you really want to send <b>%s</b>?\n" % rowe["item"]), self.window)
- if result == gtk.RESPONSE_NO:
- row[attributes.index("send")] = False
- self.dehydrate()
+ def on_config_plugin_clicked(self, button, plugin, image):
+ ui = PluginSettingsUI(plugin, parent=self.window)
+ ui.hydrate()
+ response = ui.run()
+ if response == gtk.RESPONSE_APPLY:
+ ui.dehydrate()
+ plugin.save_settings()
+ if plugin.Settings.check():
+ box = image.get_parent()
+ im = gtk.Image()
+ im.set_from_stock(gtk.STOCK_APPLY, gtk.ICON_SIZE_MENU)
+ box.remove(image)
+ box.pack_start(im)
+ im.show()
+ image.destroy()
+ button.set_sensitive(False)
+ elif response == gtk.RESPONSE_CANCEL:
+ print "cancel"
+ ui.destroy()
+
+ def check_settings(self, daemon):
+ pluginlist = getPluginInfoList(daemon)
+ reporters = pluginlist.getReporterPlugins()
+ wrong_conf_plugs = []
+ for reporter in reporters:
+ if reporter.Settings.check() == False:
+ wrong_conf_plugs.append(reporter)
+
+ #gui_error_message(_("%s is not properly set!\nPlease check the settings and try to report again." % reporter))
+ if wrong_conf_plugs:
+ gladefile = "%s%ssettings_wizard.glade" % (sys.path[0],"/")
+ builder = gtk.Builder()
+ builder.add_from_file(gladefile)
+ dialog = builder.get_object("WrongSettings")
+ vbWrongSettings = builder.get_object("vbWrongSettings")
+ for plugin in wrong_conf_plugs:
+ hbox = gtk.HBox()
+ image = gtk.Image()
+ image.set_from_stock(gtk.STOCK_CANCEL, gtk.ICON_SIZE_MENU)
+ button = gtk.Button(plugin.getName())
+ button.connect("clicked", self.on_config_plugin_clicked, plugin, image)
+ hbox.pack_start(button)
+ hbox.pack_start(image)
+ vbWrongSettings.pack_start(hbox)
+ vbWrongSettings.show_all()
+ dialog.set_transient_for(self.window)
+ response = dialog.run()
+ dialog.destroy()
+ if response == gtk.RESPONSE_NO:
+ print "user cancelled reporting"
+ return False
+ if response == gtk.RESPONSE_YES:
+ print "user wants to proceed with report"
+ return True
+ return True
- def on_cancel_clicked(self, button, treeview):
- pass
def hydrate(self):
+ self.editable = []
+ self.reportListStore.clear()
for item in self.report:
if item == "Comment":
buff = gtk.TextBuffer()
@@ -146,10 +203,21 @@ class ReporterDialog():
else:
del self.report["Comment"]
+ def on_send_clicked(self, button):
+ #def on_apply_clicked(self, button, treeview):
+ attributes = ["item", "content", "editable", "send", "attachment"]
+ for row in self.reportListStore:
+ rowe = dict(zip(attributes, row))
+ if (rowe["attachment"] or (rowe["editable"] and rowe["attachment"])) and rowe["send"]:
+ result = gui_question_dialog(_("<b>WARNING</b>, you're about to send data which might contain sensitive information.\n"
+ "Do you really want to send <b>%s</b>?\n" % rowe["item"]), self.window)
+ if result == gtk.RESPONSE_NO:
+ row[attributes.index("send")] = False
+ self.dehydrate()
+ self.window.response(gtk.RESPONSE_APPLY)
+
def run(self):
result = self.window.run()
- if result != gtk.RESPONSE_APPLY:
- self.report = None
self.window.destroy()
- return self.report
+ return (result, self.report)
diff --git a/src/Gui/Makefile.am b/src/Gui/Makefile.am
index a3993fa5..ffdace54 100644
--- a/src/Gui/Makefile.am
+++ b/src/Gui/Makefile.am
@@ -8,7 +8,7 @@ PYTHON_FILES = CCDBusBackend.py CCDumpList.py CCDump.py CC_gui_functions.py \
SettingsDialog.py ABRTPlugin.py PluginList.py PluginSettingsUI.py \
PluginsSettingsDialog.py ConfBackend.py
-GLADE_FILES = ccgui.glade report.glade settings.glade dialogs.glade
+GLADE_FILES = ccgui.glade report.glade settings.glade dialogs.glade settings_wizard.glade
EXTRA_DIST = $(PYTHON_FILES) $(GLADE_FILES) abrt-gui abrt.desktop
diff --git a/src/Gui/report.glade b/src/Gui/report.glade
index e4a6c582..48fbad0a 100644
--- a/src/Gui/report.glade
+++ b/src/Gui/report.glade
@@ -47,7 +47,7 @@
</child>
</widget>
<packing>
- <property name="position">1</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
@@ -109,25 +109,34 @@
<property name="use_stock">True</property>
</widget>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
- <widget class="GtkButton" id="bApply">
- <property name="label" translatable="yes">Send</property>
- <property name="response_id">-10</property>
+ <widget class="GtkButton" id="bRefresh">
+ <property name="label" translatable="yes">gtk-refresh</property>
+ <property name="response_id">-50</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
+ <property name="use_stock">True</property>
</widget>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
+ <child>
+ <widget class="GtkButton" id="bSend">
+ <property name="label" translatable="yes">Send</property>
+ <property name="response_id">-5</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
diff --git a/src/Gui/settings_wizard.glade b/src/Gui/settings_wizard.glade
new file mode 100644
index 00000000..2af5d77d
--- /dev/null
+++ b/src/Gui/settings_wizard.glade
@@ -0,0 +1,104 @@
+<?xml version="1.0"?>
+<interface>
+ <requires lib="gtk+" version="2.16"/>
+ <!-- interface-naming-policy project-wide -->
+ <object class="GtkDialog" id="WrongSettings">
+ <property name="border_width">5</property>
+ <property name="title" translatable="yes">Wrong Settings Detected</property>
+ <property name="type_hint">normal</property>
+ <property name="has_separator">False</property>
+ <child internal-child="vbox">
+ <object class="GtkVBox" id="dialog-vbox3">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkVBox" id="ws_vbox1">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkLabel" id="lWrongSettingsWarning">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;WARNING:&lt;/b&gt; Wrong settings detected for some of the enabled reporter plugins, please use the buttons bellow to open respective configuration and fix it before you proceed, otherwise the reporting process can fail.
+</property>
+ <property name="use_markup">True</property>
+ <property name="wrap">True</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbWrongSettings">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="lWrongSettings_question">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;Do you want to continue?&lt;/b&gt;</property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child internal-child="action_area">
+ <object class="GtkHButtonBox" id="dialog-action_area3">
+ <property name="visible">True</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="bCancel">
+ <property name="label" translatable="yes">gtk-no</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="bContinue">
+ <property name="label" translatable="yes">gtk-yes</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-9">bCancel</action-widget>
+ <action-widget response="-8">bContinue</action-widget>
+ </action-widgets>
+ </object>
+</interface>