Browse Source

Misc. source comment typo and whitespace fixes

Found via codespell
master
luz.paz 3 months ago
parent
commit
9453e68e23

+ 1
- 1
CMakeLists.txt View File

@@ -229,7 +229,7 @@ if(MSVC)
# Copy libpack 'bin' directory contents to build 'bin' per user request - only IF NOT EXISTS already
if (NOT EXISTS ${CMAKE_BINARY_DIR}/bin/DLLs)
set(COPY_LIBPACK_BIN_TO_BUILD ON)
option(FREECAD_COPY_LIBPACK_BIN_TO_BUILD "Copy larger libpack dependency 'bin' folder to the build direcctory." OFF)
option(FREECAD_COPY_LIBPACK_BIN_TO_BUILD "Copy larger libpack dependency 'bin' folder to the build directory." OFF)
endif()
else()
message("Libpack NOT found.\nIf you intend to use a Windows libpack, set the FREECAD_LIBPACK_DIR to the libpack directory.")

+ 3
- 3
src/Gui/DlgMacroRecordImp.h View File

@@ -37,7 +37,7 @@ namespace Dialog {
* \author Jürgen Riegel
*/
class DlgMacroRecordImp : public QDialog, public Ui_DlgMacroRecord, public Gui::WindowParameter
{
{
Q_OBJECT
public:
@@ -52,8 +52,8 @@ protected Q_SLOTS:
void on_lineEditMacroPath_textChanged ( const QString & );
protected:
/// conviniance pointer
MacroManager* macroManager;
/// convenience pointer
MacroManager* macroManager;
QString macroPath; // Macro file to save in
};

+ 5
- 3
src/Mod/Draft/DraftGeomUtils.py View File

@@ -47,9 +47,11 @@ params = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft")

def precision():
"precision(): returns the Draft precision setting"
# Set precision level with a cap to avoid overspecification that:-
# 1 - whilst it is precise enough (e.g. that OCC would consider 2 points are conincident) (not sure what it should be 10 or otherwise);
# 2 - but FreeCAD / OCC can handle 'internally' (e.g. otherwise user may set something like 15 that the code would never consider 2 points are coincident as internal float is not that precise);
# Set precision level with a cap to avoid overspecification that:
# 1 - whilst it is precise enough (e.g. that OCC would consider 2 points are coincident)
# (not sure what it should be 10 or otherwise);
# 2 - but FreeCAD/OCC can handle 'internally' (e.g. otherwise user may set something like
# 15 that the code would never consider 2 points are coincident as internal float is not that precise);

precisionMax = 10
precisionInt = params.GetInt("precision",6)

+ 3
- 4
src/Mod/Fem/App/FemMesh.cpp View File

@@ -946,10 +946,10 @@ std::set<int> FemMesh::getFacesOnly(void) const
// get the volume nodes
// if the face nodes are a subset of the volume nodes
// add the face to the volume faces and break
// if face not belongs to a volume
// if face doesn't belong to a volume
// add it to faces only
//
// This means it is iterated over a lot of volumes many times, this is quite expensive !
// This means it is iterated over a lot of volumes many times, this is quite expensive!
//
// TODO make this faster
// Idea:
@@ -959,7 +959,7 @@ std::set<int> FemMesh::getFacesOnly(void) const
// if not in volume faces
// add it to the faces only
//
// but the volume faces does not seam know their global mesh ID, I could not found any method in SMESH
// but the volume faces do not seem to know their global mesh ID, I could not find any method in SMESH

std::set<int> resultIDs;

@@ -2050,4 +2050,3 @@ Base::Quantity FemMesh::getVolume(void)const


}


+ 4
- 4
src/Mod/Fem/femmesh/meshtools.py View File

@@ -201,14 +201,14 @@ def get_femnodes_ele_table(
):
'''the femnodes_ele_table contains for each node its membership in elements
{nodeID : [[eleID, NodePosition], [], ...], nodeID : [[], [], ...], ...}
stored informatation are:
stored information is:
element number, the number of nodes per element
the position of the node in the element.
The position of the node in the element is coded
as a set bit at that position in a bit array (integer)
FIXME: the number of nodes per element should be
replaced by the type of the element
but I did not know, how to get this from the mesh.
but I did not know how to get this from the mesh.
Since the femelement_table contains either
volume or face or edgemesh the femnodes_ele_table only
has either volume or face or edge elements
@@ -1799,9 +1799,9 @@ def get_anlysis_empty_references_group_elements(
aShape
):
'''get the elementIDs if the Reference shape is empty
see get_analysis_group_elements() for more informatations
see get_analysis_group_elements() for more information
on solid meshes only material objects could have an
empty reference without being something wrong!
empty reference without there being something wrong!
face meshes could have empty ShellThickness and
edge meshes could have empty BeamSection/FluidSection
'''

+ 8
- 8
src/Mod/Fem/femtest/testcommon.py View File

@@ -59,9 +59,9 @@ class TestFemCommon(unittest.TestCase):
slab.Width = 500.00
cf = ObjectsFem.makeConstraintFixed(doc)
ref_eles = []
# FreeCAD list property seam not to support append,
# thus we need some workaround
# which is on many elements even much faster
# FreeCAD list property doesn't seem to support append,
# thus we need a workaround
# which on many elements is even much faster
for i, face in enumerate(slab.Shape.Edges):
ref_eles.append("Edge%d" % (i + 1))
cf.References = [(slab, ref_eles)]
@@ -77,11 +77,11 @@ class TestFemCommon(unittest.TestCase):
def test_pyimport_all_FEM_modules(
self
):
# we're going to try to import all python modules from FreeCAD Fem
# we're going to try to import all python modules from FreeCAD FEM
pymodules = []

# collect all Python modules in Fem
pymodules += testtools.collect_python_modules('') # Fem main dir
# collect all Python modules in FEM
pymodules += testtools.collect_python_modules('') # FEM main dir
pymodules += testtools.collect_python_modules('femexamples')
pymodules += testtools.collect_python_modules('feminout')
pymodules += testtools.collect_python_modules('femmesh')
@@ -90,8 +90,8 @@ class TestFemCommon(unittest.TestCase):
pymodules += testtools.collect_python_modules('femtest')
pymodules += testtools.collect_python_modules('femtools')
pymodules += testtools.collect_python_modules('femsolver')
# TODO test with join on windows, the use of os.path.join
# in following code seams to make problems on windws os
# TODO test with join on Windows, the use of os.path.join
# in the following code seems to create problems on Windows OS
pymodules += testtools.collect_python_modules('femsolver/elmer')
pymodules += testtools.collect_python_modules('femsolver/elmer/equations')
pymodules += testtools.collect_python_modules('femsolver/z88')

+ 1
- 1
src/Mod/Material/StandardMaterial/Tools/make_ods.sh View File

@@ -4,7 +4,7 @@
FCMAT_DIR="../"
MATERIALS_FILE=Materials

# Remove exisitng $MATERIALS_FILE.csv
# Remove existing $MATERIALS_FILE.csv
if [ -f "$MATERIALS_FILE.csv" ]
then
rm $MATERIALS_FILE.csv

+ 5
- 5
src/Mod/Material/importFCMat.py View File

@@ -89,7 +89,7 @@ def decode(name):
# in the module Material.py is another implementation of reading and writing FCMat files
# this implementation uses the ConfigParser module
# in ViewProviderFemMaterial in add_cards_from_a_dir() the parser from Material.py is used
# since this mixture seams to be there for ages it should not be changed for 0.18
# since this mixture seems to have be there for ages it should not be changed for 0.18
# TODO: get rid of this mixture in FreeCAD 0.19

# Metainformation
@@ -102,7 +102,7 @@ def decode(name):
def read(filename):
"reads a FCMat file and returns a dictionary from it"
# the reader should return a dictionary in any case even if the file
# has problems, a empty dict shuld be returned un such case
# has problems, an empty dict should be returned in such case
if isinstance(filename, unicode):
if sys.version_info.major < 3:
filename = filename.encode(sys.getfilesystemencoding())
@@ -117,7 +117,7 @@ def read(filename):
for ln, line in enumerate(f):
ln += 1 # enumerate starts with 0, but we would like to have the real line number
if line.startswith('#'):
# a # is assumed to be a comment which is ignored
# a '#' is assumed to be a comment which is ignored
continue
# the use of line number is not smart for a data model
# a wrong user edit could break the file
@@ -141,7 +141,7 @@ def read(filename):
# [ is a Section
if line[0] not in ";[":
# split once on first occurrence
# a link could contain a = and thus would be split
# a link could contain a '=' and thus would be split
k = line.split("=", 1)
if len(k) == 2:
v = k[1].strip()
@@ -223,7 +223,7 @@ def write(filename, dictionary, write_group_section=True):
f.write("\n[" + s["keyname"] + "]\n")
for k, i in s.items():
if (k != "keyname" and i != '') or k == "Name":
# use only keys which are not empty and the name even if empty
# use only keys which are not empty and the name, even if empty
if sys.version_info.major >= 3:
f.write(k + " = " + i + "\n")
else:

+ 2
- 1
src/Mod/Material/materialtools/cardutils.py View File

@@ -607,7 +607,8 @@ def output_value_unit_info(param, value):

def check_mat_units(mat):
known_quantities = get_known_material_quantity_parameter()
# check if the param is a Quantity according card template, than chaeck unit
# check if the param is a Quantity according to the card template
# then check unit
# print(known_quantities)
units_ok = True
for param, value in mat.items():

+ 1
- 1
src/Mod/Path/PathScripts/PathToolControllerGui.py View File

@@ -34,7 +34,7 @@ import PathScripts.PathUtil as PathUtil

from PySide import QtCore, QtGui

# Qt tanslation handling
# Qt translation handling
def translate(context, text, disambig=None):
return QtCore.QCoreApplication.translate(context, text, disambig)


+ 2
- 2
src/Mod/Path/PathScripts/post/grbl_post.py View File

@@ -46,10 +46,10 @@ grbl_post.export(object, "/path/to/file.ncc")
# Default values for command line arguments:
OUTPUT_COMMENTS = True # default output of comments in output gCode file
OUTPUT_HEADER = True # default output header in output gCode file
OUTPUT_LINE_NUMBERS = False # default does'nt utput lines numbers in output gCode file
OUTPUT_LINE_NUMBERS = False # default doesn't output line numbers in output gCode file
SHOW_EDITOR = True # default show the resulting file dialog output in GUI
PRECISION = 3 # Default precision for metric (see http://linuxcnc.org/docs/2.7/html/gcode/overview.html#_g_code_best_practices)
TRANSLATE_DRILL_CYCLES = False # If true, G81, G82 & G83 are translated in G0/G1 moves
TRANSLATE_DRILL_CYCLES = False # If true, G81, G82 & G83 are translated in G0/G1 moves
PREAMBLE = '''G17 G90
''' # default preamble text will appear at the beginning of the gCode output file.
POSTAMBLE = '''M5

+ 41
- 41
src/Mod/Spreadsheet/App/Spreadsheet_legacy.py View File

@@ -45,7 +45,7 @@ class MathParser:
if self.vars.get(var) != None:
raise RuntimeError("Cannot redefine the value of " + var)
self.vars[var] = vars[var]
def getValue(self):
value = self.parseExpression()
self.skipWhitespace()
@@ -56,23 +56,23 @@ class MathParser:
"' at index " +
str(self.index))
return value
def peek(self):
return self.string[self.index:self.index + 1]
def hasNext(self):
return self.index < len(self.string)
def skipWhitespace(self):
while self.hasNext():
if self.peek() in ' \t\n\r':
self.index += 1
else:
return
def parseExpression(self):
return self.parseAddition()
def parseAddition(self):
values = [self.parseMultiplication()]
while True:
@@ -87,7 +87,7 @@ class MathParser:
else:
break
return sum(values)
def parseMultiplication(self):
values = [self.parseParenthesis()]
while True:
@@ -112,7 +112,7 @@ class MathParser:
for factor in values:
value *= factor
return value
def parseParenthesis(self):
self.skipWhitespace()
char = self.peek()
@@ -128,7 +128,7 @@ class MathParser:
return value
else:
return self.parseNegative()
def parseNegative(self):
self.skipWhitespace()
char = self.peek()
@@ -137,7 +137,7 @@ class MathParser:
return -1 * self.parseParenthesis()
else:
return self.parseValue()
def parseValue(self):
self.skipWhitespace()
char = self.peek()
@@ -145,7 +145,7 @@ class MathParser:
return self.parseNumber()
else:
return self.parseVariable()
def parseVariable(self):
self.skipWhitespace()
var = ''
@@ -156,7 +156,7 @@ class MathParser:
self.index += 1
else:
break
value = self.vars.get(var, None)
if value == None:
raise ValueError(
@@ -164,15 +164,15 @@ class MathParser:
var +
"'")
return float(value)
def parseNumber(self):
self.skipWhitespace()
strValue = ''
decimal_found = False
char = ''
while self.hasNext():
char = self.peek()
char = self.peek()
if char == '.':
if decimal_found:
raise SyntaxError(
@@ -186,7 +186,7 @@ class MathParser:
else:
break
self.index += 1
if len(strValue) == 0:
if char == '':
raise SyntaxError("Unexpected end found")
@@ -197,21 +197,21 @@ class MathParser:
" but instead I found a '" +
char +
"'. What's up with that?")
return float(strValue)

class Spreadsheet:
"""An object representing a spreadsheet. Can be used as a
FreeCAD object or as a standalone python object.
Cells of the spreadsheet can be got/set as arguments, as:
myspreadsheet = Spreadsheet()
myspreadsheet.a1 = 54
print(myspreadsheet.a1)
myspreadsheet.a2 = "My text"
myspreadsheet.b1 = "=a1*3"
print(myspreadsheet.b1)
The cell names are case-insensitive (a1 = A1)
"""

@@ -269,13 +269,13 @@ class Spreadsheet:
return self._cells[key]
else:
return self.__dict__.__getitem__(key)
def __setitem__(self, key, value):
__setattr__(self, key, value)

def __getitem__(self, key):
return __getattr__(self, key)
def __getstate__(self):
self._cells["Type"] = self.Type
if hasattr(self,"Object"):
@@ -347,7 +347,7 @@ class Spreadsheet:
return True
else:
return False
def isNumeric(self,key):
"isNumeric(cell): returns True if the given cell returns a number"
key = key.lower()
@@ -376,7 +376,7 @@ class Spreadsheet:
else:
if not nu:
# forbidden to set items at row 0
if v == "0":
if v == "0":
return False
if v.isalpha():
if not allowMoreThanOneLetter:
@@ -394,7 +394,7 @@ class Spreadsheet:
c = ''
r = ''
for ch in key:
if ch.isalpha():
if ch.isalpha():
c += ch
else:
r += ch
@@ -420,7 +420,7 @@ class Spreadsheet:
if index in [c,r]:
cells[k] = self._cells[k]
return cells
def evaluate(self,key):
"evaluate(key): evaluates the given formula"
key = key.lower()
@@ -458,7 +458,7 @@ class Spreadsheet:
co.Proxy.setCells(co,obj)
elif Draft.getType(co) == "SpreadsheetPropertyController":
co.Proxy.compute(co)
def getControlledCells(self,obj):
"returns a list of cells managed by controllers"
cells = []
@@ -499,18 +499,18 @@ class ViewProviderSpreadsheet(object):
self.editor = SpreadsheetView(vobj.Object)
addSpreadsheetView(self.editor)
return True
def unsetEdit(self,vobj,mode=0):
return False

def doubleClicked(self,vobj):
self.setEdit(vobj)
def claimChildren(self):
if hasattr(self,"Object"):
if hasattr(self.Object,"Controllers"):
return self.Object.Controllers
def __getstate__(self):
return None

@@ -532,17 +532,17 @@ class SpreadsheetController:
obj.FilterType = ["Object Type","Object Name"]
obj.DataType = ["Get Property","Count"]
obj.Direction = ["Horizontal","Vertical"]
def execute(self,obj):
pass
def __getstate__(self):
return self.Type

def __setstate__(self,state):
if state:
self.Type = state
def onChanged(self,obj,prop):
if prop == "DataType":
if obj.DataType == "Count":
@@ -659,7 +659,7 @@ class SpreadsheetPropertyController:
obj.addProperty("App::PropertyString","TargetProperty","Base","The property or constraint of the target object to control")
obj.addProperty("App::PropertyString","Cell","Base","The cell that contains the value to apply to the property")
obj.TargetType = ["Property","Constraint"]
def execute(self,obj):
pass

@@ -708,14 +708,14 @@ class SpreadsheetPropertyController:
except:
if DEBUG: print("unable to set constraint ",obj.TargetProperty, " of object ",obj.TargetObject.Name, " to ",value)

def __getstate__(self):
return self.Type

def __setstate__(self,state):
if state:
self.Type = state
def onChanged(self,obj,prop):
pass

@@ -736,7 +736,7 @@ class SpreadsheetView(QtGui.QWidget):
def __init__(self,spreadsheet=None):
from DraftTools import translate
QtGui.QWidget.__init__(self)
self.setWindowTitle(str(translate("Spreadsheet","Spreadsheet")))
self.setObjectName("Spreadsheet viewer")
self.verticalLayout = QtGui.QVBoxLayout(self)
@@ -877,7 +877,7 @@ class SpreadsheetView(QtGui.QWidget):
if content == None:
content = ""
self.lineEdit.setText(str(content))
def getEditLine(self):
"called when something has been entered in the edit line"
txt = str(self.lineEdit.text())
@@ -988,8 +988,8 @@ def makeSpreadsheet():


def makeSpreadsheetController(spreadsheet,cell=None,direction=None):
"""makeSpreadsheetController(spreadsheet,[cell,direction]): adds a
controller to the given spreadsheet. Call can be a starting cell such as "A5",
"""makeSpreadsheetController(spreadsheet,[cell,direction]): adds a
controller to the given spreadsheet. Call can be a starting cell such as "A5",
and direction can be "Horizontal" or "Vertical"."""
obj = FreeCAD.ActiveDocument.addObject("App::FeaturePython","CellController")
SpreadsheetController(obj)
@@ -1006,7 +1006,7 @@ def makeSpreadsheetController(spreadsheet,cell=None,direction=None):


def makeSpreadsheetPropertyController(spreadsheet,object=None,prop=None,cell=None):
"""makeSpreadsheetPropertyController(spreadsheet,[object,prop,cell]): adds a
"""makeSpreadsheetPropertyController(spreadsheet,[object,prop,cell]): adds a
property controller, targeting the given object if any, to the given spreadsheet.
You can give a property (such as "Length" or "Proxy.Length") and a cell address
(such as "B6")."""
@@ -1092,7 +1092,7 @@ def export(exportList,filename):
return
obj = exportList[0]
if Draft.getType(obj) != "Spreadsheet":
print("Spreadhseet: The selected object is not a spreadsheet")
print("Spreadsheet: The selected object is not a spreadsheet")
return
if not obj.Proxy._cells:
print("Spreadsheet: The selected spreadsheet contains no cell")

+ 2
- 2
vagrant/Xenial/reset View File

@@ -13,13 +13,13 @@ if [ "$(id -u)" != 0 ]; then
fi

echo "This script will permanently destroy and reset all state in snapd"
echo "You will loose all of your installed snaps"
echo "You will lose all of your installed snaps"
echo
echo "Type: DESTROY to remove all of your snap state"
echo
read consent

if [ "$consent" != "DESTROY" ]; then
if [ "$consent" != "DESTROY" ]; then
echo "No consent, aborting"
exit 0
fi

Loading…
Cancel
Save