Skip to content

Commit 81fee71

Browse files
committed
add debug option
1 parent b955422 commit 81fee71

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

inkscape/svg2shenzhen/export.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,8 @@ def __init__(self):
214214
self.OptionParser.add_option("--openfactory", action="store", type="inkbool", dest="openfactory", default="true")
215215
self.OptionParser.add_option("--openkicad", action="store", type="inkbool", dest="openkicad", default="true")
216216
self.OptionParser.add_option("--autoflatten", action="store", type="inkbool", dest="autoflatten", default="true")
217+
self.OptionParser.add_option("--debug", action="store", type="inkbool", dest="debug", default=False)
218+
217219

218220

219221
self.doc_width = 0
@@ -516,14 +518,16 @@ def exportToKicad(self, png_path, output_path, layer_type, invert = "true"):
516518
bitmap2component_exe = os.path.join(plugin_path, 'bitmap2component.exe')
517519

518520
command = "\"%s\" \"%s\" \"%s\" %s %s %s %s" % (bitmap2component_exe, png_path, output_path, layer_type, invert , str(int(self.options.dpi)) , str(int(self.options.threshold)))
519-
inkex.debug(command)
521+
if (self.options.debug):
522+
inkex.debug(command)
520523
return subprocess.Popen(command.encode("utf-8"), shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
521524

522525

523526
def exportToPng(self, svg_path, output_path):
524527
area_param = '-D' if self.options.crop else 'C'
525528
command = "inkscape %s -d %s -e \"%s\" \"%s\"" % (area_param, self.options.dpi, output_path, svg_path)
526-
inkex.debug(command)
529+
if (self.options.debug):
530+
inkex.debug(command)
527531
return subprocess.Popen(command.encode("utf-8"), shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
528532

529533

inkscape/svg2shenzhen_export.inx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<param name="threshold" type="int" min="0" max="255" _gui-text="Threshold (default: 128)">128</param>
1414
<param name="dpi" type="int" min="0" max="2000" _gui-text="Export DPI (default: 600)">600</param>
1515
<param name="autoflatten" type="boolean" gui-text="Auto flatten bezier for Edge.Cuts layer?">true</param>
16-
16+
<param name="debug" type="boolean" gui-text="Debug Mode?">false</param>
1717
<param name="openfactory" type="boolean" gui-text="Open PCBWay after export?">true</param>
1818
<param name="openkicad" type="boolean" gui-text="Open Kicad after export?">false</param>
1919

0 commit comments

Comments
 (0)