Gentoo Archives: gentoo-commits

From: "Chris Reffett (creffett)" <creffett@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in app-misc/xmind/files: x-xmind.xml xmind.schemas xmind.16.png xmind.32.png xmind-thumbnailer xmind.48.png
Date: Sat, 02 Mar 2013 03:32:59
Message-Id: 20130302033255.3B8C62171D@flycatcher.gentoo.org
1 creffett 13/03/02 03:32:55
2
3 Added: x-xmind.xml xmind.schemas xmind.16.png xmind.32.png
4 xmind-thumbnailer xmind.48.png
5 Log:
6 New package wrt bugs 295242, 375249. Thanks to Mark Dumlao <madumlao@×××××.com>, Vitovt <vitovt@××××××××××.ua>, Heiu-mun Park <padangustasana@×××××.com>, Tarcisio Fedrizzi <tarcisio.fedrizzi@×××××.com> for work in making the ebuild.
7
8 (Portage version: 2.2.0_alpha163/cvs/Linux x86_64, signed Manifest commit with key 42618354)
9
10 Revision Changes Path
11 1.1 app-misc/xmind/files/x-xmind.xml
12
13 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-misc/xmind/files/x-xmind.xml?rev=1.1&view=markup
14 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-misc/xmind/files/x-xmind.xml?rev=1.1&content-type=text/plain
15
16 Index: x-xmind.xml
17 ===================================================================
18 <?xml version="1.0" encoding="UTF-8"?>
19 <mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
20 <mime-type type="application/x-xmind">
21 <sub-class-of type="application/zip"/>
22 <comment>XMind Workbook</comment>
23 <alias type="application/vnd.xmind.workbook"/>
24 <generic-icon name="package-x-generic"/>
25 <glob pattern="*.xmind"/>
26 </mime-type>
27 </mime-info>
28
29
30
31 1.1 app-misc/xmind/files/xmind.schemas
32
33 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-misc/xmind/files/xmind.schemas?rev=1.1&view=markup
34 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-misc/xmind/files/xmind.schemas?rev=1.1&content-type=text/plain
35
36 Index: xmind.schemas
37 ===================================================================
38 <gconfschemafile>
39 <schemalist>
40
41 <schema>
42 <key>/schemas/desktop/gnome/thumbnailers/application@x-xmind/enable</key>
43 <applyto>/desktop/gnome/thumbnailers/application@x-xmind/enable</applyto>
44 <owner>xmind-thumb</owner>
45 <type>bool</type>
46 <default>true</default>
47 <locale name="C">
48 <short></short>
49 <long></long>
50 </locale>
51 </schema>
52
53
54 <schema>
55 <key>/schemas/desktop/gnome/thumbnailers/application@x-xmind/command</key>
56 <applyto>/desktop/gnome/thumbnailers/application@x-xmind/command</applyto>
57 <owner>xmind-thumb</owner>
58 <type>string</type>
59 <default>/usr/bin/xmind-thumbnailer %u %o</default>
60 <locale name="C">
61 <short></short>
62 <long></long>
63 </locale>
64 </schema>
65
66 </schemalist>
67 </gconfschemafile>
68
69
70
71 1.1 app-misc/xmind/files/xmind.16.png
72
73 <<Binary file>>
74
75
76 1.1 app-misc/xmind/files/xmind.32.png
77
78 <<Binary file>>
79
80
81 1.1 app-misc/xmind/files/xmind-thumbnailer
82
83 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-misc/xmind/files/xmind-thumbnailer?rev=1.1&view=markup
84 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-misc/xmind/files/xmind-thumbnailer?rev=1.1&content-type=text/plain
85
86 Index: xmind-thumbnailer
87 ===================================================================
88 #!/usr/bin/env python
89
90 import gnomevfs
91 import os
92 import sys
93 import zipfile
94 from PIL import Image, ImageEnhance
95
96 # Alter these varibles to change thumbnail look
97 ICON_PATH = "/usr/share/icons/hicolor/32x32/apps/xmind.png" # Change this path to alter icons
98 ICON_OPACITY = 0.6 #Opacity of the icon (between 0.0 and 1.0)
99 THUMBNAIL_BACKGROUND_COLOR = "white" # Color of the background
100
101 in_file_path = gnomevfs.get_local_path_from_uri(sys.argv[1])
102 out_file_path = sys.argv[2]
103 path_without_thumbs = os.getenv("HOME")+"/Templates"
104
105 def get_icon(thumbnail_size):
106 #Load icon
107 icon = Image.open(ICON_PATH).convert("RGBA")
108 #Set it's opacity
109 icon = set_icon_opacity(icon,ICON_OPACITY)
110 #And set it's position in thumbnail
111 icon_posx=thumbnail_size[0]-icon.size[0]
112 icon_posy=thumbnail_size[1]-icon.size[1]
113 icon_width=thumbnail_size[0]
114 icon_height=thumbnail_size[1]
115 return {"image":icon,"position":(icon_posx,icon_posy,icon_width,icon_height)}
116
117 def get_basic_thumbnail():
118 #Find out if the file is not in Templates directory
119 if in_file_path.find(path_without_thumbs)!=0:
120 try:
121 #Extract thumbnail from Xmind file and save it
122 zip=zipfile.ZipFile(in_file_path,mode="r")
123 picture=zip.read("Thumbnails/thumbnail.jpg")
124 zip.close()
125 thumbnail=open(out_file_path,"w")
126 thumbnail.write(picture)
127 thumbnail.write("/n")
128 thumbnail.close()
129 #Open saved thumbnail
130 image=Image.open(out_file_path).convert("RGBA")
131 if image.size[0]>200:
132 image = image.resize((200,image.size[1]*200/image.size[0]))
133 if image.size[1]>200:
134 image = image.resize((image.size[0]*200/image.size[1],200))
135 return {"suceeded":True,"image":image,"size":(image.size[0],image.size[1])}
136
137 except:
138 return {"suceeded":False}
139 else:
140 return {"suceeded":False}
141
142 # Nicked from http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/362879
143 def set_icon_opacity(icon,opacity):
144 #Returns an image with reduced opacity.
145 assert opacity >= 0 and opacity <= 1
146 if icon.mode != 'RGBA':
147 icon = icon.convert('RGBA')
148 else:
149 icon = icon.copy()
150 alpha = icon.split()[3]
151 alpha = ImageEnhance.Brightness(alpha).enhance(opacity)
152 icon.putalpha(alpha)
153 return icon
154
155 thumbnail=get_basic_thumbnail()
156 if thumbnail["suceeded"]:
157 background=Image.new("RGB", thumbnail["size"], THUMBNAIL_BACKGROUND_COLOR)
158 icon=get_icon(thumbnail["size"])
159 thumbnail=thumbnail["image"]
160 # Add thumbnail
161 background.paste(thumbnail, None, thumbnail)
162 # Add icon
163 background.paste(icon["image"],icon["position"],icon["image"])
164 # Save thumbnail
165 background.save(out_file_path,"PNG")
166
167
168
169 1.1 app-misc/xmind/files/xmind.48.png
170
171 <<Binary file>>