@@ -223,6 +223,7 @@ def To_SVG(self):
223223 hiddenLayers .append (layer [1 ])
224224
225225 base .svg .append (BeautifulSoup ('<g inkscape:label="Vias" inkscape:groupmode="layer" type="layervia" user="True" />' , 'html.parser' ))
226+ base .svg .append (BeautifulSoup ('<g inkscape:label="Modules" inkscape:groupmode="layer" type="module" user="True" />' , 'html.parser' ))
226227
227228
228229 for item in self .segment :
@@ -237,8 +238,8 @@ def To_SVG(self):
237238
238239 for item in self .module :
239240 tag = item .To_SVG (hiddenLayers = hiddenLayers )
240- layer = item .layer
241- base .svg .find ('g' , {'inkscape:label' : layer }, recursive = False ).append (tag )
241+ # layer = item.layer
242+ base .svg .find ('g' , {'inkscape:label' : 'Modules' }, recursive = False ).append (tag )
242243
243244 for item in self .gr_line :
244245 tag = BeautifulSoup (item .To_SVG (), 'html.parser' )
@@ -308,9 +309,10 @@ def From_SVG(self, svg):
308309 self .via .append (via )
309310
310311 elif tag ['type' ] == "module" :
311- module = Module ()
312- module .From_SVG (tag )
313- self .module .append (module )
312+ for moduletag in tag .find_all ('g' ):
313+ module = Module ()
314+ module .From_SVG (moduletag )
315+ self .module .append (module )
314316
315317 for tag in svg .svg .find_all ('text' ):
316318 if tag .has_attr ('type' ) == True :
@@ -368,63 +370,7 @@ def From_SVG(self, svg):
368370 zone .From_SVG (tag , paths )
369371 self .zone .append (zone )
370372
371-
372- def Parse_Layers_Segments (self , svg ):
373- #This gets reversed after it returns
374- layers = []
375- modules = []
376- segments = []
377- gr_lines = []
378- gr_arcs = []
379- gr_curves = []
380- gr_polys = []
381- gr_text = []
382- zones = []
383-
384- for tag in svg .svg .find_all ('g' ):
385- if tag ['id' ] == 'layervia' :
386- vias = self .Parse_Vias (tag )
387-
388- elif tag ['id' ].startswith ('module' ):
389- module = self .Parse_Module (tag )
390- modules .append (module )
391-
392- elif tag ['id' ].startswith ('layer' ):
393- #This gets reversed later
394- layer = [ tag ['number' ] ]
395- layer .append (tag ['inkscape:label' ])
396-
397- if tag .has_attr ('user' ):
398- layer .append ('user' )
399- if tag .has_attr ('signal' ):
400- layer .append ('signal' )
401- if tag .has_attr ('power' ):
402- layer .append ('power' )
403- if tag .has_attr ('hide' ):
404- layer .append ('hide' )
405-
406- layers .append (layer )
407-
408- for path in tag .find_all ('path' ):
409- if path .has_attr ('type' ) == True and path ['type' ] == 'zone' :
410- zones .append (self .Parse_Zone (path ))
411- elif path .has_attr ('type' ) == True and path ['type' ] == 'gr_poly' :
412- gr_polys .append (self .Parse_Polys (path ))
413- else :
414- segment , gr_line , gr_arc , gr_curve = self .Parse_Segment (path )
415- segments += segment
416- gr_lines += gr_line
417- gr_arcs += gr_arc
418- gr_curves += gr_curve
419-
420- for text in tag .find_all ('text' ):
421- gr_text .append (self .Parse_Text (text ))
422-
423-
424- layers .append ('layers' )
425- chunk = modules + segments + gr_polys + gr_lines + gr_arcs + gr_curves + gr_text + vias + zones
426- return layers , chunk
427-
373+
428374base_proto = '''
429375 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
430376<!-- Created with Inkscape (http://www.inkscape.org/) -->
0 commit comments