Skip to content

Commit

Permalink
Added SnapEDA button to KiCad view
Browse files Browse the repository at this point in the history
  • Loading branch information
eeintech committed Feb 22, 2023
1 parent 6f0991a commit 5b9b895
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 9 deletions.
65 changes: 57 additions & 8 deletions kintree/gui/views/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,14 +521,58 @@ class KicadView(MainView):

title = 'KiCad'
fields = {
'enable': ft.Switch(label='KiCad', value=settings.ENABLE_KICAD, on_change=None),
'Symbol Library': DropdownWithSearch(label='', dr_width=400, sr_width=400, dense=True, options=[]),
'Symbol Template': DropdownWithSearch(label='', dr_width=400, sr_width=400, dense=True, options=[]),
'Footprint Library': DropdownWithSearch(label='', dr_width=400, sr_width=400, dense=True, options=[]),
'Footprint': DropdownWithSearch(label='', dr_width=400, sr_width=400, dense=True, options=[]),
'New Footprint Name': ft.TextField(label='New Footprint Name', width=400, dense=True),
'enable': ft.Switch(
label='KiCad',
value=settings.ENABLE_KICAD,
),
'Symbol Library': DropdownWithSearch(
label='',
dr_width=GUI_PARAMS['textfield_width'],
sr_width=GUI_PARAMS['textfield_width'],
dense=GUI_PARAMS['textfield_dense'],
options=[],
),
'Symbol Template': DropdownWithSearch(
label='',
dr_width=GUI_PARAMS['textfield_width'],
sr_width=GUI_PARAMS['textfield_width'],
dense=GUI_PARAMS['textfield_dense'],
options=[],
),
'Footprint Library': DropdownWithSearch(
label='',
dr_width=GUI_PARAMS['textfield_width'],
sr_width=GUI_PARAMS['textfield_width'],
dense=GUI_PARAMS['textfield_dense'],
options=[],
),
'Footprint': DropdownWithSearch(
label='',
dr_width=GUI_PARAMS['textfield_width'],
sr_width=GUI_PARAMS['textfield_width'],
dense=GUI_PARAMS['textfield_dense'],
options=[],
),
'New Footprint Name': ft.TextField(
label='New Footprint Name',
width=GUI_PARAMS['textfield_width'],
dense=GUI_PARAMS['textfield_dense'],
),
'Check SnapEDA': ft.ElevatedButton(
content=ft.Row(
[
ft.Icon('search'),
ft.Text('Check SnapEDA', size=16),
]
),
height=GUI_PARAMS['button_height'],
width=GUI_PARAMS['button_width'] * 2,
),
}

def check_snapeda(self, e):
print('Checking SnapEDA...')

def update_footprint_options(self, library: str):
footprint_options = []
# Load paths
Expand Down Expand Up @@ -575,8 +619,13 @@ def build_column(self):
)
kicad_inputs = []
for name, field in self.fields.items():
if name != 'enable':
field.on_change = self.push_data
# Update callbacks
if type(field) == ft.ElevatedButton:
field.on_click = self.check_snapeda
else:
if name != 'enable':
field.on_change = self.push_data
# Update options
if type(field) == DropdownWithSearch:
field.label = name
if name == 'Symbol Library':
Expand Down
3 changes: 2 additions & 1 deletion run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,11 @@ def check_result(status: str, new_part: bool) -> bool:
'category_tree': [supplier_info['category'], supplier_info['subcategory']],
'parameters': supplier_info['parameters'],
'Symbol': f'{category}:{number}',
'Template': [supplier_info['category'], supplier_info['subcategory']],
})
# Update categories
part_info['category_tree'] = inventree_interface.get_categories_from_supplier_data(part_info)
# Needed for tests
part_info['Template'] = part_info['category_tree']
# Display part to be tested
pretty_test_print(f'[INFO]\tChecking "{number}" ({status})')

Expand Down

0 comments on commit 5b9b895

Please sign in to comment.