summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--iw/installpath.py6
-rw-r--r--iw/xconfig.py75
-rw-r--r--todo.py6
-rw-r--r--xf86config.py97
4 files changed, 125 insertions, 59 deletions
diff --git a/iw/installpath.py b/iw/installpath.py
index eeaeb8647..e1485fe40 100644
--- a/iw/installpath.py
+++ b/iw/installpath.py
@@ -37,7 +37,8 @@ class InstallPathWindow (InstallWindow):
(WORKSTATION_KDE, _("KDE Workstation")),
(SERVER, _("Server")))
- installSteps = [ ( PartitionWindow, "partition" ),
+ installSteps = [ ( XConfigWindow, "xconfig" ),
+ ( PartitionWindow, "partition" ),
( FormatWindow, "format" ),
( LiloWindow, "lilo" ),
( NetworkWindow, "network" ),
@@ -73,11 +74,8 @@ class InstallPathWindow (InstallWindow):
def getNext(self):
if not self.__dict__.has_key("upgradeButton"):
- print "okay"
return
- print "ACK"
-
if self.upgradeButton.get_active():
self.todo.upgrade = 1
self.ics.getICW ().setStateList (self.commonSteps +
diff --git a/iw/xconfig.py b/iw/xconfig.py
index ce308e35a..12a642a94 100644
--- a/iw/xconfig.py
+++ b/iw/xconfig.py
@@ -5,32 +5,72 @@ from gui import _
import string
import sys
+"""
+_("Video Card")
+_("Monitor")
+_("Video Ram")
+_("Horizontal Frequency Range")
+_("Vertical Frequency Range")
+_("Test failed")
+"""
+
class XConfigWindow (InstallWindow):
def __init__ (self, ics):
InstallWindow.__init__ (self, ics)
+ self.ics.setNextEnabled (FALSE)
+
self.todo = ics.getToDo ()
ics.setTitle (_("X Configuration"))
- ics.setNextEnabled (1)
ics.setHTML ("<HTML><BODY>This is the X configuration screen<</BODY></HTML>")
+ self.didTest = 0
+
+ def setNext (self):
+ if self.skip.get_active () or self.custom.get_active () or self.didTest:
+ self.ics.setNextEnabled (TRUE)
+ else:
+ self.ics.setNextEnabled (FALSE)
+
+ def customToggled (self, widget, *args):
+ self.setNext ()
+
+ def skipToggled (self, widget, *args):
+ self.autoBox.set_sensitive (not widget.get_active ())
+ self.todo.x.skip = widget.get_active ()
+ self.setNext ()
+
+ def testPressed (self, widget, *args):
+ try:
+ self.todo.x.test ()
+ except RuntimeError:
+ ### test failed window
+ pass
+ else:
+ self.didTest = 1
+
+ self.setNext ()
+
def getScreen (self):
self.todo.x.probe ()
-
- box = GtkVBox (FALSE, 50)
+ self.todo.x.filterModesByMemory ()
+
+ box = GtkVBox (FALSE, 5)
box.set_border_width (5)
+ self.autoBox = GtkVBox (FALSE, 5)
+
label = GtkLabel (_("In most cases your video hardware can "
"be probed to automatically determine the "
"best settings for your display."))
label.set_justify (JUSTIFY_LEFT)
label.set_line_wrap (TRUE)
label.set_alignment (0.0, 0.5)
- box.pack_start (label, FALSE)
+ self.autoBox.pack_start (label, FALSE)
label = GtkLabel (_("Autoprobe results:"))
label.set_alignment (0.0, 0.5)
- box.pack_start (label, FALSE)
+ self.autoBox.pack_start (label, FALSE)
report = self.todo.x.probeReport ()
report = string.replace (report, '\t', ' ')
@@ -38,20 +78,23 @@ class XConfigWindow (InstallWindow):
result = GtkLabel (report)
result.set_alignment (0.2, 0.5)
result.set_justify (JUSTIFY_LEFT)
- box.pack_start (result, FALSE)
-
+ self.autoBox.pack_start (result, FALSE)
+
test = GtkAlignment ()
- test.set (0.5, 0.5, 0.0, 0.0)
button = GtkButton (_("Test this configuration"))
+ button.connect ("pressed", self.testPressed)
test.add (button)
+
+ self.custom = GtkCheckButton (_("Customize X Configuration"))
+ self.custom.connect ("toggled", self.customToggled)
- custom = GtkCheckButton (_("Customize X Configuration"))
+ self.skip = GtkCheckButton (_("Skip X Configuration"))
+ self.skip.connect ("toggled", self.skipToggled)
- box.pack_start (test, FALSE)
- box.pack_start (custom, FALSE)
-
- top = GtkAlignment ()
- top.set (0.5, 0.5, 1.0, 0.0)
- top.add (box)
+ self.autoBox.pack_start (test, FALSE)
+ self.autoBox.pack_start (self.custom, FALSE)
+
+ box.pack_start (self.autoBox, FALSE)
+ box.pack_start (self.skip, FALSE)
- return top
+ return box
diff --git a/todo.py b/todo.py
index 44249e07b..7f8e9972f 100644
--- a/todo.py
+++ b/todo.py
@@ -1044,6 +1044,12 @@ class ToDo:
self.writeTimezone()
pcmcia.createPcmciaConfig(self.instPath + "/etc/sysconfig/pcmcia")
self.copyConfModules ()
+ if not self.x.skip:
+ self.x.wite (self.instPath + "/etc/X11/XF96Config")
+ os.symlink ("../../usr/X11R6/bin/XF86_" + self.x.server,
+ self.instPath + "/etc/X11/X")
+ # XXX fixup inittab
+
self.installLilo ()
del syslog
diff --git a/xf86config.py b/xf86config.py
index b48dfdf84..dc1996dc1 100644
--- a/xf86config.py
+++ b/xf86config.py
@@ -5,6 +5,8 @@ if __name__ == "__main__":
import string
import iutil
import kudzu
+import time
+import os
def _(x):
return x
@@ -22,9 +24,8 @@ class XF86Config:
self.monID = None
self.devID = None
self.probed = 0
- self.modes = { "8" : ["640x480"],
- "16" : ["640x480"],
- "32" : ["640x480"], }
+ self.skip = 0
+ self.modes = { "8" : ["640x480"] }
def filterModesByMemory (self):
if not self.vidRam:
@@ -47,8 +48,6 @@ class XF86Config:
self.modes["32"] = []
elif string.atoi(self.vidRam) >= 256:
self.modes["8"] = ["640x480"]
- self.modes["16"] = []
- self.modes["32"] = []
def cards (self, thecard = None):
cards = {}
@@ -117,10 +116,10 @@ class XF86Config:
(device, server, descr) = card
if len (server) > 5 and server[0:5] == "Card:":
self.vidCards.append (self.cards (server[5:]))
- if len (server) > 5 and server[0:7] == "Server:":
- { "NAME" : descr,
- "SERVER" : server[8:] }
- self.vidCards.append ({ "NAME" : descr, "SERVER" : server[8:] })
+ if len (server) > 7 and server[0:7] == "Server:":
+ info = { "NAME" : string.split (descr, '|')[1],
+ "SERVER" : server[7:] }
+ self.vidCards.append (info)
if self.vidCards:
self.devID = self.vidCards[0]["NAME"]
@@ -174,6 +173,44 @@ class XF86Config:
return probe
+ def write (self, path):
+ config = open (path, 'w')
+ config.write (self.preludeSection ())
+ config.write (self.inputSection ())
+ config.write (self.mouseSection ())
+ config.write (self.monitorSection ())
+ config.write (self.deviceSection ())
+ config.write (self.screenSection ())
+ config.close ()
+
+ def test (self):
+ self.write ('/tmp/XF86Config.test')
+
+ serverPath = "/usr/X11R6/bin/XF86_" + self.server
+
+ server = os.fork()
+ if (not server):
+ os.execv(serverPath, ["XF86-test", ':9', '-xf86config',
+ '/tmp/XF86Config.test', 'vt6'])
+
+ time.sleep (1)
+## pid, status = os.waitpid (server, os.WNOHANG)
+## if not pid:
+## raise RuntimeError, "X server failed to start"
+
+ child = os.fork()
+ if (not child):
+ os.environ["DISPLAY"] = ":9"
+ os.execv("/usr/X11R6/bin/Xtest", ["Xtest", "--nostart"])
+ else:
+ pid, status = os.waitpid(child, 0)
+ os.kill (server, 15)
+ os.waitpid(server, 0)
+ if not os.WIFEXITED (status) or os.WEXITSTATUS (status):
+ if os.WEXITSTATUS (status) not in [ 0, 1, 2 ]:
+ raise RuntimeError, "X test failed %d" % (status,)
+ return
+
def preludeSection (self):
return """
# File generated by anaconda.
@@ -602,8 +639,7 @@ Section "Device"
return section
def screenSection (self):
- info = { "DRIVER" : string.lower (self.server),
- "DEVICE" : self.devID,
+ info = { "DEVICE" : self.devID,
"MONITOR" : self.monID }
section = """
# **********************************************************************
@@ -619,6 +655,7 @@ Section "Screen"
# Depth 16
Modes "default"
EndSubsection
+EndSection
# The 16-color VGA server
Section "Screen"
@@ -641,45 +678,28 @@ Section "Screen"
ViewPort 0 0
EndSubsection
EndSection
-
-# The accelerated svga server
-Section "Screen"
- Driver "svga"
- Device "%(DEVICE)s"
- Monitor "%(MONITOR)s"
""" % info
- for depth in self.modes.keys ():
+ for driver in [ "svga", "accel" ]:
+ info["DRIVER"] = driver
section = section + """
- Subsection "Display"
- Depth %s
- Modes """ % depth
- for res in self.modes[depth]:
- section = section + '"' + res + '" '
- section = section + """
- ViewPort 0 0
- EndSubsection
-EndSection
-"""
- section = section + """
-# The accelerated servers (S3, Mach32, Mach8, 8514, P9000, AGX, W32, Mach64
-# I128, S3V, 3DLabs)
+# The %(DRIVER)s server
Section "Screen"
- Driver "accel"
+ Driver "%(DRIVER)s"
Device "%(DEVICE)s"
Monitor "%(MONITOR)s"
""" % info
- for depth in self.modes.keys ():
- section = section + """
+ for depth in self.modes.keys ():
+ section = section + """
Subsection "Display"
Depth %s
Modes """ % depth
- for res in self.modes[depth]:
- section = section + '"' + res + '" '
- section = section + """
+ for res in self.modes[depth]:
+ section = section + '"' + res + '" '
+ section = section + """
ViewPort 0 0
EndSubsection
"""
- section = section + "EndSection\n"
+ section = section + "EndSection\n"
return section
if __name__ == "__main__":
@@ -696,4 +716,3 @@ if __name__ == "__main__":
x.modes["16"] = [ "640x480" ]
x.modes["32"] = [ "640x480" ]
print x.screenSection ()
-