403Webshell
Server IP : 93.86.61.54  /  Your IP : 216.73.216.206
Web Server : Apache/2.4.62 (Ubuntu)
System : Linux rasin.ddns.net 6.8.0-124-generic #124~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 21:05:19 UTC x86_64
User : www-data ( 33)
PHP Version : 8.4.22
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/share/inkscape/extensions/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/share/inkscape/extensions/jessyink_install.py
#!/usr/bin/env python
#
# Copyright 2008, 2009 Hannes Hochreiner
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see http://www.gnu.org/licenses/.
#
"""Install jessyInk scripts"""

import inkex
from inkex import Script

from inkex.localization import inkex_gettext as _

inkex.NSS[u"jessyink"] = u"https://launchpad.net/jessyink"

class JessyInkMixin(object):
    """Common jessyInk items"""
    def is_installed(self):
        """Check jessyInk is installed correctly"""
        scripts = self.svg.getElement("//svg:script[@jessyink:version='1.5.5']")
        if scripts is None:
            raise inkex.AbortExtension(_(
                "The JessyInk script is not installed in this SVG file or has a "
                "different version than the JessyInk extensions. Please select "
                "\"install/update...\" from the \"JessyInk\" sub-menu of the \"Extensions\" "
                "menu to install or update the JessyInk script.\n\n"))

    def attr_remove(self, prop, is_removed=True):
        """Remove a property if it exists in the svg"""
        if is_removed:
            for node in self.svg.xpath(f"//*[@jessyink:{prop}]"):
                node.set(f"jessyink:{prop}", None)
            for node in self.svg.xpath(f"//*[@jessyInk_{prop}]"):
                node.set(f"jessyInk_{prop}", None)

    def attr_update(self, name):
        """Update a single attr"""
        for node in self.svg.xpath(f"//*[@jessyInk_{name}]"):
            node.set(f"jessyink:{name}", node.get(f"jessyInk_{name}"))
            node.set(f"jessyInk_{name}", None)
        for node in self.svg.xpath(f"//*[@jessyink:{name}]"):
            node.set(f"jessyink:{name}", node.get(f"jessyink:{name}").replace("=", ":"))

    @staticmethod
    def prop_str_to_list(string):
        """Script string to list of instructions"""
        return [prop.strip() for prop in string.split(";") if prop]

    @staticmethod
    def list_to_prop_str(lst):
        """List of instructions to script string"""
        return "; ".join(lst) + ';'


class Install(JessyInkMixin, inkex.EffectExtension):
    """Install jessyInk extension into an SVG"""
    def add_arguments(self, pars):
        pars.add_argument('--tab', type=str, dest='what')

    def effect(self):
        # Find and delete old script node
        for node in self.svg.xpath("//svg:script[@id='JessyInk']"):
            node.getparent().remove(node)

        # Create new script node
        script_elem = Script()
        with open(self.get_resource("jessyInk.js")) as fhl:
            script_elem.text = fhl.read()
        script_elem.set("id", "JessyInk")
        script_elem.set("jessyink:version", '1.5.5')
        self.svg.append(script_elem)

        # Remove "jessyInkInit()" in the "onload" attribute, if present.
        prop_list = [prop.strip() for prop in self.svg.get("onload", '').split(';')]
        if "jessyInkInit()" in prop_list:
            prop_list.remove("jessyInkInit()")
        self.svg.set("onload", "; ".join(prop_list) or None)

        # Update jessyInk attributes to new formats
        for attr in ('effectIn', 'effectOut', 'masterSlide',
                     'transitionIn', 'transitionOut', 'autoText'):
            self.attr_update(attr)


# Create effect instance
if __name__ == '__main__':
    Install().run()

Youez - 2016 - github.com/yon3zu
LinuXploit