Commit 4bab8dde authored by jean-pierre charras's avatar jean-pierre charras

Fix some minor coverity warnings. Fix a bug in pcad2kicad plugin. Scripting:...

Fix some minor coverity warnings. Fix a bug in pcad2kicad plugin. Scripting: map BASE_SET. Rename some python bom scripts with better names. Fix erroneous comments and add comments
parent 25b9a42e
......@@ -227,15 +227,18 @@ static void DrawGraphicTextPline( EDA_RECT* aClipBox,
coord[ik + 1].x, coord[ik + 1].y );
}
}
else if( aSketchMode )
else if( aDC )
{
for( int ik = 0; ik < (point_count - 1); ik++ )
GRCSegm( aClipBox, aDC, coord[ik].x, coord[ik].y,
coord[ik + 1].x, coord[ik + 1].y, aWidth, aColor );
if( aSketchMode )
{
for( int ik = 0; ik < (point_count - 1); ik++ )
GRCSegm( aClipBox, aDC, coord[ik].x, coord[ik].y,
coord[ik + 1].x, coord[ik + 1].y, aWidth, aColor );
}
else
GRPoly( aClipBox, aDC, point_count, coord, 0,
aWidth, aColor, aColor );
}
else
GRPoly( aClipBox, aDC, point_count, coord, 0,
aWidth, aColor, aColor );
}
......
......@@ -48,6 +48,7 @@ KIWAY_PLAYER::KIWAY_PLAYER( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType
m_modal_loop( 0 ), m_modal_resultant_parent( 0 )
{
// DBG( printf("KIWAY_EXPRESS::wxEVENT_ID:%d\n", KIWAY_EXPRESS::wxEVENT_ID );)
m_modal_ret_val = 0;
}
......
......@@ -258,7 +258,7 @@ void DIALOG_EESCHEMA_OPTIONS::OnDeleteButtonClick( wxCommandEvent& event )
// If the selectedField is still not in the templateField range now,
// make sure we stay in range and when there are no fields present
// move to -1
if( selectedField >= templateFields.size() )
if( selectedField >= int( templateFields.size() ) )
selectedField = templateFields.size() - 1;
// Update the display to reflect the new data
......
......@@ -44,13 +44,13 @@ protected:
* edit panel
* selectedField = -1 when no valid item selected
*/
size_t selectedField;
int selectedField;
/** @brief return true if aFieldId is a valid field selection
*/
bool fieldSelectionValid( size_t aFieldId )
bool fieldSelectionValid( int aFieldId )
{
return ( aFieldId >= 0 ) && ( aFieldId < templateFields.size() );
return ( aFieldId >= 0 ) && ( aFieldId < int( templateFields.size() ) );
}
/**
......
......@@ -116,7 +116,8 @@ SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* aDC, int aType )
lastTextItalic = textItem->IsItalic();
lastTextOrientation = textItem->GetOrientation();
if( (aType == SCH_GLOBAL_LABEL_T) || (aType == SCH_HIERARCHICAL_LABEL_T) )
if( ( textItem->Type() == SCH_GLOBAL_LABEL_T ) ||
( textItem->Type() == SCH_HIERARCHICAL_LABEL_T ) )
{
lastGlobalLabelShape = textItem->GetShape();
}
......
......@@ -296,12 +296,12 @@ void SCH_EDIT_FRAME::OnSelectUnit( wxCommandEvent& aEvent )
if( LIB_PART* part = Prj().SchLibs()->FindLibPart( component->GetPartName() ) )
{
wxCHECK_RET( (unit >= 1) && (unit <= part->GetUnitCount()),
int unitCount = part->GetUnitCount();
wxCHECK_RET( (unit >= 1) && (unit <= unitCount),
wxString::Format( wxT( "Cannot select unit %d from component " ), unit ) +
part->GetName() );
int unitCount = part->GetUnitCount();
if( unitCount <= 1 || component->GetUnit() == unit )
return;
......
......@@ -115,6 +115,7 @@ SCH_COMPONENT::SCH_COMPONENT( const wxPoint& aPos, SCH_ITEM* aParent ) :
SCH_ITEM( aParent, SCH_COMPONENT_T )
{
Init( aPos );
m_currentSheetPath = NULL;
}
......@@ -128,6 +129,7 @@ SCH_COMPONENT::SCH_COMPONENT( LIB_PART& aPart, SCH_SHEET_PATH* sheet, int unit,
m_convert = convert;
m_part_name = aPart.GetName();
m_part = aPart.SharedPtr();
m_currentSheetPath = NULL;
SetTimeStamp( GetNewTimeStamp() );
......
......@@ -1035,13 +1035,11 @@ void MODULE::MoveAnchorPosition( const wxPoint& aMoveVector )
* but:
* - the footprint position is not modified.
* - the relative (local) coordinates of these items are modified
* - Draw coordinates are updated
*/
wxPoint footprintPos = GetPosition();
/* Update the relative coordinates:
* The coordinates are relative to the anchor point.
* Calculate deltaX and deltaY from the anchor. */
// Update (move) the relative coordinates relative to the new anchor point.
wxPoint moveVector = aMoveVector;
RotatePoint( &moveVector, -GetOrientation() );
......
......@@ -207,7 +207,7 @@ void PCB_PAD::AddToModule( MODULE* aModule, int aRotation, bool aEncapsulatedPad
pad->SetDrillSize( wxSize( m_hole, m_hole ) );
pad->SetSize( wxSize( m_hole, m_hole ) );
pad->SetLayerSet( LSET::AllCuMask() | LSET( 3, B_Mask, F_Mask ) );
pad->SetLayerSet( LSET::AllCuMask() | LSET( 2, B_Mask, F_Mask ) );
}
else
{
......
......@@ -28,6 +28,7 @@
*/
%include <std_vector.i>
%include <std_basic_string.i>
%include <std_string.i>
%include <std_map.i>
......@@ -65,6 +66,7 @@
#include <wx_python_helpers.h>
#include <cstddef>
#include <vector>
#include <bitset>
#include <class_title_block.h>
#include <class_colors_design_settings.h>
......@@ -114,6 +116,12 @@
%template(intVector) std::vector<int>;
%template(str_utf8_Map) std::map< std::string,UTF8 >;
// wrapper of BASE_SEQ (see typedef std::vector<LAYER_ID> BASE_SEQ;)
%template(base_seqVect) std::vector<enum LAYER_ID>;
// TODO: wrapper of BASE_SET (see std::bitset<LAYER_ID_COUNT> BASE_SET;)
/* KiCad plugin handling */
%include "kicadplugins.i"
......
#
# Example python script to generate a BOM from a KiCad generic netlist
#
# Example: Sorted and Grouped HTML BOM with more advanced grouping
# Example: Sorted and Grouped HTML BOM with advanced grouping
#
"""
......@@ -75,7 +75,7 @@ def myEqu(self, other):
kicad_netlist_reader.comp.__equ__ = myEqu
# Generate an instance of a generic netlist, and load the netlist tree from
# video.tmp. If the file doesn't exist, execution will stop
# <file>.tmp. If the file doesn't exist, execution will stop
net = kicad_netlist_reader.netlist(sys.argv[1])
# Open a file to write too, if the file cannot be opened output to stdout
......
......@@ -9,10 +9,8 @@
"""
@package
Generate a HTML BOM list.
Components are sorted and grouped by value
Fields are (if exist)
Ref, Quantity, Value, Part, Datasheet, Description, Vendor
Helper module for interpreting generic netlist and build custom
bom generators or netlists in foreign format
"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment