comparison cagou/core/common.py @ 179:7177fe2d9725

common: new ActionIcon widget which display symbol or image icon according to what is specified in plugin_info
author Goffi <goffi@goffi.org>
date Tue, 01 May 2018 20:48:48 +0200
parents 11ff8cd93659
children 284cb5c467b0
comparison
equal deleted inserted replaced
178:11ff8cd93659 179:7177fe2d9725
81 pass 81 pass
82 82
83 83
84 class ActionSymbol(Symbol): 84 class ActionSymbol(Symbol):
85 pass 85 pass
86
87
88 class ActionIcon(BoxLayout):
89 plugin_info = properties.DictProperty()
90
91 def on_plugin_info(self, instance, plugin_info):
92 self.clear_widgets()
93 try:
94 symbol = plugin_info['icon_symbol']
95 except KeyError:
96 icon_src = plugin_info['icon_medium']
97 icon_wid = Image(source=icon_src, allow_stretch=True)
98 self.add_widget(icon_wid)
99 else:
100 icon_wid = ActionSymbol(symbol=symbol)
101 self.add_widget(icon_wid)