File: strings.py

package info (click to toggle)
fontypython 0.4.6-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,152 kB
  • ctags: 559
  • sloc: python: 3,619; makefile: 10
file content (362 lines) | stat: -rw-r--r-- 11,523 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
# This Python file uses the following encoding: utf-8
##	Fonty Python Copyright (C) 2006, 2007, 2008, 2009 Donn.C.Ingle
##	Contact: donn.ingle@gmail.com - I hope this email lasts.
##
##	This file is part of Fonty Python.
##	Fonty Python 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.
##
##	Fonty Python 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 Fonty Python.  If not, see <http://www.gnu.org/licenses/>.


import pathcontrol 
import fpversion
import os

copyright = "Fonty Python Copyright (C) 2006, 2007, 2008, 2009, 2016 Donn.C.Ingle"
contact = "email: donn.ingle@gmail.com"
done = "Done."

## We use PathControl to get some info, BUT we DO NOT WANT TO MAKE
## the ~/.fontypython folder from this module.
## This module (strings) also gets used via setup.py
## and that has the result of making the folder with root ownership! Bad news.
## So, there is a new flag to manage this now:
_pc = pathcontrol.PathControl( makeFolder=False )

version = _("Fonty Python version %s") % fpversion.version

warranty = """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."""

aboutText = "%s\n%s\nWritten on Gnu\Linux, using wxPython.\n\n%s" % (copyright, version, warranty)

options=_("""Options:
  -v --version  Show program's version number and exit.
  -h --help	 Show this help message and exit.
  -e --examples
				Show some %$@#$ examples!
  -i Pog --install=Pog
				Install the fonts in this Pog to your 
				fonts folder.
  -u Pog --uninstall=Pog
				Uninstall the fonts in this Pog.
  -l --list	
				List the names of all the Pogs.
  -s num --size=num
				Set a new default point size.
  -n num --number=num
				Set a new default for how many fonts 
				to view at one go. Don't overdo this.
  -p Pog --purge=Pog
				Purge the Pog of font files that are no
				longer really there.
  -c folder --check=folder
				Check for bad fonts that crash Fonty.
				It will recurse through sub-folders.
				This will build a file:
				~/.fontypython/segfonts
				After using this tool you should be
				able to browse folders that crashed
				Fonty. (The reason it's not done
				by default is that it's very slow.)
				* NOTE: The fonts that crash Fonty
				are probably still perfectly good
				and can be used in other apps. It's
				simply a bug in the library we use to
				access fonts that chokes things. This
				will (hopefully) improve in the future.
  -a folder Pog --all folder Pog
				Puts all fonts in this folder into the Pog.
				If the Pog already exists, it will add
				only *new* fonts, this means fonts are not
				repeated in that Pog.
  -A folder Pog --all-recurse folder Pog
				Puts all fonts in this folder and *all*
				sub-folders into the Pog. Rest same as -a.
  -z Pog --zip=Pog
				All the fonts inside Pog will be zipped
				and the zipfile will be named after the Pog.
				The file will be placed in the current
				directory.
				""")

use = _("""%(c)s [OPTIONS] [VIEW] [TARGET]
VIEW   : A place where fonts are. (A Pog or a Folder.)
TARGET : A "Pog". A place to keep those fonts.

("%(c)s" on it's own will start the GUI.)

NB: Try not to use spaces in Pog names. If you must, 
then "quote the name."

Please use -e to see more info.

NEWS : We now support TTF, OTF, Type1 (PFB, PFA) 
and TTC fonts.

%(version)s

The basic idea:
===============
Many designers have collections of font files in big
directory structures or on other media. Fonty Python
will let you gather your fonts and structure them
into collections -- or what I call "Pogs" -- a place
to keep tyPOGraphy. Well, why not?

Your fonts never move from where they are
(so don't worry). All that happens is that you select 
fonts visually and place their names into a Pog,
then you install or uninstall Pogs as you need them.
No copies of your fonts are made, only links to the
original files are used to install the fonts.

For example, you might have a Pog called 'logos'
into which you place all the fonts you have of
company logos. After that, when you need to work
with those logos, you simply install the 'logos' Pog
and start your design app!

FP is also great for just looking at fonts wherever
they are on your computer, without having to install
them system-wide.

Manage your fonts on Gnu/Linux!
===============================
%(copy)s

%(warranty)s

%(contact)s
""" ) % { "c":"fontypython", "folder":_pc.appPath(), "contact":contact, "copy":copyright, "warranty":warranty, "version":version }

	
examples = _("""The basic format is:
%(c)s [VIEW] [TARGET]
  VIEW   = A place where fonts are. A Pog or a folder
		   someplace.
  TARGET = A Pog, a place to keep references to fonts
		   If you don't include a target then you are
		   viewing/editing only.

Tips:
=====
* Don't use spaces in Pog names. If you absolutely
  must then use quotes around the name, e.g. "Pogs
  of Ni"
* If your design apps (for example The Gimp) do not
  reflect the fonts that you have installed, restart
  the app. Sometimes the system needs a while to
  reflect the new fonts in your fonts folder.

Examples: All using short options, see -h
=========
%(c)s /path/to/fonts/ttfs/a
  This will start off showing the fonts in that path.
 
%(c)s /path/to/fonts/ttfs/b Trouser
  This will let you view and choose fonts from the
  path and it will store them in a Pog named "Trouser".
  The Pog will be created if it's not already there.

%(c)s Lumberjack
  This will let you see the fonts in the Pog named
  "Lumberjack". You can also uninstall individual
  fonts by selecting them. A cross will appear
  indicating the fonts that will be uninstalled.

%(c)s Camelot Spamalot
  This will let you see and choose fonts in
  "Camelot" and it will store them in "Spamalot"
  It lets you copy fonts between Pogs.

%(c)s -i Cheese
  Will install the fonts in Pog Cheese so you can
  use them in other apps.

%(c)s -u Trouser
  Will uninstall the fonts listed in Pog Trouser,
  so you can't use 'em anymore.( You Naughty thing) 
  
%(c)s -s 128 
  Will set the point size to 128 - Crazy man!

%(c)s -n 25
  Will show 25 fonts at a time. Beware large numbers!
	
%(c)s -s 64 -v 10 Pimple
  Will set the point size to 64, the number of fonts
  to view is 10 and then display the Pimple Pog.

%(c)s -p Glutton
  If there are any fonts in "Glutton" that are not
  really on your drive/media anymore (perhaps you
  deleted them or the cat did) then this will go 
  through your Pog and cull them.

%(c)s -c /some/path/to/fonts
  If Fonty keeps crashing on /some/path/to/fonts
  then you should run a check on that folder.
  This will 'mark' the dangerous fonts and let
  you use that folder in the future.

%(c)s -a /some/path HolyHandGrenade
  This will put all the fonts in that path into
  the Pog called HolyHandGrenade.

%(c)s -A /some/path Tutto
  This will do the same as -a above: start in that 
  path, but it will then walk down recursivly 
  through all sub-folders too. The fonts will 
  be placed in Tutto.

Your fontypython folder is:
%(folder)s
If you want to backup your Pogs, that's where ya go.
%(contact)s

%(copy)s""") % { "c":"fontypython", "folder":_pc.appPath(), "contact":contact, "copy":copyright }

## These two are used in setup.py
description = _("Fonty Python - view and manage all kinds of fonts on Gnu/Linux")
long_description = _("""Manage your fonts on Gnu/Linux.
NEWS : We now support TTF, OTF, Type1 (PFB, PFA) 
and TTC fonts.

Many designers have collections of font files in big
directory structures or on other media. Fonty Python
will let you gather your fonts and structure them
into collections -- or what I call "Pogs" -- a place
to keep tyPOGraphy. Well, why not?

Your fonts never move from where they are
(so don't worry). All that happens is that you select 
fonts visually and place their names into a Pog,
then you install or uninstall Pogs as you need them.
No copies of your fonts are made, only links to the
original files are used to install the fonts.

For example, you might have a Pog called "logos"
into which you place all the fonts you have of
company logos. After that, when you need to work
with those logos, you simply install the 'logos' Pog
and start your design app!

FP is also great for just looking at fonts wherever
they are on your computer, without having to install
them system-wide.
	
	%(copy)s
	%(contact)s
	""") % {"copy":copyright, "contact":contact}


wxvers="2.8"
wxVersionError = _("""I cannot find "python-wxversion"
Please install this package - NB: ensure that
you use only the "Unicode build".

TIP
===
On my distro I can search for it like this:
aptitude search python-wx
This returns many results, one of which is:
python-wxversion 
I then install it like this:
sudo aptitude install python-wxversion 

If you get long error messages, you will need to
install python-wxgtk*, where the star means the 
version number and it should be at least %(wxv)s

You can also get the latest version from here:
http://wxpython.org/download.php
""") % {"wxv":wxvers}
	
wxError =_("""I cannot find "python-wxgtkX.Y"
Please install this package - NB: ensure that
you use only the "Unicode build".

TIP
===
On my distro I can search for it like this:
aptitude search python-wx
This returns many results, one of which is:
python-wxgtk%(wxv)s
I then install it like this:
sudo aptitude install python-wxgtk%(wxv)s

Make sure it's at least version %(wxv)s

You can also get the latest version from here:
http://wxpython.org/download.php
""") % {"wxv":wxvers}


PILError = _("""I cannot find "python-imaging"
Please install this package.

TIP
===
On my distro I can search for it like this:
aptitude search python-imag
This returns many results, one of which is:
python-imaging
I then install it like this:
sudo aptitude install python-imaging

Make sure it's at least version 1.1.6-1

You can also get the latest version from here:
http://www.pythonware.com/products/pil/index.htm
""")

## Won't xlate the thanks:
thanks = u"""Many thanks to:
1. Robin Dunn - wxPython and much sundry help.

2. Martin v. Löwis - Essential concepts regarding unicode and files.

3. Pietro Battiston - Italian translation.

4. Baptiste - French translation and many ideas.

5. Jason Yamada-Hanff - For the wiki, at least :)

6. Michael Hoeft - For code, friendship and the German translation.

7. Kartik Mistry - Our esteemed Debian packager!

8. savannah.nongnu.org - For the hosting.

9. And all those I have neglected to include.
"""

## June 2009 : Get the GPL from the COPYING file rather than a copy of it all here again.
try:
	root = __file__                              
	if os.path.islink(root):                     
		root = os.path.realpath(root)            
	fontyroot = os.path.dirname(os.path.abspath(root)) 
	p = os.path.join(fontyroot,'COPYING')
	GPL = open(p,"r").read()
except:
	GPL = """
					GNU GENERAL PUBLIC LICENSE
					   Version 3, 29 June 2007

The file "COPYING" cannot be found. Please check the installation directory for the licence.
"""