Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/widgets.py
diff options
context:
space:
mode:
authorGonzalo Odiard <godiard@gmail.com>2013-05-15 14:46:07 (GMT)
committer Gonzalo Odiard <godiard@gmail.com>2013-05-15 16:50:52 (GMT)
commit3134268fbfda6f681cea80c5c1278f3cdafa2657 (patch)
tree3fee393f62d8eb9c1fa5eb2c7429da6f3fd05ee6 /widgets.py
parentd259aee454c6f8cc0ae058a518c7785031ecddac (diff)
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 <gonzalo@laptop.org>
Diffstat (limited to 'widgets.py')
-rw-r--r--widgets.py24
1 files changed, 19 insertions, 5 deletions
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():