Icône du fichier
 
 

4678

Download Palette Extension

par Olibia

Inkscape extension to download color palettes from the web.

Usage

From the Extensions menu choose Palette and Download.
Select one or more palettes to download from the predefined collection.
Provide a name and a .gpl file URL to download a palette from the web.

Notes

Inkscape must be restarted for palettes to appear.
Downloaded palettes are stored in ~/.config/inkscape/palettes.
Tested only on Inkscape for Linux.

Inkscape Extensions

Taille
2,2 Kio
Créé le
Type
application/zip
General Public License v3 (GPLv3)

Lien

Victor Westmann a écrit le  :

Or I am doing something dumb or this extension does not work in Inkscape 0.92.3 (64 bit), portable version, on Windows 7 64 bit.

Decompressed the files from this extension to %INKSCAPE_HOME%\share\extensions in a special separate folder.
Opened Inkscape and the extension was not under "Extensions > Palette".

Please advise. Thank you!

Maren Hachmann a écrit le  :

Victor, any downloaded extensions go into your user extensions directory, see Edit > Preferences > System: User extensions in Inkscape. They don't work if they are kept in an extra folder, you need to put the inx and py file into the same folder where the other inx and py files are.

Manuel Alfonso Ortiz Lopez a écrit le  :

Hi there, in windows there are some bugs, mostly because the system structure and some diferences between inkscape for linux and windows, i modified the download_palette.py to make it work. so first i included:

#START ----------------------------------
import ssl
import subprocess
from sys import platform
#------------------------------------ END
the ssl lib will be used to create a context, because inkscape use an old version of certifi, that's the main raison the extension doesnt works. ([SSL: CERTIFICATE_VERIFY_FAILED])
then subprocess to open the explorer in the download folder (~\.config\inkscape\palettes) and the (INKSCAPE_DIR\share\palettes) for the user to move the downloaded files. since inkscape doesn't have the privileges to create a file inside of it's installations folder.

#START ----------------------------------
def palettes_path(self):
if platform.lower() == 'win32':#check if it's windows and changes the path's "/" symbol to '\\'
path = os.path.expanduser('~')+("/.config/inkscape/palettes".replace('/','\\'))
else:
path = os.path.expanduser('~')+"/.config/inkscape/palettes"
if not os.path.exists(path):
os.makedirs(path)
return path

#------------------------------------ END
and at the end the download_palettes like this

#START ----------------------------------
def download_palettes(self):
urls = self.palettes_urls()
for palette in self.get_selected_palettes():
url = urls.get(palette)

if url is not None:
try:
context=ssl._create_unverified_context()#creates a SSL context to bypass the SSL bug
_obj=urllib.urlretrieve(url, self.file_path(palette), context=context)#saves the object
#inkex.errormsg(_("The file is in the folder: \n"+self.file_path(palette))))
except Exception as e:#get some information of the exception
inkex.errormsg(_("File %s.gpl could not be downloaded! Please try again." % palette + str(e)+'\n'+os.getcwd()))#shows the exception and where's the working directory
if platform.lower() == 'win32':#check the platform again
inkex.errormsg(_("The palettes are stored in:\n"+ self.palettes_path() + "\nYou will need to copy and paste the palletes in the folder " + os.path.split(os.getcwd())[0]+"\\palettes" )) #tell the user what must be done
subprocess.Popen('explorer ' + self.palettes_path() ) #Download folder
subprocess.Popen('explorer ' + os.path.split(os.getcwd())[0]+"\\palettes")# where should be moved the files

#------------------------------------ END

sorry for my bad english XD

Connectez-vous pour ajouter un commentaire !