Skip to content

Commit

Permalink
chore: rename to exclude DNP #54
Browse files Browse the repository at this point in the history
  • Loading branch information
bennymeg committed Sep 26, 2023
1 parent d3cb950 commit 8a0af1a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion plugins/options.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
IGNORE_DNP_OPT = "IGNORE DNP"
EXCLUDE_DNP_OPT = "EXCLUDE DNP"
OUTPUT_NAME_OPT = "OUTPUT NAME"
12 changes: 6 additions & 6 deletions plugins/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from .thread import ProcessThread
from .events import StatusEvent
from .options import IGNORE_DNP_OPT
from .options import EXCLUDE_DNP_OPT


# WX GUI form that show the plugin progress
Expand All @@ -28,8 +28,8 @@ def __init__(self):

self.mOptionsLabel = wx.StaticText(self, label='Options:')
# self.mOptionsSeparator = wx.StaticLine(self)
self.mIgnoreDnpCheckbox = wx.CheckBox(self, label='Ignore DNP components')
self.mIgnoreDnpCheckbox.SetValue(False)
self.mExcludeDnpCheckbox = wx.CheckBox(self, label='Exclude DNP components')
self.mExcludeDnpCheckbox.SetValue(False)

self.mGenerateButton = wx.Button(self, label='Generate', size=wx.Size(600, 60))

Expand All @@ -44,7 +44,7 @@ def __init__(self):

boxSizer.Add(self.mOptionsLabel, 0, wx.ALL, 5)
# boxSizer.Add(self.mOptionsSeparator, 0, wx.ALL, 5)
boxSizer.Add(self.mIgnoreDnpCheckbox, 0, wx.ALL, 5)
boxSizer.Add(self.mExcludeDnpCheckbox, 0, wx.ALL, 5)
boxSizer.Add(self.mGaugeStatus, 0, wx.ALL, 5)
boxSizer.Add(self.mGenerateButton, 0, wx.ALL, 5)

Expand All @@ -57,9 +57,9 @@ def __init__(self):

def onGenerateButtonClick(self, event):
options = dict()
options[IGNORE_DNP_OPT] = self.mIgnoreDnpCheckbox.GetValue()
options[EXCLUDE_DNP_OPT] = self.mExcludeDnpCheckbox.GetValue()

self.mIgnoreDnpCheckbox.Hide()
self.mExcludeDnpCheckbox.Hide()
self.mOptionsLabel.Hide()
self.mGenerateButton.Hide()
self.mGaugeStatus.Show()
Expand Down
10 changes: 5 additions & 5 deletions plugins/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def generate_netlist(self, temp_dir):
netlist_writer = pcbnew.IPC356D_WRITER(self.board)
netlist_writer.Write(os.path.join(temp_dir, netlistFileName))

def generate_tables(self, temp_dir, ignore_dnp):
def generate_tables(self, temp_dir, exclude_dnp):
'''Generate the data tables.'''
if hasattr(self.board, 'GetModules'):
footprints = list(self.board.GetModules())
Expand Down Expand Up @@ -177,8 +177,9 @@ def generate_tables(self, temp_dir, ignore_dnp):
# 2: 'smt'
# }.get(footprint.GetAttributes())

if not footprint.GetAttributes() & pcbnew.FP_EXCLUDE_FROM_POS_FILES or \
not (ignore_dnp and footprint.GetValue().upper() == 'DNP'):
skip_footprint = exclude_dnp and (footprint.HasProperty('dnp') or footprint.GetValue().upper() == 'DNP')

if not (footprint.GetAttributes() & pcbnew.FP_EXCLUDE_FROM_POS_FILES) and not skip_footprint:
# append unique ID if duplicate footprint designator
unique_id = ""
if footprint_designators[footprint.GetReference()] > 1:
Expand Down Expand Up @@ -213,8 +214,7 @@ def generate_tables(self, temp_dir, ignore_dnp):
'Layer': layer,
})

if not footprint.GetAttributes() & pcbnew.FP_EXCLUDE_FROM_BOM or \
not (ignore_dnp and footprint.GetValue().upper() == 'DNP'):
if not (footprint.GetAttributes() & pcbnew.FP_EXCLUDE_FROM_BOM) and not skip_footprint:
# append unique ID if we are dealing with duplicate bom designator
unique_id = ""
if bom_designators[footprint.GetReference()] > 1:
Expand Down
2 changes: 1 addition & 1 deletion plugins/thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def run(self):

# generate data tables
self.progress(50)
self.process_manager.generate_tables(temp_dir, self.options[IGNORE_DNP_OPT])
self.process_manager.generate_tables(temp_dir, self.options[EXCLUDE_DNP_OPT])

# generate pick and place file
self.progress(60)
Expand Down

0 comments on commit 8a0af1a

Please sign in to comment.