Eliminate many "doing what you told me to" messages

These messages were perhaps originally intended as a debuggin aid but now add clutter to the output panes. Remaining messges are mostly the result of methods to display attributes of an object (which one could call from the Python console) or actually provide some information which would not be obvious from the circumstances
This commit is contained in:
Kevin Martin
2024-02-01 00:42:15 -05:00
parent 9dafb71ca5
commit 02ebb17558
35 changed files with 53 additions and 280 deletions

View File

@@ -38,7 +38,7 @@ import FreeCAD as App
import draftutils.utils as utils
from draftutils.translate import translate
from draftutils.messages import _msg, _err
from draftutils.messages import _err
def is_group(obj):
@@ -128,8 +128,7 @@ def ungroup(obj):
found, obj = utils.find_object(obj, doc=App.activeDocument())
if not found:
_msg("obj: {}".format(obj_str))
_err(translate("draft", "Wrong input: object not in document."))
_err(translate("draft", "Wrong input: object {} not in document.").format(obj_str))
return None
doc = obj.Document

View File

@@ -42,7 +42,7 @@ import os
import FreeCAD as App
from draftutils import params
from draftutils import utils
from draftutils.messages import _err, _msg, _wrn
from draftutils.messages import _err, _wrn
from draftutils.translate import translate
if App.GuiUp:
@@ -328,7 +328,6 @@ def remove_hidden(objectslist):
if obj.ViewObject:
if not obj.ViewObject.isVisible():
newlist.remove(obj)
_msg(translate("draft", "Visibility off; removed from list: ") + obj.Label)
return newlist
@@ -821,7 +820,6 @@ def get_bbox(obj, debug=False):
If there is a problem it will return `None`.
"""
_name = "get_bbox"
utils.print_header(_name, "Bounding box", debug=debug)
found, doc = utils.find_doc(App.activeDocument())
if not found:
@@ -833,13 +831,9 @@ def get_bbox(obj, debug=False):
found, obj = utils.find_object(obj, doc)
if not found:
_msg("obj: {}".format(obj_str))
_err(translate("draft", "Wrong input: object not in document."))
_err(translate("draft", "Wrong input: object {} not in document.").format(obj_str))
return None
if debug:
_msg("obj: {}".format(obj.Label))
if (not hasattr(obj, "ViewObject")
or not obj.ViewObject
or not hasattr(obj.ViewObject, "RootNode")):

View File

@@ -40,7 +40,7 @@ import PySide.QtCore as QtCore
import FreeCAD as App
from draftutils import params
from draftutils.messages import _msg, _wrn, _err, _log
from draftutils.messages import _wrn, _err, _log
from draftutils.translate import translate
# TODO: move the functions that require the graphical interface
@@ -1029,8 +1029,7 @@ def find_doc(doc=None):
try:
doc = App.getDocument(doc)
except NameError:
_msg("document: {}".format(doc))
_err(translate("draft", "Wrong input: unknown document."))
_err(translate("draft", "Wrong input: unknown document {}").format(doc))
return not FOUND, None
return FOUND, doc