Browse Source

Added support for additional form of terminal coloring

pull/778/head
Justin Berger 2 years ago
parent
commit
e794c59ca5
1 changed files with 4 additions and 2 deletions
  1. 6
      gooey/gui/components/widgets/richtextconsole.py

6
gooey/gui/components/widgets/richtextconsole.py

@ -57,10 +57,12 @@ class RichTextConsole(wx.richtext.RichTextCtrl):
# Actions for coloring text
for index, hex in enumerate(kColorList):
escSeq = '{}{}{}'.format(colored.fore.ESC, index, colored.fore.END)
escSeqShort = '\x1b[0;{}{}'.format(index, colored.fore.END)
wxcolor = wx.Colour(int(hex[1:3],16), int(hex[3:5],16), int(hex[5:],16), alpha=wx.ALPHA_OPAQUE)
# NB : we use a default parameter to force the evaluation of the binding
self.actionsMap[escSeq] = lambda bindedColor=wxcolor: self.BeginTextColour(bindedColor)
self.actionsMap[escSeqShort] = self.actionsMap[escSeq] = \
lambda bindedColor=wxcolor: self.BeginTextColour(bindedColor)
self.Bind(wx.EVT_MOUSEWHEEL, self.onMouseWheel)

Loading…
Cancel
Save