forked from snhobbs/kicad-testpoints-pcm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
4,208 additions
and
330 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Build Asset | ||
on: | ||
workflow_dispatch: | ||
branches: | ||
|
||
jobs: | ||
build: | ||
|
||
name: Build | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@master | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
|
||
- name: Update zip | ||
run: | | ||
cd pcm | ||
python build.py | ||
cd build | ||
echo "ZIP_NAME=$(ls kicadtestpoints*.zip)" >> $GITHUB_ENV | ||
echo "PCM_NAME=$(ls kicadtestpoints*.zip | rev | cut -c 5- | rev)" >> $GITHUB_ENV | ||
- name: Upload pcm build to action - avoid double-zip | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ env.PCM_NAME }} | ||
path: ./pcm/build/${{ env.PCM_NAME }} | ||
retention-days: 7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Build Asset for Release | ||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
build: | ||
|
||
name: Build | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@master | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
|
||
- name: Update zip | ||
run: | | ||
cd pcm | ||
python build.py | ||
cd build | ||
echo "ZIP_NAME=$(ls kicadtestpoints*.zip)" >> $GITHUB_ENV | ||
echo "PCM_NAME=$(ls kicadtestpoints*.zip | rev | cut -c 5- | rev)" >> $GITHUB_ENV | ||
- name: Publish release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: | | ||
./pcm/build/${{ env.ZIP_NAME }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
## Aknowlegements | ||
+ KiCAD PCM Packaging: Fully based off of (https://github.com/sparkfun/SparkFun_KiCad_Panelizer). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .SparkFunKiCadPanelizer import plugin |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import os | ||
import sys | ||
import subprocess | ||
import threading | ||
import time | ||
|
||
import wx | ||
import wx.aui | ||
from wx import FileConfig | ||
|
||
import os | ||
from .util import add_paths | ||
dir_path = os.path.dirname(os.path.realpath(__file__)) | ||
paths = dir_path | ||
#paths = [ | ||
# os.path.join(dir_path, 'deps'), | ||
#] | ||
|
||
def check_for_panelizer_button(): | ||
# From Miles McCoo's blog | ||
# https://kicad.mmccoo.com/2017/03/05/adding-your-own-command-buttons-to-the-pcbnew-gui/ | ||
def find_pcbnew_window(): | ||
windows = wx.GetTopLevelWindows() | ||
pcbneww = [w for w in windows if "pcbnew" in w.GetTitle().lower()] | ||
if len(pcbneww) != 1: | ||
return None | ||
return pcbneww[0] | ||
|
||
def callback(_): | ||
plugin.Run() | ||
|
||
while not wx.GetApp(): | ||
time.sleep(1) | ||
bm = wx.Bitmap(os.path.join(os.path.dirname(__file__),'icon.png'), wx.BITMAP_TYPE_PNG) | ||
button_wx_item_id = 0 | ||
|
||
from pcbnew import ID_H_TOOLBAR | ||
while True: | ||
time.sleep(1) | ||
pcbnew_window = find_pcbnew_window() | ||
if not pcbnew_window: | ||
continue | ||
|
||
top_tb = pcbnew_window.FindWindowById(ID_H_TOOLBAR) | ||
if button_wx_item_id == 0 or not top_tb.FindTool(button_wx_item_id): | ||
top_tb.AddSeparator() | ||
button_wx_item_id = wx.NewId() | ||
top_tb.AddTool(button_wx_item_id, "SparkFunKiCadPanelizer", bm, | ||
"SparkFun KiCad Panelizer", wx.ITEM_NORMAL) | ||
top_tb.Bind(wx.EVT_TOOL, callback, id=button_wx_item_id) | ||
top_tb.Realize() | ||
|
||
|
||
try: | ||
with add_paths(paths): | ||
from .plugin import PanelizerPlugin | ||
plugin = PanelizerPlugin() | ||
plugin.register() | ||
except Exception as e: | ||
print(e) | ||
import logging | ||
root = logging.getLogger() | ||
root.debug(repr(e)) | ||
|
||
# Add a button the hacky way if plugin button is not supported | ||
# in pcbnew, unless this is linux. | ||
if not plugin.pcbnew_icon_support and not sys.platform.startswith('linux'): | ||
t = threading.Thread(target=check_for_panelizer_button) | ||
t.daemon = True | ||
t.start() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .dialog import Dialog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
|
||
import wx | ||
|
||
class DialogShim(wx.Dialog): | ||
def __init__(self, parent, **kwargs): | ||
try: | ||
wx.StockGDI._initStockObjects() | ||
except: | ||
pass | ||
|
||
wx.Dialog.__init__(self, parent, **kwargs) | ||
|
||
def SetSizeHints(self, a, b, c=None): | ||
if c is not None: | ||
super(wx.Dialog, self).SetSizeHints(a,b,c) | ||
else: | ||
super(wx.Dialog, self).SetSizeHints(a,b) # Was super(wx.Dialog, self).SetSizeHintsSz(a,b) | ||
|
Oops, something went wrong.