From 3134268fbfda6f681cea80c5c1278f3cdafa2657 Mon Sep 17 00:00:00 2001 From: Gonzalo Odiard Date: Wed, 15 May 2013 14:46:07 +0000 Subject: Move the list toolbar to a radiomenubutton in the paragraph toolbar This is another change needed to use Write with rotated screen. Signed-off-by: Gonzalo Odiard --- (limited to 'widgets.py') diff --git a/widgets.py b/widgets.py index 987b11d..47b5e3d 100644 --- a/widgets.py +++ b/widgets.py @@ -171,8 +171,11 @@ class AbiButton(RadioToolButton): class AbiMenuItem(MenuItem): def __init__(self, abi, abi_signal, do_abi_cb, icon_name, label, - button, on_abi_cb=None): + button, on_abi_cb=None, button_icon_name=None): self._icon_name = icon_name + # _button_icon_name is used only in the first case of + # the list menu + self._button_icon_name = button_icon_name self._button = button MenuItem.__init__(self, icon_name=icon_name, text_label=label) @@ -182,14 +185,22 @@ class AbiMenuItem(MenuItem): abi, do_abi_cb) def __activated_cb(self, button, abi, do_abi_cb): - if self._button.get_icon_name() == self._icon_name: - return + + if self._button_icon_name is not None: + if self._button.get_icon_name() == self._button_icon_name: + return + else: + if self._button.get_icon_name() == self._icon_name: + return abi.handler_block(self._abi_handler) try: logging.debug('Do abi %s' % do_abi_cb) do_abi_cb() - self._button.set_icon_name(self._icon_name) + if self._button_icon_name is not None: + self._button.set_icon_name(self._button_icon_name) + else: + self._button.set_icon_name(self._icon_name) finally: abi.handler_unblock(self._abi_handler) @@ -199,7 +210,10 @@ class AbiMenuItem(MenuItem): return logging.debug('On abi %s prop=%r' % (abi_signal, prop)) - self._button.set_icon_name(self._icon_name) + if self._button_icon_name is not None: + self._button.set_icon_name(self._button_icon_name) + else: + self._button.set_icon_name(self._icon_name) class ExportButtonFactory(): -- cgit v0.9.1