Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEM: hardcoded colors in solver job #13562

Closed
2 tasks done
maxwxyz opened this issue Apr 20, 2024 · 6 comments · Fixed by #13684
Closed
2 tasks done

FEM: hardcoded colors in solver job #13562

maxwxyz opened this issue Apr 20, 2024 · 6 comments · Fixed by #13684
Labels
Feature FR for improvements or new features Stylesheets Anything regarding stylesheets/themes UI/UX WB FEM Related to the FEM Workbench

Comments

@maxwxyz
Copy link
Collaborator

maxwxyz commented Apr 20, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Problem description

Originally posted here: obelisk79/OpenTheme#38
image

The text is not legible with dark themes and the color is not exposed so a theme could style it / change color.
@FEA-eng FYI

Full version info

OS: Debian GNU/Linux trixie/sid (KDE/plasma)
Word size of FreeCAD: 64-bit
Version: 0.22.0dev.35024 (Git) AppImage
Build type: Release
Branch: main
Hash: 4ff00ef99869e35295a5a17b8f486901504c655b
Python 3.10.13, Qt 5.15.8, Coin 4.0.0, Vtk 9.2.6, OCC 7.6.3
Locale: Polish/Poland (pl_PL)
Installed mods: 
  * Curves 0.6.14
  * sheetmetal 0.3.12
  * Rocket 3.2.4
  * kicadStepUpMod 10.21.4
  * fasteners 0.4.70
  * Render 2023.8.18
  * BIM 2021.12.0
  * FreeCAD-Reinforcement-added_translations.zip
  * FreeCAD-Reinforcement-master.zip
  * Reinforcement
  * Alternate_OpenSCAD 1.0.0
  * Woodworking 0.21.30486
  * dodo 1.0.0
  * Alternate_OpenSCAD.backup1691601718.9594336.zip
  * OpenDark 2023.10.30
  * freecad.gears 1.0.0

Subproject(s) affected?

FEM

Anything else?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@maxwxyz maxwxyz added WB FEM Related to the FEM Workbench UI/UX Feature FR for improvements or new features labels Apr 20, 2024
@luzpaz luzpaz added the Stylesheets Anything regarding stylesheets/themes label Apr 20, 2024
@lyphrowny
Copy link
Contributor

The function responsible is this one:

def femConsoleMessage(self, message="", color="#000000"):
self.fem_console_message = self.fem_console_message + (
'<font color="#0000FF">{0:4.1f}:</font> <font color="{1}">{2}</font><br>'
.format(time.time() - self.Start, color, message)
)
self.form.textEdit_Output.setText(self.fem_console_message)
self.form.textEdit_Output.moveCursor(QtGui.QTextCursor.End)

How to expose colors? Any examples in other WBs?
Do the colors need to be exposed or can they be assigned by accessing the theme? For example ThemeConfig.ErrorColorText


These functions may cause the same problem:

  • def console_log(self, message="", color="#000000"):
    self.console_message_gmsh = self.console_message_gmsh + (
    '<font color="#0000FF">{0:4.1f}:</font> <font color="{1}">{2}</font><br>'
    .format(time.time() - self.Start, color, message)
    )
    self.form.te_output.setText(self.console_message_gmsh)
    self.form.te_output.moveCursor(QtGui.QTextCursor.End)
  • def _getText(self, report):
    text = ""
    for i in report.infos:
    line = "<b>Info:</b> %s" % i
    text += "%s<br>" % self._getColoredLine(line, INFO_COLOR)
    for w in report.warnings:
    line = "<b>Warning:</b> %s" % w
    text += "%s<br>" % self._getColoredLine(line, WARNING_COLOR)
    for e in report.errors:
    line = "<b>Error:</b> %s" % e
    text += "%s<br>" % self._getColoredLine(line, ERROR_COLOR)
    return text

@maxwxyz
Copy link
Collaborator Author

maxwxyz commented Apr 21, 2024

@obelisk79 what do you need to style color / how to use text color from the preferences?

@obelisk79
Copy link

Just use the same variables as the Python Editor/report view should do the trick. Plus it would make things generally more consistent across the application.

@Syres916
Copy link
Contributor

The CfdOF Wb already has this implemented, see https://github.com/jaheyns/CfdOF/blob/master/CfdOF/Solve/TaskPanelCfdSolverControl.py#L81 and https://github.com/jaheyns/CfdOF/blob/master/CfdOF/CfdTools.py#L370

I personally added bold to the time just to make it stand out when I'm benchmarking a model on different pieces of kit.

CfdOF_Solver_Colours

@Syres916
Copy link
Contributor

@FEA-eng would you like to try the following changes https://github.com/FreeCAD/FreeCAD/compare/main...Syres916:FreeCAD:FEM_TaskPanel_Colours?expand in order to give a very similar output to the CfdOF screenshot above?

@FEA-eng
Copy link
Contributor

FEA-eng commented Apr 27, 2024

@Syres916 I tested it, looks good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature FR for improvements or new features Stylesheets Anything regarding stylesheets/themes UI/UX WB FEM Related to the FEM Workbench
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants