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.
This commit is contained in:
parent
2ba05304f8
commit
a873cfc04e
@ -70,14 +70,24 @@ class _HeaderItem(Gtk.MenuItem):
|
|||||||
self.set_allocation(allocation)
|
self.set_allocation(allocation)
|
||||||
self.get_child().size_allocate(allocation)
|
self.get_child().size_allocate(allocation)
|
||||||
|
|
||||||
|
def do_draw(self, cr):
|
||||||
|
# force state normal, we don't want change color when hover
|
||||||
|
self.set_state(Gtk.StateType.NORMAL)
|
||||||
|
|
||||||
class _HeaderSeparator(Gtk.SeparatorMenuItem):
|
# draw separator
|
||||||
"""A SeparatorMenuItem that can be styled in the theme."""
|
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()
|
||||||
|
|
||||||
__gtype_name__ = 'SugarPaletteHeaderSeparator'
|
# draw content
|
||||||
|
Gtk.MenuItem.do_draw(self, cr)
|
||||||
def __init__(self):
|
return False
|
||||||
Gtk.SeparatorMenuItem.__init__(self)
|
|
||||||
|
|
||||||
|
|
||||||
class Palette(PaletteWindow):
|
class Palette(PaletteWindow):
|
||||||
@ -458,10 +468,6 @@ class Palette(PaletteWindow):
|
|||||||
self._label_menuitem.show()
|
self._label_menuitem.show()
|
||||||
self._widget.append(self._label_menuitem)
|
self._widget.append(self._label_menuitem)
|
||||||
|
|
||||||
separator = _HeaderSeparator()
|
|
||||||
self._widget.append(separator)
|
|
||||||
separator.show()
|
|
||||||
|
|
||||||
self._setup_widget()
|
self._setup_widget()
|
||||||
|
|
||||||
return self._widget
|
return self._widget
|
||||||
|
Loading…
Reference in New Issue
Block a user