Partially revert "Remove unused code into GUI"
This commit is contained in:
@@ -232,6 +232,13 @@ QMap<QString, CallTip> CallTipsList::extractTips(const QString& context) const
|
||||
}
|
||||
Py::Object obj(eval, true);
|
||||
|
||||
// Checks whether the type is a subclass of PyObjectBase because to get the doc string
|
||||
// of a member we must get it by its type instead of its instance otherwise we get the
|
||||
// wrong string, namely that of the type of the member.
|
||||
// Note: 3rd party libraries may use their own type object classes so that we cannot
|
||||
// reliably use Py::Type. To be on the safe side we should use Py::Object to assign
|
||||
// the used type object to.
|
||||
//Py::Object type = obj.type();
|
||||
Py::Object type(PyObject_Type(obj.ptr()), true);
|
||||
Py::Object inst = obj; // the object instance
|
||||
PyObject* typeobj = Base::getTypeAsObject(&Base::PyObjectBase::Type);
|
||||
|
||||
@@ -45,6 +45,12 @@ using namespace std;
|
||||
namespace bp = boost::placeholders;
|
||||
|
||||
|
||||
/* TRANSLATOR Gui::Dialog::DlgDisplayPropertiesImp */
|
||||
|
||||
#if 0 // needed for Qt's lupdate utility
|
||||
qApp->translate("QDockWidget", "Display properties");
|
||||
#endif
|
||||
|
||||
class DlgDisplayPropertiesImp::Private
|
||||
{
|
||||
typedef boost::signals2::connection DlgDisplayPropertiesImp_Connection;
|
||||
@@ -507,6 +513,7 @@ void DlgDisplayPropertiesImp::setShapeColor(const std::vector<Gui::ViewProvider*
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
d->ui.buttonColor->setEnabled(shapeColor);
|
||||
}
|
||||
|
||||
@@ -526,6 +533,7 @@ void DlgDisplayPropertiesImp::setLineColor(const std::vector<Gui::ViewProvider*>
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
d->ui.buttonLineColor->setEnabled(shapeColor);
|
||||
}
|
||||
|
||||
@@ -542,6 +550,7 @@ void DlgDisplayPropertiesImp::setPointSize(const std::vector<Gui::ViewProvider*>
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
d->ui.spinPointSize->setEnabled(pointSize);
|
||||
}
|
||||
|
||||
@@ -558,6 +567,7 @@ void DlgDisplayPropertiesImp::setLineWidth(const std::vector<Gui::ViewProvider*>
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
d->ui.spinLineWidth->setEnabled(lineWidth);
|
||||
}
|
||||
|
||||
@@ -578,6 +588,7 @@ void DlgDisplayPropertiesImp::setTransparency(const std::vector<Gui::ViewProvide
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
d->ui.spinTransparency->setEnabled(transparency);
|
||||
d->ui.horizontalSlider->setEnabled(transparency);
|
||||
}
|
||||
@@ -599,6 +610,7 @@ void DlgDisplayPropertiesImp::setLineTransparency(const std::vector<Gui::ViewPro
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
d->ui.spinLineTransparency->setEnabled(transparency);
|
||||
d->ui.sliderLineTransparency->setEnabled(transparency);
|
||||
}
|
||||
@@ -613,6 +625,7 @@ std::vector<Gui::ViewProvider*> DlgDisplayPropertiesImp::getSelection() const
|
||||
Gui::ViewProvider* view = Application::Instance->getDocument(it->pDoc)->getViewProvider(it->pObject);
|
||||
views.push_back(view);
|
||||
}
|
||||
|
||||
return views;
|
||||
}
|
||||
|
||||
|
||||
@@ -86,6 +86,11 @@ DlgParameterImp::DlgParameterImp( QWidget* parent, Qt::WindowFlags fl )
|
||||
policy.setHorizontalStretch(3);
|
||||
paramValue->setSizePolicy(policy);
|
||||
|
||||
#if 0 // This is needed for Qt's lupdate
|
||||
qApp->translate( "Gui::Dialog::DlgParameterImp", "System parameter" );
|
||||
qApp->translate( "Gui::Dialog::DlgParameterImp", "User parameter" );
|
||||
#endif
|
||||
|
||||
ParameterManager* sys = App::GetApplication().GetParameterSet("System parameter");
|
||||
const std::map<std::string,ParameterManager *>& rcList = App::GetApplication().GetParameterSetList();
|
||||
for (std::map<std::string,ParameterManager *>::const_iterator it= rcList.begin();it!=rcList.end();++it) {
|
||||
|
||||
@@ -38,6 +38,19 @@
|
||||
using namespace Gui::Dialog;
|
||||
using namespace Base;
|
||||
|
||||
/* TRANSLATOR Gui::Dialog::DlgSettingsUnitsImp */
|
||||
|
||||
#if 0 // needed for Qt's lupdate utility
|
||||
qApp->translate("Gui::Dialog::DlgSettingsUnits", "Standard (mm/kg/s/degree)");
|
||||
qApp->translate("Gui::Dialog::DlgSettingsUnits", "MKS (m/kg/s/degree)");
|
||||
qApp->translate("Gui::Dialog::DlgSettingsUnits", "US customary (in/lb)");
|
||||
qApp->translate("Gui::Dialog::DlgSettingsUnits", "Imperial decimal (in/lb)");
|
||||
qApp->translate("Gui::Dialog::DlgSettingsUnits", "Building Euro (cm/m²/m³)");
|
||||
qApp->translate("Gui::Dialog::DlgSettingsUnits", "Building US (ft-in/sqft/cft)");
|
||||
qApp->translate("Gui::Dialog::DlgSettingsUnits", "Metric small parts & CNC(mm, mm/min)");
|
||||
qApp->translate("Gui::Dialog::DlgSettingsUnits", "Imperial for Civil Eng (ft, ft/sec)");
|
||||
qApp->translate("Gui::Dialog::DlgSettingsUnits", "FEM (mm, N, sec)");
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Constructs a DlgSettingsUnitsImp which is a child of 'parent', with the
|
||||
|
||||
@@ -363,6 +363,11 @@ QObject* PythonWrapper::toQObject(const Py::Object& pyobject)
|
||||
return reinterpret_cast<QObject*>(ptr);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PYQT // Unwrapping using sip/PyQt
|
||||
void* ptr = qt_getCppPointer(pyobject, "sip", "unwrapinstance");
|
||||
return reinterpret_cast<QObject*>(ptr);
|
||||
#endif
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -494,6 +499,10 @@ Py::Object PythonWrapper::fromQObject(QObject* object, const char* className)
|
||||
//
|
||||
return qt_wrapInstance<QObject*>(object, className, "shiboken2", "PySide2.QtCore", "wrapInstance");
|
||||
#endif
|
||||
#ifdef HAVE_PYQT // Unwrapping using sip/PyQt
|
||||
Q_UNUSED(className);
|
||||
return qt_wrapInstance<QObject*>(object, "QObject", "sip", "PyQt5.QtCore", "wrapinstance");
|
||||
#endif
|
||||
}
|
||||
|
||||
Py::Object PythonWrapper::fromQWidget(QWidget* widget, const char* className)
|
||||
@@ -519,6 +528,11 @@ Py::Object PythonWrapper::fromQWidget(QWidget* widget, const char* className)
|
||||
//
|
||||
return qt_wrapInstance<QWidget*>(widget, className, "shiboken2", "PySide2.QtWidgets", "wrapInstance");
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PYQT // Unwrapping using sip/PyQt
|
||||
Q_UNUSED(className);
|
||||
return qt_wrapInstance<QWidget*>(widget, "QWidget", "sip", "PyQt5.QtWidgets", "wrapinstance");
|
||||
#endif
|
||||
}
|
||||
|
||||
const char* PythonWrapper::getWrapperName(QObject* obj) const
|
||||
|
||||
@@ -694,6 +694,7 @@ bool Gui::SoFCDB::writeToFile(SoNode* node, const char* filename, bool binary)
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -882,7 +882,7 @@ SoFCSelection::redrawHighlighted(SoAction * action , SbBool doHighlight )
|
||||
|
||||
SoState *state = action->getState();
|
||||
|
||||
QtGLWidget* window;
|
||||
QtGLWidget* window;
|
||||
SoGLRenderAction *glAction;
|
||||
SoGLWidgetElement::get(state, window);
|
||||
SoGLRenderActionElement::get(state, glAction);
|
||||
|
||||
@@ -68,6 +68,31 @@
|
||||
|
||||
using namespace Gui;
|
||||
|
||||
/*!
|
||||
\code
|
||||
|
||||
s="""
|
||||
#Inventor V2.1 ascii
|
||||
|
||||
Annotation {
|
||||
Translation { translation 4 0 0 }
|
||||
FontStyle {
|
||||
size 20
|
||||
style BOLD
|
||||
}
|
||||
BaseColor {
|
||||
rgb 0.0 0.0 0.0
|
||||
}
|
||||
|
||||
|
||||
SoTextLabel { string ["Text label", "Second line"] backgroundColor 1.0 0.447059 0.337255}
|
||||
}
|
||||
"""
|
||||
|
||||
App.ActiveDocument.addObject("App::InventorObject","iv").Buffer=s
|
||||
|
||||
\endcode
|
||||
*/
|
||||
|
||||
SO_NODE_SOURCE(SoTextLabel)
|
||||
|
||||
@@ -116,6 +141,7 @@ void SoTextLabel::GLRender(SoGLRenderAction *action)
|
||||
const SbViewportRegion & vp = SoViewportRegionElement::get(state);
|
||||
SbVec2s vpsize = vp.getViewportSizePixels();
|
||||
|
||||
// font stuff
|
||||
SbName fontname = SoFontNameElement::get(state);
|
||||
int lines = this->string.getNum();
|
||||
|
||||
@@ -125,7 +151,6 @@ void SoTextLabel::GLRender(SoGLRenderAction *action)
|
||||
nilpoint[0] = (nilpoint[0] + 1.0f) * 0.5f * vpsize[0];
|
||||
nilpoint[1] = (nilpoint[1] + 1.0f) * 0.5f * vpsize[1];
|
||||
|
||||
|
||||
// Unfortunately, the size of the label is stored in the pimpl class of
|
||||
// SoText2 which cannot be accessed directly. However, there is a trick
|
||||
// to get the required information: set model, viewing and projection
|
||||
|
||||
@@ -119,6 +119,8 @@
|
||||
|
||||
FC_LOG_LEVEL_INIT("3DViewer",true,true)
|
||||
|
||||
//#define FC_LOGGING_CB
|
||||
|
||||
using namespace Gui;
|
||||
|
||||
/*** zoom-style cursor ******/
|
||||
@@ -479,6 +481,7 @@ void View3DInventorViewer::init()
|
||||
this->getSoRenderManager()->setGLRenderAction(new SoBoxSelectionRenderAction);
|
||||
this->getSoRenderManager()->getGLRenderAction()->setCacheContext(id);
|
||||
|
||||
// set the transparency and antialiasing settings
|
||||
getSoRenderManager()->getGLRenderAction()->setTransparencyType(SoGLRenderAction::SORTED_OBJECT_SORTED_TRIANGLE_BLEND);
|
||||
|
||||
// Settings
|
||||
@@ -1402,6 +1405,7 @@ void View3DInventorViewer::setAxisCross(bool on)
|
||||
axisCross->scaleFactor = 1.0f;
|
||||
axisGroup = new SoSkipBoundingGroup;
|
||||
axisGroup->addChild(axisCross);
|
||||
|
||||
sep->addChild(axisGroup);
|
||||
}
|
||||
}
|
||||
@@ -2161,6 +2165,7 @@ void View3DInventorViewer::renderToFramebuffer(QtGLFramebufferObject* fbo)
|
||||
if (this->axiscrossEnabled) {
|
||||
this->drawAxisCross();
|
||||
}
|
||||
|
||||
fbo->release();
|
||||
}
|
||||
|
||||
@@ -2253,6 +2258,9 @@ void View3DInventorViewer::renderGLImage()
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
// #define ENABLE_GL_DEPTH_RANGE
|
||||
// The calls of glDepthRange inside renderScene() causes problems with transparent objects
|
||||
// so that's why it is disabled now: http://forum.freecadweb.org/viewtopic.php?f=3&t=6037&hilit=transparency
|
||||
|
||||
// Documented in superclass. Overrides this method to be able to draw
|
||||
// the axis cross, if selected, and to keep a continuous animation
|
||||
@@ -2273,6 +2281,11 @@ void View3DInventorViewer::renderScene(void)
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
#if defined(ENABLE_GL_DEPTH_RANGE)
|
||||
// using 90% of the z-buffer for the background and the main node
|
||||
glDepthRange(0.1,1.0);
|
||||
#endif
|
||||
|
||||
// Render our scenegraph with the image.
|
||||
SoGLRenderAction* glra = this->getSoRenderManager()->getGLRenderAction();
|
||||
SoState* state = glra->getState();
|
||||
@@ -2307,6 +2320,11 @@ void View3DInventorViewer::renderScene(void)
|
||||
state->pop();
|
||||
}
|
||||
|
||||
#if defined (ENABLE_GL_DEPTH_RANGE)
|
||||
// using 10% of the z-buffer for the foreground node
|
||||
glDepthRange(0.0,0.1);
|
||||
#endif
|
||||
|
||||
// Render overlay front scenegraph.
|
||||
glra->apply(this->foregroundroot);
|
||||
|
||||
@@ -2314,6 +2332,11 @@ void View3DInventorViewer::renderScene(void)
|
||||
this->drawAxisCross();
|
||||
}
|
||||
|
||||
#if defined (ENABLE_GL_DEPTH_RANGE)
|
||||
// using the main portion of z-buffer again (for frontbuffer highlighting)
|
||||
glDepthRange(0.1,1.0);
|
||||
#endif
|
||||
|
||||
// Immediately reschedule to get continuous spin animation.
|
||||
if (this->isAnimating()) {
|
||||
this->getSoRenderManager()->scheduleRedraw();
|
||||
@@ -2406,6 +2429,7 @@ void View3DInventorViewer::selectAll()
|
||||
if (obj) objs.push_back(obj);
|
||||
}
|
||||
}
|
||||
|
||||
if (!objs.empty())
|
||||
Gui::Selection().setSelection(objs.front()->getDocument()->getName(), objs);
|
||||
}
|
||||
@@ -2435,6 +2459,7 @@ bool View3DInventorViewer::processSoEvent(const SoEvent* ev)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return navigation->processEvent(ev);
|
||||
}
|
||||
|
||||
@@ -3221,11 +3246,8 @@ void View3DInventorViewer::drawAxisCross(void)
|
||||
// Set the viewport in the OpenGL canvas. Dimensions are calculated
|
||||
// as a percentage of the total canvas size.
|
||||
SbVec2s view = this->getSoRenderManager()->getSize();
|
||||
const int pixelarea =
|
||||
int(float(this->axiscrossSize)/100.0f * std::min(view[0], view[1]));
|
||||
|
||||
const int pixelarea = int(float(this->axiscrossSize)/100.0f * std::min(view[0], view[1]));
|
||||
SbVec2s origin(view[0] - pixelarea, 0);
|
||||
|
||||
glViewport(origin[0], origin[1], pixelarea, pixelarea);
|
||||
|
||||
// Set up the projection matrix.
|
||||
|
||||
@@ -147,6 +147,7 @@ QIcon ViewProviderPythonFeatureImp::getIcon() const
|
||||
e.ReportException();
|
||||
}
|
||||
}
|
||||
|
||||
return QIcon();
|
||||
}
|
||||
|
||||
|
||||
@@ -511,6 +511,55 @@ std::list<std::string> Workbench::listCommandbars() const
|
||||
return bars;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#if 0 // needed for Qt's lupdate utility
|
||||
qApp->translate("CommandGroup", "File");
|
||||
qApp->translate("CommandGroup", "Edit");
|
||||
qApp->translate("CommandGroup", "Help");
|
||||
qApp->translate("CommandGroup", "Link");
|
||||
qApp->translate("CommandGroup", "Tools");
|
||||
qApp->translate("CommandGroup", "View");
|
||||
qApp->translate("CommandGroup", "Window");
|
||||
qApp->translate("CommandGroup", "Standard");
|
||||
qApp->translate("CommandGroup", "Macros");
|
||||
qApp->translate("CommandGroup", "Macro");
|
||||
qApp->translate("CommandGroup", "Structure");
|
||||
qApp->translate("CommandGroup", "Standard-Test");
|
||||
qApp->translate("CommandGroup", "Standard-View");
|
||||
qApp->translate("CommandGroup", "TreeView");
|
||||
qApp->translate("CommandGroup", "Measure");
|
||||
|
||||
qApp->translate("Workbench", "&File");
|
||||
qApp->translate("Workbench", "&Edit");
|
||||
qApp->translate("Workbench", "Standard views");
|
||||
qApp->translate("Workbench", "Axonometric");
|
||||
qApp->translate("Workbench", "&Stereo");
|
||||
qApp->translate("Workbench", "&Zoom");
|
||||
qApp->translate("Workbench", "Visibility");
|
||||
qApp->translate("Workbench", "&View");
|
||||
qApp->translate("Workbench", "&Tools");
|
||||
qApp->translate("Workbench", "&Macro");
|
||||
qApp->translate("Workbench", "&Windows");
|
||||
qApp->translate("Workbench", "&On-line help");
|
||||
qApp->translate("Workbench", "&Help");
|
||||
qApp->translate("Workbench", "File");
|
||||
qApp->translate("Workbench", "Macro");
|
||||
qApp->translate("Workbench", "View");
|
||||
qApp->translate("Workbench", "Special Ops");
|
||||
// needed for Structure toolbar
|
||||
qApp->translate("Workbench", "Link actions");
|
||||
#endif
|
||||
|
||||
#if 0 // needed for the application menu on OSX
|
||||
qApp->translate("MAC_APPLICATION_MENU", "Services");
|
||||
qApp->translate("MAC_APPLICATION_MENU", "Hide %1");
|
||||
qApp->translate("MAC_APPLICATION_MENU", "Hide Others");
|
||||
qApp->translate("MAC_APPLICATION_MENU", "Show All");
|
||||
qApp->translate("MAC_APPLICATION_MENU", "Preferences...");
|
||||
qApp->translate("MAC_APPLICATION_MENU", "Quit %1");
|
||||
qApp->translate("MAC_APPLICATION_MENU", "About %1");
|
||||
#endif
|
||||
|
||||
TYPESYSTEM_SOURCE(Gui::StdWorkbench, Gui::Workbench)
|
||||
|
||||
|
||||
@@ -130,8 +130,12 @@ bool PropertyItemDelegate::eventFilter(QObject *o, QEvent *ev)
|
||||
PropertyEditor *parentEditor = qobject_cast<PropertyEditor*>(this->parent());
|
||||
auto widget = qobject_cast<QWidget*>(o);
|
||||
if (widget && parentEditor && parentEditor->activeEditor
|
||||
&& widget != parentEditor->activeEditor)
|
||||
{
|
||||
&& widget != parentEditor->activeEditor) {
|
||||
// All the attempts to ignore the focus-out event has been approved to not work
|
||||
// reliably because there are still cases that cannot be handled.
|
||||
// So, the best for now is to always ignore this event.
|
||||
// See https://forum.freecadweb.org/viewtopic.php?p=579530#p579530 why this is not
|
||||
// possible.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,8 @@ using namespace Gui;
|
||||
using namespace Gui::PropertyEditor;
|
||||
|
||||
|
||||
/* TRANSLATOR Gui::PropertyEditor::PropertyModel */
|
||||
|
||||
PropertyModel::PropertyModel(QObject* parent)
|
||||
: QAbstractItemModel(parent)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user