This commit is contained in:
Patrick Felixberger
2020-02-20 16:59:05 +01:00
11 changed files with 482 additions and 33 deletions

View File

@@ -445,7 +445,8 @@ class _TaskPanelFemResultShow:
if len(plt.get_fignums()) > 0:
plt.show()
else:
QtGui.QMessageBox.information(None,
QtGui.QMessageBox.information(
None,
self.result_obj.Label + " - Information",
"No histogram available.\nPlease select a result type first."
)
@@ -518,11 +519,11 @@ class _TaskPanelFemResultShow:
from ply import yacc
import femtools.tokrules as tokrules
identifiers = [
'x', 'y', 'z', 'T', 'vM', 'Peeq', 'P1', 'P2', 'P3',
'sxx', 'syy', 'szz', 'sxy', 'sxz', 'syz',
'exx', 'eyy', 'ezz', 'exy', 'exz', 'eyz',
'MF', 'NP', 'rx', 'ry', 'rz', 'mc',
's1x', 's1y', 's1z', 's2x', 's2y', 's2z', 's3x', 's3y', 's3z'
"x", "y", "z", "T", "vM", "Peeq", "P1", "P2", "P3",
"sxx", "syy", "szz", "sxy", "sxz", "syz",
"exx", "eyy", "ezz", "exy", "exz", "eyz",
"MF", "NP", "rx", "ry", "rz", "mc",
"s1x", "s1y", "s1z", "s2x", "s2y", "s2z", "s3x", "s3y", "s3z"
]
tokrules.names = {}
for i in identifiers:

View File

@@ -320,7 +320,7 @@ class _FemResultMechanical():
if len(obj.Stats) == 39:
temp = obj.Stats
for i in range(12, -1, -1):
del temp [3 * i + 1]
del temp[3 * i + 1]
obj.Stats = temp
def __getstate__(self):

View File

@@ -89,6 +89,9 @@
# include <BRepFill_Filling.hxx>
#endif
#include <cstdio>
#include <fstream>
#include <CXX/Extensions.hxx>
#include <CXX/Objects.hxx>
@@ -1802,7 +1805,19 @@ private:
try {
if (useFontSpec) {
#ifdef FC_OS_WIN32
// Windows doesn't do Utf8 by default and FreeType doesn't do wchar.
// this is a hacky work around.
// copy fontspec to Ascii temp name
std::string tempFile = Base::FileInfo::getTempFileName(); //utf8/ascii
Base::FileInfo fiIn(fontspec);
fiIn.copyTo(tempFile.c_str());
CharList = FT2FC(unichars,pysize,tempFile.c_str(),height,track);
Base::FileInfo fiTemp(tempFile);
fiTemp.deleteFile();
#else
CharList = FT2FC(unichars,pysize,fontspec,height,track);
#endif
}
else {
CharList = FT2FC(unichars,pysize,dir,fontfile,height,track);

View File

@@ -120,13 +120,23 @@ PyObject* FT2FC(const Py_UNICODE *PyUString,
throw std::runtime_error(ErrorMsg.str());
}
// FT does not return an error if font file not found?
std::ifstream is;
is.open (FontSpec);
if (!is) {
ErrorMsg << "Font file not found: " << FontSpec;
throw std::runtime_error(ErrorMsg.str());
}
#ifdef FC_OS_WIN32
Base::FileInfo fi(FontSpec);
if (!fi.isReadable()) {
ErrorMsg << "Font file not found (Win): " << FontSpec;
throw std::runtime_error(ErrorMsg.str());
}
#else
// FT does not return an error if font file not found?
std::ifstream is;
is.open (FontSpec);
if (!is) {
ErrorMsg << "Font file not found: " << FontSpec;
throw std::runtime_error(ErrorMsg.str());
}
#endif
error = FT_New_Face(FTLib,FontSpec,FaceIndex, &FTFont);
if(error) {

View File

@@ -284,7 +284,7 @@
</widget>
</item>
<item row="5" column="2">
<widget class="Gui::PrefUnitSpinBox" name="plsb_FontSize" native="true">
<widget class="Gui::PrefUnitSpinBox" name="plsb_FontSize">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -294,7 +294,7 @@
<property name="toolTip">
<string>Dimension font size</string>
</property>
<property name="value" stdset="0">
<property name="value">
<double>4.000000000000000</double>
</property>
<property name="prefEntry" stdset="0">
@@ -306,7 +306,7 @@
</widget>
</item>
<item row="8" column="2">
<widget class="Gui::PrefUnitSpinBox" name="plsb_ArrowSize" native="true">
<widget class="Gui::PrefUnitSpinBox" name="plsb_ArrowSize">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -316,7 +316,7 @@
<property name="toolTip">
<string>Dimension arrowhead size</string>
</property>
<property name="value" stdset="0">
<property name="value">
<double>5.000000000000000</double>
</property>
<property name="prefEntry" stdset="0">
@@ -821,20 +821,23 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="currentIndex">
<number>1</number>
</property>
<property name="prefEntry" stdset="0">
<cstring>SectionLineStyle</cstring>
<cstring>SectionLineStandard</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/TechDraw/General</cstring>
<cstring>Mod/TechDraw/Standards</cstring>
</property>
<item>
<property name="text">
<string>ISO</string>
<string>ANSI</string>
</property>
</item>
<item>
<property name="text">
<string>ANSI</string>
<string>ISO</string>
</property>
</item>
</widget>

View File

@@ -39,6 +39,9 @@
#include "QGIView.h"
#include "QGISectionLine.h"
#define ANSISTANDARD 0
#define ISOSTANDARD 1
using namespace TechDrawGui;
using namespace TechDraw;
@@ -82,8 +85,8 @@ void QGISectionLine::makeLine()
QPointF beginExtLine1,beginExtLine2; //ext line start pts for measure Start side and measure End side
QPointF endExtLine1, endExtLine2;
QPointF offsetDir(m_arrowDir.x,-m_arrowDir.y);
int format = getPrefSectionFormat();
if (format == 0) { //"ASME"
int format = getPrefSectionStandard();
if (format == ANSISTANDARD) { //"ASME"/"ANSI"
//draw from section line endpoint
QPointF offsetBegin = m_extLen * offsetDir;
beginExtLine1 = m_start; //from
@@ -115,8 +118,8 @@ void QGISectionLine::makeLine()
void QGISectionLine::makeArrows()
{
int format = getPrefSectionFormat();
if (format == 0) {
int format = getPrefSectionStandard();
if (format == ANSISTANDARD) {
makeArrowsTrad();
} else {
makeArrowsISO();
@@ -180,8 +183,8 @@ void QGISectionLine::makeArrowsTrad()
void QGISectionLine::makeSymbols()
{
int format = getPrefSectionFormat();
if (format == 0) {
int format = getPrefSectionStandard();
if (format == ANSISTANDARD) {
makeSymbolsTrad();
} else {
makeSymbolsISO();
@@ -291,11 +294,11 @@ Qt::PenStyle QGISectionLine::getSectionStyle()
}
//ASME("traditional") vs ISO("reference arrow method") arrows
int QGISectionLine::getPrefSectionFormat()
int QGISectionLine::getPrefSectionStandard()
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Format");
int format = hGrp->GetInt("SectionFormat", 0);
GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Standards");
int format = hGrp->GetInt("SectionLineStandard", ISOSTANDARD);
return format;
}

View File

@@ -67,7 +67,7 @@ protected:
void makeSymbolsTrad();
void makeSymbolsISO();
void setTools();
int getPrefSectionFormat();
int getPrefSectionStandard();
private:
char* m_symbol;