Is there a way to make errors beep?

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
Post Reply
User avatar
lrak
Posts: 34
Joined: Fri Feb 22, 2019 12:33 am

Is there a way to make errors beep?

Post by lrak »

The problems I have are usually with editing things. If I do something that creates an 'error' (red text in the 'Report View' box) and don't notice - I find it is possible to get a mess I can't recover from. The problem is I'm looking at the model I'm working on - and miss the errors.

I'm not a python programmer - but I think there is a play-sound lib - don't know how to load it or how to write something that will make the beep - so any help would be welcome. (I'm running on Debian bullseye - 0.19.. )
I would rather have questions that cannot be answered,
than answers that cannot be questioned’
Richard Feynman.
chrisb
Veteran
Posts: 53945
Joined: Tue Mar 17, 2015 9:14 am

Re: Is there a way to make errors beep?

Post by chrisb »

I don't know of a beep, but you can configure Preferences->Output window->Show Report on error.
That opens the report view, which should be alert enough.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
mario52
Veteran
Posts: 4674
Joined: Wed May 16, 2012 2:13 pm

Re: Is there a way to make errors beep?

Post by mario52 »

Hi

good idea adding option in "General > Output Window > CheckBox "Beep or Sound file..."

mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: Is there a way to make errors beep?

Post by TheMarkster »

This macro will set it so that you get a beep every time the text changes in the report view. I haven't worked out how to distinguish errors, warnings, and regular messages. I thought of using rv.textColor(), but it seems to always return black no matter even if the message is in red. There might be a way to move the cursor up to get the previous line, but I have failed with that, too.

Code: Select all

from PySide import QtGui,QtCore

mw = Gui.getMainWindow()
rv = mw.findChild(QtGui.QTextEdit, "Report view")

def onMsg():
    QtGui.QApplication.beep()

modifiers = QtGui.QApplication.keyboardModifiers()
if modifiers == QtCore.Qt.ControlModifier:
    rv.textChanged.disconnect()
    FreeCAD.Console.PrintMessage('beep observer disconnected\n')
else:
    rv.textChanged.connect(onMsg)
    FreeCAD.Console.PrintMessage('beep observer connected\n')
Usage: run the macro to install the beep observer. Hold down Ctrl key while running to disconnect the beep observer.
Attachments
report_view_beep.FCMacro
(445 Bytes) Downloaded 18 times
mario52
Veteran
Posts: 4674
Joined: Wed May 16, 2012 2:13 pm

Re: Is there a way to make errors beep?

Post by mario52 »

Hi
TheMarkster wrote: Fri Jan 07, 2022 6:37 pm This macro will set it so that you get a beep every time the text changes in the report view.
you are too fast thanks

mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: Is there a way to make errors beep?

Post by TheMarkster »

mario52 wrote: Sat Jan 08, 2022 10:41 am Hi
TheMarkster wrote: Fri Jan 07, 2022 6:37 pm This macro will set it so that you get a beep every time the text changes in the report view.
you are too fast thanks

mario
I wanted to have the option to beep only for errors and warnings, but failed to make that work. It could be done in C++ code since the mechanism for opening the report view on these errors is already there.

To play another sound file:

Code: Select all

from PySide2 import QtMultimedia
QtMultimedia.QSound.play("some_file.wav")
User avatar
lrak
Posts: 34
Joined: Fri Feb 22, 2019 12:33 am

Re: Is there a way to make errors beep?

Post by lrak »

OK - This is great! - really appreciate.

I've spent a lot of time creating problems by trying to edit things and not realizing I've corrupted the object.

The little nudge from the beep really helps..
I would rather have questions that cannot be answered,
than answers that cannot be questioned’
Richard Feynman.
Post Reply