Merge branch 'fix-4960-palette-damange' of https://github.com/samdroid-apps/sugar-toolkit-gtk3
This commit is contained in:
commit
f4ec9346d2
@ -1388,14 +1388,36 @@ class CursorInvoker(Invoker):
|
|||||||
|
|
||||||
|
|
||||||
class ToolInvoker(WidgetInvoker):
|
class ToolInvoker(WidgetInvoker):
|
||||||
|
'''
|
||||||
|
A palette invoker for toolbar buttons and other items. This invoker
|
||||||
|
will properly align the palette so that is perpendicular to the toolbar
|
||||||
|
(a horizontal toolbar will spawn a palette going downwards). It also
|
||||||
|
draws the highlights specific to a toolitem.
|
||||||
|
|
||||||
|
For :class:`sugar3.graphics.toolbutton.ToolButton` and subclasses, you
|
||||||
|
should not use the toolinvoker directly. Instead, just subclass the
|
||||||
|
tool button and override the `create_palette` function.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
parent (Gtk.Widget): toolitem to connect invoker to
|
||||||
|
'''
|
||||||
|
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
WidgetInvoker.__init__(self)
|
WidgetInvoker.__init__(self)
|
||||||
|
self._tool = None
|
||||||
|
|
||||||
if parent:
|
if parent:
|
||||||
self.attach_tool(parent)
|
self.attach_tool(parent)
|
||||||
|
|
||||||
def attach_tool(self, widget):
|
def attach_tool(self, widget):
|
||||||
|
'''
|
||||||
|
Attach a toolitem to the invoker. Same behaviour as passing the
|
||||||
|
`parent` argument to the constructor.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
widget (Gtk.Widget): toolitem to connect invoker to
|
||||||
|
'''
|
||||||
|
self._tool = widget
|
||||||
self.attach_widget(widget, widget.get_child())
|
self.attach_widget(widget, widget.get_child())
|
||||||
|
|
||||||
def _get_alignments(self):
|
def _get_alignments(self):
|
||||||
@ -1411,6 +1433,14 @@ class ToolInvoker(WidgetInvoker):
|
|||||||
def primary_text_clicked(self):
|
def primary_text_clicked(self):
|
||||||
self._widget.emit('clicked')
|
self._widget.emit('clicked')
|
||||||
|
|
||||||
|
def notify_popup(self):
|
||||||
|
WidgetInvoker.notify_popup(self)
|
||||||
|
self._tool.queue_draw()
|
||||||
|
|
||||||
|
def notify_popdown(self):
|
||||||
|
WidgetInvoker.notify_popdown(self)
|
||||||
|
self._tool.queue_draw()
|
||||||
|
|
||||||
|
|
||||||
class TreeViewInvoker(Invoker):
|
class TreeViewInvoker(Invoker):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user