diff options
author | Matt Wilson <msw@redhat.com> | 2001-07-25 02:19:48 +0000 |
---|---|---|
committer | Matt Wilson <msw@redhat.com> | 2001-07-25 02:19:48 +0000 |
commit | 98f8de10a0032f3c200497970303e3b0631124fc (patch) | |
tree | 4c3962f1364dd9bc10203b90b1b7d77a3f9af696 | |
parent | 1c9ff234c13bf6fd5486033d17c199accadec49d (diff) | |
download | anaconda-98f8de10a0032f3c200497970303e3b0631124fc.tar.gz anaconda-98f8de10a0032f3c200497970303e3b0631124fc.tar.xz anaconda-98f8de10a0032f3c200497970303e3b0631124fc.zip |
Remove all python use of Imlib; replace with gdk pixbuf
-rwxr-xr-x | gui.py | 49 | ||||
-rw-r--r-- | iw/account_gui.py | 12 | ||||
-rw-r--r-- | iw/bootdisk_gui.py | 6 | ||||
-rw-r--r-- | iw/bootloader_gui.py | 20 | ||||
-rw-r--r-- | iw/confirm_gui.py | 6 | ||||
-rw-r--r-- | iw/congrats_gui.py | 12 | ||||
-rw-r--r-- | iw/installpath_gui.py | 6 | ||||
-rw-r--r-- | iw/keyboard_gui.py | 6 | ||||
-rw-r--r-- | iw/language_gui.py | 6 | ||||
-rw-r--r-- | iw/language_support_gui.py | 14 | ||||
-rw-r--r-- | iw/mouse_gui.py | 6 | ||||
-rw-r--r-- | iw/package_gui.py | 21 | ||||
-rw-r--r-- | iw/partition_gui.py | 2 | ||||
-rw-r--r-- | iw/progress_gui.py | 21 | ||||
-rw-r--r-- | iw/silo_gui.py | 13 | ||||
-rw-r--r-- | iw/timezone_gui.py | 6 | ||||
-rw-r--r-- | iw/welcome_gui.py | 26 | ||||
-rw-r--r-- | iw/xconfig_gui.py | 65 | ||||
-rw-r--r-- | splashscreen.py | 23 |
19 files changed, 138 insertions, 182 deletions
@@ -18,7 +18,7 @@ import os os.environ["LC_ALL"] = "C" import GDK -import GdkImlib +import gdkpixbuf import iutil import string import isys @@ -681,19 +681,18 @@ class InstallControlWindow: # Create header at the top of the installer if runres != '640x480': - for dir in ["/usr/share/anaconda/", - "", - "/tmp/updates"]: + for dir in ("/usr/share/anaconda/", + "", + "/tmp/updates"): try: - im = GdkImlib.Image (dir + image) + p = gdkpixbuf.new_from_file(dir + image) except: - im = None + p = None else: break - if im: - im.render () - pix = im.make_pixmap () + if p: + pix = apply(GtkPixmap, p.render_pixmap_and_mask()) a = GtkAlignment () a.add (pix) a.set (0.5, 0.5, 1.0, 1.0) @@ -826,16 +825,32 @@ class InstallControlState: def getHelpButtonEnabled (self): return self.helpButtonEnabled + def findPixmap(self, file): + for path in ("/usr/share/anaconda/pixmaps/", "pixmaps/", + "/usr/share/anaconda/", "", + "/mnt/source/RHupdates/pixmaps/", + "/mnt/source/RHupdates/"): + fn = path + file + if os.access(fn, os.R_OK): + return fn + return None + def readPixmap (self, file): + fn = self.findPixmap(file) + if not fn: + log("unable to load %s", file) + return None try: - im = GdkImlib.Image ("/usr/share/anaconda/pixmaps/" + file) - except: - try: - im = GdkImlib.Image ("pixmaps/" + file) - except: - print "Unable to load", file - return None - return im + p = gdkpixbuf.new_from_file (fn) + except RuntimeError: + log("unable to read %s", file) + return None + if p: + pix = apply (GtkPixmap, p.render_pixmap_and_mask()) + return pix + else: + log("unable to read %s", file) + return None def readHTML (self, file): self.htmlFile = file diff --git a/iw/account_gui.py b/iw/account_gui.py index 0a9959118..13883524a 100644 --- a/iw/account_gui.py +++ b/iw/account_gui.py @@ -260,10 +260,8 @@ class AccountWindow (InstallWindow): box = GtkVBox () hbox = GtkHBox() - im = self.ics.readPixmap ("root-password.png") - if im: - im.render () - pix = im.make_pixmap () + pix = self.ics.readPixmap ("root-password.png") + if pix: a = GtkAlignment () a.add (pix) a.set (0.0, 0.0, 0.0, 0.0) @@ -343,10 +341,8 @@ class AccountWindow (InstallWindow): bb.pack_start (self.delete) hbox = GtkHBox() - im = self.ics.readPixmap ("users.png") - if im: - im.render () - pix = im.make_pixmap () + pix = self.ics.readPixmap ("users.png") + if pix: a = GtkAlignment () a.add (pix) a.set (0.5, 0.5, 0, 0) diff --git a/iw/bootdisk_gui.py b/iw/bootdisk_gui.py index 9b5d89704..029a9740b 100644 --- a/iw/bootdisk_gui.py +++ b/iw/bootdisk_gui.py @@ -42,10 +42,8 @@ class BootdiskWindow (InstallWindow): self.dispatch = disp box = GtkVBox (FALSE, 5) - im = self.ics.readPixmap ("gnome-floppy.png") - if im: - im.render () - pix = im.make_pixmap () + pix = self.ics.readPixmap ("gnome-floppy.png") + if pix: a = GtkAlignment () a.add (pix) a.set (0.0, 0.0, 0.0, 0.0) diff --git a/iw/bootloader_gui.py b/iw/bootloader_gui.py index de88e82e8..032de8847 100644 --- a/iw/bootloader_gui.py +++ b/iw/bootloader_gui.py @@ -17,23 +17,14 @@ from iw_gui import * from gtk import * from gnome.ui import * from translate import _, N_ -from xpms_gui import CHECKBOX_ON_XPM -from xpms_gui import CHECKBOX_OFF_XPM -import GdkImlib +import gdkpixbuf import iutil from package_gui import queryUpgradeContinue import gui class BootloaderWindow (InstallWindow): - foo = GdkImlib.create_image_from_xpm (CHECKBOX_ON_XPM) - foo.render() - checkMark = foo.make_pixmap() - del foo - - foo = GdkImlib.create_image_from_xpm (CHECKBOX_OFF_XPM) - foo.render() - checkMark_Off = foo.make_pixmap() - del foo + checkMark = None + checkMark_Off = None windowTitle = N_("Boot Loader Configuration") htmlTag = "bootloader" @@ -288,6 +279,11 @@ class BootloaderWindow (InstallWindow): # LiloWindow tag="lilo" def getScreen(self, dispatch, bl, fsset, diskSet): + if not BootloaderWindow.checkMark: + BootloaderWindow.checkMark = self.ics.readPixmap("checkbox-on.png") + if not BootloaderWindow.checkMark_Off: + BootloaderWindow.checkMark_Off = self.ics.readPixmap("checkbox-off.png") + self.dispatch = dispatch self.bl = bl self.intf = dispatch.intf diff --git a/iw/confirm_gui.py b/iw/confirm_gui.py index e302c047f..95c62527c 100644 --- a/iw/confirm_gui.py +++ b/iw/confirm_gui.py @@ -11,10 +11,8 @@ class ConfirmWindow (InstallWindow): hbox = GtkHBox (TRUE, 5) box = GtkVBox (FALSE, 5) - im = self.ics.readPixmap ("about-to-install.png") - if im: - im.render () - pix = im.make_pixmap () + pix = self.ics.readPixmap ("about-to-install.png") + if pix: a = GtkAlignment () a.add (pix) a.set (0.5, 0.5, 1.0, 1.0) diff --git a/iw/congrats_gui.py b/iw/congrats_gui.py index c57d0cf62..8a661ab58 100644 --- a/iw/congrats_gui.py +++ b/iw/congrats_gui.py @@ -22,10 +22,8 @@ class CongratulationWindow (InstallWindow): hbox = GtkHBox (TRUE, 5) - im = self.ics.readPixmap ("done.png") - if im: - im.render () - pix = im.make_pixmap () + pix = self.ics.readPixmap ("done.png") + if pix: a = GtkAlignment () a.add (pix) a.set (0.5, 0.5, 1.0, 1.0) @@ -73,10 +71,8 @@ class ReconfigCongratulationWindow (InstallWindow): hbox = GtkHBox (TRUE, 5) - im = self.ics.readPixmap ("done.png") - if im: - im.render () - pix = im.make_pixmap () + pix = self.ics.readPixmap ("done.png") + if pix: a = GtkAlignment () a.add (pix) a.set (0.5, 0.5, 1.0, 1.0) diff --git a/iw/installpath_gui.py b/iw/installpath_gui.py index b72dd9582..0d676a64d 100644 --- a/iw/installpath_gui.py +++ b/iw/installpath_gui.py @@ -50,10 +50,8 @@ class InstallPathWindow (InstallWindow): box.set_sensitive(sensitive) def pixRadioButton (self, group, label, pixmap): - im = self.ics.readPixmap (pixmap) - if im: - im.render () - pix = im.make_pixmap () + pix = self.ics.readPixmap (pixmap) + if pix: hbox = GtkHBox (FALSE, 5) hbox.pack_start (pix, FALSE, FALSE, 0) label = GtkLabel (label) diff --git a/iw/keyboard_gui.py b/iw/keyboard_gui.py index 252b2b684..4b9247375 100644 --- a/iw/keyboard_gui.py +++ b/iw/keyboard_gui.py @@ -88,10 +88,8 @@ class KeyboardWindow (InstallWindow): box = GtkVBox(FALSE, 5) hbox = GtkHBox(FALSE, 5) - im = self.ics.readPixmap("gnome-keyboard.png") - if im: - im.render() - pix = im.make_pixmap() + pix = self.ics.readPixmap("gnome-keyboard.png") + if pix: a = GtkAlignment() a.add(pix) a.set(0.0, 0.0, 0.0, 0.0) diff --git a/iw/language_gui.py b/iw/language_gui.py index f0612976b..5dad11ee9 100644 --- a/iw/language_gui.py +++ b/iw/language_gui.py @@ -26,10 +26,8 @@ class LanguageWindow (InstallWindow): mainBox = GtkVBox (FALSE, 10) hbox = GtkHBox(FALSE, 5) - im = self.ics.readPixmap ("gnome-globe.png") - if im: - im.render () - pix = im.make_pixmap () + pix = self.ics.readPixmap ("gnome-globe.png") + if pix: a = GtkAlignment () a.add (pix) a.set (0.0, 0.0, 0.0, 0.0) diff --git a/iw/language_support_gui.py b/iw/language_support_gui.py index a7c17fc51..be89cee6c 100644 --- a/iw/language_support_gui.py +++ b/iw/language_support_gui.py @@ -3,25 +3,15 @@ from iw_gui import * from translate import _, N_ from xpms_gui import CHECKBOX_ON_XPM from xpms_gui import CHECKBOX_OFF_XPM -import GdkImlib +import gdkpixbuf from gnome.ui import * from flags import flags import checklist class LanguageSupportWindow (InstallWindow): - foo = GdkImlib.create_image_from_xpm (CHECKBOX_ON_XPM) - foo.render() - checkMark = foo.make_pixmap() - del foo - - foo = GdkImlib.create_image_from_xpm (CHECKBOX_OFF_XPM) - foo.render() - checkMark_Off = foo.make_pixmap() - del foo - windowTitle = _("Additional Language Support") htmlTag = "langsupport" - + def getNext (self): self.supportedLangs = [] diff --git a/iw/mouse_gui.py b/iw/mouse_gui.py index d56ca9a3a..c8aa7dff8 100644 --- a/iw/mouse_gui.py +++ b/iw/mouse_gui.py @@ -204,10 +204,8 @@ class MouseWindow (InstallWindow): hbox = GtkHBox(FALSE, 5) - im = self.ics.readPixmap ("gnome-mouse.png") - if im: - im.render () - pix = im.make_pixmap () + pix = self.ics.readPixmap ("gnome-mouse.png") + if pix: a = GtkAlignment () a.add (pix) a.set (0.0, 0.0, 0.0, 0.0) diff --git a/iw/package_gui.py b/iw/package_gui.py index b19f8b36c..f193f6b18 100644 --- a/iw/package_gui.py +++ b/iw/package_gui.py @@ -6,12 +6,11 @@ from thread import * from examine_gui import * import rpm import gui -import GdkImlib import string import sys -import xpms_gui from translate import _, N_ import checklist +import gdkpixbuf def queryUpgradeContinue(intf): rc = intf.messageWindow(_("Proceed with upgrade?"), @@ -330,10 +329,14 @@ class IndividualPackageSelectionWindow (InstallWindow): # self.ctree.unset_flags (CAN_FOCUS) if (not self.__dict__.has_key ("open_p")): - self.open_p, self.open_b = create_pixmap_from_xpm_d (self.ctree, - None, xpms_gui.DIRECTORY_OPEN_XPM) - self.closed_p, self.closed_b = create_pixmap_from_xpm_d (self.ctree, - None, xpms_gui.DIRECTORY_CLOSE_XPM) + fn = self.ics.findPixmap("directory-open.png") + p = gdkpixbuf.new_from_file (fn) + if p: + self.open_p, self.open_b = p.render_pixmap_and_mask() + fn = self.ics.findPixmap("directory-closed.png") + p = gdkpixbuf.new_from_file (fn) + if p: + self.closed_p, self.closed_b = p.render_pixmap_and_mask() groups = {} @@ -530,10 +533,8 @@ class PackageSelectionWindow (InstallWindow): pixname = string.replace (pixname, ')', '-') pixname = string.lower (pixname) + ".png" checkButton = None - im = self.ics.readPixmap (pixname) - if im: - im.render () - pix = im.make_pixmap () + pix = self.ics.readPixmap (pixname) + if pix: hbox = GtkHBox (FALSE, 5) hbox.pack_start (pix, FALSE, FALSE, 0) label = GtkLabel (_(comp.name)) diff --git a/iw/partition_gui.py b/iw/partition_gui.py index 9dc369564..8279b6331 100644 --- a/iw/partition_gui.py +++ b/iw/partition_gui.py @@ -24,8 +24,6 @@ from fsset import * from autopart import doPartitioning, queryAutoPartitionOK from autopart import CLEARPART_TYPE_LINUX_DESCR_TEXT, CLEARPART_TYPE_ALL_DESCR_TEXT, CLEARPART_TYPE_NONE_DESCR_TEXT from autopart import AUTOPART_DISK_CHOICE_DESCR_TEXT -from xpms_gui import CHECKBOX_ON_XPM -from xpms_gui import CHECKBOX_OFF_XPM import gui import parted diff --git a/iw/progress_gui.py b/iw/progress_gui.py index 3d3cfb278..151936c05 100644 --- a/iw/progress_gui.py +++ b/iw/progress_gui.py @@ -87,13 +87,12 @@ class InstallProgressWindow (InstallWindow): num = self.pixcurnum + 1 if num >= len(self.pixmaps): num = min(1, len(self.pixmaps)) - im = self.ics.readPixmap (self.pixmaps[num]) - im.render () - pix = im.make_pixmap () - self.adbox.remove (self.adpix) - pix.set_alignment (0.5, 0.5) - self.adbox.add (pix) - self.adpix = pix + pix = self.ics.readPixmap (self.pixmaps[num]) + if pix: + self.adbox.remove (self.adpix) + pix.set_alignment (0.5, 0.5) + self.adbox.add (pix) + self.adpix = pix self.adbox.show_all() self.pixcurnum = num self.pixtimer.reset() @@ -261,14 +260,12 @@ class InstallProgressWindow (InstallWindow): hbox.pack_start (clist, TRUE) vbox.pack_start (hbox, FALSE) - im = self.ics.readPixmap ("progress_first.png") - - if im: + pix = self.ics.readPixmap ("progress_first.png") + if pix: frame = GtkFrame() frame.set_shadow_type (SHADOW_IN) - im.render () box = GtkEventBox () - self.adpix = im.make_pixmap () + self.adpix = pix style = box.get_style ().copy () style.bg[STATE_NORMAL] = style.white box.set_style (style) diff --git a/iw/silo_gui.py b/iw/silo_gui.py index 9a77753c4..bf1578b62 100644 --- a/iw/silo_gui.py +++ b/iw/silo_gui.py @@ -4,14 +4,9 @@ from iw_gui import * from gtk import * from translate import _ from xpms_gui import SMALL_CHECK -import GdkImlib +import gdkpixbuf class SiloWindow (InstallWindow): - foo = GdkImlib.create_image_from_xpm (SMALL_CHECK) - foo.render() - checkMark = foo.make_pixmap() - del foo - def __init__ (self, ics): InstallWindow.__init__ (self, ics) @@ -239,10 +234,8 @@ class SiloWindow (InstallWindow): optionBox.pack_start (self.silo, FALSE) topBox.pack_start (optionBox) - im = self.ics.readPixmap ("silo.png") - if im: - im.render () - pix = im.make_pixmap () + pix = self.ics.readPixmap ("silo.png") + if pix: a = GtkAlignment () a.add (pix) a.set (1.0, 0.0, 0.0, 0.0) diff --git a/iw/timezone_gui.py b/iw/timezone_gui.py index 8eef59bc8..274700379 100644 --- a/iw/timezone_gui.py +++ b/iw/timezone_gui.py @@ -177,10 +177,8 @@ class TimezoneWindow (InstallWindow): align.add (self.systemUTC) hbox.pack_start (align, FALSE) - im = self.ics.readPixmap ("timezone.png") - if im: - im.render () - pix = im.make_pixmap () + pix = self.ics.readPixmap ("timezone.png") + if pix: a = GtkAlignment () a.add (pix) a.set (1.0, 0.0, 0.0, 0.0) diff --git a/iw/welcome_gui.py b/iw/welcome_gui.py index aab534e1c..4d708ea41 100644 --- a/iw/welcome_gui.py +++ b/iw/welcome_gui.py @@ -2,7 +2,6 @@ from gtk import * from gnome.ui import * from iw_gui import * from translate import _, N_ -import GdkImlib class WelcomeWindow (InstallWindow): @@ -13,30 +12,17 @@ class WelcomeWindow (InstallWindow): InstallWindow.__init__ (self, ics) ics.setGrabNext (1) - def load_image(self, file): - try: - im = GdkImlib.Image("/usr/share/anaconda/" + file) - except: - try: - im = GdkImlib.Image("" + file) - except: - print "Unable to load", file - - return im - # WelcomeWindow tag="wel" def getScreen (self, configFileData): frame = GtkFrame () frame.set_shadow_type (SHADOW_IN) image = configFileData["WelcomeScreen"] - - im = self.load_image(image) + print "try to load", image + pix = self.ics.readPixmap(image) - if im: - im.render () + if pix: box = GtkEventBox () - pix = im.make_pixmap () style = box.get_style ().copy () style.bg[STATE_NORMAL] = style.white box.set_style (style) @@ -78,12 +64,10 @@ class ReconfigWelcomeWindow (InstallWindow): box.set_border_width (5) frame.add (box) - im = self.ics.readPixmap ("first-375.png") + pix = self.ics.readPixmap ("first-375.png") - if im: - im.render () + if pix: ebox = GtkEventBox () - pix = im.make_pixmap () style = ebox.get_style ().copy () style.bg[STATE_NORMAL] = style.white ebox.set_style (style) diff --git a/iw/xconfig_gui.py b/iw/xconfig_gui.py index fe6aaac47..3c7eb9844 100644 --- a/iw/xconfig_gui.py +++ b/iw/xconfig_gui.py @@ -1,25 +1,29 @@ -from gtk import * -from iw_gui import * -from translate import _, N_ +# +# xconfig_gui: gui X configuration +# +# Brent Fox <bfox@redhat.com> +# +# Copyright 2001 Red Hat, Inc. +# +# This software may be freely redistributed under the terms of the GNU +# library public license. +# +# You should have received a copy of the GNU Library Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# import copy import string import sys import iutil -import xpms_gui import glob - +import gdkpixbuf +from gtk import * +from iw_gui import * +from translate import _, N_ from monitor import isValidSyncRange -""" -_("Video Card") -_("Monitor") -_("Video Ram") -_("Horizontal Frequency Range") -_("Vertical Frequency Range") -_("Test failed") -""" - class XCustomWindow (InstallWindow): htmlTag = "xcustom" @@ -94,13 +98,12 @@ class XCustomWindow (InstallWindow): if self.monitor_align: self.hbox.remove (self.monitor_align) - im = self.ics.readPixmap (file) - im.render () - pix = im.make_pixmap () - self.monitor_align = GtkAlignment () - self.monitor_align.add (pix) - self.monitor_align.set (0.5, 0.5, 1.0, 1.0) - self.hbox.pack_start (self.monitor_align, TRUE, TRUE) + pix = self.ics.readPixmap (file) + if pix: + self.monitor_align = GtkAlignment () + self.monitor_align.add (pix) + self.monitor_align.set (0.5, 0.5, 1.0, 1.0) + self.hbox.pack_start (self.monitor_align, TRUE, TRUE) self.hbox.show_all() def swap_monitor (self, num): @@ -131,13 +134,11 @@ class XCustomWindow (InstallWindow): self.vbox4 = GtkVBox () if desktop == "GNOME": - im = self.ics.readPixmap("gnome.png") + pix = self.ics.readPixmap("gnome.png") elif desktop == "KDE": - im = self.ics.readPixmap("kde.png") + pix = self.ics.readPixmap("kde.png") - if im: - im.render () - pix = im.make_pixmap () + if pix: a = GtkAlignment () a.add (pix) a.set (0.5, 0.5, 1.0, 1.0) @@ -512,7 +513,10 @@ class MonitorWindow (InstallWindow): self.hEntry = GtkEntry () self.vEntry = GtkEntry () - (self.monitor_p, self.monitor_b) = create_pixmap_from_xpm_d (self.ctree, None, xpms_gui.MONITOR_XPM) + fn = self.ics.findPixmap("monitor-small.png") + p = gdkpixbuf.new_from_file (fn) + if p: + self.monitor_p, self.monitor_b = p.render_pixmap_and_mask() # load monitor list and insert into tree self.orig_name = self.monitor.getMonitorID(useProbed=1) @@ -833,8 +837,11 @@ class XConfigWindow (InstallWindow): self.ctree.set_selection_mode (SELECTION_BROWSE) self.ctree.set_expander_style(CTREE_EXPANDER_TRIANGLE) self.ctree.set_line_style(CTREE_LINES_NONE) - - (self.videocard_p, self.videocard_b) = create_pixmap_from_xpm_d (self.ctree, None, xpms_gui.VIDEOCARD_XPM) + + fn = self.ics.findPixmap("videocard.png") + p = gdkpixbuf.new_from_file (fn) + if p: + self.videocard_p, self.videocard_b = p.render_pixmap_and_mask() self.manufacturer_nodes = {} diff --git a/splashscreen.py b/splashscreen.py index e5adcfe3e..44e35258a 100644 --- a/splashscreen.py +++ b/splashscreen.py @@ -22,7 +22,7 @@ from gtk import * from gtk import _root_window from flags import flags import GDK -import GdkImlib +import gdkpixbuf splashwindow = None @@ -46,38 +46,35 @@ def splashScreenShow(configFileData): def load_image(file): try: -# im = GdkImlib.Image("/usr/share/anaconda/pixmaps/" + file) - im = GdkImlib.Image("/usr/share/anaconda/" + file) + p = gdkpixbuf.new_from_file("/usr/share/anaconda/" + file) except: try: - im = GdkImlib.Image("" + file) + p = gdkpixbuf.new_from_file("" + file) except: - im = None + p = None print "Unable to load", file - return im + return p global splashwindow width = screen_width() - im = None + p = None # If the xserver is running at 800x600 res or higher, use the # 800x600 splash screen. if width >= 800: -# im = load_image('first.png') image = configFileData["Splashscreen"] - im = load_image(image) + p = load_image(image) else: - im = load_image('pixmaps/first-lowres.png') + p = load_image('pixmaps/first-lowres.png') - if im: - im.render () + if p: + pix = apply (GtkPixmap, p.render_pixmap_and_mask()) splashwindow = GtkWindow () splashwindow.set_position (WIN_POS_CENTER) box = GtkEventBox () - pix = im.make_pixmap () style = box.get_style ().copy () style.bg[STATE_NORMAL] = style.white box.set_style (style) |