Explorar el Código

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

Marius Stanciu hace 5 años
padre
commit
26dd29e7dd
Se han modificado 4 ficheros con 26 adiciones y 9 borrados
  1. 1 1
      CHANGELOG.md
  2. 2 2
      FlatCAMApp.py
  3. 6 2
      flatcamGUI/GUIElements.py
  4. 17 4
      flatcamTools/ToolShell.py

+ 1 - 1
CHANGELOG.md

@@ -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 
 

+ 2 - 2
FlatCAMApp.py

@@ -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)
 

+ 6 - 2
flatcamGUI/GUIElements.py

@@ -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)
 

+ 17 - 4
flatcamTools/ToolShell.py

@@ -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()