|
21 | 21 |
|
22 | 22 | from ..context import LOG |
23 | 23 | from ..publish import RideLogException |
24 | | -from ..widgets import Label, RIDEDialog |
| 24 | +from ..widgets import Label, RIDEDialog, ButtonWithHandler |
25 | 25 |
|
26 | 26 | _ = wx.GetTranslation # To keep linter/code analyser happy |
27 | 27 | builtins.__dict__['_'] = wx.GetTranslation |
@@ -82,10 +82,9 @@ def _create_body(self, plugins, activation_callback): |
82 | 82 | sizer.Add(self._create_label(panel, _('Enabled')), 0, wx.BOTTOM, border=8) |
83 | 83 | sizer.Add(self._create_label(panel, _('Plugin')), 0, wx.BOTTOM | wx.EXPAND, border=8) |
84 | 84 | for plugin in sorted(plugins, key=lambda p: p.name): |
85 | | - sizer.Add(_PluginEnablationCheckBox(panel, plugin, |
86 | | - activation_callback), |
87 | | - flag=wx.ALIGN_CENTER_HORIZONTAL) |
88 | | - sizer.Add(_PluginRow(panel, plugin), 0, wx.EXPAND) |
| 85 | + sizer.Add(_PluginEnablationCheckBox(panel, plugin, activation_callback), |
| 86 | + flag=wx.ALIGN_LEFT) |
| 87 | + sizer.Add(_PluginRow(panel, plugin, self.color_background), 0, wx.EXPAND) |
89 | 88 | panel.SetSizer(sizer) |
90 | 89 | return panel |
91 | 90 |
|
@@ -141,16 +140,26 @@ def _execute(self, method): |
141 | 140 |
|
142 | 141 | class _PluginRow(wx.Panel): |
143 | 142 |
|
144 | | - def __init__(self, parent, plugin): |
| 143 | + def __init__(self, parent, plugin, backgound_color): |
145 | 144 | wx.Panel.__init__(self, parent) |
| 145 | + sz_head = wx.FlexGridSizer(0, 3, hgap=4, vgap=4) |
| 146 | + l_name = self._get_name(plugin) |
| 147 | + sz_head.Add(l_name) |
| 148 | + b_spacing = Label(self, label=' ') |
| 149 | + sz_head.Add(b_spacing) |
| 150 | + if hasattr(plugin, 'on_config_panel'): |
| 151 | + try: |
| 152 | + sz_head.Add(ButtonWithHandler(self, _('Settings'), bitmap='wrench.png', |
| 153 | + color_secondary_background=backgound_color, |
| 154 | + handler=lambda e: plugin.on_config_panel()), |
| 155 | + flag=wx.ALIGN_LEFT) |
| 156 | + except AttributeError: |
| 157 | + pass |
146 | 158 | sizer = wx.BoxSizer(wx.VERTICAL) |
147 | | - sizer.Add(self._get_name(plugin)) |
| 159 | + sizer.Add(sz_head) |
148 | 160 | for name, value in plugin.metadata.items(): |
149 | 161 | sizer.Add(self._get_metadata(name, value)) |
150 | 162 | sizer.Add(self._get_description(plugin), 0, wx.EXPAND) |
151 | | - config = plugin.config_panel(self) |
152 | | - if config: |
153 | | - sizer.Add(config, 1, wx.EXPAND | wx.LEFT, border=16) |
154 | 163 | self.SetSizer(sizer) |
155 | 164 |
|
156 | 165 | def _get_name(self, plugin): |
|
0 commit comments