2 # -*- coding: UTF-8 -*-
5 # graphical user interface for pdf2swf
7 # Part of the swftools package.
9 # Copyright (c) 2008,2009 Matthias Kramm <kramm@quiss.org>
11 # This program is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; either version 2 of the License, or
14 # (at your option) any later version.
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write to the Free Software
23 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
26 from gui
import fields
28 class Quality(wx
.Panel
):
29 def __init__(self
, parent
):
30 wx
.Panel
.__init
__(self
, parent
)
33 sizer
= wx
.BoxSizer(wx
.VERTICAL
)
35 ("bitmap", "poly2bitmap", "bitmapfonts", "textonly"),
37 [u
"Convert polygons to polygons and fonts to fonts",
39 u
"Convert fonts to fonts, everything else to bitmaps",
41 u
"Convert everthing to bitmaps", (1, 0, 1, 0),
42 u
"Convert text only", (0, 0, 0, 1),
46 self
.__options
.append(obj
)
47 sizer
.Add(ra
, 0, wx
.EXPAND|wx
.ALL
, 5)
50 ('Spinner', 'zoom', u
'Resolution (in dpi):', (0, 100), 72),
51 ('Slider', 'fontquality', u
'Font quality:', (0, 100), 20),
52 ('Choose', 'storeallcharacters', u
'Insert full fonts in SWF file:',
53 (u
'no', 0, u
'yes', 1), 0),
54 ('Choose', 'local-with-filesystem', u
'Make SWF local-with-filesystem (instead of local-with-network)',
55 (u
'no', 0, u
'yes', 1), 0),
56 ('Slider', 'splinequality', u
'Polygon quality:', (0, 100), 100),
57 ('Slider', 'jpegquality', u
'JPEG quality:', (0, 100), 75),
58 ('Choose', 'jpegsubpixels', u
'JPEG image resolution:',
59 (u
'same as in PDF', 0, u
'1x', 1, u
'2x', 2, u
'4x', 4), 0),
60 ('Choose', 'ppmsubpixels', u
'non-JPEG image resolution:',
61 (u
'same as in PDF', 0, u
'1x', 1, u
'2x', 2, u
'4x', 4), 0),
64 box
= wx
.StaticBox(self
, label
=u
"Quality")
65 bsizer
= wx
.StaticBoxSizer(box
, wx
.VERTICAL
)
67 flex
= wx
.FlexGridSizer(cols
=2, hgap
=0, vgap
=0)
68 flex
.AddGrowableCol(0)
69 flex
.AddGrowableCol(1)
70 for ctrl
, opt
, label
, range, value
in quality
:
71 wxobj
= getattr(fields
, ctrl
)
72 optobj
= wxobj(opt
, label
, range, value
)
73 lb
, sp
= optobj
.draw(self
)
74 flex
.Add(lb
, 0, wx
.TOP|wx
.ALIGN_CENTER_VERTICAL
, 5)
75 flex
.Add(sp
, 0, wx
.TOP|wx
.EXPAND
, 5)
76 self
.__options
.append(optobj
)
78 bsizer
.Add(flex
, 0, wx
.EXPAND
)
79 sizer
.Add(bsizer
, 0, wx
.EXPAND|wx
.ALL
, 5)
83 def __get_options(self
):
85 options
= property(__get_options
)
89 for opt
in self
.__options
:
90 data
[opt
.name
] = opt
.value
93 def unpickle(self
, data
):
95 for opt
in self
.__options
:
96 fields
[opt
.name
] = opt
98 for k
, v
in data
.items():