Skip to content

Commit

Permalink
KiUtils is now a PIP package, more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
eeintech committed Feb 21, 2023
1 parent 241181d commit b42f036
Show file tree
Hide file tree
Showing 27 changed files with 374 additions and 9,761 deletions.
2 changes: 0 additions & 2 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ omit =
# Do not run coverage on virtual environment files
env-kintree/*
.venv/*
# Skip KiCad library tool
kintree/kicad/kiutils/*
# Skip UI coverage
kintree/kintree_gui.py
kintree/common/progress.py
Expand Down
2 changes: 1 addition & 1 deletion kintree/gui/views/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def on_search(self, e):
self.dropdown.options = self.update_option_list(self.search_field.value)
if len(self.dropdown.options) == 1:
self.dropdown.value = self.dropdown.options[0].key
self.on_change(e)
self.on_change(e, label=self.label, value=self.value)
else:
self.dropdown.value = None
else:
Expand Down
25 changes: 16 additions & 9 deletions kintree/gui/views/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def process_enable(self, e, ignore=['enable']):
def sanitize_data(self):
return

def push_data(self, e=None):
def push_data(self, e=None, label=None, value=None):
for key, field in self.fields.items():
try:
self.data[key] = field.value
Expand Down Expand Up @@ -304,8 +304,11 @@ def run_search(self, e):
supplier=self.fields['supplier'].value,
part_info=part_supplier_info,
)
# Stitch parameters
if part_supplier_info.get('parameters', None):
self.data['parameters'] = part_supplier_info['parameters']

if part_supplier_info:
if part_supplier_form:
for field_idx, field_name in enumerate(self.fields['search_form'].keys()):
# print(field_idx, field_name, get_default_search_keys()[field_idx], search_form_field[field_name])
try:
Expand Down Expand Up @@ -477,13 +480,17 @@ def update_footprint_options(self, library: str):
def push_data(self, e=None, label=None, value=None):
super().push_data(e)
if label or e:
if 'Footprint Library' in [label, e.control.label]:
if value:
selected_footprint_library = value
else:
selected_footprint_library = e.data
self.fields['Footprint'].options = self.update_footprint_options(selected_footprint_library)
self.fields['Footprint'].update()
try:
if 'Footprint Library' in [label, e.control.label]:
if value:
selected_footprint_library = value
else:
selected_footprint_library = e.data
self.fields['Footprint'].options = self.update_footprint_options(selected_footprint_library)
self.fields['Footprint'].update()
except AttributeError:
# Handles condition where search field tries to reset dropdown
pass

def build_library_options(self, type: str):
found_libraries = self.find_libraries(type)
Expand Down
6 changes: 3 additions & 3 deletions kintree/kicad/kicad_symbol.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ def __init__(self, library_path):
def is_symbol_in_library(self, symbol_id):
''' Check if symbol already exists in library '''
for symbol in self.kicad_lib.symbols:
cprint(f'[DBUG]\t{symbol.id} ?= {symbol_id}', silent=settings.HIDE_DEBUG)
if symbol.id == symbol_id:
cprint(f'[DBUG]\t{symbol.libId} ?= {symbol_id}', silent=settings.HIDE_DEBUG)
if symbol.libId == symbol_id:
cprint(f'[KCAD]\tWarning: Component {symbol_id} already in library', silent=settings.SILENT)
return True

Expand Down Expand Up @@ -84,7 +84,7 @@ def add_symbol_to_library_from_inventree(self, symbol_data, template_path=None,
return part_in_lib, new_part

# Update name/ID
new_symbol.id = symbol_id
new_symbol.libId = symbol_id

# Update properties
for property in new_symbol.properties:
Expand Down
10 changes: 0 additions & 10 deletions kintree/kicad/kiutils/__init__.py

This file was deleted.

0 comments on commit b42f036

Please sign in to comment.