issue #0002744: FR: check box to export STEP w/without pcurves
This commit is contained in:
@@ -168,6 +168,7 @@ QObject* PythonWrapper::toQObject(const Py::Object& pyobject)
|
||||
{
|
||||
// http://pastebin.com/JByDAF5Z
|
||||
#if defined (HAVE_SHIBOKEN) && defined(HAVE_PYSIDE)
|
||||
#if 1
|
||||
PyTypeObject * type = Shiboken::SbkType<QObject>();
|
||||
if (type) {
|
||||
if (Shiboken::Object::checkType(pyobject.ptr())) {
|
||||
@@ -176,8 +177,18 @@ QObject* PythonWrapper::toQObject(const Py::Object& pyobject)
|
||||
return reinterpret_cast<QObject*>(cppobject);
|
||||
}
|
||||
}
|
||||
#else // does the same using shiboken's Python interface
|
||||
// https://github.com/PySide/Shiboken/blob/master/shibokenmodule/typesystem_shiboken.xml
|
||||
Py::Module mainmod(PyImport_ImportModule((char*)"shiboken"), true);
|
||||
Py::Callable func = mainmod.getDict().getItem("getCppPointer");
|
||||
Py::Tuple arguments(1);
|
||||
arguments[0] = pyobject; //PySide pointer
|
||||
Py::Tuple result(func.apply(arguments));
|
||||
void* ptr = PyLong_AsVoidPtr(result[0].ptr());
|
||||
return reinterpret_cast<QObject*>(ptr);
|
||||
#endif
|
||||
#else
|
||||
Py::Module mainmod(PyImport_AddModule((char*)"sip"));
|
||||
Py::Module mainmod(PyImport_ImportModule((char*)"sip"), true);
|
||||
Py::Callable func = mainmod.getDict().getItem("unwrapinstance");
|
||||
Py::Tuple arguments(1);
|
||||
arguments[0] = pyobject; //PyQt pointer
|
||||
@@ -202,6 +213,7 @@ Py::Object PythonWrapper::fromQIcon(const QIcon* icon)
|
||||
Py::Object PythonWrapper::fromQWidget(QWidget* widget, const char* className)
|
||||
{
|
||||
#if defined (HAVE_SHIBOKEN) && defined(HAVE_PYSIDE)
|
||||
#if 1
|
||||
PyTypeObject * type = Shiboken::SbkType<QWidget>();
|
||||
if (type) {
|
||||
SbkObjectType* sbk_type = reinterpret_cast<SbkObjectType*>(type);
|
||||
@@ -214,9 +226,18 @@ Py::Object PythonWrapper::fromQWidget(QWidget* widget, const char* className)
|
||||
return Py::asObject(pyobj);
|
||||
}
|
||||
throw Py::RuntimeError("Failed to wrap widget");
|
||||
#else // does the same using shiboken's Python interface
|
||||
Py::Module mainmod(PyImport_ImportModule((char*)"shiboken"), true);
|
||||
Py::Callable func = mainmod.getDict().getItem("wrapInstance");
|
||||
Py::Tuple arguments(2);
|
||||
arguments[0] = Py::asObject(PyLong_FromVoidPtr(widget));
|
||||
Py::Module qtmod(PyImport_ImportModule((char*)"PySide.QtGui"));
|
||||
arguments[1] = qtmod.getDict().getItem(className);
|
||||
return func.apply(arguments);
|
||||
#endif
|
||||
#else
|
||||
Q_UNUSED(className);
|
||||
Py::Module sipmod(PyImport_AddModule((char*)"sip"));
|
||||
Py::Module sipmod(PyImport_ImportModule((char*)"sip"), true);
|
||||
Py::Callable func = sipmod.getDict().getItem("wrapinstance");
|
||||
Py::Tuple arguments(2);
|
||||
arguments[0] = Py::asObject(PyLong_FromVoidPtr(widget));
|
||||
@@ -781,8 +802,8 @@ void* PrefPagePyProducer::Produce () const
|
||||
}
|
||||
return widget;
|
||||
}
|
||||
catch (Py::Exception& e) {
|
||||
e.clear();
|
||||
catch (Py::Exception&) {
|
||||
PyErr_Print();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>445</width>
|
||||
<height>270</height>
|
||||
<height>291</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -20,26 +20,6 @@
|
||||
<string>Export</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Units for export of STEP</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QComboBox" name="comboBoxUnits">
|
||||
<item>
|
||||
@@ -59,7 +39,27 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<item row="0" column="1">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Units for export of STEP</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3">
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Scheme</string>
|
||||
@@ -85,6 +85,13 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<widget class="QCheckBox" name="checkBoxPcurves">
|
||||
<property name="text">
|
||||
<string>Write out curves in parametric space of surface</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -144,6 +151,7 @@
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>comboBoxUnits</tabstop>
|
||||
<tabstop>checkBoxPcurves</tabstop>
|
||||
<tabstop>radioButtonAP203</tabstop>
|
||||
<tabstop>radioButtonAP214</tabstop>
|
||||
<tabstop>lineEditCompany</tabstop>
|
||||
|
||||
@@ -199,9 +199,18 @@ DlgImportExportStep::~DlgImportExportStep()
|
||||
void DlgImportExportStep::saveSettings()
|
||||
{
|
||||
int unit = ui->comboBoxUnits->currentIndex();
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part")->GetGroup("STEP");
|
||||
hGrp->SetInt("Unit", unit);
|
||||
Base::Reference<ParameterGrp> hPartGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part");
|
||||
|
||||
// General
|
||||
Base::Reference<ParameterGrp> hGenGrp = hPartGrp->GetGroup("General");
|
||||
int writesurfacecurve = ui->checkBoxPcurves->isChecked() ? 1 : 0;
|
||||
hGenGrp->SetInt("WriteSurfaceCurveMode", writesurfacecurve);
|
||||
Interface_Static::SetIVal("write.surfacecurve.mode", writesurfacecurve);
|
||||
|
||||
// STEP
|
||||
Base::Reference<ParameterGrp> hStepGrp = hPartGrp->GetGroup("STEP");
|
||||
hStepGrp->SetInt("Unit", unit);
|
||||
switch (unit) {
|
||||
case 1:
|
||||
Interface_Static::SetCVal("write.step.unit","M");
|
||||
@@ -217,29 +226,38 @@ void DlgImportExportStep::saveSettings()
|
||||
// scheme
|
||||
if (ui->radioButtonAP203->isChecked()) {
|
||||
Interface_Static::SetCVal("write.step.schema","AP203");
|
||||
hGrp->SetASCII("Scheme", "AP203");
|
||||
hStepGrp->SetASCII("Scheme", "AP203");
|
||||
}
|
||||
else {
|
||||
// possible values: AP214CD (1996), AP214DIS (1998), AP214IS (2002)
|
||||
Interface_Static::SetCVal("write.step.schema","AP214CD");
|
||||
hGrp->SetASCII("Scheme", "AP214CD");
|
||||
hStepGrp->SetASCII("Scheme", "AP214CD");
|
||||
}
|
||||
|
||||
// header info
|
||||
hGrp->SetASCII("Company", ui->lineEditCompany->text().toLatin1());
|
||||
hGrp->SetASCII("Author", ui->lineEditAuthor->text().toLatin1());
|
||||
//hGrp->SetASCII("Product", ui->lineEditProduct->text().toLatin1());
|
||||
hStepGrp->SetASCII("Company", ui->lineEditCompany->text().toLatin1());
|
||||
hStepGrp->SetASCII("Author", ui->lineEditAuthor->text().toLatin1());
|
||||
//hStepGrp->SetASCII("Product", ui->lineEditProduct->text().toLatin1());
|
||||
}
|
||||
|
||||
void DlgImportExportStep::loadSettings()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part")->GetGroup("STEP");
|
||||
int unit = hGrp->GetInt("Unit", 0);
|
||||
Base::Reference<ParameterGrp> hPartGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part");
|
||||
|
||||
// General
|
||||
Base::Reference<ParameterGrp> hGenGrp = hPartGrp->GetGroup("General");
|
||||
int writesurfacecurve = Interface_Static::IVal("write.surfacecurve.mode");
|
||||
writesurfacecurve = hGenGrp->GetInt("WriteSurfaceCurveMode", writesurfacecurve);
|
||||
ui->checkBoxPcurves->setChecked(writesurfacecurve == 0 ? false : true);
|
||||
|
||||
// STEP
|
||||
Base::Reference<ParameterGrp> hStepGrp = hPartGrp->GetGroup("STEP");
|
||||
int unit = hStepGrp->GetInt("Unit", 0);
|
||||
ui->comboBoxUnits->setCurrentIndex(unit);
|
||||
|
||||
// scheme
|
||||
QString ap = QString::fromStdString(hGrp->GetASCII("Scheme",
|
||||
QString ap = QString::fromStdString(hStepGrp->GetASCII("Scheme",
|
||||
Interface_Static::CVal("write.step.schema")));
|
||||
if (ap.startsWith(QLatin1String("AP203")))
|
||||
ui->radioButtonAP203->setChecked(true);
|
||||
@@ -247,8 +265,8 @@ void DlgImportExportStep::loadSettings()
|
||||
ui->radioButtonAP214->setChecked(true);
|
||||
|
||||
// header info
|
||||
ui->lineEditCompany->setText(QString::fromStdString(hGrp->GetASCII("Company")));
|
||||
ui->lineEditAuthor->setText(QString::fromStdString(hGrp->GetASCII("Author")));
|
||||
ui->lineEditCompany->setText(QString::fromStdString(hStepGrp->GetASCII("Company")));
|
||||
ui->lineEditAuthor->setText(QString::fromStdString(hStepGrp->GetASCII("Author")));
|
||||
ui->lineEditProduct->setText(QString::fromLatin1(
|
||||
Interface_Static::CVal("write.step.product.name")));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user