Remove thoroughly obsolete displayconfig module

pull/2/head
Timothy Pearson 10 years ago
parent e22d686a13
commit 1ef4e61fbb

@ -1,3 +1,5 @@
- Remove thoroughly obsolete displayconfig tool
- Handle "ain't got no cpufreq" more gracefully (Malone bug # 99198)
- Fix typo in mountconfig that lead to a crash (Malone bug # 87861)
- BUG: Fix detection of the nvidia proprietary driver (Malone bug #104860)

@ -8,14 +8,3 @@ prune package/mandrake/.svn
include README COPYING ChangeLog MANIFEST.in TODO
global-include *.desktop *.py *.pot *.po *.ui
global-exclude *~ .svn
include displayconfig/40guidance-displayconfig_restore
include displayconfig/vesamodes
include displayconfig/extramodes
include displayconfig/widescreenmodes
include displayconfig/ldetect-lst/Cards+
include displayconfig/ldetect-lst/MonitorsDB
include displayconfig/ldetect-lst/pcitable
exclude displayconfig/test.py
exclude displayconfig/xconfig-test.py
exclude displayconfig/popentest.py
exclude displayconfig/guidance_bug_reporter.py

@ -47,9 +47,6 @@ have only been tested on Mandrake.
* mountconfig - Mount point configuration utility. Feature complete and
stable.
* displayconfig - Display and graphics card configuration utility. Feature
complete but it only tested on Kubuntu right now.
* wineconfig - Wine configuration utility.
* grubconfig - Grub boot loader configuration utility. beta quality now.
@ -115,46 +112,15 @@ This will test for a working installation of PyQt/PyKDE and automatically
install the files using the same installation prefix as TDE. You will need
to have a working Python install before you can even run the setup.py script.
displayconfig-hwprobe installation
----------------------------------
displayconfig-hwprobe.py is a small program that should be run at boottime
before Xorg is started. It scans the PCI bus looking for graphics cards and
compares the list it finds to the previous time it was run. If the two lists
of hardware are different then "dpkg-reconfigure xserver-xorg" is automatically
run in non-interactive mode to generate a new xorg.conf based on the new
hardware.
The philosophy is that it is better to have a system with a raw but working
xorg.conf and X server, than to keep the old configuration and a Xorg that
won't startup. Swapping a graphics card should not "break" the OS.
The setup.py script currently does not install displayconfig-hwprobe.py by
itself. For now this must be done by the packager. displayconfig-hwprobe.py
should be put in /etc/init.d and installed to run at boot time with a command
like this:
update-rc.d displayconfig-hwprobe.py start 18 3 .
displayconfig-hwprobe.py only supports Kubuntu right now. Perhaps in the
future displayconfig-hwprobe will be expanded to detect hardware and generate
an xorg.conf by itself.
More information about displayconfig-hwprobe.py and the files it uses is
inside displayconfig-hwprobe.py. Currently the hardware data is written to
/var/lib/guidance/guidance-gfxhardware-snapshot. IMPORTANT: The directory
/var/lib/guidance/ should be created before using displayconfig-hwprobe.py.
Running
-------
Installation should add a couple of entries to the Trinity Control Center in the
System section (displayconfig will show up in Peripherals). It is also possible
System section. It is also possible
to run the commands outside of the Trinity Control Center from the shell as root:
* serviceconfig
* userconfig
* mountconfig
* displayconfig
* wineconfig
* grubconfig

32
TODO

@ -61,11 +61,6 @@ mountconfig
This is stand on Mandriva 2005.
* Implement "real" HAL backend.
displayconfig
~~~~~~~~~~~~~
* Use HAL for fetching PCI and card info? alongside existing systems (ldetect)?
Extra?
~~~~~~
@ -260,33 +255,6 @@ calling a drakxtools)
----------------------------------------------------------------------------
List of hardware probing tools to use for displayconfig:
--------------------------------------------------------
[1] xvinfo - Print out X-Video extension adaptor information
xvinfo prints out the capabilities of any video adaptors
associated with the display
that are accesible through the X-Video extension.
[2] xresprobe - Prints out resolutions, frequency and displaytype.
Doesn't work in all cases. Works via ddc, I guess.
[3] ddcprobe - Uses VESA BIOS Extension
Detects VGA + OEM, modes (only set up modes?), vid mem (kudzu)
[3] read-edid
get-edid|parse-edid prints out a "good-looking" Monitor Section for
xorg.conf, not reliable (failed on notebook)
[4] ddcxinfo - prints out modelines, hsync and vsync (kudzu)
[5] svgamodes - prints out supported video modes (kudzu)
--
Pixel
programming languages addict http://merd.net/pixel/language-study/

@ -1,11 +0,0 @@
# Set the X server resolution to that selected by the user.
#
# This needs to be done before windows managers or X clients start,
# otherwise the DPI and fonts sizes get all screwed up.
#
# http://www.simonzone.com/software/guidance
#
# This file is sourced by Xsession(5), not executed.
# The "|| true" is to ensure that the Xsession script does not terminate
# and stop the login if something fails in the Python program.
/opt/trinity/bin/displayconfig-restore || true

@ -1,340 +0,0 @@
###########################################################################
# ScanPCI.py - #
# ------------------------------ #
# copyright : (C) 2005 by Simon Edwards #
# email : simon@simonzone.com #
# #
###########################################################################
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
###########################################################################
"""Provides information about the devices attached to the PCI bus.
"""
import struct
import csv
import os.path
import sys
###########################################################################
class PCIDevice(object):
def __init__(self,line=None):
self.vendor = None # PCI vendor id
self.device = None
self.subvendor = None # 0xffff if not probe_type'd or no subid
self.subdevice = None # 0xffff if not probe_type'd or no subid
self.pci_class = None # 'None' if not probe_type'd
self.pci_bus = None # pci bus id 8 bits wide
self.pci_device = None # pci device id 5 bits wide
self.pci_function = None# pci function id 3 bits wide
self.module = None
self.text = None
self.already_found = False
if line is not None:
self.loadFromString(line)
def isGfxCard(self):
if self.module is not None and \
(self.module.startswith("Card:") or self.module.startswith("Server:XFree86(")):
return True
return (self.pci_class & PCIBus.PCI_BASE_CLASS_MASK)==PCIBus.PCI_BASE_CLASS_DISPLAY
def getModule(self):
if self.module is not None:
if self.module.startswith("Server:XFree86("):
return self.module[15:-1]
elif self.module.startswith("Card:"):
return self.module[5:]
return self.module
def isModuleXorgDriver(self):
return self.module is not None and \
(self.module.startswith("Server:XFree86(") or self.module.startswith("Card:"))
def __str__(self):
s = "PCI:%i:%i:%i, " % (self.pci_bus,self.pci_device,self.pci_function)
s += "Vendor:%x, Device:%x," % (self.vendor,self.device)
if self.subvendor is not None:
s += " Subvendor:%x," % self.subvendor
if self.subdevice is not None:
s += " Subdevice:%x," % self.subdevice
if self.pci_class is not None:
s += " Class:%x," % self.pci_class
if self.module is not None:
s += " Module:%s," % self.module
if self.text is not None:
s += " Text:%s" % self.text
return s
def loadFromString(self,line):
parts = line.split(",")
for i in range(len(parts)):
bit = parts[i].strip()
if bit.startswith("PCI:"):
pci_code = bit[4:].split(":")
self.pci_bus = int(pci_code[0])
self.pci_device = int(pci_code[1])
self.pci_function = int(pci_code[2])
elif bit.startswith("Vendor:"):
self.vendor = int(bit[7:],16)
elif bit.startswith("Device:"):
self.device = int(bit[7:],16)
elif bit.startswith("Subvendor:"):
self.subvendor = int(bit[10:],16)
elif bit.startswith("Subdevice:"):
self.subdevice = int(bit[10:],16)
elif bit.startswith("Class:"):
self.pci_class = int(bit[6:],16)
elif bit.startswith("Module:"):
self.module = bit[7:]
elif bit.startswith("Text:"):
self.text = " ".join(parts[i:]).strip()[5:]
break
############################################################################
class PCIBus(object):
PCI_CLASS_SERIAL_USB = 0x0c03
PCI_CLASS_SERIAL_FIREWIRE = 0x0c00
PCI_BASE_CLASS_MASK = 0xff00
PCI_BASE_CLASS_DISPLAY = 0x0300
def __init__(self, data_file_dir="."):
self.devices = []
self.data_file_dir = data_file_dir
def detect(self,device_data="/proc/bus/pci/devices"):
# Shamelessly translated from ldetect's pci.c.
fhandle = open(device_data)
for line in fhandle.readlines():
#print "L:",line
entry = PCIDevice()
self.devices.append(entry)
parts = line.split()
devbusfn = int(parts[0],16)
idbits = int(parts[1],16)
entry.vendor = idbits >> 16
entry.device = idbits & 0xffff
entry.pci_bus = devbusfn >> 8
entry.pci_device = (devbusfn & 0xff) >> 3
entry.pci_function = (devbusfn & 0xff) & 0x07
try:
infohandle = open("/proc/bus/pci/%02x/%02x.%d" % (
entry.pci_bus, entry.pci_device, entry.pci_function),"r")
# these files are 256 bytes but we only need first 48 bytes
buf = infohandle.read(48)
(class_prog, entry.pci_class, entry.subvendor, entry.subdevice) = \
struct.unpack("<xxxxxxxxxBHxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxHH",buf)
#print "STRUCT: ",struct.unpack("@xxxxxxxxxBHxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxHH",buf)
if (entry.subvendor==0 and entry.subdevice==0) or \
(entry.subvendor==entry.vendor and entry.subdevice==entry.device):
entry.subvendor = 0xffff
entry.subdevice = 0xffff
if entry.pci_class == PCIBus.PCI_CLASS_SERIAL_USB:
# taken from kudzu's pci.c
if class_prog == 0:
entry.module = "usb-uhci"
elif class_prog == 0x10:
entry.module = "usb-ohci"
elif class_prog == 0x20:
entry.module = "ehci-hcd"
if entry.pci_class == PCIBus.PCI_CLASS_SERIAL_FIREWIRE:
# taken from kudzu's pci.c
if class_prog == 0x10:
entry.module = "ohci1394"
infohandle.close()
except IOError:
pass
fhandle.close()
#if False or os.path.exists("/usr/share/ldetect-lst/pcitable"):
#self._resolveDevicesWithLdetect()
#else:
self._resolveDevicesWithHwdata()
#self._resolveDevicesWithDiscover()
def _resolveDevicesWithLdetect(self):
# Scan the PCI database.
#fhandle = open(os.path.join(self.data_file_dir,"pcitable"),"r")
fhandle = open(os.path.join("/opt/trinity/share/apps/guidance/","pcitable"),"r")
# This class is just for skipping comment lines in the database file.
# This whole class is just an iterator wrapper that we put around our file iterator.
class commentskipperiterator(object):
def __init__(self,fhandle):
self.fhandle = iter(fhandle)
def __iter__(self):
return self
def next(self):
line = self.fhandle.next()
while line[0]=="#":
line = self.fhandle.next()
return line
unknowndevices = self.devices[:]
# Process each row of the DB.
for row in csv.reader(commentskipperiterator(fhandle),delimiter='\t'):
if len(row)==4:
(vendor,device,module,text) = row
elif len(row)==6:
(vendor, device, subvendor, subdevice, module, text) = row
subvendor = int(subvendor[2:],16)
subdevice = int(subdevice[2:],16)
else:
continue
vendor = int(vendor[2:],16) # parse hex numbers of the form 0x1abc
device = int(device[2:],16)
i = 0
while i<len(unknowndevices):
pcidevice = unknowndevices[i]
if pcidevice.vendor==vendor and pcidevice.device==device \
and (len(row)==4 \
or (pcidevice.subvendor==subvendor and pcidevice.subdevice==subdevice)):
if module!="unknown":
pcidevice.module = module
pcidevice.text = text
if len(row)==6: # Close match, also matched on subdevice/subvendor ids.
del unknowndevices[i]
else:
i += 1
else:
i += 1
fhandle.close()
def _resolveDevicesWithDiscover(self):
unknown_devices = self.devices[:]
self._resolveDevicesWithDiscoverFile("/usr/share/discover/pci-26.lst",unknown_devices)
self._resolveDevicesWithDiscoverFile("/usr/share/discover/pci.lst",unknown_devices)
def _resolveDevicesWithDiscoverFile(self,filename,unknown_devices):
# Scan the PCI database.
fhandle = open(filename,"r")
# Process each row of the DB.
for line in fhandle:
row = line.replace("\t"," ").split(" ")
if len(row) >= 1 and row[0] != '':
# Skip manufacturer info lines.
continue
vendor = int(row[1][:4],16)
device = int(row[1][4:],16)
module = row[3]
text = ' '.join(row[4:]).strip()
i = 0
while i<len(unknown_devices):
pcidevice = unknown_devices[i]
if pcidevice.vendor==vendor and pcidevice.device==device:
pcidevice.module = module
pcidevice.text = text
del unknown_devices[i]
else:
i += 1
fhandle.close()
def _resolveDevicesWithHwdata(self):
# Scan the PCI database.
fhandle = open("/usr/share/hwdata/pci.ids","r")
# This class is just for skipping comment lines in the database file.
# This whole class is just an iterator wrapper that we put around our file iterator.
class commentskipperiterator(object):
def __init__(self,fhandle):
self.fhandle = iter(fhandle)
def __iter__(self):
return self
def next(self):
line = self.fhandle.next()
while line[0]=="#":
line = self.fhandle.next()
return line
unknowndevices = self.devices[:]
# Process each row of the DB.
for row in fhandle:
stripped_row = row.strip()
if stripped_row=='' or stripped_row[0]=='#':
continue # Comment or blank line, skip it.
if stripped_row[0]=='C':
# Reached the device class data, stop.
break
if row[0]!='\t':
# Vendor line
vendor_parts = stripped_row.split(' ')
vendor = int(vendor_parts[0],16)
continue
if row[1]!='\t':
# Device line
device_parts = stripped_row.split(' ')
device = int(device_parts[0],16)
subvendor = None
subdevice = None
else:
# Subvendor line
subvendor_parts = stripped_row.split(' ')
subvendor = int(subvendor_parts[0],16)
subdevice = int(subvendor_parts[1],16)
i = 0
while i<len(unknowndevices):
pcidevice = unknowndevices[i]
if pcidevice.vendor==vendor and pcidevice.device==device \
and (subvendor is None \
or (pcidevice.subvendor==subvendor and pcidevice.subdevice==subdevice)):
#pcidevice.module = module
if subvendor is None:
pcidevice.text = ' '.join(vendor_parts[1:]) + '|' + ' '.join(device_parts[1:]).strip()
i += 1
else:
pcidevice.text = ' '.join(vendor_parts[1:]) + '|' + ' '.join(device_parts[1:]+subvendor_parts[2:]).strip()
del unknowndevices[i] # Perfect match, finished with this device.
else:
i += 1
fhandle.close()
def __str__(self):
return "\n".join([str(x) for x in self.devices])
def loadFromFile(self,filename):
fhandle = open(filename,'r')
for line in fhandle.readlines():
if line.strip()!="":
entry = PCIDevice(line=line)
self.devices.append(entry)
fhandle.close()
############################################################################
def main():
bus = PCIBus("ldetect-lst/")
if len(sys.argv)>1:
if sys.argv[1]=="--help" or sys.argv[1]=="-h":
print "Usage:\n ScanPCI.py <pci device file name>"
sys.exit(0)
bus.detect(sys.argv[1])
else:
bus.detect()
print bus
if __name__=='__main__':
main()

@ -1,132 +0,0 @@
#!/usr/bin/python
###########################################################################
# displayconfig-hwprobe.py - description #
# ------------------------------ #
# begin : Sun Jan 22 2006 #
# copyright : (C) 2006 by Simon Edwards #
# email : simon@simonzone.com #
# #
###########################################################################
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
###########################################################################
# This program should be run during boot time. It quickly examines the
# graphics cards (read: PCI devices) in the computer and compares they to
# the list in the file $hardware_info_filename. If the two lists differ
# then the Debian package manager is automatically called to regenerate
# /etc/X11/xorg.conf. This hopefully should mean that people can swap gfx
# cards in and out and always have a system that will run Xorg. (even
# though the config will be most likely be suboptimal. Suboptimal is better
# than no X server).
import ScanPCI
import os
import syslog
import select
hardware_info_filename = "/var/lib/guidance/guidance-gfxhardware-snapshot"
data_file_dir = "/usr/share/apps/guidance/"
def main():
# Scan the PCI bus.
pci_bus = ScanPCI.PCIBus(data_file_dir)
pci_bus.detect()
# Stuff our device info in to a string.
hardware_config = ""
for pci_device in pci_bus.devices:
if pci_device.isGfxCard():
hardware_config += "PCI:%i:%i:%i Vendor:%x Device:%x Subvendor:%x Subdevice:%x\n" % \
(pci_device.pci_bus, pci_device.pci_device, pci_device.pci_function,
pci_device.vendor, pci_device.device,
pci_device.subvendor, pci_device.subdevice)
# Read in the old gfx hardware info in.
previous_hardware = None
try:
fhandle = open(hardware_info_filename)
previous_hardware = fhandle.read()
fhandle.close()
except IOError:
previous_hardware = None
if previous_hardware is not None and previous_hardware!=hardware_config:
# Run dpkg and configure the new hardware.
syslog.syslog(syslog.LOG_INFO, "Graphics card hardware has changed. Reconfiguring xorg.conf using 'dpkg-reconfigure xserver-xorg'.")
cmd = ['dpkg-reconfigure','xserver-xorg']
environ = os.environ.copy()
environ['DEBIAN_FRONTEND'] = 'noninteractive'
#os.spawnvpe(os.P_WAIT, 'dpkg-reconfigure', cmd, environ)
result = ExecWithCapture('/usr/sbin/dpkg-reconfigure', cmd, 0, '/', 0,1, -1, environ)
for line in result.split('\n'):
syslog.syslog(syslog.LOG_INFO,"dpkg-reconfigure:"+line)
# [21:18] <Riddell> you are brave indeed
# [21:21] <Sime> I figured some kind of non-interactive "dpkg-reconfigure xorg" might be enough.
# [21:22] <Riddell> yep
if previous_hardware is None or previous_hardware!=hardware_config:
syslog.syslog(syslog.LOG_INFO, "Writing graphics card hardware list to "+hardware_info_filename)
# Write out the gfx hardware info
tmp_filename = hardware_info_filename + ".tmp"
fhandle = open(tmp_filename,'w')
fhandle.write(hardware_config)
fhandle.close()
os.rename(tmp_filename, hardware_info_filename)
############################################################################
def ExecWithCapture(command, argv, searchPath = 0, root = '/', stdin = 0,
catchfd = 1, closefd = -1, environ = None):
if not os.access(root + command, os.X_OK) and not searchPath:
raise RuntimeError, command + " can not be run"
(read, write) = os.pipe()
childpid = os.fork()
if (not childpid):
if (root and root != '/'): os.chroot(root)
os.dup2(write, catchfd)
os.close(write)
os.close(read)
if closefd != -1:
os.close(closefd)
if stdin:
os.dup2(stdin, 0)
os.close(stdin)
# Replace the environment
if environ is not None:
os.environ.clear()
os.environ.update(environ)
if searchPath:
os.execvp(command, argv)
else:
os.execv(command, argv)
sys.exit(1)
os.close(write)
rc = ""
s = "1"
while s:
select.select([read], [], [])
s = os.read(read, 1000)
rc = rc + s
os.close(read)
try:
os.waitpid(childpid, 0)
except OSError, (errno, msg):
print __name__, "waitpid:", msg
return rc
main()

@ -1,324 +0,0 @@
#!/usr/bin/python
###########################################################################
# displayconfig-restore.py - description #
# ------------------------------ #
# begin : Wed Dec 15 2004 #
# copyright : (C) 2004-2006 by Simon Edwards #
# email : simon@simonzone.com #
# #
###########################################################################
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
###########################################################################
import os
import os.path
import subprocess
import ixf86misc
import xf86misc
from execwithcapture import *
############################################################################
def FindXorgConfig(self):
# Lookup location of X configfile
for line in ExecWithCapture("xset", ["xset","q"],True).split('\n'):
if line.strip().startswith("Config file"):
return line.split(":")[1].strip()
# Sometimes, xset doesn't know about the configfile location, hence ...
if os.path.isfile("/etc/X11/xorg.conf"):
return "/etc/X11/xorg.conf"
return None
############################################################################
# FixXorgDPI
# ==========
# The idea here is to ensure that applications use a sensible DPI setting
# for fonts. When Xorg starts up it tries to detect the size of the attached
# monitor and calculate the real DPI from there and use that. Problems are:
#
# * if the monitor size can not be detect then Xorg uses 75dpi. This is
# usually far too low.
#
# * if the monitor size is not accurately detected then you get bad a DPI.
#
# * most fonts are optimised to work at a handful of standard DPIs. 96dpi,
# 120dpi and printer resolution 300dpi and 600dpi. Fonts rendered in
# non-standard DPIs often look bad and jagged. This is a real problem
# when rendering fonts on low resolution devices. (i.e. a computer
# monitor).
#
# Although it is desirable in theory to use the real DPI of the monitor, in
# practice it is more important to ensure that fonts are well rendered even
# if the DPI in use is not correct.
#
# What this function does is read the display size from the X server and
# if it is lower than 140dpi then 'round' it to either 96dpi or 120dpi.
# (A dpi greater or equal to 140 is assumed to be high enough to render fonts
# well.) The new dpi is then loaded with the xrdb command into the X server
# resource database. Most X applications (Qt and GTK apps at least) will then
# use this DPI for font rendering.
#
def FixXorgDPI(desiredDPI):
# dpi is:
# None - round the DPI.
# xserver - Use the X server's DPI.
# <number> - DPI to use.
if desiredDPI=="xserver":
return
dpi = 96
try:
if desiredDPI is not None:
dpi = int(desiredDPI)
except ValueError:
desiredDPI = None
if desiredDPI is None:
xserver = xf86misc.XF86Server()
if len(xserver.getScreens())!=0:
(width,height,width_mm,height_mm) = xserver.getScreens()[0].getDimensions()
if not float(width_mm) == 0:
w_dpi = float(width)/(float(width_mm)/25.4)
else:
w_dpi = 96
if not float(height_mm) == 0:
h_dpi = float(height)/(float(height_mm)/25.4)
else:
h_dpi = 96
dpi = (w_dpi+h_dpi)/2.0 # Average the two possible DPIs.
if dpi >= 140: # Anything above 140 is ok.
dpi = int(dpi)
else:
if abs(96-dpi) < abs(120-dpi): # Rounding to 96 is best.
dpi = 96
else:
dpi = 120
# work around for LP beastie 151311
if ((w_dpi < 200) and (h_dpi > 900)):
dpi = 96
try:
xrdb = subprocess.Popen(["xrdb","-nocpp","-merge"],stdin=subprocess.PIPE)
xrdb.communicate("Xft.dpi: %i\n" % dpi)
xrdb.wait()
except OSError:
pass
# Other common, but now used settingsfor xrdb:
# Xft.antialias:
# Xft.hinting:
# Xft.hintstyle:
# Xft.rgba:
############################################################################
def ReadDisplayConfigRC():
screens = None
dpi = None
dpms_seconds = None
dpms_enabled = None
configpath = ExecWithCapture("tde-config",['tde-config','--path','config'],True)
# Hunt down the user's displayconfigrc file and adjust the resolution
# on the fly to match. (Non-root Users can independantly specify their own settings.)
dirs = configpath.strip().split(":")
for dir in dirs:
if dir!="":
configpath = os.path.join(dir,"displayconfigrc")
if os.path.exists(configpath):
# Parse the config file.
fhandle = open(configpath)
screens = []
currentscreen = None
for line in fhandle.readlines():
line = line.strip()
if line.startswith("[Screen"):
# Screen, width, height, refresh, reflectx, reflecty, rotate, redgamma, greengamma,bluegamma
currentscreen = [int(line[7:-1]), None, None, None, False, False, "0", None, None, None]
screens.append(currentscreen)
elif line.startswith("["):
currentscreen = None
elif line.startswith("dpi="):
dpi = line[4:]
elif currentscreen is not None:
if line.startswith("width="):
currentscreen[1] = int(line[6:])
elif line.startswith("height="):
currentscreen[2] = int(line[7:])
elif line.startswith("refresh="):
currentscreen[3] = int(line[8:])
elif line.startswith("reflectX="):
currentscreen[4] = line[9:]=="1"
elif line.startswith("reflectY="):
currentscreen[5] = line[9:]=="1"
elif line.startswith("rotate="):
currentscreen[6] = line[7:]
elif line.startswith("redgamma="):
currentscreen[7] = line[9:]
elif line.startswith("greengamma="):
currentscreen[8] = line[11:]
elif line.startswith("bluegamma="):
currentscreen[9] = line[10:]
elif line.startswith("dpmsEnabled"):
dpms_enabled = line.split("=")[1]
elif line.startswith("dpmsSeconds"):
dpms_seconds = int(line.split("=")[1])
fhandle.close()
break
return (screens,dpi,dpms_enabled,dpms_seconds)
############################################################################
def main():
(screens,dpi,dpms_enabled,dpms_seconds) = ReadDisplayConfigRC()
if dpms_enabled:
if dpms_enabled == "on":
if not dpms_seconds:
dpms_seconds = 900
cmd = "xset dpms %i %i %i" % (dpms_seconds,dpms_seconds,dpms_seconds)
os.system(cmd)
else:
cmd = "xset -dpms"
os.system(cmd)
if screens is not None:
# Set the X server.
try:
xserver = xf86misc.XF86Server()
if len(screens)!=0:
for screen in screens:
(id,width,height,refresh,reflectx,reflecty,rotate,redgamma,greengamma,bluegamma) = screen
# Convert the stuff into RandR's rotation bitfield thingy.
if rotate=="0":
rotation = xf86misc.XF86Screen.RR_Rotate_0
elif rotate=="90":
rotation = xf86misc.XF86Screen.RR_Rotate_90
elif rotate=="180":
rotation = xf86misc.XF86Screen.RR_Rotate_180
elif rotate=="270":
rotation = xf86misc.XF86Screen.RR_Rotate_270
if reflectx:
rotation |= xf86misc.XF86Screen.RR_Reflect_X
if reflecty:
rotation |= xf86misc.XF86Screen.RR_Reflect_Y
if id<len(xserver.getScreens()):
xscreen = xserver.getScreens()[id]
if xscreen.resolutionSupportAvailable():
available_sizes = xscreen.getAvailableSizes()
# Find the closest matching resolution
best_score = 1000000
best_size_id = 0
for size_id in range(len(available_sizes)):
size = available_sizes[size_id]
score = abs(size[0]-width)+abs(size[1]-height)
if score < best_score:
best_size_id = size_id
best_score = score
# Now find the best refresh for this resolution
best_score = 1000000
best_refresh = 50
for available_refresh in xscreen.getAvailableRefreshRates(best_size_id):
score = abs(refresh-available_refresh)
if score < best_score:
best_refresh = available_refresh
best_score = score
# Mask out any unsupported rotations.
rotation &= xscreen.getAvailableRotations()
xscreen.setScreenConfigAndRate(best_size_id, rotation, best_refresh)
# Restore the gamma settings.
if redgamma is not None and greengamma is not None and bluegamma is not None:
try:
xscreen.setGamma( (float(redgamma), float(greengamma), float(bluegamma)) )
except ValueError,e:
pass
FixXorgDPI(dpi)
except xf86misc.XF86Error,err:
print err
return
else:
# Ensure that the xorgs virtual screen size matches the default resolution
# of the server. Why does this matter? When Xorg starts up it reads its
# config file chooses the first mode in the "modes" line of the active
# Screen section and uses it as the virtual screen size and as the
# screen resolution (ie 1024x768 resolution screen showing a 1024x768 gfx
# buffer). But, this means that you can't use RandR to get to any higher
# screen resolutions (ie 1280x1024) because Xorg requires that the virtual
# screen size 'cover' the screen resolution being displayed.
#
# So, to get around this problem and make it possible for people to select
# a lower resolution screen *and* still have the option later to use
# RandR/displayconfig to switch to higher resolution, displayconfig
# explicitly sets the virtual screen size in xorg.conf to the largest
# resoluution that the monitor/gfx card can support. The down side to
# this is that the X server and tdm get the correct resolution but the
# wrong (virtual) screen size. The user can now scroll around on the
# greater virtual screen. Kind of annoying for tdm, unacceptable once
# the user has logged in.
#
# What we do now as the user's KDE session is being started up is check
# what the real virtual screen size is meant to be (=same as the real
# resolution being used) and then use the RandR extension to explicitly
# set the correct resolution. This has the effect of changing the virtual
# screeen size to what we really want. (RandR can change the virtual
# screen size, thankfully)
import displayconfigabstraction
try:
xserver = xf86misc.XF86Server()
for xscreen in xserver.getScreens():
if xscreen.resolutionSupportAvailable():
mode_line = ixf86misc.XF86VidModeGetModeLine(xserver.getDisplay(),xscreen.getScreenId())
hdisplay = mode_line[1]
vdisplay = mode_line[5]
live_refresh_rate = xscreen.getRefreshRate()
try:
(live_width,live_height,x,x) = xscreen.getAvailableSizes()[xscreen.getSizeID()]
except IndexError, errmsg:
print "IndexError:", errmsg, "in displayconfig-restore getting live screen size - trying screen 0."
(live_width,live_height,x,x) = xscreen.getAvailableSizes()[0]
if (hdisplay,vdisplay) != (live_width,live_height):
# The screen resolution doesn't match the virtual screen size.
screen_sizes = xscreen.getAvailableSizes()
for size_id in range(len(screen_sizes)):
screen_size = screen_sizes[size_id]
if screen_size[0]==hdisplay and screen_size[1]==vdisplay:
# Find the closest matching refresh rate.
best_refresh = 0
best_score = 1000000
for rate in xscreen.getAvailableRefreshRates(size_id):
score = abs(rate-live_refresh_rate)
if score < best_score:
best_refresh = rate
best_score = score
# Reset the screen mode and virtual screen size.
xscreen.setScreenConfigAndRate(size_id,xscreen.getRotation(),best_refresh)
break
FixXorgDPI(dpi)
except (xf86misc.XF86Error,TypeError),err:
print err
main()

@ -1,51 +0,0 @@
[Desktop Entry]
Name=Monitor & Display
Name[el]=Οθόνη & εμφάνιση
Name[es]=Monitor y pantalla
Name[et]=Monitor ja kuva
Name[it]=Schermo
Name[ja]=モニタとディスプレイ
Name[nl]=Monitor en beeldscherm
Name[pt]=Monitor & Ecrã
Name[pt_BR]=Monitor & Visualização
Name[sr]=Монитор и приказ
Name[sr@Latn]=Monitor i prikaz
Name[sv]=Bildskärm och skärm
Name[xx]=xxMonitor & Displayxx
Comment=Display and Monitor Configuration
Comment[el]=Ρυθμίσεις εμφάνισης και οθόνης
Comment[es]=Configuración de la pantalla y el monitor
Comment[et]=Monitori ja kuva seadistamine
Comment[it]=Configurazione dello schermo
Comment[ja]=モニタとディスプレイの設定
Comment[nl]=Configuratie van beeldscherm en monitor
Comment[pt]=Configuração do Monitor e Ecrã
Comment[pt_BR]=Configuração do Monitor e da Visualização
Comment[sr]=Подешавање приказа и монитора
Comment[sr@Latn]=Podešavanje prikaza i monitora
Comment[sv]=Skärm- och bildskärmsinställning
Comment[xx]=xxDisplay and Monitor Configurationxx
Icon=displayconfig.png
Encoding=UTF-8
X-TDE-ModuleType=Library
X-TDE-Library=displayconfig
X-TDE-FactoryName=displayconfig
X-TDE-RootOnly=true
Type=Application
Exec=tdecmshell Peripherals/displayconfig
Categories=Qt;TDE;X-TDE-settings-hardware;
GenericName=Screen Configuration Editor
GenericName[el]=Επεξεργαστής ρυθμίσεων οθόνης
GenericName[es]=Editor de la configuración de la pantalla
GenericName[et]=Ekraani seadistamise redaktor
GenericName[it]=Editor della configurazione dello schermo
GenericName[ja]=スクリーン設定エディタ
GenericName[nl]=Scherminstellingen bewerken
GenericName[pt]=Editor da Configuração do Ecrã
GenericName[pt_BR]=Editor de Configuração da Tela
GenericName[sr]=Уређивач подешавања екрана
GenericName[sr@Latn]=Uređivač podešavanja ekrana
GenericName[sv]=Editor för skärminställning
GenericName[xx]=xxScreen Configuration Editorxx
NoDisplay=true

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -1,741 +0,0 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/home/sebas/dev/guidance/trunk/displayconfig/displayconfighardwaretab.ui'
#
# Created: Sat Apr 23 14:39:39 2005
# by: The PyQt User Interface Compiler (pyuic) 3.13
#
# WARNING! All changes made in this file will be lost!
import sys
from qt import *
image0_data = [
"32 32 522 2",
"Qt c None",
".i c #000000",
"bA c #0037a6",
"bU c #0038a6",
"ch c #0038a7",
"bo c #003ba8",
"cA c #003ba9",
"bT c #003ca8",
"bG c #003ca9",
"fp c #020202",
"cS c #0242ae",
"fq c #030303",
"bH c #0341ab",
"cg c #0441ab",
"b1 c #0443ae",
"fo c #050505",
"fB c #060606",
"bS c #0642ad",
"a7 c #0740a5",
"cf c #0744ad",
"fC c #080808",
".5 c #083fa5",
"bn c #0841a5",
"d# c #0848b2",
"bF c #0942a6",
"bh c #0949b1",
".h c #0a0a0a",
"cz c #0a47b0",
"ce c #0a48b0",
"dY c #0a4fb7",
"fI c #0b0b0b",
"b0 c #0b44a9",
"cm c #0b4ab2",
"b2 c #0c4ab1",
"fA c #0e0e0e",
"dk c #0e4eb5",
"bz c #0f4db2",
"b3 c #0f4db3",
"bI c #0f4db4",
".A c #111111",
"cl c #114bad",
"cR c #114eb4",
"cd c #114fb4",
"b4 c #1250b5",
"cG c #1250b6",
"fr c #131313",
"cy c #1351b5",
"dA c #1353b8",
"cn c #1452b6",
"aJ c #1550af",
"bR c #1552b7",
"eR c #161616",
"cQ c #1653b7",
"bp c #1654b7",
"d. c #1654b8",
"a8 c #1656b9",
"cx c #1756b8",
"cF c #1852b2",
"b5 c #1857b9",
"cZ c #1857ba",
".2 c #191919",
"dX c #195cbf",
"cP c #1a58ba",
"cc c #1a59ba",
"#p c #1a5dbf",
"cH c #1b59bb",
"co c #1b5abb",
"ag c #1c1c1c",
"c9 c #1c5abb",
"dH c #1c60c2",
"dg c #1d5ebf",
"a3 c #1e1e1e",
"cY c #1e58b6",
"bJ c #1e5dbd",
"dG c #1f5ebc",
"cp c #1f5ebd",
"aY c #1f5fbf",
"cI c #205ebd",
"b6 c #205fbe",
"dW c #2063c3",
"bX c #212121",
"c8 c #215fbe",
"c0 c #2160bf",
"cb c #2161bf",
"#v c #225db7",
"cq c #2261c0",
"cw c #2262c0",
"df c #235db9",
"by c #2362c0",
"ds c #2364c2",
"cD c #242424",
"bQ c #2463c0",
"cr c #2464c1",
"aj c #2560b9",
"dp c #262626",
"cv c #2665c1",
"c1 c #2665c2",
"aB c #2667c4",
"dI c #266ac7",
".# c #272727",
"dr c #2763bc",
"b7 c #2766c2",
"cJ c #2766c3",
"cs c #2767c2",
"ca c #2767c3",
"eq c #282828",
"cO c #2867c3",
"bg c #2968c3",
"ct c #2968c4",
"cu c #2969c4",
"ab c #296bc7",
"bK c #2a69c5",
"b8 c #2a6ac5",
".6 c #2a6eca",
"#V c #2b66bc",
"cK c #2b6ac6",
"bq c #2b6bc5",
"c7 c #2b6bc6",
".o c #2c2c2c",
"#q c #2c5cb7",
"bi c #2c5eb7",
"bx c #2c6bc6",
"bP c #2c6cc6",
"aK c #2c6cc7",
"#P c #2c6ec8",
"g. c #2d2d2d",
"bB c #2d60b9",
"c# c #2d6dc7",
"cL c #2d6ec7",
"dJ c #2d71cb",
"dV c #2d71cc",
"aX c #2e6dc7",
"b9 c #2e6ec7",
"c. c #2e6ec8",
"fb c #2f2f2f",
"c2 c #2f6ec8",
"a9 c #2f6fc8",
"cT c #3063bb",
"cM c #3070c8",
"bw c #3070c9",
"ak c #3072cb",
"bf c #3171c9",
"br c #3171ca",
"aA c #3271c9",
"cN c #3272c9",
"aW c #3272ca",
"c3 c #3372ca",
"dt c #3372cb",
"dz c #3373ca",
"b. c #3373cb",
"bL c #3374cb",
"dK c #3377cf",
"dU c #3379d0",
"aZ c #3467be",
"aL c #3474cb",
"#o c #3478d0",
"da c #3567bf",
"dZ c #356cc3",
"aa c #3575cc",
"bO c #3576cc",
"#W c #3576ce",
".B c #363636",
"bM c #3676cc",
"be c #3676cd",
"c6 c #3677cd",
"fJ c #373737",
"az c #3777cd",
"bN c #3778cd",
"#T c #383838",
"bv c #3878cd",
"bs c #3878ce",
"#O c #3879ce",
"fZ c #393939",
"dl c #396cc1",
"aM c #3979ce",
"#w c #397bd1",
"dL c #397dd3",
"#n c #397ed3",
"fz c #3a3a3a",
"c4 c #3a7bcf",
"bu c #3a7bd0",
"dT c #3a7fd4",
"aG c #3b3b3b",
"c5 c #3b7bcf",
"bd c #3b7bd0",
"a# c #3b7cd0",
".7 c #3b80d5",
"gh c #3c3c3c",
"dB c #3c70c3",
"ay c #3c7cd1",
"aV c #3c7dd1",
"a4 c #3d3d3d",
"#X c #3d7dd1",
"aN c #3d7ed1",
"dy c #3d7ed2",
"bt c #3e7fd1",
"dh c #3e7fd2",
"dM c #3e83d7",
"bk c #3f3f3f",
"#Q c #3f73c5",
"al c #3f7fd2",
"#N c #3f80d2",
"b# c #3f80d3",
"dS c #3f85d7",
"#x c #4081d3",
"#m c #4084d7",
"f5 c #414141",
"a. c #4182d3",
"aU c #4182d4",
"bY c #424242",
"aC c #4276c6",
"aO c #4282d4",
"ax c #4283d4",
"bc c #4283d5",
"di c #4284d4",
".8 c #4287d9",
"#Y c #4384d5",
"dN c #4389da",
"cW c #444444",
"dj c #4484d5",
"dR c #4489db",
"g# c #454545",
"#M c #4586d6",
"bb c #4587d6",
"dd c #464646",
"ac c #467ac9",
"aT c #4687d7",
"aP c #4788d7",
"#y c #4788d8",
"#l c #478ddc",
"dO c #478ddd",
"er c #484848",
"ba c #4889d7",
"aw c #4889d8",
"am c #488ad8",
".9 c #488edd",
"dE c #494949",
"#Z c #498ad8",
"dx c #498bd9",
"d2 c #4a4a4a",
"aS c #4a8bd9",
"dP c #4a90de",
"aQ c #4b8cda",
"du c #4b8dda",
"#L c #4b8ddb",
"fU c #4c4c4c",
"dw c #4c8eda",
"dv c #4c8edb",
"dQ c #4c92df",
"av c #4d8edb",
"#z c #4d8fdb",
"an c #4d8fdc",
"#9 c #4e8fdc",
"#0 c #4e90dc",
"#k c #4f94e1",
"#. c #4f95e2",
"aR c #5092dd",
"au c #5193de",
"ao c #5294de",
"#K c #5294df",
"#A c #5395df",
"#1 c #5395e0",
"ap c #5597e0",
"at c #5597e1",
"#j c #559ce6",
"## c #579de6",
"#8 c #589ae2",
"aq c #589be2",
"fs c #595959",
"#B c #599be3",
"as c #599ce3",
"ar c #5a9ce3",
"#7 c #5c9fe6",
"#2 c #5d9fe5",
"#i c #5da3ea",
"fH c #5e5e5e",
"#C c #5ea2e7",
"#a c #5ea4eb",
"#J c #5fa1e6",
"gg c #606060",
"#6 c #60a3e7",
"#3 c #60a3e8",
"#5 c #62a4e9",
"#4 c #62a5e9",
"#I c #63a7ea",
"#h c #63aaef",
"#D c #64a7ea",
"#b c #64abef",
".g c #666666",
"f4 c #686868",
"#E c #68abed",
"#g c #69b1f2",
"#H c #6aaeee",
"#F c #6aaeef",
"#c c #6ab1f3",
"#G c #6bafef",
"#f c #6db4f5",
"#d c #6eb5f5",
"#e c #6eb6f6",
".E c #7087ae",
".n c #717171",
"f9 c #757575",
".Y c #758fb7",
"fO c #787878",
"el c #7ba0d7",
".F c #7d98be",
"gf c #7e7e7e",
"f0 c #808080",
"ek c #83a7dc",
"ga c #848484",
".X c #85a2c7",
".a c #868686",
"d5 c #86abdf",
"fy c #878787",
".W c #87a5c9",
"ej c #87abdd",
"d4 c #88aadc",
"f6 c #898989",
".Z c #899cc0",
".G c #8aa7ca",
"ei c #8aafe0",
"fD c #8b8b8b",
".V c #8ba8ca",
".H c #8ca9cb",
"d6 c #8cb1e2",
".U c #8eaccd",
"eh c #8eb3e3",
".I c #8faccd",
"d7 c #90b5e4",
".T c #92afcf",
"em c #92afdd",
".J c #92b0d0",
"eg c #92b7e5",
"d8 c #93b8e6",
".j c #949494",
".S c #95b3d1",
".K c #95b3d2",
"d9 c #96bbe8",
"ge c #979797",
".R c #98b6d3",
".L c #98b6d4",
"e. c #99bfea",
".f c #9a9a9a",
".e c #9b9b9b",
".Q c #9bb9d4",
".M c #9bb9d6",
".d c #9c9c9c",
"ef c #9cc2ec",
".c c #9d9d9d",
"e# c #9dc2eb",
".b c #9e9e9e",
".N c #9ebcd7",
"ee c #9ec4ed",
"ea c #9fc4ee",
".O c #a0bed8",
".P c #a0bfd8",
"ed c #a0c5ee",
"eb c #a0c6ee",
"ec c #a1c6ef",
"gd c #a3a3a3",
"gb c #a4a4a4",
"fa c #a5a5a5",
"gc c #a6a6a6",
"fN c #a8a8a8",
"fc c #acacac",
"fi c #b4b4b4",
"f8 c #b5b5b5",
"fm c #b8b8b8",
"fj c #b9b9b9",
"fl c #bababa",
"fk c #bbbbbb",
"fn c #bcbcbc",
"fx c #bebebe",
"fw c #bfbfbf",
"fh c #c1c1c1",
"fv c #c2c2c2",
"fu c #c3c3c3",
"eQ c #c4c4c4",
"eo c #c6c6c5",
"fE c #c6c6c6",
".4 c #c6c9d0",
"fe c #c7c7c7",
".z c #c8c8c8",
"#u c #c8ccd3",
"fd c #c9c9c9",
"d1 c #cac9c8",
"aF c #cacaca",
"f# c #cbcac9",
"ep c #cbcbcb",
"a2 c #cccccc",
"dD c #cdccca",
"do c #cdcdcd",
"#U c #cdd0d7",
"f. c #cecccc",
"af c #cecece",
"ai c #ced1d8",
"aI c #ced2d9",
"dn c #cfcecd",
"eP c #cfcfcf",
"e9 c #d0cfcf",
"ft c #d0d0d0",
"eO c #d0d0d1",
"dc c #d1d1cf",
"fg c #d1d1d1",
"e8 c #d2d2d1",
"#s c #d2d2d2",
"a6 c #d2d6dc",
".1 c #d3d3d3",
"cV c #d4d3d2",
"eN c #d4d3d3",
"e7 c #d4d4d3",
"f7 c #d4d4d4",
"bm c #d4d7de",
"ff c #d5d5d5",
"eM c #d5d6d6",
"d0 c #d5d7da",
"cC c #d6d5d4",
"e6 c #d6d6d5",
"f3 c #d6d6d6",
"en c #d6d7d9",
"dC c #d6d8db",
"bE c #d6d9e0",
"fY c #d7d7d7",
"eL c #d7d8d7",
".D c #d7d8db",
"bZ c #d7dbe2",
"fX c #d8d8d8",
"e5 c #d8d9d8",
"dm c #d8d9dc",
"cj c #d9d8d7",
"eK c #d9d9d9",
"db c #d9dbde",
"ck c #d9dde4",
"fM c #dadada",
"cU c #dadcdf",
"e4 c #dbdbda",
"eJ c #dbdbdb",
"cB c #dbdde0",
"dF c #dbdfe5",
"bW c #dcdbda",
"eI c #dcdcdc",
"cE c #dce0e6",
"fQ c #dddddd",
"cX c #dde1e8",