Hi, I've applied this and the previous patch, with one minor modification. Comments below.
On 28 July 2013 16:37, Sandro Bonazzola <[email protected]> wrote: <snip> > def do_size_request(self, requisition): > layout = self.get_layout() > - width, height = layout.get_pixel_size() > + height = layout.get_pixel_size()[1] > requisition.width = 0 > requisition.height = height This silences a linter warning but makes the code harder to read, so I've left this out for now. If you really feel strongly about it, you could rename width to _width or something... I'm not sure how linter-specific such default ignore patterns are. cheers, Kai On 28 July 2013 16:37, Sandro Bonazzola <[email protected]> wrote: > From 0b8dc06bd098a82483a76e634addcdb61e6a169c Mon Sep 17 00:00:00 2001 > From: Sandro Bonazzola <[email protected]> > Date: Sun, 28 Jul 2013 08:26:26 +0200 > Subject: [PATCH 2/2] wraplabel: code quality fixes > > - removed unused imports > - pep8 cleanup > - avoid redefining builtin str > - removed unused variables > --- > meld/ui/wraplabel.py | 17 ++++++++--------- > 1 file changed, 8 insertions(+), 9 deletions(-) > > diff --git a/meld/ui/wraplabel.py b/meld/ui/wraplabel.py > index d40a5be..9b5504b 100644 > --- a/meld/ui/wraplabel.py > +++ b/meld/ui/wraplabel.py > @@ -21,28 +21,27 @@ > # Python translation from wrapLabel.{cc|h} by Gian Mario Tagliaretti > > import gtk > -import gobject > import pango > > > class WrapLabel(gtk.Label): > __gtype_name__ = 'WrapLabel' > > - def __init__(self, str=None): > + def __init__(self, text=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) > + if text is not None: > + self.set_text(text) > > self.set_alignment(0.0, 0.0) > > def do_size_request(self, requisition): > layout = self.get_layout() > - width, height = layout.get_pixel_size() > + height = layout.get_pixel_size()[1] > requisition.width = 0 > requisition.height = height > > @@ -50,12 +49,12 @@ class WrapLabel(gtk.Label): > gtk.Label.do_size_allocate(self, allocation) > self.__set_wrap_width(allocation.width) > > - def set_text(self, str): > - gtk.Label.set_text(self, str) > + def set_text(self, text): > + gtk.Label.set_text(self, text) > self.__set_wrap_width(self.__wrap_width) > > - def set_markup(self, str): > - gtk.Label.set_markup(self, str) > + def set_markup(self, text): > + gtk.Label.set_markup(self, text) > self.__set_wrap_width(self.__wrap_width) > > def __set_wrap_width(self, width): > -- > 1.8.3.1 > > _______________________________________________ > meld-list mailing list > [email protected] > https://mail.gnome.org/mailman/listinfo/meld-list _______________________________________________ meld-list mailing list [email protected] https://mail.gnome.org/mailman/listinfo/meld-list
