From 39ce9d79610159c7f129ebfc5eacbf049cf5a160 Mon Sep 17 00:00:00 2001 From: Chris Reffett Date: Sat, 2 Mar 2013 03:32:55 +0000 Subject: New package wrt bugs 295242, 375249. Thanks to Mark Dumlao , Vitovt , Heiu-mun Park , Tarcisio Fedrizzi for work in making the ebuild. (Portage version: 2.2.0_alpha163/cvs/Linux x86_64, signed Manifest commit with key 42618354) --- app-misc/xmind/ChangeLog | 14 ++++ app-misc/xmind/files/x-xmind.xml | 10 +++ app-misc/xmind/files/xmind-thumbnailer | 78 ++++++++++++++++++++ app-misc/xmind/files/xmind.16.png | Bin 0 -> 1817 bytes app-misc/xmind/files/xmind.32.png | Bin 0 -> 2987 bytes app-misc/xmind/files/xmind.48.png | Bin 0 -> 3607 bytes app-misc/xmind/files/xmind.schemas | 30 ++++++++ app-misc/xmind/metadata.xml | 8 +++ app-misc/xmind/xmind-3.3.1.201212250029.ebuild | 96 +++++++++++++++++++++++++ 9 files changed, 236 insertions(+) create mode 100644 app-misc/xmind/ChangeLog create mode 100644 app-misc/xmind/files/x-xmind.xml create mode 100644 app-misc/xmind/files/xmind-thumbnailer create mode 100644 app-misc/xmind/files/xmind.16.png create mode 100644 app-misc/xmind/files/xmind.32.png create mode 100644 app-misc/xmind/files/xmind.48.png create mode 100644 app-misc/xmind/files/xmind.schemas create mode 100644 app-misc/xmind/metadata.xml create mode 100644 app-misc/xmind/xmind-3.3.1.201212250029.ebuild (limited to 'app-misc/xmind') diff --git a/app-misc/xmind/ChangeLog b/app-misc/xmind/ChangeLog new file mode 100644 index 000000000000..9c41692ce92d --- /dev/null +++ b/app-misc/xmind/ChangeLog @@ -0,0 +1,14 @@ +# ChangeLog for app-misc/xmind +# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/app-misc/xmind/ChangeLog,v 1.1 2013/03/02 03:32:55 creffett Exp $ + +*xmind-3.3.1.201212250029 (02 Mar 2013) + + 02 Mar 2013; Chris Reffett +files/x-xmind.xml, + +files/xmind-thumbnailer, +files/xmind.16.png, +files/xmind.32.png, + +files/xmind.48.png, +files/xmind.schemas, +metadata.xml, + +xmind-3.3.1.201212250029.ebuild: + New package wrt bugs 295242, 375249. Thanks to Mark Dumlao + , Vitovt , Heiu-mun Park + , Tarcisio Fedrizzi + for work in making the ebuild. diff --git a/app-misc/xmind/files/x-xmind.xml b/app-misc/xmind/files/x-xmind.xml new file mode 100644 index 000000000000..57292e9c689b --- /dev/null +++ b/app-misc/xmind/files/x-xmind.xml @@ -0,0 +1,10 @@ + + + + + XMind Workbook + + + + + diff --git a/app-misc/xmind/files/xmind-thumbnailer b/app-misc/xmind/files/xmind-thumbnailer new file mode 100644 index 000000000000..48eb89b8cd9a --- /dev/null +++ b/app-misc/xmind/files/xmind-thumbnailer @@ -0,0 +1,78 @@ +#!/usr/bin/env python + +import gnomevfs +import os +import sys +import zipfile +from PIL import Image, ImageEnhance + +# Alter these varibles to change thumbnail look +ICON_PATH = "/usr/share/icons/hicolor/32x32/apps/xmind.png" # Change this path to alter icons +ICON_OPACITY = 0.6 #Opacity of the icon (between 0.0 and 1.0) +THUMBNAIL_BACKGROUND_COLOR = "white" # Color of the background + +in_file_path = gnomevfs.get_local_path_from_uri(sys.argv[1]) +out_file_path = sys.argv[2] +path_without_thumbs = os.getenv("HOME")+"/Templates" + +def get_icon(thumbnail_size): + #Load icon + icon = Image.open(ICON_PATH).convert("RGBA") + #Set it's opacity + icon = set_icon_opacity(icon,ICON_OPACITY) + #And set it's position in thumbnail + icon_posx=thumbnail_size[0]-icon.size[0] + icon_posy=thumbnail_size[1]-icon.size[1] + icon_width=thumbnail_size[0] + icon_height=thumbnail_size[1] + return {"image":icon,"position":(icon_posx,icon_posy,icon_width,icon_height)} + +def get_basic_thumbnail(): + #Find out if the file is not in Templates directory + if in_file_path.find(path_without_thumbs)!=0: + try: + #Extract thumbnail from Xmind file and save it + zip=zipfile.ZipFile(in_file_path,mode="r") + picture=zip.read("Thumbnails/thumbnail.jpg") + zip.close() + thumbnail=open(out_file_path,"w") + thumbnail.write(picture) + thumbnail.write("/n") + thumbnail.close() + #Open saved thumbnail + image=Image.open(out_file_path).convert("RGBA") + if image.size[0]>200: + image = image.resize((200,image.size[1]*200/image.size[0])) + if image.size[1]>200: + image = image.resize((image.size[0]*200/image.size[1],200)) + return {"suceeded":True,"image":image,"size":(image.size[0],image.size[1])} + + except: + return {"suceeded":False} + else: + return {"suceeded":False} + +# Nicked from http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/362879 +def set_icon_opacity(icon,opacity): + #Returns an image with reduced opacity. + assert opacity >= 0 and opacity <= 1 + if icon.mode != 'RGBA': + icon = icon.convert('RGBA') + else: + icon = icon.copy() + alpha = icon.split()[3] + alpha = ImageEnhance.Brightness(alpha).enhance(opacity) + icon.putalpha(alpha) + return icon + +thumbnail=get_basic_thumbnail() +if thumbnail["suceeded"]: + background=Image.new("RGB", thumbnail["size"], THUMBNAIL_BACKGROUND_COLOR) + icon=get_icon(thumbnail["size"]) + thumbnail=thumbnail["image"] + # Add thumbnail + background.paste(thumbnail, None, thumbnail) + # Add icon + background.paste(icon["image"],icon["position"],icon["image"]) + # Save thumbnail + background.save(out_file_path,"PNG") diff --git a/app-misc/xmind/files/xmind.16.png b/app-misc/xmind/files/xmind.16.png new file mode 100644 index 000000000000..28480879c7a1 Binary files /dev/null and b/app-misc/xmind/files/xmind.16.png differ diff --git a/app-misc/xmind/files/xmind.32.png b/app-misc/xmind/files/xmind.32.png new file mode 100644 index 000000000000..4774b258abcb Binary files /dev/null and b/app-misc/xmind/files/xmind.32.png differ diff --git a/app-misc/xmind/files/xmind.48.png b/app-misc/xmind/files/xmind.48.png new file mode 100644 index 000000000000..6fc816afb180 Binary files /dev/null and b/app-misc/xmind/files/xmind.48.png differ diff --git a/app-misc/xmind/files/xmind.schemas b/app-misc/xmind/files/xmind.schemas new file mode 100644 index 000000000000..336b09ecd837 --- /dev/null +++ b/app-misc/xmind/files/xmind.schemas @@ -0,0 +1,30 @@ + + + + + /schemas/desktop/gnome/thumbnailers/application@x-xmind/enable + /desktop/gnome/thumbnailers/application@x-xmind/enable + xmind-thumb + bool + true + + + + + + + + + /schemas/desktop/gnome/thumbnailers/application@x-xmind/command + /desktop/gnome/thumbnailers/application@x-xmind/command + xmind-thumb + string + /usr/bin/xmind-thumbnailer %u %o + + + + + + + + diff --git a/app-misc/xmind/metadata.xml b/app-misc/xmind/metadata.xml new file mode 100644 index 000000000000..b8f97c36765b --- /dev/null +++ b/app-misc/xmind/metadata.xml @@ -0,0 +1,8 @@ + + + + + creffett@gentoo.org + Chris Reffett + + diff --git a/app-misc/xmind/xmind-3.3.1.201212250029.ebuild b/app-misc/xmind/xmind-3.3.1.201212250029.ebuild new file mode 100644 index 000000000000..4b63bb3ae00f --- /dev/null +++ b/app-misc/xmind/xmind-3.3.1.201212250029.ebuild @@ -0,0 +1,96 @@ +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-misc/xmind/xmind-3.3.1.201212250029.ebuild,v 1.1 2013/03/02 03:32:55 creffett Exp $ + +EAPI=5 + +inherit eutils multilib fdo-mime gnome2-utils + +MY_PN="${PN}-portable" +MY_P="${MY_PN}-${PV}" + +DESCRIPTION="A brainstorming and mind mapping software tool." +HOMEPAGE="http://www.xmind.net" +SRC_URI="http://dl2.xmind.net/xmind-downloads/${MY_P}.zip" +LICENSE="EPL-1.0 LGPL-3" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="" + +DEPEND=" + >=virtual/jre-1.5 + x11-libs/gtk+:2 +" +RDEPEND="${DEPEND}" + +S=${WORKDIR} + +QA_PRESTRIPPED="/usr/$(get_libdir)/xmind/XMind/libcairo-swt.so" + +src_configure() { + if use amd64; then + XDIR="XMind_Linux_64bit" + else + XDIR="XMind_Linux" + fi + mv -v "$XDIR" XMind + mv -v XMind/.eclipseproduct XMind/configuration Commons + + # force data instance & config area to be at home/.xmind directory + sed -i -e '/-configuration/d' XMind/XMind.ini || die + sed -i -e '/\.\/configuration/d' XMind/XMind.ini || die + sed -i -e '/-data/d' XMind/XMind.ini || die + sed -i -e '/\.\.\/Commons\/data\/workspace-cathy/d' XMind/XMind.ini || die + echo '-Dosgi.instance.area=@user.home/.xmind/workspace-cathy' >> XMind/XMind.ini || die + echo '-Dosgi.configuration.area=@user.home/.xmind/configuration-cathy' >> XMind/XMind.ini || die +} + +src_compile() { + :; +} + +src_install() { + libdir="$(get_libdir)" + dodir "/usr/${libdir}/xmind" + insinto "/usr/${libdir}/xmind" + doins -r Commons + doins -r XMind + + exeinto "/usr/${libdir}/xmind/XMind" + doexe XMind/XMind + dosym "/usr/${libdir}/xmind/XMind/XMind" /usr/bin/xmind + + # insall icons + local res + for res in 16 32 48; do + insinto /usr/share/icons/hicolor/${res}x${res}/apps + newins "${FILESDIR}/xmind.${res}.png" xmind.png + done + + # insall MIME type + insinto /usr/share/mime/packages + doins "${FILESDIR}/x-xmind.xml" + + # make desktop entry + make_desktop_entry xmind XMind xmind Office "MimeType=application/x-xmind;" + sed -i -e "/^Exec/s/$/ %F/" "${ED}"/usr/share/applications/*.desktop + + insinto /etc/gconf/schemas + doins "${FILESDIR}/xmind.schemas" + dobin "${FILESDIR}/xmind-thumbnailer" +} + +pkg_preinst() { + gnome2_icon_savelist +} + +pkg_postinst() { + fdo-mime_desktop_database_update + fdo-mime_mime_database_update + gnome2_icon_cache_update + elog "For audio notes support, install media-sound/lame" +} + +pkg_postrm() { + gnome2_icon_cache_update +} -- cgit v1.2.3-65-gdbad