23
#include "PreCompiled.h"
25
#include <QFontDatabase>
28
#include <Base/Console.h>
29
#include <Base/Interpreter.h>
30
#include <Base/Tools.h>
31
#include <Gui/Application.h>
32
#include <Gui/Language/Translator.h>
33
#include <Gui/WidgetFactory.h>
35
#include "DlgPrefsTechDrawAdvancedImp.h"
36
#include "DlgPrefsTechDrawAnnotationImp.h"
37
#include "DlgPrefsTechDrawColorsImp.h"
38
#include "DlgPrefsTechDrawDimensionsImp.h"
39
#include "DlgPrefsTechDrawGeneralImp.h"
40
#include "DlgPrefsTechDrawHLRImp.h"
41
#include "DlgPrefsTechDrawScaleImp.h"
42
#include "MDIViewPage.h"
43
#include "ViewProviderAnnotation.h"
44
#include "ViewProviderBalloon.h"
45
#include "ViewProviderCosmeticExtension.h"
46
#include "ViewProviderDimension.h"
47
#include "ViewProviderDrawingView.h"
48
#include "ViewProviderDrawingViewExtension.h"
49
#include "ViewProviderGeomHatch.h"
50
#include "ViewProviderHatch.h"
51
#include "ViewProviderImage.h"
52
#include "ViewProviderLeader.h"
53
#include "ViewProviderPage.h"
54
#include "ViewProviderPageExtension.h"
55
#include "ViewProviderProjGroup.h"
56
#include "ViewProviderProjGroupItem.h"
57
#include "ViewProviderRichAnno.h"
58
#include "ViewProviderSpreadsheet.h"
59
#include "ViewProviderSymbol.h"
60
#include "ViewProviderTemplate.h"
61
#include "ViewProviderTemplateExtension.h"
62
#include "ViewProviderTile.h"
63
#include "ViewProviderViewClip.h"
64
#include "ViewProviderViewPart.h"
65
#include "ViewProviderViewSection.h"
66
#include "ViewProviderWeld.h"
71
void CreateTechDrawCommands();
72
void CreateTechDrawCommandsDims();
73
void CreateTechDrawCommandsDecorate();
74
void CreateTechDrawCommandsAnnotate();
75
void CreateTechDrawCommandsExtensionDims();
76
void CreateTechDrawCommandsExtensions();
77
void CreateTechDrawCommandsStack();
79
void loadTechDrawResource()
82
Q_INIT_RESOURCE(TechDraw);
83
Q_INIT_RESOURCE(TechDraw_translation);
84
Gui::Translator::instance()->refresh();
87
std::string fontDir = App::Application::getResourceDir() + "Mod/TechDraw/Resources/fonts/";
89
std::vector<std::string> fontsAll(
90
{"osifont-lgpl3fe.ttf", "osifont-italic.ttf", "Y14.5-2018.ttf", "Y14.5-FreeCAD.ttf"});
92
for (auto& font : fontsAll) {
93
QString fontFile = Base::Tools::fromStdString(fontDir + font);
94
int rc = QFontDatabase::addApplicationFont(fontFile);
96
Base::Console().Warning(
97
"TechDraw failed to load font file: %d from: %s\n", rc, qPrintable(fontFile));
104
extern PyObject* initModule();
108
PyMOD_INIT_FUNC(TechDrawGui)
110
if (!Gui::Application::Instance) {
111
PyErr_SetString(PyExc_ImportError, "Cannot load Gui module in console application.");
112
PyMOD_Return(nullptr);
116
Base::Interpreter().loadModule("TechDraw");
118
catch (const Base::Exception& e) {
119
PyErr_SetString(PyExc_ImportError, e.what());
120
PyMOD_Return(nullptr);
122
PyObject* mod = TechDrawGui::initModule();
124
Base::Console().Log("Loading TechDrawGui module... done\n");
127
CreateTechDrawCommands();
128
CreateTechDrawCommandsDims();
129
CreateTechDrawCommandsDecorate();
130
CreateTechDrawCommandsAnnotate();
131
CreateTechDrawCommandsExtensionDims();
132
CreateTechDrawCommandsExtensions();
133
CreateTechDrawCommandsStack();
135
TechDrawGui::Workbench::init();
136
TechDrawGui::MDIViewPage::init();
137
TechDrawGui::MDIViewPagePy::init_type();
139
TechDrawGui::ViewProviderPage::init();
140
TechDrawGui::ViewProviderDrawingView::init();
142
TechDrawGui::ViewProviderTemplate::init();
143
TechDrawGui::ViewProviderDimension::init();
144
TechDrawGui::ViewProviderBalloon::init();
145
TechDrawGui::ViewProviderViewPart::init();
146
TechDrawGui::ViewProviderProjGroupItem::init();
147
TechDrawGui::ViewProviderProjGroup::init();
148
TechDrawGui::ViewProviderViewSection::init();
149
TechDrawGui::ViewProviderViewClip::init();
150
TechDrawGui::ViewProviderAnnotation::init();
151
TechDrawGui::ViewProviderSymbol::init();
152
TechDrawGui::ViewProviderDraft::init();
153
TechDrawGui::ViewProviderArch::init();
154
TechDrawGui::ViewProviderHatch::init();
155
TechDrawGui::ViewProviderGeomHatch::init();
156
TechDrawGui::ViewProviderSpreadsheet::init();
157
TechDrawGui::ViewProviderImage::init();
158
TechDrawGui::ViewProviderLeader::init();
159
TechDrawGui::ViewProviderRichAnno::init();
160
TechDrawGui::ViewProviderTile::init();
161
TechDrawGui::ViewProviderWeld::init();
163
TechDrawGui::ViewProviderPageExtension ::init();
165
TechDrawGui::ViewProviderDrawingViewExtension::init();
166
TechDrawGui::ViewProviderTemplateExtension::init();
168
TechDrawGui::ViewProviderCosmeticExtension::init();
171
new Gui::PrefPageProducer<TechDrawGui::DlgPrefsTechDrawGeneralImp>(QT_TRANSLATE_NOOP("QObject", "TechDraw"));
172
new Gui::PrefPageProducer<TechDrawGui::DlgPrefsTechDrawScaleImp>(QT_TRANSLATE_NOOP("QObject", "TechDraw"));
173
new Gui::PrefPageProducer<TechDrawGui::DlgPrefsTechDrawDimensionsImp>(QT_TRANSLATE_NOOP("QObject", "TechDraw"));
174
new Gui::PrefPageProducer<TechDrawGui::DlgPrefsTechDrawAnnotationImp>(QT_TRANSLATE_NOOP("QObject", "TechDraw"));
175
new Gui::PrefPageProducer<TechDrawGui::DlgPrefsTechDrawColorsImp>(QT_TRANSLATE_NOOP("QObject", "TechDraw"));
176
new Gui::PrefPageProducer<TechDrawGui::DlgPrefsTechDrawHLRImp>(QT_TRANSLATE_NOOP("QObject", "TechDraw"));
177
new Gui::PrefPageProducer<TechDrawGui::DlgPrefsTechDrawAdvancedImp>(QT_TRANSLATE_NOOP("QObject", "TechDraw"));
180
loadTechDrawResource();