Misc. typos
Found via `codespell`
This commit is contained in:
@@ -23,15 +23,15 @@ add_definitions(-DBOOST_${Boost_VERSION})
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
#write relevant cmake variables to a file for later access with python. Exportet are all variables
|
||||
#starting with BUILD. As the variable only exists if the user set it to ON a dict is useless, we
|
||||
#use a python list for export.
|
||||
#write relevant cmake variables to a file for later access with python. Exported are all variables
|
||||
#starting with BUILD. As the variable only exists if the user set it to ON a dict is useless, we
|
||||
#use a python list for export.
|
||||
set(_vars "const char CMakeVariables[] =\"cmake = [")
|
||||
set(_delim "")
|
||||
get_cmake_property(_variableNames VARIABLES)
|
||||
foreach (_variableName ${_variableNames})
|
||||
if (${_variableName})
|
||||
STRING(REGEX MATCH "^[_]?[^_]*" _prefix "${_variableName}_")
|
||||
STRING(REGEX MATCH "^[_]?[^_]*" _prefix "${_variableName}_")
|
||||
if(${_prefix} STREQUAL "BUILD")
|
||||
STRING(REPLACE "\\" "\\\\" _name ${_variableName})
|
||||
set(_vars "${_vars}${_delim}\\n\"\n\"\\\"${_name}\\\"")
|
||||
|
||||
@@ -85,7 +85,7 @@ CallTipsList::CallTipsList(QPlainTextEdit* parent)
|
||||
pal.setColor(QPalette::Inactive, QPalette::HighlightedText, pal.color(QPalette::Active, QPalette::HighlightedText));
|
||||
parent->setPalette( pal );
|
||||
|
||||
connect(this, SIGNAL(itemActivated(QListWidgetItem *)),
|
||||
connect(this, SIGNAL(itemActivated(QListWidgetItem *)),
|
||||
this, SLOT(callTipItemActivated(QListWidgetItem *)));
|
||||
|
||||
hideKeys.append(Qt::Key_Space);
|
||||
@@ -124,7 +124,7 @@ CallTipsList::~CallTipsList()
|
||||
}
|
||||
|
||||
void CallTipsList::keyboardSearch(const QString& wordPrefix)
|
||||
{
|
||||
{
|
||||
// first search for the item that matches perfectly
|
||||
for (int i=0; i<count(); ++i) {
|
||||
QString text = item(i)->text();
|
||||
@@ -189,7 +189,7 @@ QString CallTipsList::extractContext(const QString& line) const
|
||||
(ch == '.') || (ch == '_') || // dot or underscore
|
||||
(ch == ' ') || (ch == '\t')) // whitespace (between dot and text)
|
||||
index = pos;
|
||||
else
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -251,13 +251,13 @@ QMap<QString, CallTip> CallTipsList::extractTips(const QString& context) const
|
||||
|
||||
// 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
|
||||
// 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
|
||||
Py::Object inst = obj; // the object instance
|
||||
union PyType_Object typeobj = {&Base::PyObjectBase::Type};
|
||||
union PyType_Object typedoc = {&App::DocumentObjectPy::Type};
|
||||
union PyType_Object basetype = {&PyBaseObject_Type};
|
||||
@@ -285,7 +285,7 @@ QMap<QString, CallTip> CallTipsList::extractTips(const QString& context) const
|
||||
#endif
|
||||
else if (PyObject_IsInstance(obj.ptr(), basetype.o) == 1) {
|
||||
// New style class which can be a module, type, list, tuple, int, float, ...
|
||||
// Make sure it's not a type objec
|
||||
// Make sure it's not a type object
|
||||
union PyType_Object typetype = {&PyType_Type};
|
||||
if (PyObject_IsInstance(obj.ptr(), typetype.o) != 1) {
|
||||
// this should be now a user-defined Python class
|
||||
@@ -397,7 +397,7 @@ void CallTipsList::extractTipsFromObject(Py::Object& obj, Py::List& list, QMap<Q
|
||||
QString longdoc = QString::fromUtf8(doc.as_string().c_str());
|
||||
int pos = longdoc.indexOf(QLatin1Char('\n'));
|
||||
pos = qMin(pos, 70);
|
||||
if (pos < 0)
|
||||
if (pos < 0)
|
||||
pos = qMin(longdoc.length(), 70);
|
||||
tip.description = stripWhiteSpace(longdoc);
|
||||
tip.parameter = longdoc.left(pos);
|
||||
@@ -410,7 +410,7 @@ void CallTipsList::extractTipsFromObject(Py::Object& obj, Py::List& list, QMap<Q
|
||||
QString longdoc = QString::fromUtf8(doc.as_string().c_str());
|
||||
int pos = longdoc.indexOf(QLatin1Char('\n'));
|
||||
pos = qMin(pos, 70);
|
||||
if (pos < 0)
|
||||
if (pos < 0)
|
||||
pos = qMin(longdoc.length(), 70);
|
||||
tip.description = stripWhiteSpace(longdoc);
|
||||
tip.parameter = longdoc.left(pos);
|
||||
@@ -458,7 +458,7 @@ void CallTipsList::extractTipsFromProperties(Py::Object& obj, QMap<QString, Call
|
||||
if (!longdoc.isEmpty()) {
|
||||
int pos = longdoc.indexOf(QLatin1Char('\n'));
|
||||
pos = qMin(pos, 70);
|
||||
if (pos < 0)
|
||||
if (pos < 0)
|
||||
pos = qMin(longdoc.length(), 70);
|
||||
tip.description = stripWhiteSpace(longdoc);
|
||||
tip.parameter = longdoc.left(pos);
|
||||
@@ -571,7 +571,7 @@ void CallTipsList::showTips(const QString& line)
|
||||
w += textEdit->style()->pixelMetric(QStyle::PM_ScrollBarExtent);
|
||||
setGeometry(posX, posY+fontMetrics().height(), w, h);
|
||||
}
|
||||
|
||||
|
||||
setCurrentRow(0);
|
||||
show();
|
||||
}
|
||||
@@ -589,7 +589,7 @@ void CallTipsList::hideEvent(QHideEvent* e)
|
||||
qApp->removeEventFilter(this);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Get all incoming events of the text edit and redirect some of them, like key up and
|
||||
* down, mouse press events, ... to the widget itself.
|
||||
*/
|
||||
@@ -681,7 +681,7 @@ void CallTipsList::callTipItemActivated(QListWidgetItem *item)
|
||||
{
|
||||
hide();
|
||||
if (!isItemSelected(item)) return;
|
||||
|
||||
|
||||
QString text = item->text();
|
||||
QTextCursor cursor = textEdit->textCursor();
|
||||
cursor.setPosition(this->cursorPos);
|
||||
@@ -769,4 +769,4 @@ QString CallTipsList::stripWhiteSpace(const QString& str) const
|
||||
return stripped;
|
||||
}
|
||||
|
||||
#include "moc_CallTips.cpp"
|
||||
#include "moc_CallTips.cpp"
|
||||
|
||||
@@ -66,14 +66,14 @@ void CreateTestCommands(void);
|
||||
|
||||
|
||||
/** The CommandBase class
|
||||
* This lightweigt class is the base class of all commands in FreeCAD. It represents the link between the FreeCAD
|
||||
* This lightweight class is the base class of all commands in FreeCAD. It represents the link between the FreeCAD
|
||||
* command framework and the QAction world of Qt.
|
||||
* @author Werner Mayer
|
||||
*/
|
||||
class GuiExport CommandBase
|
||||
class GuiExport CommandBase
|
||||
{
|
||||
protected:
|
||||
CommandBase(const char* sMenu, const char* sToolTip=0, const char* sWhat=0,
|
||||
CommandBase(const char* sMenu, const char* sToolTip=0, const char* sWhat=0,
|
||||
const char* sStatus=0, const char* sPixmap=0, const char* sAccel=0);
|
||||
virtual ~CommandBase();
|
||||
|
||||
|
||||
@@ -371,7 +371,7 @@ std::vector<SelectionObject> SelectionSingleton::getSelectionEx(const char* pDoc
|
||||
if (It->pDoc == pcDoc) {
|
||||
// right type?
|
||||
if (It->pObject->getTypeId().isDerivedFrom(typeId)){
|
||||
// if the object has already an entry
|
||||
// if the object already has an entry
|
||||
if (SortMap.find(It->pObject) != SortMap.end()){
|
||||
// only add sub-element
|
||||
if (!It->SubName.empty()) {
|
||||
|
||||
@@ -77,7 +77,7 @@ MODALT = MODS[Draft.getParam("modalt",2)]
|
||||
def msg(text=None,mode=None):
|
||||
"prints the given message on the FreeCAD status bar"
|
||||
if FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").GetBool("Verbose",True):
|
||||
if not text:
|
||||
if not text:
|
||||
FreeCAD.Console.PrintMessage("")
|
||||
else:
|
||||
if mode == 'warning':
|
||||
@@ -779,7 +779,7 @@ class Wire(Line):
|
||||
|
||||
|
||||
class BSpline(Line):
|
||||
"a FreeCAD command for creating a b-spline"
|
||||
"a FreeCAD command for creating a B-spline"
|
||||
|
||||
def __init__(self):
|
||||
Line.__init__(self,wiremode=True)
|
||||
@@ -2900,7 +2900,7 @@ class Stretch(Modifier):
|
||||
|
||||
def proceed(self):
|
||||
if self.call:
|
||||
self.view.removeEventCallback("SoEvent",self.call)
|
||||
self.view.removeEventCallback("SoEvent",self.call)
|
||||
supported = ["Rectangle","Wire","BSpline","BezCurve","Sketch"]
|
||||
self.sel = []
|
||||
for obj in FreeCADGui.Selection.getSelection():
|
||||
@@ -2910,7 +2910,7 @@ class Stretch(Modifier):
|
||||
if obj.Base:
|
||||
if Draft.getType(obj.Base) in supported:
|
||||
self.sel.append([obj.Base,obj.Placement])
|
||||
|
||||
|
||||
elif Draft.getType(obj.Base) in ["Offset2D","Array"]:
|
||||
base = None
|
||||
if hasattr(obj.Base,"Source") and obj.Base.Source:
|
||||
|
||||
@@ -453,7 +453,7 @@ void FemVTKTools::exportVTKMesh(const FemMesh* mesh, vtkSmartPointer<vtkUnstruct
|
||||
double coords[3] = {double(node->X()*scale), double(node->Y()*scale), double(node->Z()*scale)};
|
||||
points->InsertPoint(node->GetID()-1, coords);
|
||||
// memory is allocated by VTK points size for max node id, not for point count
|
||||
// if the SMESH mesh has gaps in node numbering, points without any element assignement will be inserted in these point gaps too
|
||||
// if the SMESH mesh has gaps in node numbering, points without any element assignment will be inserted in these point gaps too
|
||||
// this needs to be taken into account on node mapping when FreeCAD FEM results are exported to vtk
|
||||
}
|
||||
grid->SetPoints(points);
|
||||
@@ -780,7 +780,7 @@ void FemVTKTools::exportFreeCADResult(const App::DocumentObject* result, vtkSmar
|
||||
const Fem::FemResultObject* res = static_cast<const Fem::FemResultObject*>(result);
|
||||
const vtkIdType nPoints = grid->GetNumberOfPoints();
|
||||
|
||||
// we need the coresponding mesh to get the correct id for the result data (when the freecad smesh mesh has gaps in the points
|
||||
// we need the corresponding mesh to get the correct id for the result data (when the freecad smesh mesh has gaps in the points
|
||||
// vtk has more points. Vtk does not support point gaps, thus the gaps are filled with points. Then the mapping must be correct)
|
||||
App::DocumentObject* meshObj = res->Mesh.getValue();
|
||||
if (!meshObj || !meshObj->isDerivedFrom(FemMeshObject::getClassTypeId())) {
|
||||
@@ -807,7 +807,7 @@ void FemVTKTools::exportFreeCADResult(const App::DocumentObject* result, vtkSmar
|
||||
data->SetNumberOfTuples(nPoints);
|
||||
data->SetName(it->c_str());
|
||||
|
||||
//we need to set values for the unused points.
|
||||
//we need to set values for the unused points.
|
||||
//TODO: ensure that the result bar does not include the used 0 if it is not part of the result (e.g. does the result bar show 0 as smallest value?)
|
||||
if (nPoints != field->getSize()) {
|
||||
double tuple[] = {0,0,0};
|
||||
@@ -844,7 +844,7 @@ void FemVTKTools::exportFreeCADResult(const App::DocumentObject* result, vtkSmar
|
||||
data->SetNumberOfValues(nPoints);
|
||||
data->SetName(it->c_str());
|
||||
|
||||
//we need to set values for the unused points.
|
||||
//we need to set values for the unused points.
|
||||
//TODO: ensure that the result bar does not include the used 0 if it is not part of the result (e.g. does the result bar show 0 as smallest value?)
|
||||
if (nPoints != field->getSize()) {
|
||||
for (vtkIdType i=0; i<nPoints; ++i) {
|
||||
|
||||
@@ -220,7 +220,7 @@ TaskFemConstraintFluidBoundary::TaskFemConstraintFluidBoundary(ViewProviderFemCo
|
||||
}
|
||||
}
|
||||
|
||||
pcSolver = NULL; // this is an private object of type Fem::FemSolverObject*
|
||||
pcSolver = NULL; // this is an private object of type Fem::FemSolverObject*
|
||||
if (pcAnalysis) {
|
||||
std::vector<App::DocumentObject*> fem = pcAnalysis->Group.getValues();
|
||||
for (std::vector<App::DocumentObject*>::iterator it = fem.begin(); it != fem.end(); ++it) {
|
||||
@@ -620,7 +620,7 @@ void TaskFemConstraintFluidBoundary::onSelectionChanged(const Gui::SelectionChan
|
||||
void TaskFemConstraintFluidBoundary::onBoundaryTypeChanged(void)
|
||||
{
|
||||
Fem::ConstraintFluidBoundary* pcConstraint = static_cast<Fem::ConstraintFluidBoundary*>(ConstraintView->getObject());
|
||||
// temperarily change BoundaryType property, but command transaction should reset it back if you 'reject' late
|
||||
// temporarily change BoundaryType property, but command transaction should reset it back if you 'reject' late
|
||||
pcConstraint->BoundaryType.setValue(ui->comboBoundaryType->currentIndex());
|
||||
updateBoundaryTypeUI();
|
||||
|
||||
@@ -675,7 +675,7 @@ void TaskFemConstraintFluidBoundary::onButtonDirection(const bool pressed) {
|
||||
Gui::Selection().clearSelection();
|
||||
/* minor bug: once Direction property(edge link) is cleared in UI, arrow direction is not updated.
|
||||
Direction property can not be easily setup in C++, see example at the end of this file `accept()`
|
||||
redraw will only happen once taskpanel is closed,
|
||||
redraw will only happen once taskpanel is closed,
|
||||
*/
|
||||
//pcConstraint->Direction.setValue(pressed);
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ unittest.TextTestRunner().run(mytest)
|
||||
|
||||
# open files from FEM test suite source code
|
||||
# be careful on updating these files, they consist the original results!
|
||||
# TODO update files, becaus some of them have non existing FEM object classes
|
||||
# TODO update files, because some of them have non-existing FEM object classes
|
||||
doc = FreeCAD.open(FreeCAD.ConfigGet("AppHomePath") + 'Mod/Fem/femtest/testfiles/ccx/cube.FCStd')
|
||||
doc = FreeCAD.open(FreeCAD.ConfigGet("AppHomePath") + 'Mod/Fem/femtest/testfiles/ccx/cube_frequency.FCStd')
|
||||
doc = FreeCAD.open(FreeCAD.ConfigGet("AppHomePath") + 'Mod/Fem/femtest/testfiles/ccx/cube_static.FCStd')
|
||||
@@ -114,4 +114,3 @@ doc = FreeCAD.open(FreeCAD.ConfigGet("AppHomePath") + 'data/examples/Fem.FCStd')
|
||||
doc = FreeCAD.open(FreeCAD.ConfigGet("AppHomePath") + 'data/examples/Fem2.FCStd')
|
||||
|
||||
'''
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ def getMaterialAttributeStructure(withSpaces=None):
|
||||
''''''
|
||||
|
||||
# material properties
|
||||
# see the following resources in the FreeCAD wiki for more informations about the material specific properties:
|
||||
# see the following resources in the FreeCAD wiki for more information about the material specific properties:
|
||||
# https://www.freecadweb.org/wiki/Material_data_model
|
||||
# https://www.freecadweb.org/wiki/Material
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ private:
|
||||
//
|
||||
// target_count : target nr. of triangles
|
||||
// tolerance : tolerance for the quadratic errors
|
||||
// aggressiveness : sharpness to increase the threashold.
|
||||
// aggressiveness : sharpness to increase the threshold.
|
||||
// 5..8 are good numbers
|
||||
// more iterations yield higher quality
|
||||
// If the passed tolerance is > 0 then this will be used to check
|
||||
|
||||
@@ -418,7 +418,7 @@ def callopenscadmeshstring(scadstr):
|
||||
|
||||
def meshopinline(opname,iterable1):
|
||||
"""uses OpenSCAD to combine meshes
|
||||
takes the name of the CGAL operation and an iterable (tuple,list) of
|
||||
takes the name of the CGAL operation and an iterable (tuple,list) of
|
||||
FreeCAD Mesh objects
|
||||
includes all the mesh data in the SCAD file
|
||||
"""
|
||||
@@ -428,7 +428,7 @@ def meshopinline(opname,iterable1):
|
||||
|
||||
def meshoptempfile(opname,iterable1):
|
||||
"""uses OpenSCAD to combine meshes
|
||||
takes the name of the CGAL operation and an iterable (tuple,list) of
|
||||
takes the name of the CGAL operation and an iterable (tuple,list) of
|
||||
FreeCAD Mesh objects
|
||||
uses stl files to supply the mesh data
|
||||
"""
|
||||
@@ -554,7 +554,7 @@ def process3D_ObjectsViaOpenSCADShape(ObjList,Operation,maxmeshpoints=None):
|
||||
def process3D_ObjectsViaOpenSCAD(doc,ObjList,Operation):
|
||||
solid = process3D_ObjectsViaOpenSCADShape(ObjList,Operation)
|
||||
if solid is not None:
|
||||
obj=doc.addObject('Part::Feature',Operation) #non parametric objec
|
||||
obj=doc.addObject('Part::Feature',Operation) #non-parametric object
|
||||
obj.Shape=solid#.removeSplitter()
|
||||
if FreeCAD.GuiUp:
|
||||
for index in ObjList :
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from .CompoundFilter import makeCompoundFilter
|
||||
from .CompoundFilter import makeCompoundFilter
|
||||
|
||||
def explodeCompound(compound_obj, b_group = None):
|
||||
"""explodeCompound(compound_obj, b_group = None): creates a bunch of compound filters, to extract every child of a compount into a separate object.
|
||||
"""explodeCompound(compound_obj, b_group = None): creates a bunch of compound filters, to extract every child of a compound into a separate object.
|
||||
group: if True, Group is always made. If False, group is never made. If None, group is made if there is more than one child.
|
||||
returns: (group_object, list_of_child_objects)"""
|
||||
sh = compound_obj.Shape
|
||||
@@ -10,7 +10,7 @@ def explodeCompound(compound_obj, b_group = None):
|
||||
b_group = n > 1
|
||||
if b_group:
|
||||
group = compound_obj.Document.addObject('App::DocumentObjectGroup','GrExplode_'+compound_obj.Name)
|
||||
group.Label = 'Exploded {obj.Label}'.format(obj = compound_obj)
|
||||
group.Label = 'Exploded {obj.Label}'.format(obj = compound_obj)
|
||||
else:
|
||||
group = compound_obj.Document
|
||||
features_created = []
|
||||
|
||||
@@ -495,7 +495,7 @@ class TestPathGeom(PathTestBase):
|
||||
self.assertEdgeShapesMatch(edge, PathGeom.flipEdge(edge))
|
||||
|
||||
def test75(self):
|
||||
'''Flip a b-spline'''
|
||||
'''Flip a B-spline'''
|
||||
spline = Part.BSplineCurve()
|
||||
spline.interpolate([Vector(1,2,3), Vector(-3,0,7), Vector(-3,1,9), Vector(1, 3, 5)])
|
||||
edge = Part.Edge(spline)
|
||||
|
||||
@@ -4725,7 +4725,7 @@ public:
|
||||
// as the ones created by this tool are intended for the b-spline endpoints, and not for the poles,
|
||||
// so here we retrieve any autoconstraint on those poles' center and mangle it to the endpoint.
|
||||
if (ConstrMethod == 0) {
|
||||
|
||||
|
||||
for(auto & constr : static_cast<Sketcher::SketchObject *>(sketchgui->getObject())->Constraints.getValues()) {
|
||||
if(constr->First == FirstPoleGeoId && constr->FirstPos == Sketcher::mid) {
|
||||
constr->First = currentgeoid;
|
||||
|
||||
@@ -335,7 +335,7 @@ void GeomFillSurface::createBSplineSurface(TopoDS_Wire& aWire)
|
||||
curves.push_back(bspline);
|
||||
}
|
||||
else {
|
||||
// try to convert it into a b-spline
|
||||
// try to convert it into a B-spline
|
||||
BRepBuilderAPI_NurbsConvert mkNurbs(edge);
|
||||
TopoDS_Edge nurbs = TopoDS::Edge(mkNurbs.Shape());
|
||||
// avoid copying
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#***************************************************************************
|
||||
#* *
|
||||
#* Copyright (c) 2015 Yorik van Havre <yorik@uncreated.net> *
|
||||
#* Copyright (c) 2015 Yorik van Havre <yorik@uncreated.net> *
|
||||
#* *
|
||||
#* This program is free software; you can redistribute it and/or modify *
|
||||
#* it under the terms of the GNU Library General Public License (LGPL) *
|
||||
@@ -32,14 +32,14 @@ the API key that gives access to the crowdin FreeCAD project.
|
||||
Usage:
|
||||
|
||||
updatecrowdin.py command
|
||||
|
||||
|
||||
Available commands:
|
||||
|
||||
status: prints a status of the translations
|
||||
update: updates crowdin the current version of .ts files found in the source code
|
||||
build: builds a new downloadable package on crowdin with all trasnlated strings
|
||||
build: builds a new downloadable package on crowdin with all translated strings
|
||||
download: downloads the latest build
|
||||
|
||||
|
||||
Example:
|
||||
|
||||
./updatecrowdin.py update
|
||||
@@ -84,7 +84,7 @@ files = [ ["Arch.ts", "/Mod/Arch/Resources/translations/Arch.ts"],
|
||||
|
||||
# handler for the command responses
|
||||
class ResponseHandler( xml.sax.ContentHandler ):
|
||||
|
||||
|
||||
def __init__(self):
|
||||
self.current = ""
|
||||
self.data = ""
|
||||
@@ -120,14 +120,14 @@ class ResponseHandler( xml.sax.ContentHandler ):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
|
||||
# only one argument allowed
|
||||
arg = sys.argv[1:]
|
||||
if len(arg) != 1:
|
||||
print(__doc__)
|
||||
sys.exit()
|
||||
arg = arg[0]
|
||||
|
||||
|
||||
# getting API key stored in ~/.crowdin-freecad
|
||||
configfile = os.path.expanduser("~")+os.sep+".crowdin-freecad"
|
||||
if not os.path.exists(configfile):
|
||||
@@ -137,35 +137,35 @@ if __name__ == "__main__":
|
||||
url = "https://api.crowdin.com/api/project/freecad/"
|
||||
key = "?key="+f.read().strip()
|
||||
f.close()
|
||||
|
||||
|
||||
if arg == "status":
|
||||
c = pycurl.Curl()
|
||||
c.setopt(pycurl.URL, url+"status"+key+"&xml")
|
||||
b = StringIO.StringIO()
|
||||
c.setopt(pycurl.WRITEFUNCTION, b.write)
|
||||
c.setopt(pycurl.WRITEFUNCTION, b.write)
|
||||
c.perform()
|
||||
c.close()
|
||||
handler = ResponseHandler()
|
||||
xml.sax.parseString(b.getvalue(),handler)
|
||||
print(handler.data)
|
||||
|
||||
|
||||
elif arg == "build":
|
||||
print("Building (warning, this can be invoked only once per 30 minutes)...")
|
||||
c = pycurl.Curl()
|
||||
c.setopt(pycurl.URL, url+"export"+key)
|
||||
b = StringIO.StringIO()
|
||||
c.setopt(pycurl.WRITEFUNCTION, b.write)
|
||||
c.setopt(pycurl.WRITEFUNCTION, b.write)
|
||||
c.perform()
|
||||
c.close()
|
||||
handler = ResponseHandler()
|
||||
xml.sax.parseString(b.getvalue(),handler)
|
||||
print(handler.data)
|
||||
|
||||
|
||||
elif arg == "download":
|
||||
print("Downloading all.zip in current directory...")
|
||||
cmd = "wget -O freecad.zip "+url+"download/all.zip"+key
|
||||
os.system(cmd)
|
||||
|
||||
|
||||
elif arg == "update":
|
||||
basepath = os.path.dirname(os.path.abspath("."))
|
||||
for f in files:
|
||||
@@ -175,7 +175,7 @@ if __name__ == "__main__":
|
||||
c.setopt(pycurl.URL, url+"update-file"+key)
|
||||
c.setopt(pycurl.HTTPPOST, fields)
|
||||
b = StringIO.StringIO()
|
||||
c.setopt(pycurl.WRITEFUNCTION, b.write)
|
||||
c.setopt(pycurl.WRITEFUNCTION, b.write)
|
||||
c.perform()
|
||||
c.close()
|
||||
handler = ResponseHandler()
|
||||
@@ -184,5 +184,3 @@ if __name__ == "__main__":
|
||||
|
||||
else:
|
||||
print(__doc__)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user