2022-04-10 08:21:59 +00:00
|
|
|
# Authors: see git history
|
|
|
|
#
|
|
|
|
# Copyright (c) 2022 Authors
|
|
|
|
# Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details.
|
|
|
|
|
|
|
|
from inkex import NSS
|
|
|
|
|
|
|
|
from .base import InkstitchExtension
|
|
|
|
|
|
|
|
|
|
|
|
class ObjectCommandsToggleVisibility(InkstitchExtension):
|
|
|
|
|
|
|
|
def effect(self):
|
|
|
|
svg = self.document.getroot()
|
|
|
|
# toggle object commands (in fact it's display or hide all of them)
|
|
|
|
command_groups = svg.xpath(".//svg:g[starts-with(@id,'command_group')]", namespaces=NSS)
|
|
|
|
display = "none"
|
|
|
|
first_iteration = True
|
|
|
|
for command_group in command_groups:
|
|
|
|
if first_iteration:
|
|
|
|
first_iteration = False
|
2023-09-07 17:29:35 +00:00
|
|
|
if command_group.style('display', 'inline') == 'none':
|
2022-04-10 08:21:59 +00:00
|
|
|
display = "inline"
|
|
|
|
command_group.style['display'] = display
|