2021-04-10 17:55:48 +00:00
|
|
|
# Authors: see git history
|
|
|
|
#
|
|
|
|
# Copyright (c) 2021 Authors
|
|
|
|
# Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details.
|
|
|
|
|
|
|
|
import wx
|
|
|
|
|
|
|
|
from ..i18n import _
|
|
|
|
|
|
|
|
|
|
|
|
class WarningPanel(wx.Panel):
|
|
|
|
"""A wx.Panel for to display warnings.
|
|
|
|
"""
|
|
|
|
|
|
|
|
def __init__(self, parent, *args, **kwargs):
|
|
|
|
wx.Panel.__init__(self, parent, wx.ID_ANY, *args, **kwargs)
|
|
|
|
|
2023-09-07 17:25:47 +00:00
|
|
|
self.main_sizer = wx.BoxSizer(wx.VERTICAL)
|
2021-04-10 17:55:48 +00:00
|
|
|
|
|
|
|
self.warning = wx.StaticText(self)
|
2023-09-07 17:25:47 +00:00
|
|
|
self.warning.SetLabel(_("An error occurred while rendering the stitch plan:"))
|
2021-04-10 17:55:48 +00:00
|
|
|
self.warning.SetForegroundColour(wx.Colour(255, 25, 25))
|
2023-09-07 17:25:47 +00:00
|
|
|
self.main_sizer.Add(self.warning, 1, wx.LEFT | wx.BOTTOM | wx.EXPAND, 10)
|
2021-04-10 17:55:48 +00:00
|
|
|
|
2023-09-07 17:25:47 +00:00
|
|
|
tc_style = wx.TE_MULTILINE | wx.TE_READONLY | wx.VSCROLL | wx.TE_RICH2
|
2024-04-27 18:16:18 +00:00
|
|
|
self.warning_text = wx.TextCtrl(self, size=(300, 300), style=tc_style)
|
2023-09-07 17:25:47 +00:00
|
|
|
font = self.warning_text.GetFont()
|
|
|
|
font.SetFamily(wx.FONTFAMILY_TELETYPE)
|
|
|
|
self.warning_text.SetFont(font)
|
|
|
|
self.main_sizer.Add(self.warning_text, 3, wx.LEFT | wx.BOTTOM | wx.EXPAND, 10)
|
2021-04-10 17:55:48 +00:00
|
|
|
|
2023-09-07 17:25:47 +00:00
|
|
|
self.SetSizerAndFit(self.main_sizer)
|
2021-04-10 17:55:48 +00:00
|
|
|
self.Layout()
|
2023-09-07 17:25:47 +00:00
|
|
|
|
|
|
|
def set_warning_text(self, text):
|
|
|
|
self.warning_text.SetValue(text)
|
|
|
|
|
|
|
|
def clear(self):
|
|
|
|
self.warning_text.SetValue("")
|