Added the ability to clear the script output from the Report view.

This commit is contained in:
Jeremy Wright 2015-01-05 10:28:15 -05:00
parent e99daaa469
commit ac1d142598
2 changed files with 21 additions and 1 deletions

View File

@ -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"""

View File

@ -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())