forked from furti/FreeCAD-Reporting
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_report.py
36 lines (27 loc) · 959 Bytes
/
create_report.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import FreeCAD
import FreeCADGui
import report
class CreateReportCommand:
toolbarName = 'Reporting_Tools'
commandName = 'Create_Report'
def GetResources(self):
from report_utils.resource_utils import iconPath
return {'MenuText': "Create Report",
'ToolTip': "Create a new Report object to execute SQL Statements",
'Pixmap': iconPath('CreateConfig.svg')
}
def Activated(self):
report.createReport()
def IsActive(self):
"""If there is no active document we can't do anything."""
return not FreeCAD.ActiveDocument is None
if __name__ == "__main__":
command = CreateReportCommand()
if command.IsActive():
command.Activated()
else:
qtutils.showInfo("No open Document", "There is no open document")
else:
import reporting_toolbars
reporting_toolbars.toolbarManager.registerCommand(
CreateReportCommand())