Skip to content

Commit c7730c2

Browse files
authored
Merge pull request #86 from twinkletwinkie/master
Export Interface & About Interface Tweaks
2 parents c1416af + b051949 commit c7730c2

File tree

3 files changed

+42
-34
lines changed

3 files changed

+42
-34
lines changed

inkscape/svg2shenzhen/export.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,12 @@
1414
from copy import deepcopy
1515
from inkex import bezier
1616
from inkex.transforms import Transform
17+
from pathlib import Path
1718

1819

20+
homePath = str()
21+
homePath = Path.home()
22+
1923
EXPORT_PNG_MAX_PROCESSES = 3
2024
EXPORT_KICAD_MAX_PROCESSES = 2
2125

@@ -254,7 +258,7 @@ def __init__(self):
254258
}
255259

256260
def add_arguments(self, pars):
257-
pars.add_argument("--path", default="~/")
261+
pars.add_argument("--path", default=homePath)
258262
pars.add_argument('-f', '--filetype', default='jpeg', help='Exported file type')
259263
pars.add_argument("--crop", type=inkex.Boolean, default=False)
260264
pars.add_argument("--dpi", type=int, default=600)
@@ -338,7 +342,12 @@ def processAutoMaskFromTo(self, from_layer, to_layer):
338342
def processExportLayer(self):
339343
options = self.options
340344

341-
output_path = os.path.expanduser(options.path)
345+
if os.path.dirname(os.getcwd()) == options.path:
346+
inkex.errormsg('EXPORT ERROR! Please Select A Directory To Export To!')
347+
exit()
348+
else:
349+
output_path = os.path.expanduser(options.path)
350+
342351
curfile = self.options.input_file
343352
layers = self.get_layers(curfile)
344353
name = self.get_name()

inkscape/svg2shenzhen_about.inx

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,28 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
32
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
4-
<_name>0. Help</_name>
3+
<_name>About</_name>
54
<id>net.svg2shenzhen.about.me</id>
65
<param name='active-tab' type="notebook">
7-
8-
<page name='about' _gui-text='About'>
9-
<_param name="help" type="description">
10-
Svg2Shenzhen version SVGSZ_VER
11-
Inkscape extension to export drawing as a KiCad Module or KiCad Project
12-
13-
Get New Update:
14-
https://github.com/badgeek/svg2shenzhen
15-
16-
Support this software:
17-
https://patreon.com/badgeek
18-
19-
20-
</_param>
21-
</page>
22-
6+
<page name='about' _gui-text='About'>
7+
<label appearance="header">Svg2Shenzhen Ver. SVGSZ_VER</label>
8+
<separator />
9+
<_param name="help" type="description" xml:space="preserve">Inkscape Extension to Export Drawings as a KiCad Module or KiCad Project
10+
11+
To get updates, get help, review the source, or contribute please visit the project's GitHub page.
12+
13+
Thank you to everyone who has contributed to Svg2Shenzhen.</_param>
14+
<separator />
15+
<label>Project GitHub</label>
16+
<label indent="2" appearance="url">https://github.com/badgeek/svg2shenzhen</label>
17+
<separator />
18+
<label>Support the Author:</label>
19+
<label indent="2" appearance="url">https://patreon.com/badgeek</label>
20+
</page>
2321
</param>
2422
<effect needs-live-preview="false">
2523
<effects-menu _name="About">
2624
<submenu _name="Svg2Shenzhen SVGSZ_VER"/>
2725
</effects-menu>
2826
<object-type>all</object-type>
2927
</effect>
30-
3128
</inkscape-extension>

inkscape/svg2shenzhen_export.inx

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
3-
<_name>2. Export Kicad</_name>
3+
<_name>2. Export to KiCad</_name>
44
<id>net.svg2shenzhen.export.layers</id>
55
<dependency type="executable" location="extensions">svg2shenzhen/export.py</dependency>
6-
<param name="help" type="description">Export Drawing to KiCad PCB Format</param>
7-
<param type="path" name="path" _gui-text="Choose Path to Export" mode="folder"/>
8-
<param name="filetype" type="optiongroup" gui-text="Export layers as..." appearance="minimal">
9-
<option selected="selected" value="kicad_module">KiCad - Module</option>
10-
<option value="kicad_pcb">KiCad - Project</option>
6+
<label appearance="header">Export Drawing to KiCad</label>
7+
<param type="path" name="path" _gui-text="Folder" mode="folder"/>
8+
<param name="filetype" type="optiongroup" gui-text="Export As (!)" appearance="minimal" _gui-description="Module is a single KiCad Module, or Part, that contains all of the layers. This is the recommended way to use this plugin. Project exports the drawing as a entire KiCad project with the layers separated into their own modules. PNG exports all of the layers a PNG Image file.">
9+
<option selected="selected" value="kicad_module">Module</option>
10+
<option value="kicad_pcb">Project</option>
1111
<option value="png">PNG - Image</option>
1212
</param>
13-
<param name="threshold" type="int" min="0" max="255" _gui-text="Threshold (default: 5)">5</param>
14-
<param name="dpi" type="int" min="0" max="3600" _gui-text="Export DPI (default: 1200)">1200</param>
15-
<param name="autoflatten" type="boolean" gui-text="Auto flatten bezier for Edge.Cuts layer?">true</param>
16-
<param name="debug" type="boolean" gui-text="Debug Mode?">false</param>
17-
<param name="openfactory" type="boolean" gui-text="Open PCBWay after export?">true</param>
18-
<param name="openkicad" type="boolean" gui-text="Open Kicad after export?">false</param>
19-
13+
<param name="threshold" type="int" min="0" max="255" _gui-text="Threshold (!)" _gui-description="Default: 5 - Define the threshold the black and white will have.">5</param>
14+
<param name="dpi" type="int" min="0" max="3600" _gui-text="Export DPI (!)" _gui-description="Default: 1200 - Define the Dots Per Inch to Export the Layers at, recommended is 1,200, max is 3,600. Below 1,200 you may see artifacts due to the low resolution.">1200</param>
15+
<separator />
16+
<param name="autoflatten" type="boolean" _gui-text="Flatten Bezier (!)" _gui-description="Select this option if you have not flattened the Bezier Curves on your Edge.Cut layer. If this is not the first time you have exported this drawing do not check this option.">false</param>
17+
<param name="openfactory" type="boolean" gui-text="Open PCBWay (!)" _gui-description="Opens the PCBWay website with an affiliate link for you to submit an order.">false</param>
18+
<param name="openkicad" type="boolean" gui-text="Open KiCad (!)" _gui-description="Opens the KiCad for you.">false</param>
19+
<param name="debug" type="boolean" _gui-text="Debug Mode" _gui-description="Only necessary for troubleshooting.">false</param>
20+
<separator />
21+
<label>SVG2SHENZHEN SVGSZ_VER</label>
2022
<effect needs-live-preview="false">
2123
<object-type>all</object-type>
2224
<effects-menu _name="Export Kicad">

0 commit comments

Comments
 (0)