Merge branch 'master' into master
This commit is contained in:
@@ -156,7 +156,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Counter of the body (or face) with a capcitance</string>
|
||||
<string>Counter of the body (or face) with a capacitance</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
|
||||
@@ -4369,8 +4369,10 @@ unsigned int GeomBezierSurface::getMemSize (void) const
|
||||
{
|
||||
unsigned int size = sizeof(Geom_BezierSurface);
|
||||
if (!mySurface.IsNull()) {
|
||||
size += mySurface->NbUPoles() * mySurface->NbVPoles() * sizeof(gp_Pnt);
|
||||
size += mySurface->NbUPoles() * mySurface->NbVPoles() * sizeof(Standard_Real);
|
||||
unsigned int poles = mySurface->NbUPoles();
|
||||
poles *= mySurface->NbVPoles();
|
||||
size += poles * sizeof(gp_Pnt);
|
||||
size += poles * sizeof(Standard_Real);
|
||||
}
|
||||
return size;
|
||||
}
|
||||
@@ -4448,8 +4450,10 @@ unsigned int GeomBSplineSurface::getMemSize (void) const
|
||||
size += mySurface->NbUKnots() * sizeof(Standard_Integer);
|
||||
size += mySurface->NbVKnots() * sizeof(Standard_Real);
|
||||
size += mySurface->NbVKnots() * sizeof(Standard_Integer);
|
||||
size += mySurface->NbUPoles() * mySurface->NbVPoles() * sizeof(gp_Pnt);
|
||||
size += mySurface->NbUPoles() * mySurface->NbVPoles() * sizeof(Standard_Real);
|
||||
unsigned int poles = mySurface->NbUPoles();
|
||||
poles *= mySurface->NbVPoles();
|
||||
size += poles * sizeof(gp_Pnt);
|
||||
size += poles * sizeof(Standard_Real);
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
@@ -41,3 +41,21 @@ import FreeCAD, FreeCADGui, os, sys, unittest, Part, PartGui
|
||||
# def tearDown(self):
|
||||
# #closing doc
|
||||
# FreeCAD.closeDocument("PartGuiTest")
|
||||
class PartGuiViewProviderTestCases(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.Doc = FreeCAD.newDocument("PartGuiTest")
|
||||
|
||||
def testCanDropObject(self):
|
||||
# https://github.com/FreeCAD/FreeCAD/pull/6850
|
||||
box = self.Doc.addObject("Part::Box", "Box")
|
||||
with self.assertRaises(TypeError):
|
||||
box.ViewObject.canDragObject(None)
|
||||
with self.assertRaises(TypeError):
|
||||
box.ViewObject.canDropObject(None)
|
||||
box.ViewObject.canDropObject()
|
||||
with self.assertRaises(TypeError):
|
||||
box.ViewObject.dropObject(box, None)
|
||||
|
||||
def tearDown(self):
|
||||
#closing doc
|
||||
FreeCAD.closeDocument("PartGuiTest")
|
||||
|
||||
@@ -116,6 +116,7 @@ private:
|
||||
Base::Console().Error("%s\n", str.c_str());
|
||||
throw Py::RuntimeError(str);
|
||||
}
|
||||
return Py::None(); //only here to prevent warning re no return value
|
||||
}
|
||||
|
||||
//! hook for FC Gui export function
|
||||
@@ -325,7 +326,7 @@ private:
|
||||
{
|
||||
PyObject *viewPy = nullptr;
|
||||
PyObject *qgiPy = nullptr;
|
||||
if (!PyArg_ParseTuple(args.ptr(), "OO", &viewPy, &qgiPy)) {
|
||||
if (!PyArg_ParseTuple(args.ptr(), "O!O", &(TechDraw::DrawViewPy::Type), &viewPy, &qgiPy)) {
|
||||
throw Py::TypeError("expected (view, item)");
|
||||
}
|
||||
|
||||
@@ -333,28 +334,23 @@ private:
|
||||
App::DocumentObject* obj = nullptr;
|
||||
Gui::ViewProvider* vp = nullptr;
|
||||
QGIView* qgiv = nullptr;
|
||||
if (PyObject_TypeCheck(viewPy, &(TechDraw::DrawViewPy::Type))) {
|
||||
obj = static_cast<App::DocumentObjectPy*>(viewPy)->getDocumentObjectPtr();
|
||||
vp = Gui::Application::Instance->getViewProvider(obj);
|
||||
if (vp) {
|
||||
TechDrawGui::ViewProviderDrawingView* vpdv =
|
||||
dynamic_cast<TechDrawGui::ViewProviderDrawingView*>(vp);
|
||||
if (vpdv) {
|
||||
qgiv = vpdv->getQView();
|
||||
if (qgiv != nullptr) {
|
||||
Gui::PythonWrapper wrap;
|
||||
if (!wrap.loadCoreModule() ||
|
||||
!wrap.loadGuiModule() ||
|
||||
!wrap.loadWidgetsModule()) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "Failed to load Python wrapper for Qt");
|
||||
return Py::None();
|
||||
}
|
||||
QGraphicsItem* item = wrap.toQGraphicsItem(qgiPy);
|
||||
if (item != nullptr) {
|
||||
qgiv->addArbitraryItem(item);
|
||||
}
|
||||
obj = static_cast<App::DocumentObjectPy*>(viewPy)->getDocumentObjectPtr();
|
||||
vp = Gui::Application::Instance->getViewProvider(obj);
|
||||
if (vp) {
|
||||
TechDrawGui::ViewProviderDrawingView* vpdv =
|
||||
dynamic_cast<TechDrawGui::ViewProviderDrawingView*>(vp);
|
||||
if (vpdv) {
|
||||
qgiv = vpdv->getQView();
|
||||
if (qgiv != nullptr) {
|
||||
Gui::PythonWrapper wrap;
|
||||
if (!wrap.loadGuiModule()) {
|
||||
throw Py::RuntimeError("Failed to load Python wrapper for Qt::Gui");
|
||||
}
|
||||
QGraphicsItem* item = wrap.toQGraphicsItem(qgiPy);
|
||||
if (item != nullptr) {
|
||||
qgiv->addArbitraryItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -373,7 +369,7 @@ private:
|
||||
{
|
||||
PyObject *viewPy = nullptr;
|
||||
PyObject *qgiPy = nullptr;
|
||||
if (!PyArg_ParseTuple(args.ptr(), "OO", &viewPy, &qgiPy)) {
|
||||
if (!PyArg_ParseTuple(args.ptr(), "O!O", &(TechDraw::DrawViewPy::Type), &viewPy, &qgiPy)) {
|
||||
throw Py::TypeError("expected (view, item)");
|
||||
}
|
||||
|
||||
@@ -381,28 +377,23 @@ private:
|
||||
App::DocumentObject* obj = nullptr;
|
||||
Gui::ViewProvider* vp = nullptr;
|
||||
QGIView* qgiv = nullptr;
|
||||
if (PyObject_TypeCheck(viewPy, &(TechDraw::DrawViewPy::Type))) {
|
||||
obj = static_cast<App::DocumentObjectPy*>(viewPy)->getDocumentObjectPtr();
|
||||
vp = Gui::Application::Instance->getViewProvider(obj);
|
||||
if (vp) {
|
||||
TechDrawGui::ViewProviderDrawingView* vpdv =
|
||||
dynamic_cast<TechDrawGui::ViewProviderDrawingView*>(vp);
|
||||
if (vpdv) {
|
||||
qgiv = vpdv->getQView();
|
||||
if (qgiv != nullptr) {
|
||||
Gui::PythonWrapper wrap;
|
||||
if (!wrap.loadCoreModule() ||
|
||||
!wrap.loadGuiModule() ||
|
||||
!wrap.loadWidgetsModule()) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "Failed to load Python wrapper for Qt");
|
||||
return Py::None();
|
||||
}
|
||||
QGraphicsObject* item = wrap.toQGraphicsObject(qgiPy);
|
||||
if (item != nullptr) {
|
||||
qgiv->addArbitraryItem(item);
|
||||
}
|
||||
obj = static_cast<App::DocumentObjectPy*>(viewPy)->getDocumentObjectPtr();
|
||||
vp = Gui::Application::Instance->getViewProvider(obj);
|
||||
if (vp) {
|
||||
TechDrawGui::ViewProviderDrawingView* vpdv =
|
||||
dynamic_cast<TechDrawGui::ViewProviderDrawingView*>(vp);
|
||||
if (vpdv) {
|
||||
qgiv = vpdv->getQView();
|
||||
if (qgiv != nullptr) {
|
||||
Gui::PythonWrapper wrap;
|
||||
if (!wrap.loadGuiModule()) {
|
||||
throw Py::RuntimeError("Failed to load Python wrapper for Qt::Gui");
|
||||
}
|
||||
}
|
||||
QGraphicsObject* item = wrap.toQGraphicsObject(qgiPy);
|
||||
if (item != nullptr) {
|
||||
qgiv->addArbitraryItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -477,8 +477,6 @@ bool TaskCenterLine::accept()
|
||||
|
||||
bool TaskCenterLine::reject()
|
||||
{
|
||||
Gui::Command::abortCommand();
|
||||
|
||||
Gui::Document* doc = Gui::Application::Instance->getDocument(m_basePage->getDocument());
|
||||
if (!doc)
|
||||
return false;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>489</width>
|
||||
<height>601</height>
|
||||
<height>611</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@@ -26,15 +26,15 @@
|
||||
<string>Format Symbols</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_GDT">
|
||||
<property name="text">
|
||||
<string>GD&T</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="grid_GDT">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_GDT">
|
||||
<property name="text">
|
||||
<string>GD&T</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="pbA01">
|
||||
<property name="toolTip">
|
||||
@@ -236,7 +236,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<item row="0" column="3">
|
||||
<widget class="QPushButton" name="pbB04">
|
||||
<property name="font">
|
||||
<font>
|
||||
@@ -401,7 +401,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
@@ -493,7 +493,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="pbD03">
|
||||
<property name="toolTip">
|
||||
<string>(Arc) Second</string>
|
||||
@@ -513,7 +513,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
@@ -678,7 +678,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="pbF06">
|
||||
<property name="toolTip">
|
||||
<string>Small phi</string>
|
||||
@@ -698,7 +698,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="grid_Format">
|
||||
@@ -712,7 +712,7 @@
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="leFormat"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lbPreview">
|
||||
<property name="text">
|
||||
<string>Preview:</string>
|
||||
@@ -726,7 +726,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
||||
Reference in New Issue
Block a user