# Path: meld/ui/wraplabel.py
# class WrapLabel(gtk.Label):
#     __gtype_name__ = 'WrapLabel'
# 
#     def __init__(self, str=None):
#         gtk.Label.__init__(self)
# 
#         self.__wrap_width = 0
#         self.layout = self.get_layout()
#         self.layout.set_wrap(pango.WRAP_WORD_CHAR)
# 
#         if str != None:
#             self.set_text(str)
# 
#         self.set_alignment(0.0, 0.0)
# 
#     def do_size_request(self, requisition):
#         layout = self.get_layout()
#         width, height = layout.get_pixel_size()
#         requisition.width = 0
#         requisition.height = height
# 
#     def do_size_allocate(self, allocation):
#         gtk.Label.do_size_allocate(self, allocation)
#         self.__set_wrap_width(allocation.width)
# 
#     def set_text(self, str):
#         gtk.Label.set_text(self, str)
#         self.__set_wrap_width(self.__wrap_width)
# 
#     def set_markup(self, str):
#         gtk.Label.set_markup(self, str)
#         self.__set_wrap_width(self.__wrap_width)
# 
#     def __set_wrap_width(self, width):
#         if width == 0:
#             return
#         layout = self.get_layout()
#         layout.set_width(width * pango.SCALE)
#         if self.__wrap_width != width:
#             self.__wrap_width = width
#             self.queue_resize()


import logging
import gobject
import gtk
from .wraplabel import WrapLabel

    def set_text_and_icon(self, stockid, primary_text, secondary_text=None):
        hbox_content = gtk.HBox(False, 8)
        hbox_content.show()

        image = gtk.Image()
        image.set_from_stock(stockid, gtk.ICON_SIZE_DIALOG)
        image.show()
        hbox_content.pack_start(image, False, False, 0)
        image.set_alignment(0.5, 0.5)

        vbox = gtk.VBox(False, 6)
        vbox.show()
        hbox_content.pack_start (vbox, True, True, 0)

        self.__labels = []

        primary_markup = "<b>%s</b>" % (primary_text,)
        primary_label = WrapLabel(primary_markup)
        primary_label.show()
        vbox.pack_start(primary_label, True, True, 0)
        primary_label.set_use_markup(True)
        primary_label.set_line_wrap(True)
        primary_label.set_alignment(0, 0.5)
        primary_label.set_flags(gtk.CAN_FOCUS)
        primary_label.set_selectable(True)
        self.__labels.append(primary_label)

        if secondary_text:
            secondary_markup = "<small>%s</small>" % (secondary_text,)

# Path: meld/ui/wraplabel.py
# class WrapLabel(gtk.Label):
#     __gtype_name__ = 'WrapLabel'
# 
#     def __init__(self, str=None):
#         gtk.Label.__init__(self)
# 
#         self.__wrap_width = 0
#         self.layout = self.get_layout()
#         self.layout.set_wrap(pango.WRAP_WORD_CHAR)
# 
#         if str != None:
#             self.set_text(str)
# 
#         self.set_alignment(0.0, 0.0)
# 
#     def do_size_request(self, requisition):
#         layout = self.get_layout()
#         width, height = layout.get_pixel_size()
#         requisition.width = 0
#         requisition.height = height
# 
#     def do_size_allocate(self, allocation):
#         gtk.Label.do_size_allocate(self, allocation)
#         self.__set_wrap_width(allocation.width)
# 
#     def set_text(self, str):
#         gtk.Label.set_text(self, str)
#         self.__set_wrap_width(self.__wrap_width)
# 
#     def set_markup(self, str):
#         gtk.Label.set_markup(self, str)
#         self.__set_wrap_width(self.__wrap_width)
# 
#     def __set_wrap_width(self, width):
#         if width == 0:
#             return
#         layout = self.get_layout()
#         layout.set_width(width * pango.SCALE)
#         if self.__wrap_width != width:
#             self.__wrap_width = width
#             self.queue_resize()


# Path: meld/ui/msgarea.py
import logging
import gobject
import gtk
from .wraplabel import WrapLabel


    def set_text_and_icon(self, stockid, primary_text, secondary_text=None):
        hbox_content = gtk.HBox(False, 8)
        hbox_content.show()

        image = gtk.Image()
        image.set_from_stock(stockid, gtk.ICON_SIZE_DIALOG)
        image.show()
        hbox_content.pack_start(image, False, False, 0)
        image.set_alignment(0.5, 0.5)

        vbox = gtk.VBox(False, 6)
        vbox.show()
        hbox_content.pack_start (vbox, True, True, 0)

        self.__labels = []

        primary_markup = "<b>%s</b>" % (primary_text,)
        primary_label = WrapLabel(primary_markup)
        primary_label.show()
        vbox.pack_start(primary_label, True, True, 0)
        primary_label.set_use_markup(True)
        primary_label.set_line_wrap(True)
        primary_label.set_alignment(0, 0.5)
        primary_label.set_flags(gtk.CAN_FOCUS)
        primary_label.set_selectable(True)
        self.__labels.append(primary_label)

        if secondary_text:
            secondary_markup = "<small>%s</small>" % (secondary_text,)

            secondary_label = WrapLabel(secondary_markup)