def cards (self, thecard = None):
cards = {}
db = open ('/usr/X11R6/lib/X11/Cards')
lines = db.readlines ()
db.close ()
card = {}
name = None
for line in lines:
line = string.strip (line)
if not line and name:
cards[name] = card
card = {}
name = None
continue
if line and line[0] == '#':
continue
if len (line) > 4 and line[0:4] == 'NAME':
name = line[5:]
if thecard:
card = cards[thecard]
# XXX set a max depth here to avoid infinite loops
while card.has_key ("SEE"):
card = cards[card["SEE"]]
return card
return cards
def monitors (self, lines = None):
monitors = {}
if not lines:
db = open ('/usr/X11R6/share/Xconfigurator/MonitorsDB')
lines = db.readlines ()
db.close ()
found = 0
for line in lines:
line = string.strip (line)
if not line:
continue
if line and line[0] == '#':
continue
fields = string.split (line, ';')
monitors [string.strip(fields[0])] = \
(string.strip(fields[2]), string.strip(fields[3]))
return monitors
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", "--norunlevel"])
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.
# **********************************************************************
# Refer to the XF86Config(4/5) man page for details about the format of
# this file.
# **********************************************************************
# **********************************************************************
# Files section. This allows default font and rgb paths to be set
# **********************************************************************
Section "Files"
# The location of the RGB database. Note, this is the name of the
# file minus the extension (like ".txt" or ".db"). There is normally
# no need to change the default.
RgbPath "/usr/X11R6/lib/X11/rgb"
# Multiple FontPath entries are allowed (they are concatenated together)
# By default, Red Hat 6.0 and later now use a font server independent of
# the X server to render fonts.
FontPath "unix/:-1"
EndSection
# **********************************************************************
# Server flags section.
# **********************************************************************
Section "ServerFlags"
# Uncomment this to cause a core dump at the spot where a signal is
# received. This may leave the console in an unusable state, but may
# provide a better stack trace in the core dump to aid in debugging
# NoTrapSignals
# Uncomment this to disable the <Crtl><Alt><BS> server abort sequence
# This allows clients to receive this key event.
# DontZap
# Uncomment this to disable the <Crtl><Alt><KP_+>/<KP_-> mode switching
# sequences. This allows clients to receive these key events.
# When using XQUEUE, comment out the above two lines, and uncomment
# the following line.
# Protocol "Xqueue"
# Baudrate and SampleRate are only for some Logitech mice
# BaudRate 9600
# SampleRate 150
# Emulate3Buttons is an option for 2-button Microsoft mice
# Emulate3Timeout is the timeout in milliseconds (default is 50ms)
Emulate3Buttons
Emulate3Timeout 50
# ChordMiddle is an option for some 3-button Logitech mice
# ChordMiddle
# when using XQUEUE, comment out the above line, and uncomment the
# following line
# Protocol "Xqueue"
AutoRepeat 500 5
# Let the server do the NumLock processing. This should only be
# required when using pre-R6 clients
# ServerNumLock
# Specify which keyboard LEDs can be user-controlled (eg, with xset(1))
# Xleds 1 2 3
# To set the LeftAlt to Meta, RightAlt key to ModeShift,
# RightCtl key to Compose, and ScrollLock key to ModeLock:
LeftAlt Meta
RightAlt Meta
ScrollLock Compose
RightCtl Control
# To disable the XKEYBOARD extension, uncomment XkbDisable.
# XkbDisable
# To customise the XKB settings to suit your keyboard, modify the
# lines below (which are the defaults). For example, for a non-U.S.
# keyboard, you will probably want to use:
# XkbModel "pc102"
# If you have a US Microsoft Natural keyboard, you can use:
# XkbModel "microsoft"
#
# Then to change the language, change the Layout setting.
# For example, a german layout can be obtained with:
# XkbLayout "de"
# or:
# XkbLayout "de"
# XkbVariant "nodeadkeys"
#
# If you'd like to switch the positions of your capslock and
# control keys, use:
# XkbOptions "ctrl:nocaps"
"""
for (tag, value) in (("XkbRules", self.keyRules),
("XkbModel", self.keyModel),
("XkbLayout", self.keyLayout),
("XkbVariant", self.keyVariant),
("XkbOptions", self.keyOptions)):
if value:
string = string + ' %s "%s"\n' % (tag, value)
string = string + "EndSection\n"
return string
# HorizSync is in kHz unless units are specified.
# HorizSync may be a comma separated list of discrete values, or a
# comma separated list of ranges of values.
# NOTE: THE VALUES HERE ARE EXAMPLES ONLY. REFER TO YOUR MONITOR'S
# USER MANUAL FOR THE CORRECT NUMBERS.
HorizSync %(HORIZ)s
# VertRefresh is in Hz unless units are specified.
# VertRefresh may be a comma separated list of discrete values, or a
# comma separated list of ranges of values.
# NOTE: THE VALUES HERE ARE EXAMPLES ONLY. REFER TO YOUR MONITOR'S
# USER MANUAL FOR THE CORRECT NUMBERS.
VertRefresh %(VERT)s
# Modes can be specified in two formats. A compact one-line format, or
# a multi-line format.
# This is a set of standard mode timings. Modes that are out of monitor spec
# are automatically deleted by the server (provided the HorizSync and
# VertRefresh lines are correct), so there's no immediate need to
# delete mode timings (unless particular mode timings don't work on your
# monitor). With these modes, the best standard mode that your monitor
# and video card can support for a given resolution is automatically
# used.
# Low-res Doublescan modes
# If your chipset does not support doublescan, you get a 'squashed'
# resolution like 320x400.