summaryrefslogtreecommitdiffstats
path: root/src/Gui/CCReporterDialog.py
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/CCReporterDialog.py
parent750129e963816a59103bdb2ea461c66f26e98343 (diff)
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/CCReporterDialog.py')
-rw-r--r--src/Gui/CCReporterDialog.py108
1 files changed, 88 insertions, 20 deletions
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)