Boms-Away icon indicating copy to clipboard operation
Boms-Away copied to clipboard

Supply schematic file on command line

Open ghost opened this issue 7 years ago • 1 comments

I've hacked bomsaway to take a filename on the command line so I can run it direct from KiCAD with the command:

python "/full/path/to/Boms-Away/bomsaway.py" "%P/%B.sch" &

Or just supply the filename on the command line in the normal way, or not.

Hoping this is useful.

Here's the diff:

diff --git bomsaway.py bomsaway.py
index ec09d86..2966997 100755
--- bomsaway.py
+++ bomsaway.py
@@ -2,6 +2,7 @@
 import os
 import csv
 import shutil
+import sys

 import wx
 from boms_away import sch, datastore
@@ -581,9 +582,15 @@ class MainFrame(wx.Frame):

 class BomsAwayApp(wx.App):
     def OnInit(self):
+        ifile = None
+        try:
+            ifile = sys.argv[1]
+        except:
+            pass
         frame = MainFrame(None, -1, 'Boms-Away!')
         frame.Show(True)
         self.SetTopWindow(frame)
+        if ifile: frame.load(ifile)
         return True

 if __name__ == '__main__':

ghost avatar Feb 23 '18 13:02 ghost

Good idea, I'll fold this in ASAP

Jeff-Ciesielski avatar Feb 23 '18 14:02 Jeff-Ciesielski