1 # -*- coding: utf-8 -*-
3 # (c) Copyright 2001-2007 Hewlett-Packard Development Company, L.P.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 # Thanks to Henrique M. Holschuh <hmh@debian.org> for various security patches
29 from base import utils
35 log.error("Unable to load qt3. Is python-qt3 installed?")
39 def load_pixmap(name, subdir=None, resize_to=None): # Qt3 only
40 name = ''.join([os.path.splitext(name)[0], '.png'])
44 ldir = os.path.join(os.getcwd(), 'data', 'images')
46 dir = os.path.join(prop.image_dir, subdir)
47 ldir = os.path.join(os.getcwd(), 'data', 'images', subdir)
50 f = os.path.join(d, name)
53 if resize_to is not None:
56 pm.convertFromImage(img.smoothScale(*resize_to), 0)
61 for w in utils.walkFiles(dir, recurse=True, abs_paths=True, return_folders=False, pattern=name):
62 if resize_to is not None:
65 pm.convertFromImage(img.smoothScale(*resize_to), 0)
70 log.error("Pixmap '%s' not found!" % name)