Compare commits

..

No commits in common. "b191a28a0a2c73d21c5e6b8ef4406506a00adedb" and "5fc603ab502de240de2775ed12a965511452f928" have entirely different histories.

3 changed files with 14 additions and 24 deletions

View file

@ -6,7 +6,6 @@ KiCAD 9 API Workbench
## What works ## What works
* Create board * Create board
* Bidirectional syncing
* Add Vias * Add Vias
* Add footprint pads * Add footprint pads
* Import footprint 3d models * Import footprint 3d models
@ -20,11 +19,14 @@ KiCAD 9 API Workbench
## In Progress / To be ported ## In Progress / To be ported
### Tracks ### Tracks
Tracks can be loaded and drawn as simple `LineSegment` but more work is needed to draw properly 'widthed', and particularly while trying to eliminate overlapping lines. Tracks can be loaded and drawn as simple `LineSegment` but more work is needed to draw properly 'widthed', and particularly whilte trying to eliminate overlapping lines.
### More Pad Shapes ### More Pad Shapes
Only rectangle get drawn right now, would like to figure out how to get Sketcher to do the heavy lifting Only rectangle get drawn right now, would like to figure out how to get Sketcher to do the heavy lifting
### Sync to KiCAD
In theory this code is mostly working but there seems to be an [issue in kicad-python](https://gitlab.com/kicad/code/kicad-python/-/issues/34)
## Plans ## Plans
### Add more board features ### Add more board features

View file

@ -17,7 +17,9 @@ class BaseObject:
self.sync_from() self.sync_from()
def execute(self, feature): def execute(self, feature):
pass # TODO this might not be the right move
print(self, 'BaseObject.execute')
#self.onDocumentRestored(feature)
def get_api(self): def get_api(self):
p = self.feature p = self.feature

View file

@ -9,8 +9,6 @@ class BaseViewProvider:
TYPE = None TYPE = None
EXTENSIONS = [] EXTENSIONS = []
save_keys = []
def __init__(self, viewprovider): def __init__(self, viewprovider):
self.viewprovider = viewprovider self.viewprovider = viewprovider
self.feature = viewprovider.Object.Proxy.feature self.feature = viewprovider.Object.Proxy.feature
@ -18,7 +16,6 @@ class BaseViewProvider:
self.icon = '' self.icon = ''
if self.ICON: if self.ICON:
print('>', settings.ICONPATH, self.ICON, os.path.join(settings.ICONPATH, self.ICON))
self.icon = os.path.join(settings.ICONPATH, self.ICON) self.icon = os.path.join(settings.ICONPATH, self.ICON)
viewprovider.Proxy = self viewprovider.Proxy = self
@ -39,7 +36,6 @@ class BaseViewProvider:
Gui.Selection.clearSelection() Gui.Selection.clearSelection()
def getIcon(self): def getIcon(self):
print(self.icon)
return self.icon return self.icon
def getDisplayModes(self,obj): def getDisplayModes(self,obj):
@ -50,21 +46,11 @@ class BaseViewProvider:
'''Return the name of the default display mode. It must be defined in getDisplayModes.''' '''Return the name of the default display mode. It must be defined in getDisplayModes.'''
return 'Standard' return 'Standard'
def dumps(self): def __getstate__(self):
data = [ getattr(self, 'icon') ] return {
'icon': self.icon
}
if len(self.save_keys) > 0: def __setstate__(self, props):
for key in self.save_keys: for prop in props:
try: setattr(self, prop, props[prop])
data.append(getattr(self, key))
except Exception as e:
#XXX logging
print(e)
return tuple(data)
def loads(self, state):
self.icon = state[0]
for idx, key in enumerate(self.save_keys):
setattr(self, key, state[idx + 1])