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

Add a way to display log in a ScriptDialog #26

Closed
narnaud opened this issue Jun 19, 2024 · 5 comments · Fixed by #157
Closed

Add a way to display log in a ScriptDialog #26

narnaud opened this issue Jun 19, 2024 · 5 comments · Fixed by #157
Assignees
Labels
⬆️ feature New feature or request
Milestone

Comments

@narnaud
Copy link
Member

narnaud commented Jun 19, 2024

Currently, scripts report their output through logging.
However, the log output doesn't render whilst the script is running.

This could be a good first step to indicate how far along a script is and to show the user that it's indeed doing something.

We could imagine adding a QPlainTextEdit with a particular name LogOutput or something like that. In the ScriptDialogItem, if we find such QPlainTextEdit, we initalize it in readonly log mode, and redirect the logging output to it.
Hint: there's a small syntaxhilighting in GUI that could be used, see LogHighlighter

@narnaud narnaud added the ⬆️ feature New feature or request label Jun 19, 2024
@narnaud narnaud added this to the Release 1.0.0 milestone Jun 19, 2024
@LeonMatthesKDAB
Copy link
Collaborator

How exactly would this solve our issue? We already have a Log panel.

The issue is that the Log panel isn't updated while JS code runs, as that is single-threaded, right?
But any other UI item, like the mentioned QPlainTextEdit, also won't update, so what would be different here?

@narnaud
Copy link
Member Author

narnaud commented Jul 9, 2024

The logs are displayed when running a script in the GUI, and visible from the Log panel (we should probably remove them from the history though... another task).

The problem this task is trying to fix is when using knut via the command line: you don't see any logs. For example, when doing the rc to ui conversion, there are some warnings displayed when a flag is not handled, but I'm missing them.

So the idea is to have a way to add a QPlainTextEdit inside the script ui that displays the log.
Hope it's clearer.

@LeonMatthesKDAB
Copy link
Collaborator

Ah, okay. That's clearer.

Shouldn't the command line output just print everything that we dump out with spdlog?

Or do you mean if you don't have a terminal open at all but still run it in script mode?

@narnaud
Copy link
Member Author

narnaud commented Jul 9, 2024

Unfortunately, it doesn't work on Windows, we can't see the command line output... (limitation of Windows, a GUI program does not display anything when run from the CLI).
The nice thing is that it will also work for people running it from another IDE (like Visual Studio, QtC...)

@LeonMatthesKDAB
Copy link
Collaborator

Okay, then that clarifies it 👍

smnppKDAB added a commit to smnppKDAB/knut that referenced this issue Aug 28, 2024
smnppKDAB added a commit to smnppKDAB/knut that referenced this issue Aug 29, 2024
smnppKDAB added a commit to smnppKDAB/knut that referenced this issue Aug 29, 2024
smnppKDAB added a commit to smnppKDAB/knut that referenced this issue Aug 29, 2024
smnppKDAB added a commit to smnppKDAB/knut that referenced this issue Aug 29, 2024
smnppKDAB added a commit to smnppKDAB/knut that referenced this issue Aug 29, 2024
smnppKDAB added a commit to smnppKDAB/knut that referenced this issue Aug 29, 2024
smnppKDAB added a commit to smnppKDAB/knut that referenced this issue Aug 29, 2024
Added a QPlainTextEdit widget to allow real-time log display in the user interface. The actual code did not allow windows users to view logs when launching knut from the command line.
Just add a QPlainTextEdit (e.g. foo) and set `data.fooDisplayLogs = "level"` to see all logs of level greater than or equal to "level"
Fixes KDAB#26
smnppKDAB added a commit to smnppKDAB/knut that referenced this issue Aug 29, 2024
Added a QPlainTextEdit widget to allow real-time log display in the user interface. The actual code did not allow windows users to view logs when launching knut from the command line.

Just add a QPlainTextEdit (e.g. foo) and set `data.fooDisplayLogs = "level"` to see all logs of level greater than or equal to "level"

Fixes KDAB#26
smnppKDAB added a commit to smnppKDAB/knut that referenced this issue Aug 30, 2024
Added a QPlainTextEdit widget to allow real-time log display in the user interface. The actual code did not allow windows users to view logs when launching knut from the command line.

Just add a QPlainTextEdit (e.g. foo) and set `data.fooDisplayLogs = "level"` to see all logs of level greater than or equal to "level"

Fixes KDAB#26
smnppKDAB added a commit to smnppKDAB/knut that referenced this issue Aug 30, 2024
Added a QPlainTextEdit widget to allow real-time log display in the user interface. The actual code did not allow windows users to view logs when launching knut from the command line.

Just add a QPlainTextEdit (e.g. foo) and set `data.fooDisplayLogs = "level"` to see all logs of level greater than or equal to "level"

Fixes KDAB#26
smnppKDAB added a commit to smnppKDAB/knut that referenced this issue Aug 30, 2024
Added a QPlainTextEdit widget to allow real-time log display in the user interface. The actual code did not allow windows users to view logs when launching knut from the command line.

Just add a QPlainTextEdit (e.g. foo) and set `data.fooDisplayLogs = "level"` to see all logs of level greater than or equal to "level"

Fixes KDAB#26
smnppKDAB added a commit to smnppKDAB/knut that referenced this issue Aug 30, 2024
Added a QPlainTextEdit widget to allow real-time log display in the user interface. The actual code did not allow windows users to view logs when launching knut from the command line.

The QPlainTextEdit can be made visible using the qml setDisplayLogs method and taking as parameter the minimum log level that we want to have.

Fixes KDAB#26
smnppKDAB added a commit to smnppKDAB/knut that referenced this issue Aug 30, 2024
Added a QPlainTextEdit widget to allow real-time log display in the user interface. The actual code did not allow windows users to view logs when launching knut from the command line.

The QPlainTextEdit can be made visible using the qml setDisplayLogs method and taking as parameter the minimum log level that we want to have.

Fixes KDAB#26
smnppKDAB added a commit to smnppKDAB/knut that referenced this issue Aug 30, 2024
Added a QPlainTextEdit widget to allow real-time log display in the user interface. The actual code did not allow windows users to view logs when launching knut from the command line.

The QPlainTextEdit can be made visible using the qml setDisplayLogs method and taking as parameter the minimum log level that we want to have.

Fixes KDAB#26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⬆️ feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants