- the status bar messages that are echoed in the Tcl Shell will no longer have all text colored but only the identifier

This commit is contained in:
Marius Stanciu 2020-04-24 06:59:49 +03:00 committed by Marius
parent b569fa1748
commit 26dd29e7dd
4 changed files with 26 additions and 9 deletions

View File

@ -12,7 +12,7 @@ CHANGELOG for FlatCAM beta
- some PEP changes, some method descriptions updated
- added a placeholder text to 2Sided Tool
- added a new menu entry in the context menu of the Tcl Shell: 'Save Log' which will save the content of the Tcl Shell browser window to a file
- the status bar messages that are echoed in the Tcl Shell will no longer have all text colored but only the identifier
23.04.2020

View File

@ -2561,8 +2561,8 @@ class App(QtCore.QObject):
self.shell.setWindowIcon(self.ui.app_icon)
self.shell.setWindowTitle("FlatCAM Shell")
self.shell.resize(*self.defaults["global_shell_shape"])
self.shell.append_output("FlatCAM %s - " % self.version)
self.shell.append_output(_("Type >help< to get started\n\n"))
self.shell._append_to_browser('in', "FlatCAM %s - " % self.version)
self.shell.append_output('%s\n\n' % _("Type >help< to get started"))
self.ui.shell_dock.setWidget(self.shell)

View File

@ -2588,9 +2588,13 @@ class _BrowserTextEdit(QTextEdit):
def clear(self):
QTextEdit.clear(self)
text = "FlatCAM %s - Type >help< to get started\n\n" % self.version
text = "!FlatCAM %s? - %s" % (self.version, _("Type >help< to get started"))
text = html.escape(text)
text = text.replace('\n', '<br/>')
# hack so I can make text bold because the escape method will replace the '<' and '>' signs with html code
text = text.replace('!', '<b>')
text = text.replace('?', '</b>')
text += '<br><br>'
self.moveCursor(QTextCursor.End)
self.insertHtml(text)

View File

@ -101,20 +101,33 @@ class TermWidget(QWidget):
text = text.replace('\n', '<br>')
text = text.replace('\t', '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;')
idx = text.find(']')
mtype = text[:idx+1].upper()
mtype = mtype.replace('_NOTCL', '')
body = text[idx+1:]
if style == 'in':
text = '<span style="font-weight: bold;">%s</span>' % text
elif style == 'err':
text = '<span style="font-weight: bold; color: red;">%s</span>' % text
text = '<span style="font-weight: bold; color: red;">%s</span>'\
'<span style="font-weight: bold;">%s</span>'\
%(mtype, body)
elif style == 'warning':
text = '<span style="font-weight: bold; color: #f4b642;">%s</span>' % text
# text = '<span style="font-weight: bold; color: #f4b642;">%s</span>' % text
text = '<span style="font-weight: bold; color: #f4b642;">%s</span>' \
'<span style="font-weight: bold;">%s</span>' \
% (mtype, body)
elif style == 'success':
text = '<span style="font-weight: bold; color: #15b300;">%s</span>' % text
# text = '<span style="font-weight: bold; color: #15b300;">%s</span>' % text
text = '<span style="font-weight: bold; color: #15b300;">%s</span>' \
'<span style="font-weight: bold;">%s</span>' \
% (mtype, body)
elif style == 'selected':
text = ''
elif style == 'raw':
text = text
else:
text = '<span>%s</span>' % text # without span <br/> is ignored!!!
# without span <br/> is ignored!!!
text = '<span>%s</span>' % text
scrollbar = self._browser.verticalScrollBar()
old_value = scrollbar.value()