summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--iw/bootdisk_gui.py83
-rw-r--r--iw/xconfig_gui.py1137
-rw-r--r--textw/bootdisk_text.py42
-rw-r--r--textw/xconfig_text.py740
4 files changed, 0 insertions, 2002 deletions
diff --git a/iw/bootdisk_gui.py b/iw/bootdisk_gui.py
deleted file mode 100644
index 18a25355b..000000000
--- a/iw/bootdisk_gui.py
+++ /dev/null
@@ -1,83 +0,0 @@
-#
-# bootdisk_gui.py: gui bootdisk creation dialog
-#
-# Copyright 2000-2002 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 iutil
-from iw_gui import *
-import gtk
-from rhpl.translate import _, N_
-from constants import *
-import gui
-
-class BootdiskWindow (InstallWindow):
-
- htmlTag = "bootdisk"
- windowTitle = N_("Boot Diskette Creation")
-
- def __init__ (self, ics):
- InstallWindow.__init__ (self, ics)
- ics.setPrevEnabled (False)
-
- def getNext (self):
- if iutil.getArch() == "alpha" or iutil.getArch() == "ia64":
- return None
-
- if self.skipDisk.get_active ():
- self.dispatch.skipStep("makebootdisk")
- else:
- self.dispatch.skipStep("makebootdisk", skip = 0)
-
- return None
-
- # BootdiskWindow tag="bootdisk"
- def getScreen (self, dir, disp, fsset):
- self.dispatch = disp
-
- box = gtk.VBox (False, 5)
- pix = gui.readImageFromFile ("gnome-floppy.png")
- if pix:
- a = gtk.Alignment ()
- a.add (pix)
- a.set (0.0, 0.0, 0.0, 0.0)
- box.pack_start (a, False)
-
- label = None
-
- text = _("The boot diskette allows you to boot your %s "
- "system from a floppy diskette. A boot diskette "
- "allows you to boot your system in the event your "
- "bootloader configuration stops working, if you "
- "chose not to install a boot loader, or if your "
- "third-party boot loader does not support Linux.\n\nIt is "
- "highly recommended you create a boot diskette.\n") % (productName,)
-
- label = gtk.Label (text)
-
- label.set_line_wrap (True)
- box.pack_start (label, False)
-
- radioBox = gtk.VBox (False)
-
- self.createDisk = gtk.RadioButton(
- None, _("_Yes, I would like to create a boot diskette"))
- radioBox.pack_start(self.createDisk, False, False, padding=10)
- self.skipDisk = gtk.RadioButton(
- self.createDisk, _("No, I _do not want to create a boot diskette"))
- radioBox.pack_start(self.skipDisk, False, False)
-
- self.createDisk.set_active(1)
-
- align = gtk.Alignment(0.5, 0.0)
- align.add(radioBox)
- box.pack_start(align)
-
- return box
diff --git a/iw/xconfig_gui.py b/iw/xconfig_gui.py
deleted file mode 100644
index 85b80d5ad..000000000
--- a/iw/xconfig_gui.py
+++ /dev/null
@@ -1,1137 +0,0 @@
-#
-# xconfig_gui: gui X configuration
-#
-# Brent Fox <bfox@redhat.com>
-#
-# Copyright 2000-2002 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 glob
-import gui
-import gobject
-import gtk
-from iw_gui import *
-from constants import *
-
-from rhpl.translate import _, N_
-from rhpl.monitor import isValidSyncRange
-
-import logging
-log = logging.getLogger("anaconda")
-
-from desktop import ENABLE_DESKTOP_CHOICE
-
-from gui import setupTreeViewFixupIdleHandler
-
-ddc_monitor_string = _("DDC Probed Monitor")
-unprobed_monitor_string = _("Unprobed Monitor")
-
-
-### why is this here???
-def makeFormattedLabel(text):
- label = gtk.Label (text)
- label.set_justify (gtk.JUSTIFY_LEFT)
- label.set_line_wrap (True)
- label.set_alignment (0.0, 0.5)
- label.set_size_request (400, -1)
- return label
-
-
-class XCustomWindow (InstallWindow):
-
- htmlTag = "xcustom"
- windowTitle = N_("Customize Graphical Configuration")
-
- def __init__ (self, ics):
- InstallWindow.__init__ (self, ics)
- self.ics.setNextEnabled (True)
-
-
- def getPrev(self):
- # restore settings
- self.xsetup.xhwstate.set_resolution(self.origres)
- self.xsetup.xhwstate.set_colordepth(self.origdepth)
- return None
-
- def getNext (self):
-
- self.xsetup.xhwstate.set_colordepth(self.selectedDepth)
- self.xsetup.xhwstate.set_resolution(self.selectedRes)
-
- if ENABLE_DESKTOP_CHOICE:
- self.desktop.setDefaultDesktop (self.newDesktop)
-
- # if we gave them a choice on login style then store it
- # otherwise we're just using default setup by
- # packages.py::handleX11Packages()
- if self.instClass.showLoginChoice:
- if self.text.get_active ():
- rl = 3
- elif self.graphical.get_active ():
- rl = 5
-
- self.desktop.setDefaultRunLevel(rl)
-
-
- def testPressed (self, widget, *args):
- log.warning("Somehow X test was attempted")
- return
-
- def numCompare (self, first, second):
- if first > second:
- return 1
- elif first < second:
- return -1
- return 0
-
- def depth_cb (self, widget):
- self.ignore_res_cb = 1
- loc = self.depth_optionmenu.get_history()
-
- if self.selectedDepth == self.avail_depth[loc]:
- self.ignore_res_cb = 0
- return
-
- self.selectedDepth = self.avail_depth[loc]
- self.xsetup.xhwstate.set_colordepth(self.selectedDepth)
-
- # now we set color depth, read out what modes are now supported
- self.selectedRes = self.xsetup.xhwstate.get_resolution()
- self.avail_res = self.xsetup.xhwstate.available_resolutions()
-
- self.create_res_optionmenu()
-
- if self.selectedRes not in self.avail_res:
- self.selectedRes = self.avail_res[-1]
-
- self.currentRes = self.avail_res.index(self.selectedRes)
- self.res_optionmenu.set_history(self.currentRes)
- self.ignore_res_cb = 0
-
- def res_cb (self, widget):
- if self.ignore_res_cb:
- return
-
- newres = self.res_optionmenu.get_history()
- if self.currentRes == newres:
- return
-
- self.currentRes = newres
- self.selectedRes = self.avail_res[self.currentRes]
- self.xsetup.xhwstate.set_resolution(self.selectedRes)
-
- self.swap_monitor (self.currentRes)
-
- def create_res_optionmenu(self):
- if self.res_optionmenu is None:
- self.res_optionmenu = gtk.OptionMenu()
-
- if self.res_menu is not None:
- self.res_optionmenu.remove_menu()
-
- self.res_menu = gtk.Menu()
-
- for r in self.avail_res:
- item = gtk.MenuItem(r)
- item.show()
- self.res_menu.add(item)
-
- self.res_optionmenu.set_menu(self.res_menu)
-
- def load_monitor_preview_pixmap(self, file):
- if self.monitor_align:
- self.hbox.remove (self.monitor_align)
-
- pix = gui.readImageFromFile (file)
- if pix:
- self.monitor_align = gtk.Alignment ()
- 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):
- def find_monitor_pixmaps():
- files = []
-
- pixmaps1 = glob.glob("/usr/share/anaconda/pixmaps/monitor_*")
- pixmaps2 = glob.glob("pixmaps/monitor_*")
- if len(pixmaps1) < len(pixmaps2):
- files = pixmaps2
- else:
- files = pixmaps1
-
- pixmaps = []
- for pixmap in files:
- pixmaps.append(pixmap[string.find(pixmap, "monitor_"):])
-
- pixmaps.sort()
- return pixmaps
-
- if self.monitor_pixmaps == None:
- self.monitor_pixmaps = find_monitor_pixmaps()
-
- try:
- self.load_monitor_preview_pixmap(self.monitor_pixmaps[num])
- except:
- log.warning("Unable to load monitor preview #%s", num)
-
- def display_desktop_pixmap(self, desktop):
- self.vbox4.destroy ()
- self.vbox4 = gtk.VBox ()
-
- if desktop == "GNOME":
- pix = gui.readImageFromFile ("gnome.png")
- elif desktop == "KDE":
- pix = gui.readImageFromFile ("kde.png")
- else:
- pix = None
-
- if pix:
- a = gtk.Alignment ()
- a.add (pix)
- a.set (0.5, 0.5, 1.0, 1.0)
- self.vbox4.pack_start (a, True, True)
-
- self.hbox4.pack_start (self.vbox4)
- self.hbox4.show_all ()
-
- def desktop_cb (self, widget, desktop):
- self.newDesktop = desktop
-
- self.display_desktop_pixmap(desktop)
-
- # XCustomWindow tag="xcustom"
- def getScreen (self, xsetup, monitor, videocard, desktop, grpset,
- instClass, instPath):
-
- self.xsetup = xsetup
- self.monitor = monitor
- self.videocard = videocard
- self.desktop = desktop
- self.instClass = instClass
-
- # dont do anything on ppc - we want to use default fb setting
- if iutil.getArch() != "ppc":
- if not xsetup.imposed_sane_default:
- xsetup.xhwstate.choose_sane_default()
- xsetup.imposed_sane_default = 1
-
- # save so we can restore if necessary going back
- self.origres = self.xsetup.xhwstate.get_resolution()
- self.origdepth = self.xsetup.xhwstate.get_colordepth()
-
- self.instPath = instPath
-
- # create toplevel packing structure
- self.box = gtk.VBox (False)
- self.box.set_border_width (5)
-
- # hbox and alignment used for monitor preview area
- # list of pixmaps for monitor preview
- self.monitor_pixmaps = None
- self.hbox = gtk.HBox (False, 5)
- self.monitor_align = None
- self.desktop_align = None
- self.load_monitor_preview_pixmap("monitor.png")
- self.box.pack_start (self.hbox)
-
- hbox1 = gtk.HBox (False, 5)
- hbox3 = gtk.HBox (False, 5)
- hbox4 = gtk.HBox (False, 5)
-
- frame1 = gtk.Frame (_("_Color Depth:"))
- frame1.get_label_widget().set_property("use-underline", True)
- frame1.set_shadow_type (gtk.SHADOW_NONE)
- frame1.set_border_width (10)
- hbox1.pack_start(frame1, True, False, 0)
-
- # determine video modes available for this card/monitor combo
- self.avail_depth = self.xsetup.xhwstate.available_color_depths()
-
- self.depth_list = [(_("256 Colors (8 Bit)")),
- (_("High Color (16 Bit)")),
- (_("True Color (24 Bit)"))]
- self.bit_depth = [8, 16, 24]
-
- # create option menu for bit depth
- self.depth_optionmenu = gtk.OptionMenu()
- self.depth_menu = gtk.Menu()
-
- for i in range(0, len(self.depth_list)):
- if self.bit_depth[i] in self.avail_depth:
- d = self.depth_list[i]
- item = gtk.MenuItem(d)
- item.show()
- self.depth_menu.add(item)
-
- self.depth_optionmenu.set_menu(self.depth_menu)
-
- frame1.add (self.depth_optionmenu)
- frame1.get_label_widget().set_mnemonic_widget(self.depth_optionmenu)
-
- # now we do screen resolution
- frame2 = gtk.Frame (_("_Screen Resolution:"))
- frame2.get_label_widget().set_property("use-underline", True)
- frame2.set_shadow_type (gtk.SHADOW_NONE)
- frame2.set_border_width (10)
- hbox1.pack_start (frame2, True, False, 2)
-
- self.avail_res = self.xsetup.xhwstate.available_resolutions()
-
- self.res_optionmenu = None
- self.res_menu = None
- self.create_res_optionmenu()
-
- frame2.add (self.res_optionmenu)
- frame2.get_label_widget().set_mnemonic_widget(self.res_optionmenu)
-
- # apply current configuration to UI
- self.selectedDepth = self.xsetup.xhwstate.get_colordepth()
- self.selectedRes = self.xsetup.xhwstate.get_resolution()
-
- if self.selectedDepth not in self.avail_depth:
- self.selectedDepth = self.avail_depth[-1]
-
- idx = self.avail_depth.index(self.selectedDepth)
- self.depth_optionmenu.set_history(idx)
-
- if self.selectedRes not in self.avail_res:
- self.selectedRes = self.avail_res[-1]
-
- self.currentRes = self.avail_res.index(self.selectedRes)
- self.res_optionmenu.set_history (self.currentRes)
- self.swap_monitor(self.currentRes)
-
- self.depth_optionmenu.connect ("changed", self.depth_cb)
- self.ignore_res_cb = 0
- self.res_optionmenu.connect ("changed", self.res_cb)
-
- self.box.pack_start (hbox1, False)
-
- #--If both KDE and GNOME are selected
- if grpset:
- gnomeSelected = (grpset.hdrlist.has_key('gnome-session')
- and grpset.hdrlist['gnome-session'].isSelected())
- kdeSelected = (grpset.hdrlist.has_key('kdebase')
- and grpset.hdrlist['kdebase'].isSelected())
- else:
- gnomeSelected = 0
- kdeSelected = 0
-
- self.newDesktop = ""
- self.origDesktop = self.desktop.getDefaultDesktop()
-
- if (ENABLE_DESKTOP_CHOICE) and (gnomeSelected or kdeSelected):
- hsep = gtk.HSeparator ()
- self.box.pack_start (hsep)
-
- if gnomeSelected and kdeSelected:
- frame3 = gtk.Frame (_("Please choose your default desktop environment:"))
- else:
- frame3 = gtk.Frame (_("Your desktop environment is:"))
-
- frame3.set_shadow_type (gtk.SHADOW_NONE)
- hbox3.pack_start (frame3, True, False, 2)
-
- self.hbox4 = gtk.HBox ()
- frame3.add (self.hbox4)
-
- # need to have this around so self.display_desktop_pixmap()
- # will work later. (messy)
- self.vbox4 = gtk.VBox()
-
- if gnomeSelected and kdeSelected:
- vbox3 = gtk.VBox()
-
- gnome_radio = gtk.RadioButton (None, (_("GNO_ME")))
- vbox3.pack_start (gnome_radio, True, False, 2)
- kde_radio = gtk.RadioButton(gnome_radio, (_("_KDE")))
- vbox3.pack_start (kde_radio, True, False, 2)
-
- self.hbox4.pack_start (vbox3)
-
- self.hbox4.pack_start (self.vbox4)
-
- #--Set the desktop GUI widget to what the user has selected
- if self.origDesktop == "GNOME":
- gnome_radio.set_active (True)
- self.display_desktop_pixmap("GNOME")
- elif self.origDesktop == "KDE":
- kde_radio.set_active (True)
- self.display_desktop_pixmap("KDE")
-
- gnome_radio.connect ("clicked", self.desktop_cb, "GNOME")
- kde_radio.connect ("clicked", self.desktop_cb, "KDE")
- else:
- self.hbox4.pack_start(gtk.Label(self.origDesktop))
- self.display_desktop_pixmap(self.origDesktop)
-
- self.box.pack_start (hbox3, False, True, 2)
- else:
- gnome_radio = None
- kde_radio = None
-
- hsep = gtk.HSeparator ()
- self.box.pack_start (hsep)
-
- # see if we should allow them to choose graphical or text login
- if self.instClass.showLoginChoice:
- frame4 = gtk.Frame (_("Please choose your login type:"))
- frame4.set_shadow_type (gtk.SHADOW_NONE)
- hbox4.pack_start (frame4, True, False, 2)
-
- self.hbox5 = gtk.HBox (True, 2)
- frame4.add (self.hbox5)
-
- self.text = gtk.RadioButton (None, (_("_Text")))
- self.graphical = gtk.RadioButton (self.text, (_("_Graphical")))
-
- self.runLevel = self.desktop.getDefaultRunLevel()
-
- if self.runLevel == 3:
- self.text.set_active (True)
- elif self.runLevel == 5:
- self.graphical.set_active (True)
-
- self.hbox5.pack_start (self.graphical, False, 2)
- self.hbox5.pack_start (self.text, False, 2)
-
- self.box.pack_start (hbox4, False, True, 2)
-
- return self.box
-
-class MonitorWindow (InstallWindow):
- windowTitle = N_("Monitor Configuration")
- htmlTag = ("monitor")
-
- def __init__ (self, ics):
- InstallWindow.__init__ (self, ics)
- self.ics.setNextEnabled (False)
- self.ics.setPrevEnabled (True)
-
- def getNext (self):
- if self.currentMonitor:
- monHoriz = string.replace(self.hEntry.get_text(), " ", "")
- monVert = string.replace(self.vEntry.get_text(), " ", "")
-
- if self.currentMonitor[:len(ddc_monitor_string)] == ddc_monitor_string:
- idname = "DDCPROBED"
- monname = self.currentMonitor[len(ddc_monitor_string)+3:]
- elif self.currentMonitor == unprobed_monitor_string:
- idname = "Unprobed Monitor"
- monname = "Unprobed Monitor"
- else:
- idname = self.currentMonitor
- monname = self.currentMonitor
-
- # warn user their monitor type is unprobed
- if idname == "Unprobed Monitor":
- rc = self.intf.messageWindow(_("Monitor Unspecified"),
- _("You have not selected a monitor type. It is "
- "recommended you choose the closest matching "
- "model in order to have the highest possible "
- "display quality."),
- type="custom",
- custom_buttons = [_("_Proceed"),
- _("_Choose monitor type")],
- custom_icon="warning")
- if rc:
- raise gui.StayOnScreen
-
- # XXX - this is messed up - we set the monitor object in instdata
- # to the current values, then we have to push it into the
- # xhwstate as well. Need to join this operation somehow.
- self.monitor.setSpecs(monHoriz,
- monVert,
- id=idname,
- name=monname)
-
- # shove into hw state object, force it to recompute available modes
- self.xsetup.xhwstate.monitor = self.monitor
- self.xsetup.xhwstate.set_monitor_name(self.currentMonitor)
- self.xsetup.xhwstate.set_hsync(monHoriz)
- self.xsetup.xhwstate.set_vsync(monVert)
- self.xsetup.xhwstate.recalc_mode()
-
- return None
-
- def setSyncField(self, field, value):
- self.ignoreEntryChanges = 1
- if value:
- field.set_text(value)
- else:
- field.set_text("")
- self.ignoreEntryChanges = 0
-
- def enableIfSyncsValid(self, entry, other):
- aval = entry.get_text()
- bval = other.get_text()
- if isValidSyncRange(aval) and isValidSyncRange(bval):
- self.ics.setNextEnabled (True)
- else:
- self.ics.setNextEnabled (False)
-
- def setCurrent(self, monitorname, recenter=1):
- self.ignoreEvents = 1
- self.currentMonitor = monitorname
-
- parent = None
- iter = self.monitorstore.get_iter_first()
-
- # iterate over the list, looking for the current monitor selection
- while iter:
- # if this is a parent node, get the first child and iter over them
- if self.monitorstore.iter_has_child(iter):
- parent = iter
- iter = self.monitorstore.iter_children(parent)
- continue
- # if it's not a parent node and the mouse matches, select it.
- elif self.monitorstore.get_value(iter, 0) == monitorname:
- path = self.monitorstore.get_path(parent)
- self.monitorview.expand_row(path, True)
- selection = self.monitorview.get_selection()
- selection.unselect_all()
- selection.select_iter(iter)
- path = self.monitorstore.get_path(iter)
- col = self.monitorview.get_column(0)
- self.monitorview.set_cursor(path, col, False)
- if recenter:
- self.monitorview.scroll_to_cell(path, col, True,
- 0.0, 0.5)
- break
- # get the next row.
- iter = self.monitorstore.iter_next(iter)
-
- # if there isn't a next row and we had a parent, go to the node
- # after the parent we've just gotten the children of.
- if not iter and parent:
- parent = self.monitorstore.iter_next(parent)
- iter = parent
-
- # set sync rates
- if monitorname == self.origMonitorName:
- hsync = self.origHsync
- vsync = self.origVsync
- elif monitorname[:len(ddc_monitor_string)] == ddc_monitor_string:
- hsync = self.ddcmon[2]
- vsync = self.ddcmon[3]
- elif monitorname == unprobed_monitor_string:
- hsync = "31.5"
- vsync = "50-61"
-# hsync = self.ddcmon[2]
-# vsync = self.ddcmon[3]
- else:
- monname = self.monitorstore.get_value(iter, 0)
- rc = self.monitor.lookupMonitorByName(monname)
- if rc:
- (model, eisa, vsync, hsync) = rc
- else:
- # no match for model ACK!
- print "Could not find match for monitor %s in list!" % monname
- print "How could this happen?"
-
- # use 640x480 to be safe
- hsync = "31.5"
- vsync = "50-61"
-
- self.setSyncField(self.hEntry, hsync)
- self.setSyncField(self.vEntry, vsync)
- self.enableIfSyncsValid(self.hEntry, self.vEntry)
-
- self.ignoreEvents = 0
-
- def selectMonitorType (self, selection, *args):
- if self.ignoreEvents:
- return
-
- (monxxx, iter) = selection.get_selected()
- if iter:
- monid = monxxx.get_value(iter, 0)
-
- self.setCurrent(monid, recenter=0)
- else:
- print "unknown error in selectMonitorType!"
-
- def monitorviewSelectCb(self, path):
- # XXX 01/09/2002 - work around broken gtkwidget, fix when jrb fixes
- if len(path) == 1:
- if self.lastvalidselection:
- self.ignoreEvents = 1
- selection = self.monitorview.get_selection()
- if not selection.path_is_selected(self.lastvalidselection):
- selection.select_path(self.lastvalidselection)
- self.ignoreEvents = 0
- return 0
-
- self.lastvalidselection = path
-
- return 1
-
- def resetCb (self, data):
- # if we have a ddc probe value, reset to that
- if self.ddcmon:
- self.setCurrent(ddc_monitor_string + " - " + self.ddcmon[1])
- else:
- self.setCurrent(unprobed_monitor_string)
-
- self.setSyncField(self.hEntry, self.origHsync)
- self.setSyncField(self.vEntry, self.origVsync)
-
- self.enableIfSyncsValid(self.hEntry, self.vEntry)
-
- self.currentMonitor = self.origMonitorName
-
- def insertCb (self, pos, text, len, data, entrys):
- if self.ignoreEntryChanges:
- return
-
- (entry, other) = entrys
- list = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", " ", ".", ","]
- if not(text[:1] in list):
- entry.emit_stop_by_name ("insert-text")
-
- self.enableIfSyncsValid(entry, other)
-
- def changedCb (self, data, entrys):
- if self.ignoreEntryChanges:
- return
-
- (entry, other) = entrys
- self.enableIfSyncsValid(entry, other)
-
- def getScreen (self, xsetup, monitor, intf):
-
- self.intf = intf
- self.xsetup = xsetup
- self.monitor = monitor
-
- # some flags to let us know when to ignore callbacks we caused
- self.ignoreEntryChanges = 0
- self.ignoreEvents = 0
-
- self.lastvalidselection = None
-
- box = gtk.VBox (False, 5)
-
- label = makeFormattedLabel (_("In most cases, the monitor can be "
- "automatically detected. If the "
- "detected settings are not correct "
- "for the monitor, select the right "
- "settings."))
- box.pack_start (label, False)
-
- # Monitor selection tree
- self.monitorstore = gtk.TreeStore(gobject.TYPE_STRING,
- gobject.TYPE_STRING)
- self.hEntry = gtk.Entry ()
- self.vEntry = gtk.Entry ()
-
- fn = self.ics.findPixmap("monitor-small.png")
- p = gtk.gdk.pixbuf_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.origMonitorID = self.monitor.getMonitorID()
- self.origMonitorName = self.monitor.getMonitorName()
- if not self.origMonitorName:
- self.origMonitorName = self.origMonitorID
-
- self.origHsync = self.monitor.getMonitorHorizSync()
- self.origVsync = self.monitor.getMonitorVertSync()
-
- monitorslist = self.monitor.monitorsDB ()
- keys = monitorslist.keys ()
- keys.sort ()
-
- # treat Generic monitors special
- idx = 0
- for man in ["Generic LCD Display", "Generic CRT Display", "Generic"]:
- if man in keys:
- keys.remove(man)
- keys.insert(idx, man)
- idx += 1
-
- self.currentMonitor = None
- toplevels={}
-
- # Insert DDC probed monitor if it had no match in database
- # or otherwise if we did not detect a monitor at all
- #--Add a category for a DDC probed monitor if a DDC monitor was probed
- self.ddcmon = self.monitor.getDDCProbeResults()
- if self.ddcmon:
- title = ddc_monitor_string
- monentry = title + " - " + self.ddcmon[1]
- else:
- title = unprobed_monitor_string
- monentry = title
-
- man = title
- toplevels[man] = self.monitorstore.append(None)
- self.monitorstore.set_value(toplevels[man], 0, title)
- iter = self.monitorstore.append(toplevels[man])
- self.monitorstore.set_value(iter, 0, monentry)
-
- # set as current monitor if necessary
- if self.origMonitorID == "DDCPROBED" or self.origMonitorID == "Unprobed Monitor":
- self.currentMonitor = monentry
- self.origMonitorName = monentry
-
- # now insert rest of monitors, unless we match the ddc probed id
- for man in keys:
- models = monitorslist[man]
- if man in ["Generic LCD Display", "Generic CRT Display", "Generic"]:
- title = _(man)
- # dont sort generic, present in order in file
- else:
- title = man
- models.sort()
-
- toplevels[man] = self.monitorstore.append(None)
- self.monitorstore.set_value(toplevels[man], 0, man)
-
- previous_monitor = ""
- for amonitor in models:
- if previous_monitor != "":
- if amonitor[0] == previous_monitor:
- continue
-
- if self.ddcmon and string.upper(self.ddcmon[0]) == string.upper(amonitor[1]):
- continue
-
- previous_monitor = amonitor[0]
- iter = self.monitorstore.append(toplevels[man])
- self.monitorstore.set_value(iter, 0, amonitor[0])
-
- if amonitor[0] == self.monitor.getMonitorID():
- self.currentMonitor = amonitor[0]
-
- self.monitorview = gtk.TreeView(self.monitorstore)
- self.monitorview.set_property("headers-visible", False)
- col = gtk.TreeViewColumn(None, gtk.CellRendererText(), text=0)
- self.monitorview.append_column(col)
-
- sw = gtk.ScrolledWindow ()
- sw.add (self.monitorview)
- sw.set_policy (gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
- sw.set_shadow_type(gtk.SHADOW_IN)
- box.pack_start (sw, True, True)
-
- self.setCurrent(self.currentMonitor)
- selection = self.monitorview.get_selection()
- selection.connect("changed", self.selectMonitorType)
- selection.set_select_function(self.monitorviewSelectCb)
-
- self.hEntry.connect ("insert_text", self.insertCb, (self.hEntry, self.vEntry))
- self.vEntry.connect ("insert_text", self.insertCb, (self.vEntry, self.hEntry))
-
- self.hEntry.connect ("changed", self.changedCb, (self.hEntry, self.vEntry))
- self.vEntry.connect ("changed", self.changedCb, (self.vEntry, self.hEntry))
-
- self.reset = gtk.Button (_("Restore _original values"))
- self.reset.connect ("clicked", self.resetCb)
- align = gtk.Alignment
-
- align = gtk.Alignment (1, 0.5)
- align.add (self.reset)
-
- synctable = gtk.Table(2, 4, False)
- hlabel = gui.MnemonicLabel (_("Hori_zontal Sync:"))
- hlabel.set_alignment (0, 0.5)
- hlabel.set_mnemonic_widget(self.hEntry)
- vlabel = gui.MnemonicLabel (_("_Vertical Sync:"))
- vlabel.set_alignment (0, 0.5)
- vlabel.set_mnemonic_widget(self.vEntry)
-
- self.hEntry.set_size_request (80, -1)
- self.vEntry.set_size_request (80, -1)
-
- hz = gtk.Label (_("kHz"))
- hz.set_alignment (0, 0.5)
-
- khz = gtk.Label (_("Hz"))
- khz.set_alignment (0, 0.5)
-
- synctable.attach(hlabel, 0, 1, 0, 1, gtk.SHRINK, gtk.FILL, 5)
- synctable.attach(self.hEntry, 1, 2, 0, 1, gtk.SHRINK)
- synctable.attach(hz, 2, 3, 0, 1, gtk.FILL, gtk.FILL, 5)
- synctable.attach(vlabel, 0, 1, 1, 2, gtk.SHRINK, gtk.FILL, 5)
- synctable.attach(self.vEntry, 1, 2, 1, 2, gtk.SHRINK)
- synctable.attach(khz, 2, 3, 1, 2, gtk.FILL, gtk.FILL, 5)
- synctable.attach(align, 3, 4, 1, 2)
-
- box.pack_start (synctable, False, False)
-
- setupTreeViewFixupIdleHandler(self.monitorview, self.monitorstore)
-
- return box
-
-class XConfigWindow (InstallWindow):
-
- htmlTag ="xconf"
- windowTitle = N_("Graphical Interface (X) Configuration")
-
- def __init__ (self, ics):
- InstallWindow.__init__ (self, ics)
- ics.setPrevEnabled (False)
- self.ics = ics
-
- def getNext (self):
- if self.skip.get_active():
- self.dispatch.skipStep("monitor")
- self.dispatch.skipStep("xcustom")
- self.dispatch.skipStep("writexconfig")
- self.xsetup.skipx = 1
-
- return None
- else:
- self.dispatch.skipStep("monitor", skip = 0)
- self.dispatch.skipStep("xcustom", skip = 0)
- self.dispatch.skipStep("writexconfig", skip = 0)
- self.xsetup.skipx = 0
-
- # if ppc then we bail now, you cant selected videocard for ppc
- if iutil.getArch() == "ppc":
- return None
-
- # set videocard type (assuming we're working with PRIMARY card)
- if self.currentCard:
- try:
- selected = self.cards[self.currentCard]
- except:
- self.intf.messageWindow(_("Unknown video card"),
- _("An error has occurred selecting "
- "the video card %s. Please report "
- "this error to %s.")
- %(self.currentCard, bugzillaUrl,))
- raise gui.StayOnScreen
-
- primary_card = self.videocard.primaryCard()
- primary_card.setCardData(selected)
- primary_card.setDevID (selected["NAME"])
- primary_card.setDescription (selected["NAME"])
-
- # pull out resolved version of card data
- card_data = primary_card.getCardData()
- if (card_data.has_key("DRIVER") and
- not card_data.has_key("UNSUPPORTED")):
- server = "Xorg"
- else:
- server = "XF86_" + card_data["SERVER"]
-
- primary_card.setXServer(server)
- else:
- selected = None
-
-
- # see if they actually picked a card, otherwise keep going
- if selected == None:
- self.intf.messageWindow(_("Unspecified video card"),
- _("You need to pick a video card before "
- "X configuration can continue. If you "
- "want to skip X configuration entirely "
- "choose the 'Skip X Configuration' button."))
- raise gui.StayOnScreen
-
- # sniff out the selected ram size
- menu = self.ramOption.get_menu ().get_active()
- index = 0
- for menu_item in self.ramOption.get_menu ().get_children ():
- if menu_item == menu:
- break
- index = index + 1
-
- vidram = self.videocard.possible_ram_sizes()[index]
-
- # lots of duplication here complicated by factor we have a
- # videocard object as part of instdata and in xhwstate!!
- # need to consolidate
- try:
- self.videocard.primaryCard().setVideoRam(str(vidram))
- self.xsetup.xhwstate.set_videocard_ram(vidram)
- cardname = self.videocard.primaryCard().cardData["NAME"]
- self.xsetup.xhwstate.set_videocard_name(cardname)
- self.xsetup.xhwstate.set_videocard_card(cardname)
- except:
- log.error("videocard-getNext: could not determine cardname for primary card %s", self.videocard.primaryCard())
- return None
-
- def skipToggled (self, widget, *args):
- if not self.force_ppc_fb:
- self.configbox.set_sensitive (not widget.get_active ())
-
- def selectCardType (self, selection, *args):
- if self.ignoreEvents:
- return
-
- (model, iter) = selection.get_selected()
- if iter:
- self.currentCard = model.get_value(iter, 0)
- else:
- print "unknown error in selectCardType!"
-
- def restorePressed (self, button):
- self.currentCard = self.probedCard
- self.currentMem = self.probedMem
- self.setCurrent(self.probedCard, self.probedMem)
-
- def desktopCb (self, widget, desktop):
- self.newDesktop = desktop
-
- def cardviewSelectCb(self, path):
- # XXX 01/09/2002 - work around broken gtkwidget, fix when jrb fixes
- if len(path) == 1:
- if self.lastvalidselection:
- self.ignoreEvents = 1
- selection = self.cardview.get_selection()
- if not selection.path_is_selected(self.lastvalidselection):
- selection.select_path(self.lastvalidselection)
- self.ignoreEvents = 0
- return 0
-
- self.lastvalidselection = path
-
- return 1
-
- def setCurrent(self, cardname, currentMem, recenter=1):
- self.ignoreEvents = 1
- self.currentCard = cardname
-
- parent = None
- iter = self.cardstore.get_iter_first()
- # iterate over the list, looking for the current mouse selection
- while iter:
- # if this is a parent node, get the first child and iter over them
- if self.cardstore.iter_has_child(iter):
- parent = iter
- iter = self.cardstore.iter_children(parent)
- continue
- # if it's not a parent node and the mouse matches, select it.
- elif self.cardstore.get_value(iter, 0) == cardname:
- path = self.cardstore.get_path(parent)
- self.cardview.expand_row(path, True)
- selection = self.cardview.get_selection()
- selection.unselect_all()
- selection.select_iter(iter)
- path = self.cardstore.get_path(iter)
- col = self.cardview.get_column(0)
- self.cardview.set_cursor(path, col, False)
- if recenter:
- self.cardview.scroll_to_cell(path, col, True,
- 0.0, 0.5)
- break
- # get the next row.
- iter = self.cardstore.iter_next(iter)
- # if there isn't a next row and we had a parent, go to the node
- # after the parent we've just gotten the children of.
- if not iter and parent:
- parent = self.cardstore.iter_next(parent)
- iter = parent
-
- #--Some video cards don't return exact numbers, so do some hacks
- try:
- vidRam = string.atoi (currentMem)
- except:
- vidRam = 1024
-
- count = self.videocard.index_closest_ram_size(vidRam)
- self.ramOption.remove_menu()
- self.ramMenu.set_active(count)
- self.ramOption.set_menu(self.ramMenu)
-
- self.ignoreEvents = 0
-
- # XConfigWindow tag="xconf"
- def getScreen (self, dispatch, xsetup, videocard, intf):
- self.ics.setHelpEnabled (True)
-
- self.dispatch = dispatch
- self.videocard = videocard
- self.xsetup = xsetup
- self.intf = intf
-
- self.lastvalidselection = None
-
- box = gtk.VBox (False, 0)
- box.set_border_width (0)
-
- self.autoBox = gtk.VBox (False, 5)
-
- self.force_ppc_fb = 0
- arch = iutil.getArch()
- # we can only probe video ram on i386
- # and we force frame buffer on ppc currently
- if arch == "ppc":
- label = makeFormattedLabel (_("Your system will be setup to "
- "use the frame buffer driver for "
- "the X Window System. If you do "
- "not want to setup the X Window "
- "System, choose "
- "'Skip X Configuration' below."))
- box.pack_start (label, False, False)
- self.force_ppc_fb = 1
- elif arch != "i386":
- label = makeFormattedLabel (_("Your video ram size can not be "
- "autodetected. Choose your video "
- "ram size from the choices below:"))
- box.pack_start (label, False)
- else:
- self.autoBox = gtk.VBox (False, 5)
-
- label = makeFormattedLabel (_("In most cases, the video hardware "
- "can be automatically detected. "
- "If the detected settings are not "
- "correct for the hardware, select "
- "the right settings."))
- self.autoBox.pack_start (label, False)
-
- box.pack_start (self.autoBox, False)
-
- # load in card database
- self.cards = self.videocard.cardsDB()
- cards = self.cards.keys()
- cards.sort()
-
- other_cards = copy.copy(cards)
- self.currentCard = None
- self.probedCard = None
- if self.videocard.primaryCard():
- carddata = self.videocard.primaryCard().getCardData(dontResolve=1)
- if carddata:
- self.currentCard = carddata["NAME"]
- else:
- self.currentCard = None
-
- carddata = self.videocard.primaryCard(useProbed=1).getCardData()
- if carddata:
- self.probedCard = carddata["NAME"]
- else:
- self.probedCard = None
-
- # load images of videocard
- fn = self.ics.findPixmap("videocard.png")
- p = gtk.gdk.pixbuf_new_from_file (fn)
- if p:
- self.videocard_p, self.videocard_b = p.render_pixmap_and_mask()
-
- # Videocard selection tree - preset 'Generic' and 'Other' nodes
- self.cardstore = gtk.TreeStore(gobject.TYPE_STRING,
- gobject.TYPE_STRING)
-
- toplevels={}
-
- # add "Generic" in before "Other" if supporting XFree86 3.x
- # Note other changes in videocard.py and elsewhere required to support
- # XFree86 3.x again
- manufacturers = ["Other"] + self.videocard.manufacturerDB()
- for man in manufacturers:
- toplevels[man] = self.cardstore.append(None)
- self.cardstore.set_value(toplevels[man], 0, man)
-
- # now go through cards and matchup with manufacturers
- for card in cards:
- temp = string.lower(card)
-
- for man in manufacturers:
- if string.lower(man) == temp[:len(man)]:
- parent = toplevels.get(man)
- iter = self.cardstore.append(parent)
- self.cardstore.set_value(iter, 0, card)
- other_cards.remove(card)
-
- # now add cards not categorized into above manufacturers
- for card in other_cards:
- parent = toplevels.get("Other")
- iter = self.cardstore.append(parent)
- self.cardstore.set_value(iter, 0, card)
-
- self.cardview = gtk.TreeView(self.cardstore)
- self.cardview.set_property("headers-visible", False)
- col = gtk.TreeViewColumn(None, gtk.CellRendererText(), text=0)
- self.cardview.append_column(col)
- selection = self.cardview.get_selection()
- selection.connect("changed", self.selectCardType)
- selection.set_select_function(self.cardviewSelectCb)
-
- sw = gtk.ScrolledWindow ()
- sw.set_policy (gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
- sw.set_shadow_type(gtk.SHADOW_IN)
- sw.add (self.cardview)
-
- # only show this option on non-ppc
- if not self.force_ppc_fb:
- box.pack_start (sw, True)
-
- #Memory configuration menu
- hbox = gtk.HBox()
- hbox.set_border_width(3)
-
- label = gui.MnemonicLabel (_("_Video card RAM: "))
-
- self.ramOption = gtk.OptionMenu()
- label.set_mnemonic_widget(self.ramOption)
- self.ramOption.set_size_request (40, 20)
- self.ramMenu = gtk.Menu()
-
- for mem in self.videocard.possible_ram_sizes():
- if mem < 1000:
- tag = "%d KB" % (mem)
- else:
- tag = "%d MB" % (mem/1024)
-
- memitem = gtk.MenuItem(tag)
- self.ramMenu.add(memitem)
-
- hbox.pack_start(label, False)
- hbox.pack_start(self.ramOption, True, True, 25)
-
- self.ramOption.set_menu (self.ramMenu)
-
- # only show this option on non-ppc
- if not self.force_ppc_fb:
- box.pack_start (hbox, False)
-
- restore = gtk.Button (_("Restore _original values"))
- restore.connect ("clicked", self.restorePressed)
- hbox.pack_start(restore, False, 25)
-
- self.skip = gtk.CheckButton (_("_Skip X configuration"))
- self.skip.connect ("toggled", self.skipToggled)
-
- hbox = gtk.HBox (True, 5)
-
- self.topbox = gtk.VBox (False, 5)
- self.topbox.set_border_width (5)
- if self.force_ppc_fb:
- # tweak packing
- self.topbox.pack_start (box, False, False)
- self.topbox.pack_start (self.skip, False, False)
- else:
- self.topbox.pack_start (box, True, True)
- self.topbox.pack_start (self.skip, False)
-
- self.configbox = box
-
- self.skip.set_active (self.dispatch.stepInSkipList("monitor"))
-
- # set state
- self.ignoreEvents = 0
- self.currentMem = self.videocard.primaryCard(useProbed=0).getVideoRam()
- self.probedMem = self.videocard.primaryCard(useProbed=1).getVideoRam()
- self.setCurrent(self.currentCard, self.currentMem)
-
- setupTreeViewFixupIdleHandler(self.cardview, self.cardstore)
-
- return self.topbox
diff --git a/textw/bootdisk_text.py b/textw/bootdisk_text.py
deleted file mode 100644
index ede7b97f5..000000000
--- a/textw/bootdisk_text.py
+++ /dev/null
@@ -1,42 +0,0 @@
-#
-# bootdisk_text.py: text mode bootdisk creation
-#
-# Copyright 2000-2002 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 iutil
-from rhpl.translate import _
-from snack import *
-from constants_text import *
-from constants import *
-
-class BootDiskWindow:
- def __call__(self, screen, dir, disp, fsset):
- buttons = [ _("Yes"), _("No") ]
-
- text = _("The boot diskette allows you to boot your %s "
- "system from a floppy diskette. A boot diskette "
- "allows you to boot your system in the event your "
- "bootloader configuration stops working.\n\nIt is "
- "highly recommended you create a boot diskette.\n\n"
- "Would you like to create a boot diskette?") % (productName,)
-
- rc = ButtonChoiceWindow(screen, _("Boot Diskette"), text,
- buttons=buttons,
- help="bootdiskquery")
-
- if rc == string.lower (_("No")):
- disp.skipStep("makebootdisk")
- else:
- disp.skipStep("makebootdisk", skip=0)
-
-
- return INSTALL_OK
-
diff --git a/textw/xconfig_text.py b/textw/xconfig_text.py
deleted file mode 100644
index 327b91b1e..000000000
--- a/textw/xconfig_text.py
+++ /dev/null
@@ -1,740 +0,0 @@
-#
-# xconfig_text.py: text mode X Windows System setup dialogs
-#
-# Copyright 2001-2002 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 iutil
-from snack import *
-from constants_text import *
-from desktop import ENABLE_DESKTOP_CHOICE
-from rhpl.translate import _
-from rhpl.monitor import isValidSyncRange
-
-ddc_monitor_string = _("DDC Probed Monitor")
-unprobed_monitor_string = _("Unprobed Monitor")
-
-class XCustomWindow:
-
- def depthchangeCB(self, screen):
- availdepths = self.xsetup.xhwstate.available_color_depths()
-
- # newt list want a list of strings, but availdepths is list of ints
- depthlist = []
- for d in availdepths:
- depthlist.append(str(d))
-
- (button, result) = ListboxChoiceWindow(screen, _("Color Depth"),
- _("Please select the color depth you "
- "would like to use:") , depthlist,
- [ TEXT_OK_BUTTON, TEXT_CANCEL_BUTTON],
- scroll = 0, height = 3, help = "colordepthsel",
- default = availdepths.index(self.selectedDepth))
-
- if button != TEXT_CANCEL_CHECK:
- self.selectedDepth = self.bit_depth[result]
- self.xsetup.xhwstate.set_colordepth(self.selectedDepth)
-
- self.selectedRes = self.xsetup.xhwstate.get_resolution()
- newmodes = self.xsetup.xhwstate.available_resolutions()
-
- if not self.selectedRes in newmodes:
- self.selectedRes = newmodes[-1]
-
- def reschangeCB(self, screen):
- availmodes = self.xsetup.xhwstate.available_resolutions()
- try:
- sel = availmodes.index(self.selectedRes)
- except:
- sel = len(availmodes)
-
- (button, result) = ListboxChoiceWindow(screen, _("Resolution"),
- _("Please select the resolution you "
- "would like to use:") , availmodes,
- [ TEXT_OK_BUTTON, TEXT_CANCEL_BUTTON],
- scroll = (len(availmodes) > 7), height = 7,
- help = "resdepthsel", default = sel)
-
- if button != TEXT_CANCEL_CHECK:
- self.selectedRes = availmodes[result]
-
- def loginCB(self, widget):
- if widget == self.graphrb:
- self.selectedRunLevel = 5
- elif widget == self.textrb:
- self.selectedRunLevel = 3
- else:
- print "Invalid widget in xconfig_text::loginCB"
-
-
- def desktopCB(self, widget):
- if widget == self.gnomerb:
- self.selectedDesktop = "GNOME"
- elif widget == self.kderb:
- self.selectedDesktop = "KDE"
- else:
- print "Invalid widget in xconfig_text::desktopCB"
-
-
- def __call__(self, screen, xsetup, monitor, videocard, desktop, grpset,
- instClass, instPath):
-
- self.instPath = instPath
- self.xsetup = xsetup
- self.origres = self.xsetup.xhwstate.get_resolution()
- self.origdepth = self.xsetup.xhwstate.get_colordepth()
-
- # dont do anything on ppc - we want to use default fb setting
- if iutil.getArch() != "ppc":
- if not xsetup.imposed_sane_default:
- xsetup.xhwstate.choose_sane_default()
- xsetup.imposed_sane_default = 1
-
- availableRes = self.xsetup.xhwstate.available_resolutions()
- availableDepths = self.xsetup.xhwstate.available_color_depths()
- self.selectedDepth = self.xsetup.xhwstate.get_colordepth()
- self.selectedRes = self.xsetup.xhwstate.get_resolution()
-
- depth_list = [(_("256 Colors (8 Bit)")),
- (_("High Color (16 Bit)")),
- (_("True Color (24 Bit)"))]
- self.bit_depth = [8, 16, 24]
- self.avail_depths = depth_list[:len(availableDepths)]
- self.res_list = ["640x480", "800x600", "1024x768", "1152x864",
- "1280x960", "1280x1024", "1400x1050", "1600x1200",
- "1920x1440", "2048x1536"]
-
- #--If both KDE and GNOME are selected
- if grpset:
- gnomeSelected = (grpset.hdrlist.has_key('gnome-session')
- and grpset.hdrlist['gnome-session'].isSelected())
- kdeSelected = (grpset.hdrlist.has_key('kdebase')
- and grpset.hdrlist['kdebase'].isSelected())
- else:
- gnomeSelected = 0
- kdeSelected = 0
-
- self.selectedDesktop = desktop.getDefaultDesktop()
- self.selectedRunLevel = desktop.getDefaultRunLevel()
-
- while 1:
- bb = ButtonBar (screen, (TEXT_OK_BUTTON, TEXT_BACK_BUTTON))
-
- toplevel = GridFormHelp (screen, _("X Customization"),
- "custom", 1, 5)
-
- text = _("Select the color depth and video mode you want to "
- "use for your system. ")
-
- customgrid = Grid(3,2)
- label = Label(_("Color Depth:"))
- customgrid.setField(label, 0, 0, (0, 0, 0, 1), anchorLeft = 1)
- field = Textbox(20, 1, depth_list[self.bit_depth.index(self.selectedDepth)])
- customgrid.setField(field, 1, 0, (0, 0, 0, 1), anchorLeft = 1)
- depthchangebutton = CompactButton(_("Change"))
- customgrid.setField (depthchangebutton, 2, 0, (0, 0, 0, 1),
- anchorLeft = 1)
- label = Label(_("Resolution:"))
- customgrid.setField(label, 0, 1, (0, 0, 0, 1), anchorLeft = 1)
- field = Textbox(14, 1, self.selectedRes)
- customgrid.setField(field, 1, 1, (0, 0, 0, 1), anchorLeft = 1)
- reschangebutton = CompactButton(_("Change"))
- customgrid.setField (reschangebutton, 2, 1, (0, 0, 0, 1),
- anchorLeft = 1)
-
- if (ENABLE_DESKTOP_CHOICE) and (gnomeSelected or kdeSelected):
- desktopgrid = Grid(3,2)
- label = Label(_("Default Desktop:"))
- desktopgrid.setField(label, 0, 1, (0, 0, 0, 1), anchorLeft = 1)
-
- if gnomeSelected and kdeSelected:
- self.gnomerb = SingleRadioButton(_("GNOME"), None,
- self.selectedDesktop == "GNOME")
- self.kderb = SingleRadioButton(_("KDE"), self.gnomerb,
- self.selectedDesktop == "KDE")
- self.gnomerb.setCallback(self.desktopCB, self.gnomerb)
- self.kderb.setCallback(self.desktopCB, self.kderb)
- desktopgrid.setField(self.gnomerb, 1, 1, (0, 0, 0, 1), anchorLeft = 1)
- desktopgrid.setField(self.kderb, 2, 1, (0, 0, 0, 1), anchorLeft = 1)
- elif gnomeSelected:
- desktopgrid.setField(Textbox(10, 1, _("GNOME")), 1, 1, (0, 0, 0, 1), anchorLeft = 1)
- elif kdeSelected:
- desktopgrid.setField(Textbox(10, 1, _("KDE")), 1, 1, (0, 0, 0, 1), anchorLeft = 1)
- else:
- desktopgrid = None
-
- if instClass.showLoginChoice:
- runlevelgrid = Grid(3,2)
- label = Label(_("Default Login:"))
- runlevelgrid.setField(label, 0, 1, (0, 0, 0, 1), anchorLeft = 1)
- self.graphrb = SingleRadioButton(_("Graphical"), None,
- (self.selectedRunLevel == 5))
- self.textrb = SingleRadioButton(_("Text"), self.graphrb,
- (self.selectedRunLevel == 3))
- self.graphrb.setCallback(self.loginCB, self.graphrb)
- self.textrb.setCallback(self.loginCB, self.textrb)
- runlevelgrid.setField(self.graphrb, 1, 1, (0, 0, 0, 1),
- anchorLeft = 1)
- runlevelgrid.setField(self.textrb, 2, 1, (0, 0, 0, 1),
- anchorLeft = 1)
- else:
- # if no choice to be given, assume run level of 5
- runlevelgrid = None
- self.selectRunLevel = 5
-
- toplevel.add(TextboxReflowed(55, text), 0, 0, (0, 0, 0, 1))
- toplevel.add(customgrid, 0, 1, (0, 0, 0, 0), growx = 1)
- if desktopgrid:
- toplevel.add(desktopgrid, 0, 2, (0, 0, 0, 0), growx = 1)
- if runlevelgrid:
- toplevel.add(runlevelgrid, 0, 3, (0, 0, 0, 0), growx = 1)
- toplevel.add(bb, 0, 4, (0, 0, 0, 0), growx = 1)
-
- result = toplevel.run ()
- rc = bb.buttonPressed (result)
-
- if rc == TEXT_BACK_CHECK:
- screen.popWindow()
- return INSTALL_BACK
- elif rc == TEXT_OK_CHECK or result == TEXT_F12_CHECK:
- screen.popWindow()
- break
- elif result == depthchangebutton:
- self.depthchangeCB(screen)
- elif result == reschangebutton:
- self.reschangeCB(screen)
-
- screen.popWindow()
-
- # store results
- self.xsetup.xhwstate.set_colordepth(self.selectedDepth)
- self.xsetup.xhwstate.set_resolution(self.selectedRes)
-
- desktop.setDefaultDesktop (self.selectedDesktop)
- desktop.setDefaultRunLevel(self.selectedRunLevel)
-
- return INSTALL_OK
-
-class MonitorWindow:
- def monchangeCB(self, screen):
- (button, result) = ListboxChoiceWindow(screen, _("Monitor"),
- _("Please select the monitor attached to your "
- "system.") , self.monitorsnames,
- [ TEXT_OK_BUTTON, TEXT_CANCEL_BUTTON],
- scroll = 1, height = 12, help = "monitor",
- default = self.currentMonitor)
-
- if button != TEXT_CANCEL_CHECK:
- self.currentMonitor = self.monitorsnames[result]
- selMonitorName = self.currentMonitor
- if selMonitorName[:len(ddc_monitor_string)] == ddc_monitor_string:
- selMonitor = self.ddcmon
- elif selMonitorName == unprobed_monitor_string:
- selMonitor = (unprobed_monitor_string, unprobed_monitor_string,
- "31.5", "50-61")
- else:
- selMonitor = self.monitor.lookupMonitorByName(selMonitorName)
-
- if selMonitor:
- self.hsync = selMonitor[3]
- self.vsync = selMonitor[2]
-
- def sanityCheckSyncRates(self, screen, hval, vval):
- hgood = isValidSyncRange(hval)
- vgood = isValidSyncRange(vval)
- if not hgood:
- badtitle = _("horizontal")
- badone = hval
- elif not vgood:
- badtitle = _("vertical")
- badone = vval
-
- if not (hgood and vgood):
- ButtonChoiceWindow(screen, _("Invalid Sync Rates"),
- _("The %s sync rate is invalid:\n\n %s\n\n"
- "A valid sync rate can be of the form:\n\n"
- " 31.5 a single number\n"
- " 50.1-90.2 a range of numbers\n"
- "31.5,35.0,39.3-40.0 a list of numbers/ranges\n") % (badtitle, badone),
- buttons = [ TEXT_OK_BUTTON ], width = 45)
- return 0
-
- return 1
-
-
- def syncchangeCB(self, screen):
- bb = ButtonBar(screen, (TEXT_OK_BUTTON, TEXT_CANCEL_BUTTON))
-
- toplevel = GridFormHelp(screen, _("Monitor Sync Rates"),
- "monitorsyncrates", 1, 5)
-
- syncgrid = Grid(2,2)
-
- text = _("Please enter the sync rates for your monitor. \n\nNOTE - "
- "it is not usually necessary to edit sync rates manually, "
- "and care should be taken to "
- "make sure the values entered are accurate.")
-
- label = Label(_("HSync Rate: "))
- syncgrid.setField(label, 0, 0, (0, 0, 0, 1), anchorLeft = 1)
- hentry = Entry(30)
- hentry.set(self.hsync)
- syncgrid.setField(hentry, 1, 0, (0, 0, 0, 1), anchorLeft = 1)
- label = Label(_("VSync Rate: "))
- syncgrid.setField(label, 0, 1, (0, 0, 0, 1), anchorLeft = 1)
- ventry = Entry(30)
- ventry.set(self.vsync)
- syncgrid.setField(ventry, 1, 1, (0, 0, 0, 1), anchorLeft = 1)
-
- toplevel.add(TextboxReflowed(55, text), 0, 0, (0, 0, 0, 0))
- toplevel.add(syncgrid, 0, 1, (0, 1, 0, 1), growx = 1)
- toplevel.add(bb, 0, 3, (0, 0, 0, 0), growx = 1)
-
- while 1:
- result = toplevel.run()
- rc = bb.buttonPressed(result)
-
- if rc == TEXT_CANCEL_CHECK:
- screen.popWindow()
- return
- elif rc == TEXT_OK_CHECK or result == TEXT_F12_CHECK:
- if hentry.value() and ventry.value():
- hval = hentry.value()
- vval = ventry.value()
-
- if self.sanityCheckSyncRates(screen, hval, vval):
- self.hsync = hval
- self.vsync = vval
- screen.popWindow()
- return
-
- def resetCB(self, screen):
- self.hsync = self.origHsync
- self.vsync = self.origVsync
- self.currentMonitor = self.origMonitorName
-
- def __call__(self, screen, xsetup, monitor, intf):
-
- self.intf = intf
- self.xsetup = xsetup
- self.monitor = monitor
-
- self.origMonitorID = self.monitor.getMonitorID()
- self.origMonitorName = self.monitor.getMonitorName()
- if not self.origMonitorName:
- self.origMonitorName = self.origMonitorID
-
- self.origHsync = self.monitor.getMonitorHorizSync()
- self.origVsync = self.monitor.getMonitorVertSync()
-
- self.ddcmon = self.monitor.getDDCProbeResults()
-
- self.monitorslist = {}
- self.monitorsnames = []
-
- # now read in monitors database
- self.monDB = self.monitor.monitorsDB()
-
- # put generic LCD and CRTs first so easy to find
- genericnames = []
- for desiredmanf in ['Generic LCD Display', 'Generic CRT Display']:
- if desiredmanf in self.monDB.keys():
- for mon in self.monDB[desiredmanf]:
- if self.ddcmon and string.upper(self.ddcmon[0]) == string.upper(mon[1]):
- continue
- self.monitorslist[mon[0]] = mon
- genericnames.append(mon[0])
-
- # now the rest
- remainingnames = []
- for man in self.monDB.keys():
- # already inserted these
- if man in ['Generic LCD Display', 'Generic CRT Display']:
- continue
-
- for mon in self.monDB[man]:
- if self.ddcmon and string.upper(self.ddcmon[0]) == string.upper(mon[1]):
- continue
- self.monitorslist[mon[0]] = mon
- remainingnames.append(mon[0])
-
- remainingnames.sort()
- self.monitorsnames = genericnames + remainingnames
-
- # Insert DDC probed monitor if it had no match in database
- # or otherwise if we did not detect a monitor at all
- #--Add a category for a DDC probed monitor if a DDC monitor was probed
- self.ddcmon = self.monitor.getDDCProbeResults()
- if self.ddcmon:
- title = ddc_monitor_string + " - " + self.ddcmon[1]
- else:
- title = unprobed_monitor_string
-
- man = title
- self.monitorslist[title] = self.ddcmon
- self.monitorsnames.insert(0, title)
-
- # set as current monitor if necessary
- if self.origMonitorID == "DDCPROBED" or self.origMonitorID == "Unprobed Monitor":
- self.currentMonitor = title
- self.origMonitorName = title
- else:
- self.currentMonitor = self.origMonitorName
-
- self.hsync = self.monitor.getMonitorHorizSync()
- self.vsync = self.monitor.getMonitorVertSync()
-
- while 1:
- selMonitorName = self.currentMonitor
- if selMonitorName[:len(ddc_monitor_string)] == ddc_monitor_string:
- selMonitor = (self.ddcmon[1], self.ddcmon[0],
- self.ddcmon[2], self.ddcmon[3])
- elif selMonitorName == unprobed_monitor_string:
- selMonitor = (unprobed_monitor_string, unprobed_monitor_string,
- "31.5", "50-61")
- else:
- selMonitor = self.monitor.lookupMonitorByName(selMonitorName)
-
- # if lookup failed fail back to unprobed monitor
- # should fix reports of tracebacks because selMonitor was None
- if selMonitor is None:
- selMonitor = (unprobed_monitor_string,
- unprobed_monitor_string,
- "31.5", "50-61")
-
- bb = ButtonBar (screen, (TEXT_OK_BUTTON, (_("Default"), "default"),
- TEXT_BACK_BUTTON))
-
- toplevel = GridFormHelp (screen, _("Monitor Configuration"),
- "monitor", 1, 5)
-
- text = _("Select the monitor for your system. Use the '%s' "
- "button to reset to the probed values.") % (_("Default"))
-
- videogrid = Grid(3, 3)
- label = Label(_("Monitor:"))
- videogrid.setField (label, 0, 0, (0, 0, 0, 1), anchorLeft = 1)
- monlabel = Textbox(20, 1, (selMonitor[0]))
- videogrid.setField (monlabel, 1, 0, (0, 0, 0, 1), anchorLeft = 1)
- monchangebutton = CompactButton(_("Change"))
- videogrid.setField (monchangebutton, 2, 0, (0, 0, 0, 1), anchorLeft = 1)
-
- label = Label(_("HSync Rate:"))
- videogrid.setField (label, 0, 1, (0, 0, 0, 0), anchorLeft = 1)
- if self.hsync:
- synctext = self.hsync
- else:
- synctext = "Unknown"
- synclabel = Textbox(20, 1, synctext)
- videogrid.setField (synclabel, 1, 1, (0, 0, 0, 0), anchorLeft = 1)
- syncchangebutton = CompactButton(_("Change"))
- videogrid.setField (syncchangebutton, 2, 1, (0, 0, 0, 0), anchorLeft = 1)
- label = Label(_("VSync Rate:"))
- videogrid.setField (label, 0, 2, (0, 0, 0, 0), anchorLeft = 1)
- if self.vsync:
- synctext = self.vsync
- else:
- synctext = "Unknown"
- synclabel = Textbox(20, 1, synctext)
- videogrid.setField (synclabel, 1, 2, (0, 0, 0, 0), anchorLeft = 1)
-
- toplevel.add(TextboxReflowed(60, text), 0, 0, (0, 0, 0, 0))
- toplevel.add(videogrid, 0, 1, (0, 1, 0, 1), growx = 1)
- toplevel.add(bb, 0, 4, (0, 0, 0, 0), growx = 1)
-
- result = toplevel.run ()
- rc = bb.buttonPressed (result)
-
- if rc == TEXT_BACK_CHECK:
- screen.popWindow()
- return INSTALL_BACK
- elif rc == TEXT_OK_CHECK or result == TEXT_F12_CHECK:
- # test sync rates
- hval = self.hsync
- vval = self.vsync
-
- screen.popWindow()
-
- if self.currentMonitor == "Unprobed Monitor":
- unspecrc = intf.messageWindow(_("Monitor Unspecified"),
- _("You have not selected a monitor type. It is "
- "recommended you choose the closest matching "
- "model in order to have the highest possible "
- "display quality."),
- type="custom",
- custom_buttons = [ _("Choose monitor type"), _("Proceed")],
- custom_icon="warning")
- if not unspecrc:
- continue
-
- if not self.sanityCheckSyncRates(screen, hval, vval):
- continue
-
- break
- elif rc == "default":
- self.resetCB(screen)
- elif result == monchangebutton:
- self.monchangeCB(screen)
- elif result == syncchangebutton:
- self.syncchangeCB(screen)
-
- screen.popWindow()
-
- # store results
- selMonitorName = self.currentMonitor
- if selMonitorName[:len(ddc_monitor_string)] == ddc_monitor_string:
- selMonitor = ("DDCPROBED",) + self.ddcmon[1:]
-
- elif selMonitorName == unprobed_monitor_string:
- selMonitor = (unprobed_monitor_string, unprobed_monitor_string,
- "31.5", "50-61")
- else:
- selMonitor = self.monitor.lookupMonitorByName(selMonitorName)
-
- # field 1 and two are reverse apparently from what ddcmon returns?!
- selMonitor = (selMonitor[1], selMonitor[0], selMonitor[2], selMonitor[3])
- if selMonitor:
- self.monitor.setSpecs(hval, vval, id=selMonitor[0],
- name=selMonitor[1])
-
- # shove into hw state object, force it to recompute available modes
- self.xsetup.xhwstate.monitor = self.monitor
- self.xsetup.xhwstate.set_monitor_name(selMonitor[0])
- self.xsetup.xhwstate.set_hsync(hval)
- self.xsetup.xhwstate.set_vsync(vval)
- self.xsetup.xhwstate.recalc_mode()
-
- return INSTALL_OK
-
-class XConfigWindowCard:
-
- # try to match card currently selected, then a generic VGA if card not
- # found, then just first in list
- def findCardInList(self, current_cardsel):
- index = 0
- backupindex = None
- for card in self.cardslist:
- if card == current_cardsel:
- self.curcardindex = index
- break
- elif card == "Generic VGA compatible":
- backupindex = index
- index = index + 1
-
- if index < len(self.cardslist):
- return index
- elif backupindex:
- return backupindex
- else:
- return 0
-
-
- def cardchangeCB(self, screen):
-
- while 1:
- (button, result) = ListboxChoiceWindow(screen, _("Video Card"),
- _("Please select the video card present in your "
- "system. Choose '%s' to reset the selection to "
- "the card the installer detected in your "
- "system.") % (_("Default")) , self.cardslist,
- [ TEXT_OK_BUTTON, (_("Default"), "default")],
- scroll = 1, height = 7, help = "videocardsel",
- default = self.selectedCard)
-
- if button == 'default':
- self.selectedCard = self.origCard
- else:
- break
-
- self.selectedCard = result
-
- def ramchangeCB(self, screen):
-
- while 1:
- (button, result) = ListboxChoiceWindow(screen, _("Video RAM"),
- _("Please select the amount of video RAM present "
- "on your video card. "
- "Choose '%s' to reset the selection to "
- "the amount the installer detected on your "
- "card.") % (_("Default")) , self.ramlist,
- [ TEXT_OK_BUTTON, (_("Default"), "default")],
- scroll = 1, height = 7, help = "videocardsel",
- default = self.selectedRam)
-
- if button == 'default':
- self.selectedRam = self.origRam
- else:
- break
-
- self.selectedRam = result
-
-
-
- def __call__(self, screen, dispatch, xsetup, videocard, intf):
-
- self.dispatch = dispatch
- self.videocard = videocard
- self.xsetup = xsetup
-
- # setup database and list of possible cards
- self.cards = self.videocard.cardsDB()
- self.cardslist = self.cards.keys()
- self.cardslist.sort()
-
- # yuck on fb driver works on ppc currently
- self.force_ppc_fb = iutil.getArch() == "ppc"
-
- self.ramlist = []
- for ram in self.videocard.possible_ram_sizes():
- self.ramlist.append(str(ram))
-
- carddata = self.videocard.primaryCard().getCardData(dontResolve=1)
- if carddata:
- self.selectedCard = self.findCardInList(carddata["NAME"])
- else:
- self.selectedCard = None
-
- carddata = self.videocard.primaryCard(useProbed=1).getCardData(dontResolve=1)
- if carddata:
- self.origCard = self.findCardInList(carddata["NAME"])
- else:
- self.origCard = None
-
- try:
- vidRam = string.atoi(self.videocard.primaryCard().getVideoRam())
- except:
- vidRam = 1024
-
- self.selectedRam = self.videocard.index_closest_ram_size(vidRam)
-
- try:
- vidRam = string.atoi(self.videocard.primaryCard(useProbed=1).getVideoRam())
- except:
- vidRam = 1024
-
- count = 0
- self.origRam = self.videocard.index_closest_ram_size(vidRam)
-
- skipx = 0
- while 1:
- bb = ButtonBar (screen, (TEXT_OK_BUTTON,
- (_("Skip X Configuration"), "skipx")))
-
- toplevel = GridFormHelp (screen, _("Video Card Configuration"),
- "videocard", 1, 5)
-
- videogrid = Grid(3, 2)
-
- if self.force_ppc_fb:
- text = _("Your system will be setup to "
- "use the frame buffer driver for "
- "the X Window System. If you do "
- "not want to setup the X Window "
- "System, choose "
- "'Skip X Configuration' below.")
-
- else:
- text = _("Select the video card and video RAM for your system.")
-
- label = Label(_("Video Card:"))
- videogrid.setField (label, 0, 0, (0, 0, 0, 1), anchorLeft = 1)
- if self.selectedCard != None:
- cardlbl = self.cardslist[self.selectedCard]
- else:
- cardlbl = _("Unknown card")
-
- cardlabel = Textbox(28, 1, cardlbl)
-
- videogrid.setField (cardlabel, 1, 0, (0, 0, 0, 1), anchorLeft = 1)
- cardchangebutton = CompactButton(_("Change"))
- videogrid.setField (cardchangebutton, 2, 0, (0, 0, 0, 1), anchorLeft = 1)
-
- label = Label(_("Video RAM:"))
- videogrid.setField (label, 0, 1, (0, 0, 0, 0), anchorLeft = 1)
- ramlabel = Textbox(12, 1, self.ramlist[self.selectedRam])
- videogrid.setField (ramlabel, 1, 1, (0, 0, 0, 0), anchorLeft = 1)
- ramchangebutton = CompactButton(_("Change"))
- videogrid.setField (ramchangebutton, 2, 1, (0, 0, 0, 0), anchorLeft = 1)
-
- toplevel.add(TextboxReflowed(60, text), 0, 0, (0, 0, 0, 0))
-
- # tweak packing
- if not self.force_ppc_fb:
- toplevel.add(videogrid, 0, 1, (0, 1, 0, 1), growx = 1)
- toplevel.add(bb, 0, 4, (0, 0, 0, 0), growx = 1)
- else:
- toplevel.add(bb, 0, 4, (0, 1, 0, 1), growx = 1)
-
-
- result = toplevel.run ()
- rc = bb.buttonPressed (result)
-
- if rc == TEXT_OK_CHECK or result == TEXT_F12_CHECK:
- # we're done
- # see if they have not specified card yet
- if self.selectedCard == None:
- intf.messageWindow(_("Unspecified video card"),
- _("You need to pick a video card before "
- "X configuration can continue. If you "
- "want to skip X configuration entirely "
- "choose the 'Skip X Configuration' button."))
- continue
- break
- elif rc == "skipx":
- skipx = 1
- break
- elif result == cardchangebutton:
- self.cardchangeCB(screen)
- elif result == ramchangebutton:
- self.ramchangeCB(screen)
-
- screen.popWindow()
-
- screen.popWindow()
- if skipx == 1:
- self.dispatch.skipStep("monitor")
- self.dispatch.skipStep("xcustom")
- self.dispatch.skipStep("writexconfig")
- self.xsetup.skipx = 1
- return INSTALL_OK
- else:
- self.dispatch.skipStep("monitor", skip = 0)
- self.dispatch.skipStep("xcustom", skip = 0)
- self.dispatch.skipStep("writexconfig", skip = 0)
- self.xsetup.skipx = 0
-
- # bail at this point if we're doing ppc configuration
- if self.force_ppc_fb:
- return INSTALL_OK
-
- # store selected videocard
- selection = self.cards[self.cardslist[self.selectedCard]]
- primary_card = self.videocard.primaryCard()
- primary_card.setCardData(selection)
- primary_card.setDevID (selection["NAME"])
- primary_card.setDescription (selection["NAME"])
-
- # pull out resolved version of card data
- card_data = primary_card.getCardData()
- if (card_data.has_key("DRIVER") and
- not card_data.has_key("UNSUPPORTED")):
- server = "Xorg"
- else:
- server = "XF86_" + card_data["SERVER"]
-
- primary_card.setXServer(server)
-
- # store selected ram
- vidram = self.videocard.possible_ram_sizes()[self.selectedRam]
- self.videocard.primaryCard().setVideoRam(str(vidram))
- self.xsetup.xhwstate.set_videocard_card(self.videocard.primaryCard())
-
- return INSTALL_OK