diff --git a/CadQuery/Gui/Command.py b/CadQuery/Gui/Command.py index 69dcfa0..dd9739e 100644 --- a/CadQuery/Gui/Command.py +++ b/CadQuery/Gui/Command.py @@ -23,6 +23,25 @@ def clearActiveDocument(): for obj in doc.Objects: doc.removeObject(obj.Label) +class CadQueryClearOutput: + """Allows the user to clear the reports view when it gets overwhelmed with output""" + + def GetResources(self): + return {"MenuText": "Clear Output", + "ToolTip": "Clears the script output from the Reports view"} + + def IsActive(self): + return True + + def Activated(self): + #Grab our code editor so we can interact with it + mw = FreeCADGui.getMainWindow() + + reportView = mw.findChild(QtGui.QDockWidget, "Report view") + + #Clear the view because it gets overwhelmed sometimes and won't scroll to the bottom + reportView.widget().clear() + class CadQueryCloseScript: """Allows the user to close a file without saving""" diff --git a/CadQuery/InitGui.py b/CadQuery/InitGui.py index d0f478b..918ee55 100644 --- a/CadQuery/InitGui.py +++ b/CadQuery/InitGui.py @@ -29,7 +29,7 @@ class CadQueryWorkbench (Workbench): #We have our own CQ menu that's added when the user chooses our workbench commands = ['CadQueryNewScript', 'CadQueryOpenScript', 'CadQuerySaveScript', 'CadQuerySaveAsScript', - 'CadQueryCloseScript', 'Separator', 'CadQueryExecuteScript'] + 'CadQueryCloseScript', 'Separator', 'CadQueryExecuteScript', 'CadQueryClearOutput'] self.appendMenu('CadQuery', commands) def Activated(self): @@ -165,5 +165,6 @@ FreeCADGui.addCommand('CadQuerySaveScript', CadQuerySaveScript()) FreeCADGui.addCommand('CadQuerySaveAsScript', CadQuerySaveAsScript()) FreeCADGui.addCommand('CadQueryExecuteScript', CadQueryExecuteScript()) FreeCADGui.addCommand('CadQueryCloseScript', CadQueryCloseScript()) +FreeCADGui.addCommand('CadQueryClearOutput', CadQueryClearOutput()) FreeCADGui.addWorkbench(CadQueryWorkbench())