[Pkg-sugar-commit] [sugar-toolkit-gtk3] 08/09: Remove _HeaderSeparator
Jonas Smedegaard
dr at jones.dk
Thu Jul 2 22:58:36 UTC 2015
This is an automated email from the git hooks/post-receive script.
js pushed a commit to tag v0.105.3
in repository sugar-toolkit-gtk3.
commit a873cfc04e3ba9b78d5bad89d19b07e4cc0324e2
Author: Gonzalo Odiard <godiard at gmail.com>
Date: Tue Jun 30 14:24:52 2015 -0300
Remove _HeaderSeparator
The palette using a Gtk.Menu, had a separator displayed using a custom widget,
but that was not well displayed (the line didn't had the palette width
due to margin on the palette) and was broken on Gtk >= 3.16
Instead of use that widget to draw the separator line between at the bottom
of _HeaderItem, as we do with the toolbar buttons when the palette is displayed.
---
src/sugar3/graphics/palette.py | 30 ++++++++++++++++++------------
1 file changed, 18 insertions(+), 12 deletions(-)
diff --git a/src/sugar3/graphics/palette.py b/src/sugar3/graphics/palette.py
index be1bcda..5a0bfea 100644
--- a/src/sugar3/graphics/palette.py
+++ b/src/sugar3/graphics/palette.py
@@ -70,14 +70,24 @@ class _HeaderItem(Gtk.MenuItem):
self.set_allocation(allocation)
self.get_child().size_allocate(allocation)
-
-class _HeaderSeparator(Gtk.SeparatorMenuItem):
- """A SeparatorMenuItem that can be styled in the theme."""
-
- __gtype_name__ = 'SugarPaletteHeaderSeparator'
-
- def __init__(self):
- Gtk.SeparatorMenuItem.__init__(self)
+ def do_draw(self, cr):
+ # force state normal, we don't want change color when hover
+ self.set_state(Gtk.StateType.NORMAL)
+
+ # draw separator
+ allocation = self.get_allocation()
+ cr.save()
+ line_width = 2
+ cr.set_line_width(line_width)
+ cr.set_source_rgb(.5, .5, .5) # button_grey #808080;
+ cr.move_to(0, allocation.height - line_width)
+ cr.line_to(allocation.width, allocation.height - line_width)
+ cr.stroke()
+ cr.restore()
+
+ # draw content
+ Gtk.MenuItem.do_draw(self, cr)
+ return False
class Palette(PaletteWindow):
@@ -458,10 +468,6 @@ class Palette(PaletteWindow):
self._label_menuitem.show()
self._widget.append(self._label_menuitem)
- separator = _HeaderSeparator()
- self._widget.append(separator)
- separator.show()
-
self._setup_widget()
return self._widget
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-sugar/sugar-toolkit-gtk3.git
More information about the pkg-sugar-commit
mailing list