From a1be22f44befce2b21e59cfe3765245116ab9b21 Mon Sep 17 00:00:00 2001 From: Thomas Dehaeze Date: Tue, 3 Nov 2020 11:30:27 +0100 Subject: [PATCH] Add Inkscape Config --- dotfiles/inkscape.org | 103 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 dotfiles/inkscape.org diff --git a/dotfiles/inkscape.org b/dotfiles/inkscape.org new file mode 100644 index 0000000..fcc3026 --- /dev/null +++ b/dotfiles/inkscape.org @@ -0,0 +1,103 @@ +#+TITLE: Inkscape +:DRAWER: +#+STARTUP: overview + +#+LANGUAGE: en +#+EMAIL: dehaeze.thomas@gmail.com +#+AUTHOR: Dehaeze Thomas + +#+HTML_LINK_HOME: ./index.html +#+HTML_LINK_UP: ./index.html + +#+HTML_HEAD: +#+HTML_HEAD: +#+HTML_HEAD: +#+HTML_HEAD: +#+HTML_HEAD: +#+HTML_HEAD: + +#+PROPERTY: header-args :comments no +#+PROPERTY: header-args+ :mkdirp yes +:END: + +* Save Selection to SVG extension +** =ink= file + +#+begin_src xml :tangle ~/.config/inkscape/extensions/save_selection/save_selection.inx + + + + <_name>Save Selection + + + org.inkscape.save_selection + + + save_selection.py + + + 1.0 + false + + + all + + + + + + + + +#+end_src + +** =py= file +:PROPERTIES: +:header-args: :shebang "#!/usr/bin/env python" +:header-args+: :comments both :mkdirp yes +:header-args+: :tangle ~/.config/inkscape/extensions/save_selection/save_selection.py +:END: + +#+begin_src python +import os +import inkex +import inkex.command + + +class SaveSelection(inkex.OutputExtension): # choose a better name + + def add_arguments(self, pars): + pars.add_argument("--param", type=float, dest="param", default=1.0) + pars.add_argument("-x", "--achoice", type=inkex.Boolean, dest="achoice", default=False) + + def save(self, stream): + # param2 = self.options.param + # choice = self.options.achoice + + # inkex.command.inkscape_command(self.svg, verbs=['EditInvert']); + # inkex.command.inkscape_command(self.svg, verbs=['EditDelete']); + + # filename = os.popen('rofi -dmenu -p "Filename"') + # print(filename) + # inkex.debug(self.svg.selected.svg) + + self.document.write(self.svg.selected) + + # Get selected objects + # selection = self.svg.selected + # selection = inkex.load_svg( + # inkex.command.inkscape_command( + # self.svg, verbs=['FitCanvasToDrawing'])) + + # # Create a Canvas ovject + + # # Write File + # # stream.write(b''.join(self.svg.selected.tostring())) + # inkex.command.write_svg(selection, "/home/thomas/", "test.svg") + + +if __name__ == '__main__': + SaveSelection().run() +#+end_src