-
Notifications
You must be signed in to change notification settings - Fork 79
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
2 changed files
with
21 additions
and
3 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
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 |
---|---|---|
|
@@ -135,6 +135,7 @@ def __init__(self): | |
self.OptionParser.add_option("--dpi", action="store", type="float", dest="dpi", default=600) | ||
self.OptionParser.add_option("--threshold", action="store", type="float", dest="threshold", default=128.0) | ||
self.OptionParser.add_option("--openfactory", action="store", type="inkbool", dest="openfactory", default="true") | ||
self.OptionParser.add_option("--openkicad", action="store", type="inkbool", dest="openkicad", default="true") | ||
|
||
|
||
self.doc_width = 0 | ||
|
@@ -228,6 +229,8 @@ def effect(self): | |
self.setDocumentSquare() | ||
self.setInkscapeScaling() | ||
self.processExportLayer() | ||
if (self.options.openfactory): | ||
webbrowser.open("https://www.pcbway.com/setinvite.aspx?inviteid=54747", new = 2) | ||
# inkex.debug(self.exportDrill()) | ||
|
||
def processExportLayer(self): | ||
|
@@ -276,8 +279,6 @@ def processExportLayer(self): | |
|
||
counter = counter + 1 | ||
|
||
if (self.options.openfactory): | ||
webbrowser.open("https://www.pcbway.com/setinvite.aspx?inviteid=54747", new = 2) | ||
|
||
|
||
kicad_edgecut_string = self.exportEdgeCut() | ||
|
@@ -296,7 +297,9 @@ def processExportLayer(self): | |
the_file.write(kicad_drill_string) | ||
the_file.write(pcb_footer) | ||
|
||
|
||
if (self.options.openkicad): | ||
self.openKicad(kicad_pcb_path) | ||
|
||
def export_layers(self, dest, show): | ||
""" | ||
Export selected layers of SVG to the file `dest`. | ||
|
@@ -341,6 +344,20 @@ def get_layers(self, src): | |
|
||
return layers | ||
|
||
def openKicad(self, kicad_file_path): | ||
platform_system = platform.system() | ||
|
||
if (platform_system == 'Darwin'): | ||
command = "open %s" % (kicad_file_path) | ||
elif (platform_system == 'Linux'): | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
5shekel
Contributor
|
||
command = "xda-open %s" % (kicad_file_path) | ||
else: | ||
command = "start %s" % (kicad_file_path) | ||
|
||
p = subprocess.Popen(command.encode("utf-8"), shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | ||
p.wait() | ||
|
||
|
||
|
||
def exportToKicad(self, png_path, output_path, layer_type, invert = "true"): | ||
plugin_path = os.path.dirname(os.path.abspath(__file__)) | ||
|
xda-open
doesn't register on my linux distro,xdg-open
does