Merge branch 'FreeCAD:master' into sketcher_dim_key

This commit is contained in:
howie-j
2023-09-10 00:09:28 +02:00
committed by GitHub
32 changed files with 793 additions and 515 deletions

View File

@@ -530,7 +530,7 @@ class arcTracker(Tracker):
"""An arc tracker."""
def __init__(self, dotted=False, scolor=None, swidth=None,
start=0, end=math.pi*2, normal=None):
start=0, end=math.pi*2):
self.circle = None
self.startangle = math.degrees(start)
self.endangle = math.degrees(end)
@@ -538,10 +538,11 @@ class arcTracker(Tracker):
self.trans.translation.setValue([0, 0, 0])
self.sep = coin.SoSeparator()
self.autoinvert = True
if normal:
self.normal = normal
else:
self.normal = FreeCAD.DraftWorkingPlane.axis
self.normal = FreeCAD.DraftWorkingPlane.axis
ang = DraftVecUtils.angle(self.getDeviation(),
FreeCAD.DraftWorkingPlane.u,
self.normal)
self.ang_offset = math.degrees(ang)
self.recompute()
super().__init__(dotted, scolor, swidth,
[self.trans, self.sep], name="arcTracker")
@@ -578,10 +579,7 @@ class arcTracker(Tracker):
"""Return the angle of a given vector in radians."""
c = self.trans.translation.getValue()
center = Vector(c[0], c[1], c[2])
rad = pt.sub(center)
a = DraftVecUtils.angle(rad, self.getDeviation(), self.normal)
# print(a)
return a
return DraftVecUtils.angle(self.getDeviation(), pt.sub(center), self.normal)
def getAngles(self):
"""Return the start and end angles in degrees."""
@@ -589,11 +587,11 @@ class arcTracker(Tracker):
def setStartPoint(self, pt):
"""Set the start angle from a point."""
self.setStartAngle(-self.getAngle(pt))
self.setStartAngle(self.getAngle(pt))
def setEndPoint(self, pt):
"""Set the end angle from a point."""
self.setEndAngle(-self.getAngle(pt))
self.setEndAngle(self.getAngle(pt))
def setApertureAngle(self, ang):
"""Set the end angle by giving the aperture angle."""
@@ -622,12 +620,16 @@ class arcTracker(Tracker):
if self.circle:
self.sep.removeChild(self.circle)
self.circle = None
if (self.endangle < self.startangle) or not self.autoinvert:
c = Part.makeCircle(1, Vector(0, 0, 0),
self.normal, self.endangle, self.startangle)
if self.autoinvert is False:
ang_sta = self.endangle
ang_end = self.startangle
elif self.endangle < self.startangle:
ang_sta = self.endangle + self.ang_offset
ang_end = self.startangle + self.ang_offset
else:
c = Part.makeCircle(1, Vector(0, 0, 0),
self.normal, self.startangle, self.endangle)
ang_sta = self.startangle + self.ang_offset
ang_end = self.endangle + self.ang_offset
c = Part.makeCircle(1, Vector(0, 0, 0), self.normal, ang_sta, ang_end)
buf = c.writeInventor(2, 0.01)
try:
ivin = coin.SoInput()
@@ -779,7 +781,7 @@ class ghostTracker(Tracker):
def setMatrix(self, matrix):
"""Set the transformation matrix.
The 4th column of the matrix (the position) is ignored.
"""
m = coin.SbMatrix(matrix.A11, matrix.A12, matrix.A13, matrix.A14,

View File

@@ -162,7 +162,7 @@ FemPostDataAlongLineFilter::FemPostDataAlongLineFilter()
m_probe->SetPassPointArrays(1);
m_probe->SetPassCellArrays(1);
// needs vtk > 6.1
#if (VTK_MAJOR_VERSION > 6) || (VTK_MINOR_VERSION > 1)
#if (VTK_MAJOR_VERSION > 6) && (VTK_MINOR_VERSION > 1)
m_probe->ComputeToleranceOff();
m_probe->SetTolerance(0.01);
#endif
@@ -311,7 +311,7 @@ FemPostDataAtPointFilter::FemPostDataAtPointFilter()
m_probe->SetPassPointArrays(1);
m_probe->SetPassCellArrays(1);
// needs vtk > 6.1
#if (VTK_MAJOR_VERSION > 6) || (VTK_MINOR_VERSION > 1)
#if (VTK_MAJOR_VERSION > 6) && (VTK_MINOR_VERSION > 1)
m_probe->ComputeToleranceOff();
m_probe->SetTolerance(0.01);
#endif

View File

@@ -69,7 +69,7 @@
</font>
</property>
<property name="text">
<string>Let the application manage (create, delete) the working directories for all solver. Use temporary directories.</string>
<string>Let the application manage (create, delete) the working directories for all solvers. Use temporary directories.</string>
</property>
<property name="wordWrap">
<bool>true</bool>

View File

@@ -68,6 +68,12 @@ DlgScale::DlgScale(QWidget* parent, Qt::WindowFlags fl)
ui->dsbYScale->setDecimals(Base::UnitsApi::getDecimals());
ui->dsbZScale->setDecimals(Base::UnitsApi::getDecimals());
findShapes();
// this will mark as selected all the items in treeWidget that are selected in the document
Gui::ItemViewSelection sel(ui->treeWidget);
sel.applyFrom(Gui::Selection().getObjectsOfType(Part::Feature::getClassTypeId()));
sel.applyFrom(Gui::Selection().getObjectsOfType(App::Link::getClassTypeId()));
sel.applyFrom(Gui::Selection().getObjectsOfType(App::Part::getClassTypeId()));
}
void DlgScale::setupConnections()
@@ -102,15 +108,8 @@ void DlgScale::onUniformScaleToggled(bool state)
}
}
App::DocumentObject& DlgScale::getShapeToScale() const
{
// Base::Console().Message("DS::getShapeToScale()\n");
std::vector<App::DocumentObject*> objs = this->getShapesToScale();
if (objs.empty())
throw Base::ValueError("No shapes selected");
return *(objs[0]);
}
//! find all the scalable objects in the active document and load them into the
//! list widget
void DlgScale::findShapes()
{
// Base::Console().Message("DS::findShapes()\n");
@@ -141,6 +140,7 @@ void DlgScale::findShapes()
}
}
//! return true if shape can be scaled.
bool DlgScale::canScale(const TopoDS_Shape& shape) const
{
if (shape.IsNull()) {
@@ -156,11 +156,13 @@ bool DlgScale::canScale(const TopoDS_Shape& shape) const
if (type == TopAbs_COMPOUND ||
type == TopAbs_COMPSOLID) {
TopExp_Explorer xp;
xp.Init(shape, TopAbs_SHAPE);
xp.Init(shape, TopAbs_EDGE);
for ( ; xp.More() ; xp.Next()) {
// there is at least 1 sub shape inside the compound
// there is at least 1 edge inside the compound, so as long as it isn't null,
// we can scale this shape. We can stop looking as soon as we find a non-null
// edge.
if (!xp.Current().IsNull()) {
// found a non-null shape
// found a non-null edge
return true;
}
}
@@ -186,6 +188,7 @@ void DlgScale::accept()
};
}
// create a FeatureScale for each scalable object
void DlgScale::apply()
{
// Base::Console().Message("DS::apply()\n");
@@ -264,6 +267,8 @@ void DlgScale::reject()
QDialog::reject();
}
//! retrieve the document objects associated with the selected items in the list
//! widget
std::vector<App::DocumentObject*> DlgScale::getShapesToScale() const
{
// Base::Console().Message("DS::getShapesToScale()\n");
@@ -282,6 +287,8 @@ std::vector<App::DocumentObject*> DlgScale::getShapesToScale() const
return objects;
}
//! return true if at least one item in the list widget corresponds to an
//! available document object in the document
bool DlgScale::validate()
{
QList<QTreeWidgetItem *> items = ui->treeWidget->selectedItems();
@@ -299,6 +306,7 @@ bool DlgScale::validate()
return !objects.empty();
}
//! update a FeatureScale with the parameters from the UI
void DlgScale::writeParametersToFeature(App::DocumentObject &feature, App::DocumentObject* base) const
{
// Base::Console().Message("DS::writeParametersToFeature()\n");

View File

@@ -146,7 +146,7 @@ public:
return genericSetAttro( name_, value );
}
}
virtual int sequence_length()
virtual PyCxx_ssize_t sequence_length()
{
// len(x)
return m_array.size();

View File

@@ -31,6 +31,7 @@
#include <Base/Console.h>
#include <Base/Sequencer.h>
#include <Base/Stream.h>
#include <Base/Writer.h>
#include <Base/Interpreter.h>
#include <App/Application.h>
@@ -88,7 +89,7 @@ void WorkerThread::run()
// --------------------------------------
QMutex PythonThread::mutex(QMutex::Recursive);
QRecursiveMutex PythonThread::mutex;
PythonThread::PythonThread(QObject* parent)
: QThread(parent)

View File

@@ -25,7 +25,7 @@
#define SANDBOX_DOCUMENTTHREAD_H
#include <QThread>
#include <QMutex>
#include <Base/Mutex.h>
#include <Base/Handle.h>
#include <App/DocumentObject.h>
@@ -63,7 +63,7 @@ public:
protected:
void run();
static QMutex mutex;
static QRecursiveMutex mutex;
};
class SandboxAppExport MeshLoaderThread : public QThread

View File

@@ -37,14 +37,7 @@ set(SandboxGui_MOC_HDRS
GLGraphicsView.h
)
fc_wrap_cpp(SandboxGui_MOC_SRCS ${SandboxGui_MOC_HDRS})
SOURCE_GROUP("Moc" FILES ${SandboxGui_MOC_SRCS})
if(BUILD_QT5)
qt5_add_resources(Resource_SRCS Resources/Sandbox.qrc)
else()
qt4_add_resources(Resource_SRCS Resources/Sandbox.qrc)
endif()
qt_add_resources(Resource_SRCS Resources/Sandbox.qrc)
SET(Resource_SRCS
${Resource_SRCS}
Resources/Sandbox.qrc

View File

@@ -68,6 +68,7 @@
#include <Gui/Command.h>
#include <Gui/MainWindow.h>
#include <Gui/FileDialog.h>
#include <Gui/Tools.h>
#include <Gui/View3DInventor.h>
#include <Gui/View3DInventorViewer.h>
#include <Gui/WaitCursor.h>
@@ -933,7 +934,7 @@ void CmdTestGrabWidget::activated(int)
{
QCalendarWidget* c = new QCalendarWidget();
c->hide();
QPixmap p = QPixmap::grabWidget(c, c->rect());
QPixmap p = c->grab(c->rect());
QLabel* label = new QLabel();
label->resize(c->size());
label->setPixmap(p);
@@ -1055,7 +1056,7 @@ void CmdTestImageNode::activated(int)
QString text = QString::fromLatin1("Distance: 2.7jgiorjgor84mm");
QFont font;
QFontMetrics fm(font);
int w = fm.width(text);
int w = Gui::QtTools::horizontalAdvance(fm, text);
int h = fm.height();

View File

@@ -48,7 +48,6 @@
#include <QResizeEvent>
#include <QTimer>
#include <QVBoxLayout>
#include <QGLWidget>
#include <QGraphicsView>
#include <QPaintEngine>
#include <QGraphicsItem>
@@ -57,6 +56,7 @@
#include <QUrl>
#include "GLGraphicsView.h"
#include <App/Application.h>
#include <Gui/Document.h>
#include <Gui/ViewProvider.h>
@@ -239,10 +239,12 @@ SceneEventFilter::eventFilter(QObject *, QEvent * qevent)
}
case QEvent::GraphicsSceneWheel:
{
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
QGraphicsSceneWheelEvent* ev = static_cast<QGraphicsSceneWheelEvent*>(qevent);
sceneev.reset(new QWheelEvent(ev->pos().toPoint(), ev->delta(), ev->buttons(),
ev->modifiers(), ev->orientation()));
qevent = sceneev.get();
#endif
break;
}
case QEvent::GraphicsSceneResize:
@@ -351,7 +353,9 @@ GraphicsScene::GraphicsScene()
pos += QPointF(0, 10 + rect.height());
}
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
m_time.start();
#endif
sorendermanager = new SoRenderManager;
sorendermanager->setAutoClipping(SoRenderManager::VARIABLE_NEAR_PLANE);
@@ -572,14 +576,18 @@ void GraphicsScene::drawBackground(QPainter *painter, const QRectF &)
return;
}
#if 0
glViewport(0, 0, width(), height());
/**/
glClearColor(m_backgroundColor.redF(), m_backgroundColor.greenF(), m_backgroundColor.blueF(), 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
#endif
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
const int delta = m_time.elapsed() - m_lastTime;
m_lastTime += delta;
#endif
sorendermanager->render(true/*PRIVATE(this)->clearwindow*/,
@@ -625,7 +633,9 @@ void GraphicsScene::mousePressEvent(QGraphicsSceneMouseEvent *event)
if (event->isAccepted())
return;
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
m_mouseEventTime = m_time.elapsed();
#endif
event->accept();
}
@@ -654,10 +664,12 @@ GraphicsView3D::GraphicsView3D(Gui::Document* doc, QWidget* parent)
: Gui::MDIView(doc, parent), m_scene(new GraphicsScene()), m_view(new GraphicsView)
{
m_view->installEventFilter(m_scene->getEventFilter());
QGLFormat f;
#if 0
QtGLFormat f;
f.setSampleBuffers(true);
f.setSamples(8);
m_view->setViewport(new QGLWidget(f));
#endif
m_view->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
m_view->setScene(m_scene);
m_scene->setNavigationModeFile(QUrl(QString::fromLatin1("coin:///scxml/navigation/examiner.xml")));
@@ -698,5 +710,4 @@ void GraphicsView3D::OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp::M
m_scene->setBackgroundColor(QColor::fromRgbF(r1, g1, b1));
}
}
#include "moc_GLGraphicsView.cpp"

View File

@@ -63,20 +63,11 @@ public:
p.drawText(200,200,QString::fromLatin1("Render to QImage"));
}
#if !defined(HAVE_QT5_OPENGL)
img = QtGLWidget::convertToGLFormat(img);
#endif
fbo = new QtGLFramebufferObject(v->getGLWidget()->size());
fbo->bind();
//glClear(GL_COLOR_BUFFER_BIT);
fbo->release();
{
#if !defined(HAVE_QT5_OPENGL)
QPainter p(fbo);
p.setPen(Qt::white);
p.drawText(200,200,QString::fromLatin1("Render to QtGLFramebufferObject"));
p.end();
#endif
//img = fbo->toImage();
//img = QtGLWidget::convertToGLFormat(img);
}
@@ -626,18 +617,6 @@ void DrawingPlane::drawLineTo(const QPoint &endPoint)
{
Q_UNUSED(endPoint);
return;
#if !defined(HAVE_QT5_OPENGL)
QPainter painter(fbo);
//QPainter painter(_pcView3D->getGLWidget());
painter.setPen(QPen(myPenColor, myPenWidth, Qt::SolidLine, Qt::RoundCap,
Qt::RoundJoin));
//painter.setOpacity(0.5);
//painter.drawLine(lastPoint.x(), fbo->height()-lastPoint.y(), endPoint.x(), fbo->height()-endPoint.y());
painter.drawLine(lastPoint.x(), lastPoint.y(), endPoint.x(), endPoint.y());
//_pcView3D->scheduleRedraw();
lastPoint = endPoint;
#endif
}
//Gui::Document* doc = Gui::Application::Instance->activeDocument();
//Gui::View3DInventorViewer* view = static_cast<Gui::View3DInventor*>(doc->getActiveView())->getViewer();

View File

@@ -364,8 +364,6 @@ public:
Q_UNUSED(MainWindow);
} // retranslateUi
};
#else
#include <Gui/iisTaskPanel/include/iisTaskPanel>
#endif
TaskPanelView::TaskPanelView(QWidget *parent)
@@ -580,96 +578,6 @@ TaskPanelView::TaskPanelView(QWidget *parent)
connect(ui->rbAndroidScheme, SIGNAL(toggled(bool)), androidAction, SIGNAL(toggled(bool)));
func->toggle(androidAction, boost::bind(&TaskPanelView::on_rbAndroidScheme_toggled, this, bp::_1));
}
#else
setWindowTitle(QLatin1String("Task View"));
QGridLayout* gridLayout = new QGridLayout(this);
iisTaskPanel *taskPanel = new iisTaskPanel(this);
iisTaskBox *tb1 = new iisTaskBox(
QPixmap(QString::fromLatin1(":/icons/document-save.svg")),QLatin1String("Expandable Group"),true, this);
taskPanel->addWidget(tb1);
gridLayout->addWidget(taskPanel, 0, 0, 2, 1);
iisIconLabel *i1 = new iisIconLabel(
Gui::BitmapFactory().iconFromTheme("document-new"), QLatin1String("Create new file"), tb1);
tb1->addIconLabel(i1);
connect(i1, SIGNAL(activated()), action, SIGNAL(triggered()));
iisIconLabel *i2 = new iisIconLabel(
Gui::BitmapFactory().iconFromTheme("document-open"), QLatin1String("Load a file"), tb1);
tb1->addIconLabel(i2);
connect(i2, SIGNAL(activated()), action, SIGNAL(triggered()));
tb1->groupLayout()->addWidget(new QPushButton(QLatin1String("Just a button"), this));
iisIconLabel *i3 = new iisIconLabel(
Gui::BitmapFactory().iconFromTheme("document-save"), QLatin1String("Save current file"), tb1);
tb1->addIconLabel(i3);
iisIconLabel *i4 = new iisIconLabel(
Gui::BitmapFactory().iconFromTheme("document-print"), QLatin1String("Print file contents"), tb1);
tb1->addIconLabel(i4);
i4->setColors(Qt::red, Qt::green, Qt::gray);
i4->setFocusPen(QPen());
tb1->groupLayout()->addWidget(new QPushButton(QLatin1String("Just another button"), this));
iisTaskBox *tb2 = new iisTaskBox(
Gui::BitmapFactory().pixmap("edit-redo"), QLatin1String("Non-expandable Group"), false, this);
taskPanel->addWidget(tb2);
iisIconLabel *i21 = new iisIconLabel(
Gui::BitmapFactory().iconFromTheme("document-new"), QLatin1String("Create new file"), tb2);
tb2->addIconLabel(i21);
iisIconLabel *i22 = new iisIconLabel(
Gui::BitmapFactory().iconFromTheme("document-open"), QLatin1String("Load a file"), tb2);
tb2->addIconLabel(i22);
iisIconLabel *i23 = new iisIconLabel(
Gui::BitmapFactory().iconFromTheme("document-save"), QLatin1String("Save current file"), tb2);
tb2->addIconLabel(i23);
i23->setEnabled(false);
iisIconLabel *i24 = new iisIconLabel(
Gui::BitmapFactory().iconFromTheme("document-print"), QLatin1String("Print file contents"), tb2);
tb2->addIconLabel(i24);
// Other widgets can be also added to the panel
QLabel *l1 = new QLabel(QLatin1String("Action Group without header"), this);
taskPanel->addWidget(l1);
iisTaskGroup *tb3 = new iisTaskGroup(this);
taskPanel->addWidget(tb3);
iisIconLabel *i31 = new iisIconLabel(
Gui::BitmapFactory().iconFromTheme("document-new"), QLatin1String("Create new file"), tb3);
tb3->addIconLabel(i31);
QHBoxLayout *hb3 = new QHBoxLayout();
tb3->groupLayout()->addLayout(hb3);
iisIconLabel *i32 = new iisIconLabel(
Gui::BitmapFactory().iconFromTheme("document-open"), QLatin1String("Load a file"), tb3);
tb3->addIconLabel(i32);
hb3->addWidget(i32);
iisIconLabel *i33 = new iisIconLabel(
Gui::BitmapFactory().iconFromTheme("document-save"), QLatin1String("Save current file"), tb3);
tb3->addIconLabel(i33);
i33->setDisabled(true);
hb3->addWidget(i33);
iisIconLabel *i34 = new iisIconLabel(
Gui::BitmapFactory().iconFromTheme("document-print"), QLatin1String("Print file contents"), tb3);
tb3->addIconLabel(i34);
taskPanel->addStretch();
taskPanel->setScheme(iisWinXPTaskPanelScheme::defaultScheme());
tb1->setScheme(iisWinXPTaskPanelScheme::defaultScheme());
tb2->setScheme(iisWinXPTaskPanelScheme2::defaultScheme());
tb3->setScheme(iisTaskPanelScheme::defaultScheme());
#endif
}

View File

@@ -37,6 +37,7 @@
#include <QtOpenGL.h>
#include "Workbench.h"
#include <App/Application.h>
#include <Gui/MenuManager.h>
#include <Gui/ToolBarManager.h>
#include <Gui/MainWindow.h>
@@ -61,7 +62,7 @@ Workbench::Workbench()
QGridLayout* pLayout = new QGridLayout(tree);
pLayout->setSpacing(0);
pLayout->setMargin (0);
pLayout->setContentsMargins(0, 0, 0, 0);
pLayout->addWidget(treeWidget, 0, 0);
tree->setObjectName
@@ -159,8 +160,7 @@ void SoWidgetShape::GLRender(SoGLRenderAction * /*action*/)
#if defined(HAVE_QT5_OPENGL)
this->image = QPixmap::grabWidget(w, w->rect()).toImage();
#else
this->image = QPixmap::grabWidget(w, w->rect()).toImage();
this->image = QtGLWidget::convertToGLFormat(this->image);
this->image = w->grab(w->rect()).toImage();
#endif
glRasterPos2d(10,10);
glDrawPixels(this->image.width(),this->image.height(),GL_RGBA,GL_UNSIGNED_BYTE,this->image.bits());
@@ -285,7 +285,6 @@ void SoWidgetShape::setWidget(QWidget* w)
this->image = img.toImage();
#if !defined(HAVE_QT5_OPENGL)
this->image = QPixmap::grabWidget(w, w->rect()).toImage();
this->image = QtGLWidget::convertToGLFormat(this->image);
this->image = w->grab(w->rect()).toImage();
#endif
}

View File

@@ -30,4 +30,3 @@ INSTALL(
DESTINATION
Mod/Tux
)

View File

@@ -33,4 +33,3 @@ if p.GetGroup("PersistentToolbars").GetBool("Enabled", 1):
import PersistentToolbarsGui
else:
pass

View File

@@ -36,7 +36,9 @@ try:
def translate(context, text):
"convenience function for Qt 4 translator"
return QtGui.QApplication.translate(context, text, None, _encoding)
except AttributeError:
def translate(context, text):
"convenience function for Qt 5 translator"
return QtGui.QApplication.translate(context, text, None)
@@ -44,6 +46,7 @@ except AttributeError:
class IndicatorButton(QtGui.QPushButton):
"""Detect language change events."""
def __init__(self, parent=None):
super(IndicatorButton, self).__init__()
@@ -56,7 +59,7 @@ class IndicatorButton(QtGui.QPushButton):
return super(IndicatorButton, self).changeEvent(event)
def onChange(self, paramGrp, param):
if(param == "NavigationStyle"):
if param == "NavigationStyle":
setCurrent()
@@ -78,14 +81,27 @@ def retranslateUi():
t0 = translate("NavigationIndicator", "Navigation style not recognized.")
global t1
t1 = "<p align='center'><b>Blender</b> " + text06 + """</p>
t1 = (
"<p align='center'><b>Blender</b> "
+ text06
+ """</p>
<table>
<tr>
<th><small>""" + text01 + """</small></th>
<th><small>""" + text02 + """</small></th>
<th><small>""" + text03 + """</small></th>
<th><small>""" + text04 + """</small></th>
<th><small>""" + text04 + """</small></th>
<th><small>"""
+ text01
+ """</small></th>
<th><small>"""
+ text02
+ """</small></th>
<th><small>"""
+ text03
+ """</small></th>
<th><small>"""
+ text04
+ """</small></th>
<th><small>"""
+ text04
+ """</small></th>
</tr>
<tr>
<td align='center'><img src=':/icons/NavigationBlender_Select.svg'></td>
@@ -95,17 +111,35 @@ def retranslateUi():
<td align='center'><img src=':/icons/NavigationBlender_PanAlt.svg'></td>
</tr>
</table>
<b>""" + text08 + ":</b> " + text10 + "</small></p>"
<b>"""
+ text08
+ ":</b> "
+ text10
+ "</small></p>"
)
global t2
t2 = "<p align='center'><b>CAD</b> " + text06 + """</p>
t2 = (
"<p align='center'><b>CAD</b> "
+ text06
+ """</p>
<table>
<tr>
<th><small>""" + text01 + """</small></th>
<th><small>""" + text02 + """</small></th>
<th><small>""" + text03 + """</small></th>
<th><small>""" + text03 + """</small></th>
<th><small>""" + text04 + """</small></th>
<th><small>"""
+ text01
+ """</small></th>
<th><small>"""
+ text02
+ """</small></th>
<th><small>"""
+ text03
+ """</small></th>
<th><small>"""
+ text03
+ """</small></th>
<th><small>"""
+ text04
+ """</small></th>
</tr>
<tr>
<td align='center'><img src=':/icons/NavigationCAD_Select.svg'></td>
@@ -115,18 +149,38 @@ def retranslateUi():
<td align='center'><img src=':/icons/NavigationCAD_Pan.svg'></td>
</tr>
</table>
<b>""" + text08 + ":</b> " + text10 + "</small></p>"
<b>"""
+ text08
+ ":</b> "
+ text10
+ "</small></p>"
)
global t3
t3 = "<p align='center'><b>Gesture</b> " + text06 + """</p>
t3 = (
"<p align='center'><b>Gesture</b> "
+ text06
+ """</p>
<table>
<tr>
<th><small>""" + text01 + """</small></th>
<th><small>""" + text02 + """</small></th>
<th><small>""" + text03 + """</small></th>
<th><small>""" + text03 + """</small></th>
<th><small>""" + text04 + """</small></th>
<th><small>""" + text05 + """</small></th>
<th><small>"""
+ text01
+ """</small></th>
<th><small>"""
+ text02
+ """</small></th>
<th><small>"""
+ text03
+ """</small></th>
<th><small>"""
+ text03
+ """</small></th>
<th><small>"""
+ text04
+ """</small></th>
<th><small>"""
+ text05
+ """</small></th>
</tr>
<tr>
<td align='center'><img src=':/icons/NavigationGesture_Select.svg'></td>
@@ -137,12 +191,24 @@ def retranslateUi():
<td align='center'><img src=':/icons/NavigationGesture_Tilt.svg'></td>
</tr>
<tr>
<th><small>""" + text01 + """</small></th>
<th><small>""" + text02 + """</small></th>
<th><small>""" + text03 + """</small></th>
<th><small>""" + text04 + """</small></th>
<th><small>""" + text04 + """</small></th>
<th><small>""" + text05 + """</small></th>
<th><small>"""
+ text01
+ """</small></th>
<th><small>"""
+ text02
+ """</small></th>
<th><small>"""
+ text03
+ """</small></th>
<th><small>"""
+ text04
+ """</small></th>
<th><small>"""
+ text04
+ """</small></th>
<th><small>"""
+ text05
+ """</small></th>
</tr>
<tr>
<td align='center'><img src=':/icons/NavigationGesture_SelectTouch.svg'></td>
@@ -153,19 +219,43 @@ def retranslateUi():
<td align='center'><img src=':/icons/NavigationGesture_TiltTouch.svg'></td>
</tr>
</table>
<p><small><b>""" + text02 + ":</b> " + text07 + """<br>
<b>""" + text08 + ":</b> " + text09 + "</small></p>"
<p><small><b>"""
+ text02
+ ":</b> "
+ text07
+ """<br>
<b>"""
+ text08
+ ":</b> "
+ text09
+ "</small></p>"
)
global t4
t4 = "<p align='center'><b>MayaGesture</b> " + text06 + """</p>
t4 = (
"<p align='center'><b>MayaGesture</b> "
+ text06
+ """</p>
<table>
<tr>
<th><small>""" + text01 + """</small></th>
<th><small>""" + text02 + """</small></th>
<th><small>""" + text02 + """</small></th>
<th><small>""" + text03 + """</small></th>
<th><small>""" + text04 + """</small></th>
<th><small>""" + text05 + """</small></th>
<th><small>"""
+ text01
+ """</small></th>
<th><small>"""
+ text02
+ """</small></th>
<th><small>"""
+ text02
+ """</small></th>
<th><small>"""
+ text03
+ """</small></th>
<th><small>"""
+ text04
+ """</small></th>
<th><small>"""
+ text05
+ """</small></th>
</tr>
<tr>
<td align='center'><img src=':/icons/NavigationMayaGesture_Select.svg'></td>
@@ -176,12 +266,24 @@ def retranslateUi():
<td align='center'><img src=':/icons/NavigationMayaGesture_Tilt.svg'></td>
</tr>
<tr>
<th><small>""" + text01 + """</small></th>
<th><small>""" + text02 + """</small></th>
<th><small>""" + text03 + """</small></th>
<th><small>""" + text04 + """</small></th>
<th><small>""" + text04 + """</small></th>
<th><small>""" + text05 + """</small></th>
<th><small>"""
+ text01
+ """</small></th>
<th><small>"""
+ text02
+ """</small></th>
<th><small>"""
+ text03
+ """</small></th>
<th><small>"""
+ text04
+ """</small></th>
<th><small>"""
+ text04
+ """</small></th>
<th><small>"""
+ text05
+ """</small></th>
</tr>
<tr>
<td align='center'><img src=':/icons/NavigationMayaGesture_SelectTouch.svg'></td>
@@ -192,19 +294,43 @@ def retranslateUi():
<td align='center'><img src=':/icons/NavigationMayaGesture_TiltTouch.svg'></td>
</tr>
</table>
<p><small><b>""" + text02 + ":</b> " + text07 + """<br>
<b>""" + text08 + ":</b> " + text09 + "</small></p>"
<p><small><b>"""
+ text02
+ ":</b> "
+ text07
+ """<br>
<b>"""
+ text08
+ ":</b> "
+ text09
+ "</small></p>"
)
global t5
t5 = "<p align='center'><b>OpenCascade</b> " + text06 + """</p>
t5 = (
"<p align='center'><b>OpenCascade</b> "
+ text06
+ """</p>
<table>
<tr>
<th><small>""" + text01 + """</small></th>
<th><small>""" + text02 + """</small></th>
<th><small>""" + text02 + """</small></th>
<th><small>""" + text03 + """</small></th>
<th><small>""" + text04 + """</small></th>
<th><small>""" + text04 + """</small></th>
<th><small>"""
+ text01
+ """</small></th>
<th><small>"""
+ text02
+ """</small></th>
<th><small>"""
+ text02
+ """</small></th>
<th><small>"""
+ text03
+ """</small></th>
<th><small>"""
+ text04
+ """</small></th>
<th><small>"""
+ text04
+ """</small></th>
</tr>
<tr>
<td align='center'><img src=':/icons/NavigationOpenCascade_Select.svg'></td>
@@ -215,16 +341,30 @@ def retranslateUi():
<td align='center'><img src=':/icons/NavigationOpenCascade_PanAlt.svg'></td>
</tr>
</table>"""
)
global t6
t6 = "<p align='center'><b>OpenInventor</b> " + text06 + """</p>
t6 = (
"<p align='center'><b>OpenInventor</b> "
+ text06
+ """</p>
<table>
<tr>
<th><small>""" + text01 + """</small></th>
<th><small>""" + text02 + """</small></th>
<th><small>""" + text02 + """</small></th>
<th><small>""" + text03 + """</small></th>
<th><small>""" + text04 + """</small></th>
<th><small>"""
+ text01
+ """</small></th>
<th><small>"""
+ text02
+ """</small></th>
<th><small>"""
+ text02
+ """</small></th>
<th><small>"""
+ text03
+ """</small></th>
<th><small>"""
+ text04
+ """</small></th>
</tr>
<tr>
<td align='center'><img src=':/icons/NavigationOpenInventor_Select.svg'></td>
@@ -234,17 +374,35 @@ def retranslateUi():
<td align='center'><img src=':/icons/NavigationOpenInventor_Pan.svg'></td>
</tr>
</table>
<b>""" + text08 + ":</b> " + text10 + "</small></p>"
<b>"""
+ text08
+ ":</b> "
+ text10
+ "</small></p>"
)
global t7
t7 = "<p align='center'><b>OpenSCAD</b> " + text06 + """</p>
t7 = (
"<p align='center'><b>OpenSCAD</b> "
+ text06
+ """</p>
<table>
<tr>
<th><small>""" + text01 + """</small></th>
<th><small>""" + text02 + """</small></th>
<th><small>""" + text02 + """</small></th>
<th><small>""" + text03 + """</small></th>
<th><small>""" + text04 + """</small></th>
<th><small>"""
+ text01
+ """</small></th>
<th><small>"""
+ text02
+ """</small></th>
<th><small>"""
+ text02
+ """</small></th>
<th><small>"""
+ text03
+ """</small></th>
<th><small>"""
+ text04
+ """</small></th>
</tr>
<tr>
<td align='center'><img src=':/icons/NavigationOpenSCAD_Select.svg'></td>
@@ -254,16 +412,30 @@ def retranslateUi():
<td align='center'><img src=':/icons/NavigationOpenSCAD_Pan.svg'></td>
</tr>
</table>"""
)
global t8
t8 = "<p align='center'><b>Revit</b> " + text06 + """</p>
t8 = (
"<p align='center'><b>Revit</b> "
+ text06
+ """</p>
<table>
<tr>
<th><small>""" + text01 + """</small></th>
<th><small>""" + text02 + """</small></th>
<th><small>""" + text03 + """</small></th>
<th><small>""" + text04 + """</small></th>
<th><small>""" + text04 + """</small></th>
<th><small>"""
+ text01
+ """</small></th>
<th><small>"""
+ text02
+ """</small></th>
<th><small>"""
+ text03
+ """</small></th>
<th><small>"""
+ text04
+ """</small></th>
<th><small>"""
+ text04
+ """</small></th>
</tr>
<tr>
<td align='center'><img src=':/icons/NavigationBlender_Select.svg'></td>
@@ -273,16 +445,32 @@ def retranslateUi():
<td align='center'><img src=':/icons/NavigationBlender_PanAlt.svg'></td>
</tr>
</table>
<b>""" + text08 + ":</b> " + text10 + "</small></p>"
<b>"""
+ text08
+ ":</b> "
+ text10
+ "</small></p>"
)
global t9
t9 = "<p align='center'><b>TinkerCAD</b> " + text06 + """</p>
t9 = (
"<p align='center'><b>TinkerCAD</b> "
+ text06
+ """</p>
<table>
<tr>
<th><small>""" + text01 + """</small></th>
<th><small>""" + text02 + """</small></th>
<th><small>""" + text03 + """</small></th>
<th><small>""" + text04 + """</small></th>
<th><small>"""
+ text01
+ """</small></th>
<th><small>"""
+ text02
+ """</small></th>
<th><small>"""
+ text03
+ """</small></th>
<th><small>"""
+ text04
+ """</small></th>
</tr>
<tr>
<td align='center'><img src=':/icons/NavigationTinkerCAD_Select.svg'></td>
@@ -291,17 +479,33 @@ def retranslateUi():
<td align='center'><img src=':/icons/NavigationTinkerCAD_Pan.svg'></td>
</tr>
</table>"""
)
global t10
t10 = "<p align='center'><b>Touchpad</b> " + text06 + """</p>
t10 = (
"<p align='center'><b>Touchpad</b> "
+ text06
+ """</p>
<table>
<tr>
<th><small>""" + text01 + """</small></th>
<th><small>""" + text02 + """</small></th>
<th><small>""" + text02 + """</small></th>
<th><small>""" + text03 + """</small></th>
<th><small>""" + text03 + """</small></th>
<th><small>""" + text04 + """</small></th>
<th><small>"""
+ text01
+ """</small></th>
<th><small>"""
+ text02
+ """</small></th>
<th><small>"""
+ text02
+ """</small></th>
<th><small>"""
+ text03
+ """</small></th>
<th><small>"""
+ text03
+ """</small></th>
<th><small>"""
+ text04
+ """</small></th>
</tr>
<tr>
<td align='center'><img src=':/icons/NavigationTouchpad_Select.svg'></td>
@@ -312,11 +516,21 @@ def retranslateUi():
<td align='center'><img src=':/icons/NavigationTouchpad_Pan.svg'></td>
</tr>
<tr>
<th><small>""" + text01 + """</small></th>
<th><small>""" + text02 + """</small></th>
<th><small>""" + text03 + """</small></th>
<th><small>""" + text03 + """</small></th>
<th><small>""" + text04 + """</small></th>
<th><small>"""
+ text01
+ """</small></th>
<th><small>"""
+ text02
+ """</small></th>
<th><small>"""
+ text03
+ """</small></th>
<th><small>"""
+ text03
+ """</small></th>
<th><small>"""
+ text04
+ """</small></th>
</tr>
<tr>
<td align='center'><img src=':/icons/NavigationTouchpad_SelectTouch.svg'></td>
@@ -326,7 +540,12 @@ def retranslateUi():
<td align='center'><img src=':/icons/NavigationTouchpad_PanTouch.svg'></td>
</tr>
</table>
<p><small><b>""" + text02 + ":</b> " + text07 + "</p>"
<p><small><b>"""
+ text02
+ ":</b> "
+ text07
+ "</p>"
)
menuSettings.setTitle(translate("NavigationIndicator", "Settings"))
menuOrbit.setTitle(translate("NavigationIndicator", "Orbit style"))
@@ -389,7 +608,7 @@ a1.setData("Gui::BlenderNavigationStyle")
a1.setObjectName("Indicator_NavigationBlender")
a2 = QtGui.QAction(gStyle)
a2.setIcon(QtGui.QIcon(':/icons/NavigationCAD_dark.svg'))
a2.setIcon(QtGui.QIcon(":/icons/NavigationCAD_dark.svg"))
a2.setText("CAD ")
a2.setData("Gui::CADNavigationStyle")
a2.setObjectName("Indicator_NavigationCAD")

View File

@@ -28,6 +28,7 @@ conectedToolbars = []
timer = QtCore.QTimer()
mw = Gui.getMainWindow()
def pythonToolbars():
"""Manage Python based toolbar in BIM workbench."""
@@ -85,10 +86,12 @@ def onRestore(active):
# Reduce flickering.
for i in toolbars:
if (i not in topRestore and
i not in leftRestore and
i not in rightRestore and
i not in bottomRestore):
if (
i not in topRestore
and i not in leftRestore
and i not in rightRestore
and i not in bottomRestore
):
area = mw.toolBarArea(toolbars[i])