summaryrefslogtreecommitdiffstats
path: root/gui.py
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2002-08-14 06:01:18 +0000
committerJeremy Katz <katzj@redhat.com>2002-08-14 06:01:18 +0000
commit633deebaa2fb250a032abca252b906489a90fd36 (patch)
treeb956bd0b1c4b47e2033914236e63eb3683793a6a /gui.py
parentfebf4c25c6f280167369f4f9e5c4bbac1eb979c6 (diff)
downloadanaconda-633deebaa2fb250a032abca252b906489a90fd36.tar.gz
anaconda-633deebaa2fb250a032abca252b906489a90fd36.tar.xz
anaconda-633deebaa2fb250a032abca252b906489a90fd36.zip
scale images to 425x225 if they're not that size for the ransom notes
Diffstat (limited to 'gui.py')
-rwxr-xr-xgui.py25
1 files changed, 17 insertions, 8 deletions
diff --git a/gui.py b/gui.py
index 3083e2bed..cd5a24d65 100755
--- a/gui.py
+++ b/gui.py
@@ -1180,7 +1180,7 @@ class InstallControlState:
return fn
return None
- def readPixmap (self, file):
+ def readPixmap (self, file, height = None, width = None):
fn = self.findPixmap(file)
if not fn:
log("unable to load %s", file)
@@ -1190,13 +1190,22 @@ class InstallControlState:
except RuntimeError, msg:
log("unable to read %s: %s", file, msg)
return None
- source = gtk.IconSource()
- source.set_pixbuf(pixbuf)
- source.set_size(gtk.ICON_SIZE_DIALOG)
- source.set_size_wildcarded(gtk.FALSE)
- iconset = gtk.IconSet()
- iconset.add_source(source)
- p = gtk.image_new_from_icon_set(iconset, gtk.ICON_SIZE_DIALOG)
+ curheight = pixbuf.get_height()
+ curwidth = pixbuf.get_width()
+ if (height is not None and width is not None
+ and height != curheight and width != curwidth):
+ sclpix = pixbuf.scale_simple(height, width,
+ gtk.gdk.INTERP_BILINEAR)
+ p = gtk.Image()
+ p.set_from_pixbuf(sclpix)
+ else:
+ source = gtk.IconSource()
+ source.set_pixbuf(pixbuf)
+ source.set_size(gtk.ICON_SIZE_DIALOG)
+ source.set_size_wildcarded(gtk.FALSE)
+ iconset = gtk.IconSet()
+ iconset.add_source(source)
+ p = gtk.image_new_from_icon_set(iconset, gtk.ICON_SIZE_DIALOG)
return p
def readHTML (self, file):