Skip to content

Commit

Permalink
Merge 67a2c05 into 9af3782
Browse files Browse the repository at this point in the history
  • Loading branch information
eeintech committed Apr 13, 2023
2 parents 9af3782 + 67a2c05 commit b069b16
Show file tree
Hide file tree
Showing 20 changed files with 798 additions and 2,443 deletions.
11 changes: 4 additions & 7 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
[run]
omit =
# Do not run coverage on virtual environment files
env-kintree/*
.venv/*
# Skip UI coverage
# Do not run coverage on environment files
*env*
# Skip GUI coverage
kintree/kintree_gui.py
kintree/common/progress.py
kintree/gui/*
# Skip wrapt_timeout_decorator
kintree/wrapt_timeout_decorator/*
kintree/common/progress.py
# Skip test script
run_tests.py
23 changes: 12 additions & 11 deletions .github/workflows/test_deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

strategy:
matrix:
python-version: ['3.8', '3.10']
python-version: ['3.8', '3.9', '3.10', '3.11']

steps:
- name: Checkout code
Expand Down Expand Up @@ -53,12 +53,9 @@ jobs:
continue-on-error: true
strategy:
matrix:
python-version: ['3.8', '3.10']
python-version: ['3.8', '3.9', '3.10', '3.11']

steps:
# - name: Test SnapEDA API
# run: |
# curl snapeda.eeinte.ch/?SN74LV4T125PWR
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -74,7 +71,7 @@ jobs:
git clone https://github.com/inventree/InvenTree/
mkdir InvenTree/static
cp tests/files/inventree_default_db.sqlite3 InvenTree/
cd InvenTree/ && invoke install && invoke migrate && cd -
cd InvenTree/ && git switch stable && invoke install && invoke migrate && cd -
- name: Ki-nTree setup
run: |
invoke install
Expand All @@ -90,19 +87,23 @@ jobs:
cat gui.log
export len_log=$(cat gui.log | wc -l)
[[ ${len_log} -eq 0 ]] && true || false
- name: Digi-Key API setup
- name: Run tests
if: github.repository == 'sparkmicro/Ki-nTree'
run: |
git clone https://$TOKEN_DIGIKEY@github.com/eeintech/digikey-token.git
cp digikey-token/token_storage.json ~/.config/kintree/cache/
cat ~/.config/kintree/cache/token_storage.json
- name: Run tests
run: |
invoke test
dk_token=$(cat ~/.config/kintree/cache/token_storage.json)
echo -e "Digi-Key Token: $dk_token\n"
invoke test -e 1
env:
DIGIKEY_CLIENT_ID: ${{ secrets.DIGIKEY_CLIENT_ID }}
DIGIKEY_CLIENT_SECRET: ${{ secrets.DIGIKEY_CLIENT_SECRET }}
MOUSER_PART_API_KEY: ${{ secrets.MOUSER_PART_API_KEY }}
ELEMENT14_PART_API_KEY: ${{ secrets.ELEMENT14_PART_API_KEY }}
- name: Run tests (skip APIs)
if: github.repository != 'sparkmicro/Ki-nTree'
run: |
invoke test -e 0
- name: Coveralls
run: |
coveralls --version
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
dist/
build/
*.spec
# Cache-backup files
# Cache and backup files
*__pycache__*
*.bck
# Test files
Expand Down
14 changes: 3 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
# <img src="https://raw.githubusercontent.com/sparkmicro/Ki-nTree/main/images/logo.png" width="auto" height="32"> Ki-nTree
### Fast part creation in [KiCad](https://kicad.org/) and [InvenTree](https://inventree.org/)
### Fast part creation for [KiCad](https://kicad.org/) and [InvenTree](https://inventree.org/)
[![License: GPL v3.0](https://img.shields.io/badge/license-GPL_v3.0-green.svg)](https://www.gnu.org/licenses/gpl-3.0)
[![Python Versions](https://raw.githubusercontent.com/sparkmicro/Ki-nTree/main/images/python_versions.svg)](https://www.python.org/)
[![PyPI](https://img.shields.io/pypi/v/kintree)](https://pypi.org/project/kintree/)
[![Tests | Linting | Publishing](https://github.com/sparkmicro/Ki-nTree/actions/workflows/test_deploy.yaml/badge.svg)](https://github.com/sparkmicro/Ki-nTree/actions)
[![Coverage Status](https://coveralls.io/repos/github/sparkmicro/Ki-nTree/badge.svg?branch=main&service=github)](https://coveralls.io/github/sparkmicro/Ki-nTree?branch=main)

## New version (1.0) is coming soon!

To install the release candidate:
``` shell
pip install --pre -U kintree
```
## :fast_forward: [Demo Video](https://youtu.be/ZsU6iZ6KgY4)

<img src="https://raw.githubusercontent.com/sparkmicro/Ki-nTree/main/images/doc/kintree_v1_example.png" width="auto" height="auto">

## Demo Videos :fast_forward: [Full Demo](https://youtu.be/haSAu926BOI) :fast_forward: [KiCad Demo](https://youtu.be/NSMfCCD0uVw)

## Introduction
Ki-nTree (pronounced "Key Entry" or "Key 'n' Tree") aims to:
* automate part creation of KiCad library parts
Expand Down Expand Up @@ -44,7 +37,7 @@ Ki-nTree was developped by [@eeintech](https://github.com/eeintech) for [SPARK M

### Requirements

* Ki-nTree is currently tested for Python 3.8 to 3.10 versions.
* Ki-nTree is currently tested for Python 3.8 to 3.11 versions.
* Ki-nTree requires a Digi-Key **production** API instance. To create one, go to https://developer.digikey.com/. Create an account, an organization and add a **production** API to your organization. Save both Client ID and Secret keys.
> [Here is a video](https://youtu.be/OI1EGEc0Ju0) to help with the different steps
* Ki-nTree requires a Mouser Search API key. To request one, head over to https://www.mouser.ca/api-search/ and click on "Sign Up for Search API"
Expand Down Expand Up @@ -111,7 +104,6 @@ Configuration files are stored in the folder pointed by the `Configuration Files

<img src="https://raw.githubusercontent.com/sparkmicro/Ki-nTree/main/images/doc/kintree_v1_settings_user.png" width="600" height="auto">


<details>
<summary><b>Click here to read about configuration files</b></summary>
<p>
Expand Down
2 changes: 1 addition & 1 deletion images/python_versions.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 0 additions & 18 deletions kintree/database/inventree_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,24 +362,6 @@ def create_part(category_id: int, name: str, description: str, revision: str, im
return 0


def delete_part(part_id: int) -> bool:
''' Delete InvenTree part (only used for testing) '''
global inventree_api

part = Part(inventree_api, part_id)
if part.pk:
part._data['active'] = False
# Remove image url (API rejects it as it is not a file)
try:
del part._data['image']
except:
pass
part.save()
return part.delete()
else:
return True


def create_company(company_name: str, manufacturer=False, supplier=False) -> bool:
''' Create InvenTree company '''
global inventree_api
Expand Down
10 changes: 8 additions & 2 deletions kintree/gui/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ def init_gui(page: ft.Page):
# Theme
update_theme(page)

# Creating a progress bar that will be used to show the user that the app is busy doing something.
# Creating a progress bar that will be used
# to show the user that the app is busy doing something
page.splash = ft.ProgressBar(visible=False)

# Init dialogs
Expand Down Expand Up @@ -94,7 +95,12 @@ def view_pop(e):
# Route and render
page.go(top_view.route)
if 'main' in top_view.route:
handle_transition(page, transition=False, update_page=True, timeout=0.3)
handle_transition(
page,
transition=False,
update_page=True,
timeout=0.3,
)
if 'part' in top_view.route:
part_view.partial_update()
elif 'inventree' in top_view.route:
Expand Down
File renamed without changes
3 changes: 1 addition & 2 deletions kintree/gui/views/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@

# Main AppBar
main_appbar = ft.AppBar(
# leading=ft.Icon(ft.icons.DOUBLE_ARROW),
leading=ft.Container(
content=ft.Image(
src=os.path.join(settings.PROJECT_DIR, 'logo.png'),
src=os.path.join(settings.PROJECT_DIR, 'gui', 'logo.png'),
fit=ft.ImageFit.CONTAIN,
),
padding=ft.padding.only(left=10),
Expand Down
Empty file removed kintree/kicad/__init__.py
Empty file.
5 changes: 0 additions & 5 deletions kintree/kicad/kicad_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,3 @@ def inventree_to_kicad(part_data: dict, library_path: str, template_path=None, s
template_path=template_path,
show_progress=show_progress
)

# NOT YET SUPPORTED - REMOVE?
# def delete_part(part_number: str, library_path: str) -> bool:
# ''' Delete KiCad symbol from library '''
# pass
5 changes: 0 additions & 5 deletions kintree/kicad/kicad_symbol.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,3 @@ def add_symbol_to_library_from_inventree(self, symbol_data, template_path=None,
pass

return part_in_lib, new_part

# NOT YET SUPPORTED - REMOVE?
# def delete_symbol_from_lib(self, part_number):
# ''' Remove symbol from KiCad library '''
# pass
Loading

0 comments on commit b069b16

Please sign in to comment.