Reviewers: ,


Please review this at http://codereview.tryton.org/230001/

Affected files:
  M tryton/common/cellrendererbinary.py
  M tryton/common/cellrendererbutton.py


Index: tryton/common/cellrendererbinary.py
===================================================================
--- a/tryton/common/cellrendererbinary.py
+++ b/tryton/common/cellrendererbinary.py
@@ -103,8 +103,9 @@
         layout = widget.create_pango_layout(self.size)
         layout.set_font_description(widget.style.font_desc)
         w, h = layout.get_size()
-        x = int(cell_area.x + (cell_area.width - w / pango.SCALE) * 0)
+        x = int(cell_area.x + 1 / pango.SCALE)
         y = int(cell_area.y + (cell_area.height - h / pango.SCALE) / 2)
+        layout.set_width(((cell_area.width / 2) - 2) * pango.SCALE)
         state = gtk.STATE_NORMAL
         if flags & gtk.CELL_RENDERER_SELECTED:
             state = gtk.STATE_ACTIVE
Index: tryton/common/cellrendererbutton.py
===================================================================
--- a/tryton/common/cellrendererbutton.py
+++ b/tryton/common/cellrendererbutton.py
@@ -58,8 +58,12 @@
         layout = widget.create_pango_layout(self.text)
         layout.set_font_description(widget.style.font_desc)
         w, h = layout.get_size()
-        x = int(cell_area.x + (cell_area.width - w / pango.SCALE) / 2)
+        if cell_area.width < w / pango.SCALE:
+            x = cell_area.x + 1 / pango.SCALE
+        else:
+            x = int(cell_area.x + (cell_area.width - w / pango.SCALE) / 2)
         y = int(cell_area.y + (cell_area.height - h / pango.SCALE) / 2)
+        layout.set_width((cell_area.width - 2) * pango.SCALE)
         window.draw_layout(widget.style.text_gc[0], x, y, layout)

     def on_get_size(self, widget, cell_area=None):


--
[email protected] mailing list

Reply via email to