summaryrefslogtreecommitdiffstats
path: root/src/Gui/CC_gui_functions.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/Gui/CC_gui_functions.py')
-rw-r--r--src/Gui/CC_gui_functions.py30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/Gui/CC_gui_functions.py b/src/Gui/CC_gui_functions.py
index d92e26f3..9378de52 100644
--- a/src/Gui/CC_gui_functions.py
+++ b/src/Gui/CC_gui_functions.py
@@ -14,11 +14,14 @@ else:
try:
# we don't want to add dependency to rpm, but if we have it, we can use it
import rpm
-except:
+except ImportError:
rpm = None
from abrt_utils import _, log, log1, log2
+def on_label_resize(label, allocation):
+ label.set_size_request(allocation.width,-1)
+
def on_url_clicked(label, url):
import gnomevfs
file_mimetype = gnomevfs.get_mime_type(url)
@@ -35,13 +38,12 @@ 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")
- dialog.set_default_size(400, 50)
- dialog.set_resizable(False)
+ dialog.set_geometry_hints(dialog, min_width=450, min_height=150)
+ dialog.set_resizable(True)
main_hbox = builder.get_object("main_hbox")
STATUS = 0
MESSAGE = 1
- message = ""
status_vbox = gtk.VBox()
for plugin, res in report_status_dict.iteritems():
plugin_status_vbox = gtk.VBox()
@@ -50,6 +52,7 @@ def gui_report_dialog ( report_status_dict, parent_dialog,
plugin_label.set_justify(gtk.JUSTIFY_RIGHT)
plugin_label.set_alignment(0, 0)
status_label = gtk.Label()
+ status_label.connect("size-allocate",on_label_resize)
status_label.set_max_width_chars(MAX_WIDTH)
status_label.set_size_request(400,-1)
status_label.set_selectable(True)
@@ -59,23 +62,22 @@ def gui_report_dialog ( report_status_dict, parent_dialog,
plugin_status_vbox.pack_start(plugin_label, expand=False)
plugin_status_vbox.pack_start(status_label, fill=True, expand=True)
# 0 means not succesfull
- #if report_status_dict[plugin][0] == '0':
+ #if report_status_dict[plugin][STATUS] == '0':
# this first one is actually a fallback to set at least
# a raw text in case when set_markup() fails
- status_label.set_text(report_status_dict[plugin][1])
- status_label.set_markup("<span foreground='red'>%s</span>" % report_status_dict[plugin][1])
+ status_label.set_text(report_status_dict[plugin][MESSAGE])
+ status_label.set_markup("<span foreground='red'>%s</span>" % report_status_dict[plugin][MESSAGE])
# if the report was not succesful then this won't pass so this runs only
# if report succeds and gets overwriten by the status message
- if report_status_dict[plugin][0] == '1':
- if "http" in report_status_dict[plugin][1][0:4] or "file://" in report_status_dict[plugin][1][0:7]:
- status_label.set_markup("<a href=\"%s\">%s</a>" % (report_status_dict[plugin][1], report_status_dict[plugin][1]))
+ if report_status_dict[plugin][STATUS] == '1':
+ if "http" in report_status_dict[plugin][MESSAGE][0:4] or "file://" in report_status_dict[plugin][MESSAGE][0:7]:
+ status_label.set_markup("<a href=\"%s\">%s</a>" % (report_status_dict[plugin][MESSAGE], report_status_dict[plugin][MESSAGE]))
# FIXME: make a new branch for rawhide with gtk 2.17 and remove this
if gtk.gtk_version[1] < 17:
status_label.connect(on_url_clicked_signal, on_url_clicked)
else:
status_label.set_text("%s" % report_status_dict[plugin][1])
if len(report_status_dict[plugin][1]) > MAX_WIDTH:
- print "setting tooltip for %s" % report_status_dict[plugin][1]
status_label.set_tooltip_text(report_status_dict[plugin][1])
status_vbox.pack_start(plugin_status_vbox, fill=True, expand=False)
main_hbox.pack_start(status_vbox)
@@ -203,7 +205,7 @@ def get_icon_for_package(theme, package):
# .dektop file found
for filename in h['filenames']:
if filename.rfind("%s.png" % icon_filename) != -1:
- log2("png file:'%s'", filename)
+ log2("png file:'%s'", filename)
icon_filename = filename
break
#we didn't find the .desktop file
@@ -221,7 +223,7 @@ def get_icon_for_package(theme, package):
else:
return None
-def show_log(log, parent=None):
+def show_log(message_log, parent=None):
builder = gtk.Builder()
builderfile = "%s%sdialogs.glade" % (sys.path[0],"/")
builder.add_from_file(builderfile)
@@ -235,7 +237,7 @@ def show_log(log, parent=None):
dialog.set_position (gtk.WIN_POS_CENTER)
buff = gtk.TextBuffer()
- buff.set_text(log)
+ buff.set_text(message_log)
tevLog.set_buffer(buff)
dialog.run()