Skip to content

Commit

Permalink
wxGUI/infobar: fix infobar creation with wxPython 4.1 (#1202)
Browse files Browse the repository at this point in the history
Fixes #1201.
  • Loading branch information
petrasovaa committed Dec 21, 2020
1 parent 5f9f792 commit 8ffe6c7
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions gui/wxpython/gui_core/infobar.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,28 @@ def __init__(self, parent):
self._text.SetForegroundColour(self._foreground_color)
self._button.SetBackgroundColour(self._background_color)

# LAYOUT
# layout
self._unInitLayout()
sizer = wx.BoxSizer(wx.VERTICAL)
self.subSizerText = wx.BoxSizer(wx.HORIZONTAL)
subSizerText = wx.BoxSizer(wx.HORIZONTAL)
self.subSizerButtons = wx.BoxSizer(wx.HORIZONTAL)
self.subSizerText.Add(self._icon, wx.SizerFlags().Centre().Border())
self.subSizerText.Add(self._text, 1, wx.ALIGN_CENTER_VERTICAL)
subSizerText.Add(self._icon, wx.SizerFlags().Centre().Border())
subSizerText.Add(self._text, 1, wx.ALIGN_CENTER_VERTICAL)
self.subSizerButtons.AddStretchSpacer()
self.subSizerButtons.Add(self._button, wx.SizerFlags().Centre().Border())
sizer.Add(self.subSizerText, wx.SizerFlags().Expand())
sizer.Add(subSizerText, wx.SizerFlags().Expand())
sizer.Add(self.subSizerButtons, wx.SizerFlags().Expand())
self.SetSizer(sizer)

def _unInitLayout(self):
sizer = self.GetSizer()
children = sizer.GetChildren()
for i in reversed(range(len(children))):
if children[i].IsSpacer():
sizer.Remove(i)
else:
sizer.Detach(i)

def ShowMessage(self, message, icon, buttons=None):
"""Show message with buttons (optional).
Buttons are list of tuples (label, handler)"""
Expand Down

0 comments on commit 8ffe6c7

Please sign in to comment.