Added KDE3 version of KDE Guidance utilities

git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kde-guidance@1102646 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 15 years ago
commit 19ae07d0d4

@ -0,0 +1,280 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS

@ -0,0 +1,334 @@
- 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)
- BUG: Displayconfig and displayconfig-restore.py would crash in combination
with later versions Xorg if the xrandr extension was not available.
(Malone bug #91545)
* Wednesday 29 March 2007 Simon Edwards <simon@simonzone.com>
- version 0.8
- Deal with AttributeError in displayconfigabstraction (Malone bug #94108)
- Add menu to choose CPU frequency policy manually
- Handle problems not being able to read the filesystem label gracefully
- Make displayconfig-restore not crash on incorrect modelines (Malone bug # 76393)
- Make displayconfig a little smarter when the preferred resolution can't be found
- Make wineconfig not crash on empty fstab lines
- Fix the fuser frontend in mountconfig to actually work again.
- Handle ZeroDivisionError in displayconfig gracefully (Malone bug #77844)
- Support for LABEL in fstab added to mountconfig, improved support for
UUID.
- Support for changing CPU frequency policy with HAL added to powermanager.
- Suspend after N minutes idle added to powermanager
- Added an option to not lock screen on resume (Malone bug # 64650)
- Handle crash in userconfig due to problems with locale (Malone bug #65739)
- Support for UUIDs in fstab added to mountconfig.
- grubconfig added. (Martin Böhm)
* Tuesday 6 March 2007 Simon Edwards <simon@simonzone.com>
- version 0.7.1
- BUG: Fixed typo in userconfig.py. (thanks to Rocco Stanzione)
- BUG: Fix double hibernate call on lid close. (Malone bug #65885)
- BUG: Change CHARGE_LEVEL_THRESHOLD to 10% (was 50%) to better workaround
acpi issue. when remaining_time is not reported correctly. Also use
threshold for battery low notification warning. (Malone bug #64752,
#67081)
- BUG: Handle error in locale.getpreferredencoding gracefully. (Malone bug
#65739)
- BUG: DPMS settings had not been saved on Apply, do that.
- BUG: Fix crash where cpu frequency scaling is not readable.
- BUG: Fix unicode and localisation handling in targetgamma, do a better job
choosing the right resolutions for example for nvidia twinview and other
unusual resolutions.
- BUG: Powermanager, first read config, then adapt the state of the UI from
those values.
- BUG: Don't crash displayconfig-restore when screenwidth and height are
bogus, use a sensible value of 96 instead. (Malone bug #77844)
- BUG: Make displayconfig-restore not crash on unknown modelines.
- BUG: Make tempfile handling more robust by using Python's tempfile.
- BUG: Check for None groupids in userconfig.
- BUG: Clear password edit after exiting the edit dialog in userconfig.
- BUG: Make AC adapter detection more robust to potential failure of
actions. (Malone bug #77091)
- BUG: permissions on groupfile should've been read, before they can be set.
- BUG: Check for valid groupid when selecting in userconfig.
- BUG: gamma settings were not being restored after logging in.
- BUG: A rounding error was causing problems in displayconfig when filtering
resolutions by the selected monitor.
- BUG: Displayconfig, userconfig and wineconfig didn't handle RTL desktops
correctly. (Diego lastrubni)
- BUG: Displayconfig would sometimes consider some widescreen modes as being
standand aspect ratio.
- BUG: Displayconfig would sometimes fail to set Display virtual size in
xorg.conf.
- BUG: Stopped displayconfig from stacktracing when it encounters a
degenerate gfx card + monitor combination that has no valid resolutions.
* Thursday 12 October 2006 Simon Edwards <simon@simonzone.com>
- version 0.7
- BUG: Don't bail out of laptop-detect is not there (Malone bug #60309)
- BUG: mountconfig.py didn't handle USB disks correctly. (KDE bug #132390)
- BUG: Disable double click opening items in mountconfig if the user is not
root.
- BUG: Don't bail out if the device section is already there (Malone bug #50411)
- BUG: Don't show new_user in the secondary groups (Malone bug #44203)
- BUG: userconfig set wrong uid for new users (Malone bug #56275)
- BUG: serviceconfig.py would sometimes fail on non-English systems.
(Malone bug #43313).
- BUG: userconfig would sometimes fail when writing the shadow password file.
(Malone bug #47090)
- BUG: userconfig would fail if the password warning field in /etc/shadow was
empty. (Malone bug #47317)
- Changed a couple of labels in order to match the new system-settings spec:
https://wiki.kubuntu.org/KubuntuSystemSettingsUsability
- mountconfig now uses CIFS for Windows Shares instead of obsolete smbfs.
(Martin Böhm)
- Displayconfig now hides useless Monitor Orientation and Second Screen group
box options which can never be activated without changing hardware or the
X driver.
- Simplified the color and gamma tab in displayconfig.
- BUG: Better detection for dualhead intel chips in displayconfig.
- Updated the data files for displayconfig from
http://cvs.mandriva.com/cgi-bin/viewvc.cgi/soft/ldetect-lst/trunk/lst/?root=svn
- wineconfig added for configuring Wine. (Yuriy Kozlov)
- powermanager applet added for monitoring laptop power levels (Sebastian
Kügler)
* Saturday 13 May 2006 Simon Edwards <simon@simonzone.com>
- version 0.6.7
- Dutch translation added (Rinse de Vries)
- BUG: Displayconfig would fail if the monitor frequency settings in xorg.conf
contained extra spaces. (Malong bug #38692)
- BUG: Displayconfig would not add the lowest screen resolution available to
the modes list in the xorg.conf's Screen section/Display subsection.
- French translation added from Launchpad Rossetta.
* Friday 28 April 2006 Simon Edwards <simon@simonzone.com>
- version 0.6.6
- BUG: Serviceconfig didn't correctly remove links in runlevel directories.
(Malone bug #39404)
- BUG: In Serviceconfig, toggling the "Start during boot" checkbox using the
context menu would fail. (Malone bug #34252)
- BUG: displayconfig-restore.py was would fail with "global name 'syslog'
undefined". (Malone bug #40683)
- BUG: Displayconfig had trouble picking a driver gfxcard model entry instead
of the detected default (e.g. VESA). (Malone bug #41127)
- BUG: Displayconfig would fail when writing out a xorg.conf that contained
non-ascii characters. (Malone bug #41474)
- Work around for an annoying bug in PyQt/PyKDE that causes the tools to
crash on exit if a dialog window has been used.
- BUG: The file paths used in displayconfig for checking for the proprietary
nvidia driver were wrong or out of date.
* Tuesday 18 April 2006 Simon Edwards <simon@simonzone.com>
- version 0.6.5
- BUG: services that have not been installed via apt would cause long loops
a lot of dpkg queries. Only query dpkg db once.
- BUG: Serviceconfig's Apply button doesn't work. It should actually be Close
(Malone #38582)
- BUG: Changing an user's password can change another password for a different
user (Malone bug #39444)
- BUG: Displayconfig would fail at startup on systems with an nVidia 7800 GTX.
(Malone bug #32915 for Rob Hughes)
- BUG: Serviceconfig would crash if the windows is closed quickly after
serviceconfig appears.
- BUG: userconfig would fail at startup if an entry in /etc/passwd refered to
a group that is not defined in /etc/group. (Malone bug #34311)
- BUG: Userconifg. Manually typing in or editing the list of secondary groups
for a user had no effect. (Malone bug #37212)
- BUG: Displayconfig fails to detect the presence of the proprietary ATI and
nVidia drivers. (The location of some of the driver files had been recently
changed).
- BUG: displayconfig-restore.py would calculated the needed DPI at login using
stale screen information which would sometimes result in the wrong DPI.
- BUG: Numerious small bugs and compatibility problems in mountconfig.
- BUG: When browsing for a SMB share, mountconfig now correctly catches the
authentication information entered by the user into the smaller popup from
kio.
- Displayconfig now assumes that dualhead/clone mode is supported if the
laptop-detect script detects a laptop.
- Displayconfig now uses the clone mode support in the i810 driver.
- Displayconfig now only offers resolutions that both monitors support when
using clone mode.
- Displayconfig now supports clone mode on any setup that also supports
xinerama.
- BUG: Mountconfig failed to take into account that the order of the
user/users, exec/noexc, suid/nosuid etc options in /etc/fstab is significant.
(thanks Christoph Wiesen)
- French translations added to the desktop files. (Anthony Mercatante)
* Sunday 2 April 2006 Simon Edwards <simon@simonzone.com>
- version 0.6.4
- BUG: All of the tools no longer write out config files under ~/.kde when
running as root. This should stop the annoying creation of config files
that can't be overwritten by the normal user.
- Userconfig is now by default not quite as tall. This should help stop
it from appearing too big in systemsettings.
- Displayconfig updated to also recognise late model nVidia chipsets.
- BUG: Displayconfig didn't support Clone mode for the proprietary nVidia
driver.
- BUG: The tools now correctly specify which translation catalogue to use for
translations.
- The screen images in the dualhead widget make better use of available widget
space.
- Displayconfig: The 40guidance-displayconfig_restore script which is used by
the Xsession script during login via KDM/xdm, has now been fixed to not stop
the login in case of failure.
- BUG: Displayconfig was getting confused by unknown graphics cards and
crashing. (Malone bug #32915)
- BUG: Displayconfig still can't handling unicode in xorg.conf. (Malone bug
#34437).
- BUG: Displayconfig is now more forgiving when xorg.conf contains characters
that are illegal with respect to the system character encoding. (Malone bug
#36590).
- BUG: Displayconfig would have trouble detecting hardware on the PCI bus on
big endian architectures. (raphink)
- BUG: Displayconfig did not correctly handle situations where the X RandR
extension is missing.
- BUG: Displayconfig would fail when loading some xorg.conf files containing
multiple graphics card specifications. (Malone bug #37275, patch applied)
- BUG: Userconfig didn't respect the entered UID when creating a account.
(Malone bug #37722).
- Displayconfig: Added 1280x960 modes (60 & 75Hz).
* Friday 17 March 2006 Simon Edwards <simon@simonzone.com>
- version 0.6.3
- BUG: userconfig and unixauthdb didn't respect the ownership of system files
when update /etc/passwd and friends. (Malone bug #26175).
- BUG: userconfig and unixauthdb would fail if /etc/passwd, /etc/groups or
/etc/shadow contained blank lines.
- BUG: displayconfig now does a better job of detecting graphics PCI devices
and handling non-detected graphics cards. Instead of crashing, "generic
VESA" is used when the type of card can't be found. (Malone bug #32915)
- The DPI that displayconfig-restore.py uses at login time can now be
controlled by adding a line to ~/.kde/share/config/displayconfigrc
in the [General] section. Add "dpi=xserver" to use the default DPI
from the X server, or "dpi=100" to use 100 DPI for example.
- BUG: Widescreen modes were missing in displayconfig.
- Displayconfig: Monitors can now be specified as being standard aspect ratio
or widescreen.
- BUG: Using the xresprobe command in displayconfig would crash some people's
machines. The much more safer ddcprobe command is now used.
(Malone bug #33943)
- BUG: A bug is displayconfig stopped monitor model detection. The xresprobe
command didn't actually return the eisa ID of the connected monitor.
ddcprobe does though (see above).
- BUG: Displayconfig. Changes to the monitor model or image format are
shown immediately on the "Size & Orientation" tab, even if the screen is
currently being used.
- BUG: When userconfig asks about whether the home directory should be created
when creating a new account, sometimes the wrong directory name was shown in
the dialog.
- BUG: Powerbook screen mode "1280x854" add to displayconfig. (Malone bug
#34383).
- BUG: Displayconfig would throw an exception if the current display didn't
support DPMS. (Malone bug #34316).
- BUG: Most utilities would fail if they came across UTF-8 or unicode
characters. (Malone bug #34194).
- BUG: Displayconfig wouldn't correctly detect the presence of installed
proprietary drivers. (OculusAquilae)
- BUG: Displayconfig had trouble handling BusID rows in xorg.conf. This would
cause the xorg.conf to be incorrectly read. (Tonio)
- Added some extra methods to ScanPCI.py to aid debugging.
- BUG: Displayconfig would not save the user's display settings when running
in kcontrol or systemsettings. (Malone bug #35257)
* Wednesday 1 March 2006 Simon Edwards <simon@simonzone.com>
- version 0.6.2
- BUG: Small bug in displayconfig that caused it to bug out around the
newCustomMonitor() method.
- BUG: userconfig had space character just before the she-bang which really
caused some trouble the for the shell.
- BUG: Displayconfig: Selecting the "Plug n Play" monitor directly without
clicking on "Detect" meant that only a very small set of resolutions would
be written to xorg.conf.
- BUG: The DPI calculations in displayconfig-restore.py where broken. This
resulted in the wrong DPI being used.
- BUG: Displayconfig: The clone mode option is now correctly disabled for
Matrox cards (mga driver).
- BUG: Displayconfig would bug out if the monitor model in the xorg.conf was
anything other than Plug n Play.
- BUG: Displayconfig would bug out if the DPMS Standby setting was 0 and DPMS
enabled.
- Displayconfig is now shown in kcontrol under settings/hardware instead of
settings/system.
- BUG: Small bug in displayconfig that will causes displayconfig to bug out
when trying to detect the monitor and no EDID info is available.
- BUG: Small cosmetic bug in displayconfig where the some tabs were missing
margins when shown in kcontrol/system settings.
- BUG: displayconfig would bug out when detecting ATI dualhead cards.
(pci_device.text was None).
* Monday 20 February 2006 Simon Edwards <simon@simonzone.com>
- version 0.6.1
- displayconfig-hwprobe.py now saves its scan info in
/var/lib/guidance/guidance-gfxhardware-snapshot.
- "Details..." button added to mountconfig in addition to the context menu for
opening the disk info dialog.
- BUG: serviceconfig: When starting and stopping daemons, the scripts expect a
terminal that understands colours. The command runner dialog doesn't, and
you end up seeing garbage characters. TERM is now set to vt100 when running
commands.
- BUG: displayconfig: Reset button didn't reset all of the parts/fields in the
GUI.
- Detect dualhead Matrox cards.
- displayconfig-restore.py now at login time also chooses and sets a 'sane'
DPI setting used by applications for fonts. More info is in the
displayconfig-restore.py source file.
- BUG: displayconfig-restore.py wasn't restoring the user's display resolution
at login.
- Plug N Play monitors are handled much better and are automatically probed
when neccessary.
* Tuesday 14 February 2006 Simon Edwards <simon@simonzone.com>
- version 0.6.0
- Right mousebutton action for most listviews.
- mountconfig can now handle multi-fs entries.
- i18n() all over the place.
- Dualhead support added to displayconfig.
- displayconfig's hardware database files updated from Mandriva.
- numerous bug fixes.
- displayconfig-hwprobe.py add. This is Ubuntu specific right now, but
what it does is detect hardware changes at boottime and automatically
run "dpkg-reconfigure" to generate a xorg.conf file that will get Xorg
running.
* Tuesday 29 November 2005 Simon Edwards <simon@simonzone.com>
- version 0.5.0
- displayconfig should now work for single head configurations.
- displayconfig has a shiney new preview.
- displayconfig is now usable on low resolution screens.
- DPMS tab cleaned up in displayconfig.
- displayconfig's hardware database files updated from Mandriva.
* Monday 12 September 2005 Simon Edwards <simon@simonzone.com>
- version 0.4.0
- displayconfig has been massively restructured internally.
- numerous bug fixes.
- start of dualhead support in displayconfig.
- When umount fails in mountconfig the option to killing blocking processes
has been added.
- better Debian support in serviceconfig. It now uses apt and dpkg to get
service descriptions.
- ext3 added to mountconfig. :)
- userconfig now respects /etc/useradd.conf
- Now uses PyKDE Extensions for building and installation.
http://www.simonzone.com/software/pykdeextensions/
- DPMS tab added to displayconfig.
* Tuesday 5 April 2005 Simon Edwards <simon@simonzone.com>
- version 0.3.0
- Displayconfig working and also feature complete.
- xf86config C module has been removed and replaced with pure Python.
- Numerous little bugs fixed in the userconfig, mountconfig and serviceconfig.
* Thursday 9 December 2004 Simon Edwards <simon@simonzone.com>
- version 0.2.0
- mountconfig added, beta quality, feature complete.
- displayconfig added, alpha quality, not feature complete.
- userconfig, beta quality, feature complete.
- serviceconfig, beta quality, feature complete.
* Thursday 20 November 2003 Simon Edwards <simon@simonzone.com>
- version 0.1.0
- Initial release.

@ -0,0 +1,21 @@
recursive-include kde *.png *.svg
recursive-include doc *.docbook *.png
graft package
prune package/.svn
graft package/mandrake
graft debian
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

@ -0,0 +1,15 @@
messagesold:
LIST=`find . -name \*.py`; \
if test -n "$$LIST"; then \
xgettext -ki18n -LPython $$LIST -o po/guidance.pot; \
fi
sh /usr/lib/kubuntu-desktop-i18n/findfiles LIST
perl /usr/lib/kubuntu-desktop-i18n/createdesktop.pl --file-list=LIST --base-dir=. > desktop.guidance.tmp
msguniq --to-code=UTF-8 --no-wrap -o desktop.guidance desktop.guidance.tmp 2>/dev/null
python /usr/lib/kubuntu-desktop-i18n/msgsplit desktop.guidance
mv desktop.guidance po/desktop_guidance.pot
rm -f desktop.guidance desktop.guidance.tmp
messages:
true

189
README

@ -0,0 +1,189 @@
!!! Warning: Read this through to the end. These tools can be dangerous. !!!
Guidance 0.8.0
~~~~~~~~~~~~~~
by Simon Edwards <simon@simonzone.com>, Sebastian Kügler <sebas@vizzzion.org>
& Yuriy Kozlov <yuriy.kozlov@gmail.com>, Martin Böhm <martin.bohm@kubuntu.org>
Introduction
------------
Guidance is a collection of system administration tools for Linux/KDE systems
that is designed to be:
* Update to date
* High quality, designed with user friendliness as high priority. (That is
to say that the tools should get the job done quickly, accurately and with
as little effort as possible.)
* Use KDE and "fit in" with KDE.
* Maintainable.
* Free Software
Warning
-------
These tools often require root access and modify important system files in
order to do their job. There is a very real chance that these tools can
destroy your computer and your data. Backup your data! Also especially
backup up /etc/passwd, /etc/shadow and /etc/fstab. If you don't know what
I'm talking about now then you probably shouldn't try using Guidance yet.
You should have some idea how to fix
We accept no responsibility in the event that something goes terribly wrong.
You have been warned.
Status
------
The tools that make up Guidance are in different stages of development and
have only been tested on Mandrake.
* userconfig - User & Group configuration. Supports /etc/passwd and
/etc/shadow right now.
* serviceconfig - System services configuration utility. Feature complete.
Works on Mandrake, Debian, (K)ubuntu Gentoo and maybe Red Hat out of the box.
* 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.
Requirements
------------
* Linux.
* Python. 2.4 recommended. You probably already have Python installed, and if
not then it will most definately be available for you distribution of choice.
* PyQt / PyKDE. Version 3.7 or higher. PyQt and PyKDE are distributed with
KDE as part of kde-bindings since version 3.3.
For versions of KDE before 3.3 it is possible to install PyQt/PyKDE
directly. The homepage for PyQt and PyKDE is:
http://www.riverbankcomputing.co.uk/pykde/index.php
Packages for most popular distributions are available here:
http://sourceforge.net/project/showfiles.php?group_id=61057
* KDE 3.
* "PyKDE Extensions" is needed for installation. It is available here:
http://www.simonzone.com/software/pykdeextensions/
This is also a runtime requirement!
* libpythonize. If you don't want the tools to appear on the KDE Control
Center of you just don't want to bother with libpythonize, then you can
build Guidance with this command:
python setup.py install build_kcm --no-kcontrol
libpythonize is only needed for the KDE Control Center.
* You also need to have the development files from your X-server installed,
XFree86 or Xorg. Most distributions package these files up in a package
called XFree86-devel, or Xorg-devel, or libxorg-X11-devel or some similar.
* Specifically, the following packages are needed on Kubuntu:
build-essential
python-sip4-dev
libxxf86vm-dev
libxrender-dev
libxrandr-dev
libpythonize0-dev
pyqt-tools
libtool
kde-devel
Installation
------------
As root run:
./setup.py install
This will test for a working installation of PyQt/PyKDE and automatically
install the files using the same installation prefix as KDE. 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 KDE Control Center in the
System section (displayconfig will show up in Peripherals). It is also possible
to run the commands outside of the KDE Control Center from the shell as root:
* serviceconfig
* userconfig
* mountconfig
* displayconfig
* wineconfig
* grubconfig
Reporting Bugs
--------------
Bug reports and feedback can be sent to simon@simonzone.com . Do make sure
that say which version of Guidance you are using and also what Linux
distribution you are using, and also how you installed SIP, PyQt, PyKDE. Also
if any error messages are printing to the console, email those too. By
running these tools from the command line you can often get useful (to me)
debug information. That kind of information is valuable.
Deinstallation
--------------
As root run:
./setup.py uninstall
Thanks go to
------------
Jim Bublitz
David Boddie
Sebastian Kügler
Theo Houtman
Pete Andrews (gamma correction system)
--
Simon Edwards
<simon@simonzone.com>

@ -0,0 +1,48 @@
Intro
~~~~~
In this file I want to try to explain some practical things about Guidance
the "project" and some basic (and hopefully not too heavy) policies about how
things work organisationally.
-- 11 Feb 2007, Simon Edwards <simon@simonzone.com>
Developers
~~~~~~~~~~
The list of developers as of 11 Feb 2007:
Simon Edwards <simon@simonzone.com>, SVN username: sedwards, IRC: sime (unregistered)
Sebastian Kügler <sebas@kde.nl>, SVN username: sebas, IRC: sebas
Yuriy Kozlov <yuriy.kozlov@gmail.com>, SVN username: ykozlov, IRC: yuriy
Martin Böhm <martin.bohm@kubuntu.org>, SVN username: martinbohm, IRC: ???
"Lure" on #kubuntu-devel will join this list whether he likes it or not if he keeps
on committing stuff to powermanager. ;-)
Subversion
~~~~~~~~~~
Main development occurs in KDE's subversion repository in
/trunk/kdereview/guidance. Branches of the stable releases can be found
in svn under /kde/branches/guidance/. 0.6 was used in the Kubuntu Dapper, 0.7
was in Edgy.
Python source code
~~~~~~~~~~~~~~~~~~
Use 4 spaces for indentation, for the simple reason that it is very common
and mixing indentation styles is a PITA.
I (Simon) use Qt/KDE style naming conventions for methods. For variable
names I'm a bit inconsistent but it is usually lower case of lower case
with underscores. All I ask is that variable names be descriptive and
understandable.
TIP: When dealing with translated strings, use uncide() and not str(),
otherwise things will break on translated desktops.
Release procedure
~~~~~~~~~~~~~~~~~
[TODO: explain how a release tarball is created.]

294
TODO

@ -0,0 +1,294 @@
TODO
====
BUG: Mountconfig has no "enable/disable" in the context menu.
BUG: Mountconfig: "enable/disable" can sometime be available for normal users.
BUG: mountconfig: The disk details dialog (sizeview.py) doesn't show *unpartioned* free space.
BUG: Live gamma changes didn't seem to work on one of the S3s.
BUG: mountconfig. Authentication details in the SMSShareSelectDialog are sometimes not
correctly used when browsing.
TODO: Some S3 cards need to have the video ram specified, and some later model don't.
It would be good if we could tell the difference and only offer the ram pulldown
when strictly needed.
TODO: Monitor type selection (CRT, lcd etc). needed for clone mode on ATI at least.
TODO: When using the proprietary nVidia driver, choose between the nVidia AGP
and kernel agpgart based on what is best the of the machine's chipset.
TODO: The proprietary ATI drivers have a 'Option "BusType" "PCI"' thing which may
of may not need to be set for PCI based ATI cards.
TODO: 3D accel on the 9250 with open source drivers.
Future TODO
===========
setup.py
~~~~~~~~
.
userconfig
~~~~~~~~~~
.
unixauthdb.py
~~~~~~~~~~~~~
* LDAP (post-1.0) in-progress
* (others?) (post-1.0)
serviceconfig
~~~~~~~~~~~~~
* Change os.system() to the calls Simon uses in some cases.
* Some services are running, but not in /var/run, implement special treatment. :>
* Remove commented line from /etc/shells in userconfig -> Modify -> Shell.
mountconfig
~~~~~~~~~~~
* Add 'proper' GUIs for editing some of the more common FS types.
- NFS.
* AttributeError when mounting Samba volume
* Handle the 'managed' mount entry options. See http://www.die.net/doc/linux/man/man8/fstab-sync.8.html
This is stand on Mandriva 2005.
* Implement "real" HAL backend.
displayconfig
~~~~~~~~~~~~~
* Use HAL for fetching PCI and card info? alongside existing systems (ldetect)?
Extra?
~~~~~~
* Swap/kernel config:
http://kerneltrap.org/node/view/3000
"To tune, simply echo a value from 0 to 100 onto /proc/sys/vm/swappiness."
* Hardware detection info:
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=lyit5wc14g.fsf%40leia.mandrakesoft.com&rnum=1&prev=/groups%3Fq%3Ddebian%2520ldetect%2520hardware%2520detection%26hl%3Den%26lr%3D%26ie%3DUTF-8%26sa%3DN%26tab%3Dwg
----------------------------------------------------------------------------
From: Pixel (pixel@mandrakesoft.com)
Subject: Re: Why so many HW detection packages?
Newsgroups: linux.debian.devel
Date: 2002-05-09 17:20:07 PST
On Fre, 26 Apr 2002, Petter Reinholdtsen wrote:
[...]
> The reson is that there are 3 hardware detection system:
> - Mandrake (libdetect, old)
truly libdetect is old and deprecated
(harddrake (was lothar) used to use it)
we (mandrake) are now mostly using ldetect & ldetect-lst
AFAIK here are the various free software hardware databases:
--------------------------------------------------------------------------------
- pci ----------
- pci.ids (in pciutils)
maps vendor+device -> description
and vendor+device+subvendor+subdevice -> description
also has device classes names
- modules.pcimap (in kernel /lib/modules/2.4*/)
maps vendor+device -> module
and vendor+device+subvendor+subdevice -> module
- XFree's xf86PciInfo.h (in XFree's source: xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h)
maps vendor+device -> description
- RedHat's pcitable (in hwdata)
maps vendor+device -> module+description
and a few vendor+device+subvendor+subdevice -> module+description
when needed
module can also be "Card:xxxx" for XFree (using Cards, see below)
- Mandrake's pcitable (in ldetect-lst)
same format as RedHat's (except for a few syntactical changes since mandrake kept old RedHat's format)
module can also be
"Card:xxxx" for XFree (using Cards+, see below)
"Server:xxxx" for XFree3
"ISDN:xxxx" for hisax special parameters
"Bad:xxxx" for warning about unhandled devices (mainly winmodems)
- Mandrake old detect's pci.lst (in detect-lst)
maps vendor+device -> class+module+description
- Progeny's pci.lst (in discover-data)
same format as detect
maps vendor+device -> class+module+description
module can also be
"Server:XFree86(module)" for XFree4
"Server:XF86_xxx" for XFree3
some comments:
- the "class" in pci.lst is not useful when "module" is given since
from the module name, one can have the "class"
- the subvendor+subdevice distinction is sometimes useful
(not very often though)
- hopefully one day modules.pcimap will be the reference :)
(except for XFree of course)
tools using those databases:
- kudzu and anaconda are using pcitable from hwdata
- library ldetect accesses pcitable from ldetect-lst,
this library is used by DrakX and drakxtools.
Mandrake's patched kudzu uses pcitable from ldetect-lst
- discover uses pci.ids from discover-data
- i don't know if tools are using modules.pcimap
- XFree --------------------
- XFree comes with Cards
- Redhat has its own version (in hwdata)
- Mandrake has its own version Cards+ & CardsNames (in ldetect-lst)
(mainly a merge of XF3 Cards and XF4 Cards)
- discover doesn't need it since it's precising the server name
(XF3) or the module name (XF4) (?)
this is usually enough (except if you want to propose the choice,
but who wants XF3 nowadays :)
- usb --------------------
- usbutils's usb.ids
maps vendor+device -> description
also has device classes names and some more stuff
- modules.usbmap (in kernel /lib/modules/2.4*/)
maps vendor+device -> module (?)
- Mandrake's usbtable (in ldetect-lst)
maps vendor+device -> module+description
module can also be
"Mouse:xxxx" for mouse configuration (fed to mousedrake)
"Tablet:wacom" for wacom tablet configuration
"Flag:xxxx" for DrakX package choosing
"Floppy:normal"
- Progeny's usb.lst (in discover-data)
maps vendor+device -> class+module+description
(but current's version only have module=unknown, so what's it
for, why not usb.ids?)
tools using those databases:
- library ldetect accesses usbtable from ldetect-lst
this library is used by DrakX and drakxtools
- i don't know if tools are using modules.usbmap
- scanner --------------------
- ScannerDB (in ldetect-lst)
maps name -> driver+kind(usb,scsi,serial,parallel)+options+various
(i don't know much about it, i don't know if yves made it from
scratch or what. ask yduret@mandrakesoft.com for more)
- isdn --------------------
- isdn.db (in ldetect-lst)
list of internet providers by country
-> phone number + domainname + dns1 (ip) + dns2
- old or small databases ----------
- isa.lst (detect), isatable (ldetect-lst), modules.isapnpmap (kernel)
- pcmcia.lst (detect, discover-data), pcmciatable (ldetect-lst)
- modules.parportmap (kernel but empty?)
- modules.ieee1394map (kernel but empty?)
--------------------------------------------------------------------------------
There may be some errors, or some missing stuff, please correct me!
I've written a tool to keep in sync with as many databases as
possible. see merge2pcitable.pl in
http://www.mandrakelinux.com/cgi-bin/cvsweb.cgi/soft/ldetect-lst/convert/
Maybe some common mailing list could be set up to deal with this?
*but* note that the database is quite kernel dependent.
- our pcitable doesn't handle this nicely
- redhat has "upgradelist" in hwdata to partly handle this
- i know we handle some pbs via /lib/modutils/macros with things like
"if `kernelversion` = 2.4", debian seems to have it in
/etc/modutils/arch
Once again, hopefully one day modules.pcimap and modules.usbmap will
be the reference! :)
[...]
> Mandrake switched from libdetect to kudzu, afaik
> (latest mandrake (8.2) version is using kudzu for HW detection).
well, mandrake has many tools doing more or less the same thing (and
alas, not exactly always the same thing): DrakX (during install),
drakxtools (when called, after install), kudzu (at boot, usually
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/
----------------------------------------------------------------------------

@ -0,0 +1,135 @@
* How many cards do we have? autodetection?
* Is our card a dualhead card?
* How many monitors are connected?
* difference between one and two card is different device sections
* twinview has one device, one screen, one serverlayout
* xinerama has two devices, two screens, two monitors
twinview <> xinerama:
all sections double
one or two cards:
different device sections
one or two monitors
?? one or two cards
?? twinview or xinerama (driver? different resolutions?)
class XSetup(Object):
Screens[] getScreens()
bool maySetDualhead()
getUseDualhead()
setUseDualhead(bool)
(xoff,yoff) getDualheadPosition() # offset from screen 1 top left corner.
setDualheadOrientation(xoff,yoff)
bool is3DAccelerated()
GFXCard[] getGFXCards()
class Screen(Object):
maySetResolution()
Resolution[] getAvailableResolutions()
getResolution()
setResolution(Resolution)
maySetRefresh()
int getRefreshRate()
setRefreshRate(int)
maySetRotation()
getRotation()
getAvailableRotations()
setRotation()
bool isAvailableMirrorHorizontal()
getMirrorHorizontal()
setMirrorHorizontal()
bool isAvailableMirrorVertical()
getMirrorVertical()
setMirrorVertical()
class Resolution(Object):
int getWidth()
int getHeight()
int[] getRefreshRates():
* What is the current setup? (Xinerama? Singlehead? Twinview?)
- Warning: Xinerama vs. DRI
* "unlinking" the sliders will yield a warning "Using different
resolutions on the screens will disable 3D hardware acceleration on
the second head", which is a Xinerama deficiency).
Note: Probably only Ati and nvidia do support mergedFB properly, other
drivers might lose xinerama features like placement and maximize
- Drag and drop widget
* The fun part: implementing a Drag and Drop widget where the (resizing)
screens can be dragged into their respective relative position,
"snapping" in the more obvious ones, i.e. plain "left of" and "right
of", "above" and "under" (without offset).
- displayconfig.MonitorPreview:
Singleheadpreview: Monitor keeps size
DualheadPreview: like now, monitor resizes to show relative screen size
Displayconfig; Notes abstractielaag
-------------------------------------
* een XSetup heeft N gfxcards.
* een GfxCard heeft N Monitors
* XSetup is een container voor alle objecten uit de abstractielaag.
* XSetup.addMonitor(monitor,gfxcard) waarbij gfxcard al in XSetup zit en een
referentie naar de kaart vormt waarop monitor is aangesloten.
* Een Adaptor heeft een 1:1 relatie met een monitor, en is 'onderdeel' van
een "Screen" (in de zin van Screen section uit xorg.conf)
* Controls zoals resize en de rotatie / mirroring widgets manipuleren een
Adaptor, die intern de Screen manipuleert
* Singlehead resolutie verandert via xrandr en slaat settings op via
displayconfig-restore.py
* Dualhead resolutie aanpassen pakt intern een passende metamode (bij twinview)
en checkt of alle zinvolle metamodes beschikbaar zijn, anders wordt de user
gewaarschuwd dat dit eerst moet gebeuren.
* Adaptor in dualhead / twinview modus worden dus naar een screen vertaald
metamodes heeft.
* Screen moet dan nog support voor metamodes krijgen.
displayconfig:
===============
* Current resolution doesn't get recognized if current != highest resolution
* new tab display powermanagement, just like the existing tab, we need to be
able to at least replace existing functionality
New Widgets:
-------------
* DualheadPreview
* RadioButtons instead of dropdown for Positioning
* Detect if we're already running on dualhead, (en|dis)able widgets accordingly
* Nvidia MergedFB
- Make preview of dualhead more clear (only xinerama or also mergedFB?)
- Generate list of Metamodes from resolutions available
- write dualhead settings to xorg.conf
* Compare dualhead with different drivers WRT xorg.conf
- generic Xinerama (Matrox, others?)
- dualhead for fglrx, SiS ...
- MergedFB as special case for nvidia (sis?)
* Preview should be rotatable (and|or) resizable (and|or) DualHeadpreview?
* Add missing elements to DualHeadTab
- [ ] Use MergedFB (binds two resolution sliders)
- label with warning "You can only use DRI on one head with different resolutions blahblah"
FIXME: enabling Dualhead should:
- Update resolutions with "metamodes"
- disable Rotation/mirroring stuff
- Add ServerLayout to xorg.conf
- Add second Screen to xorg.conf
- Alternatively (if both resolutions are the same enable MergedFB

@ -0,0 +1,11 @@
# 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/kde3/bin/displayconfig-restore || true

@ -0,0 +1,340 @@
###########################################################################
# 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/kde3/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()

@ -0,0 +1,132 @@
#!/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()

@ -0,0 +1,324 @@
#!/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("kde-config",['kde-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 kdm 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 kdm, 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()

@ -0,0 +1,49 @@
[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-KDE-ModuleType=Library
X-KDE-Library=displayconfig
X-KDE-FactoryName=displayconfig
X-KDE-RootOnly=true
Type=Application
Exec=kcmshell Peripherals/displayconfig
Categories=Qt;KDE;X-KDE-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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,741 @@
# -*- 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",
"e3 c #dedddc",
"fT c #dedede",
"ci c #dedfe2",
"dq c #dee1e7",
"de c #dee2e8",
"bD c #dfdedc",
"eH c #dfdfdf",
"bV c #dfe1e4",
"e2 c #e0dfdd",
"bC c #e0e2e5",
"bj c #e1e0df",
"eG c #e1e1e1",
"a0 c #e1e3e6",
"aD c #e1e3e7",
"e1 c #e2e1e0",
"eF c #e2e2e2",
"a1 c #e3e2e1",
"eE c #e3e3e3",
"e0 c #e4e2e3",
"aE c #e4e3e1",
"fS c #e4e4e4",
"fR c #e5e5e5",
"eZ c #e6e5e5",
"eD c #e6e6e6",
"fF c #e7e7e7",
"eY c #e8e7e7",
"eC c #e8e8e8",
"eX c #e9e9e8",
"eB c #e9eaea",
"d3 c #e9ecef",
".p c #eaeaea",
"ad c #eaebef",
"eA c #ebebeb",
"eW c #ecebea",
"fP c #ececec",
"ez c #ededec",
"fW c #ededed",
"f2 c #eeeeee",
"ey c #efeeef",
"f1 c #efefef",
"ex c #f0f0f0",
"#R c #f0f2f6",
"ae c #f1f0ef",
".m c #f1f1f1",
"ew c #f1f2f2",
"fL c #f2f2f2",
"fG c #f3f3f3",
"#r c #f3f5f8",
"ev c #f4f3f3",
"eV c #f4f4f3",
".3 c #f4f4f4",
"et c #f4f6f8",
".C c #f5f5f5",
"eU c #f6f6f4",
"#t c #f6f6f6",
"eu c #f6f7f8",
"fV c #f7f7f7",
"ah c #f8f8f8",
".0 c #f8f9fa",
"eT c #f9f7f7",
"aH c #f9f9f9",
"fK c #fafafa",
"eS c #fbfafa",
"a5 c #fbfbfb",
"bl c #fcfcfc",
"es c #fdfdfc",
".k c #fdfdfd",
".y c #fefefe",
".x c #fffcf8",
".w c #fffcf9",
".v c #fffdf9",
".u c #fffef9",
".t c #fffefa",
"#S c #fffefd",
".s c #fffffa",
".r c #fffffc",
".q c #fffffd",
".l c #ffffff",
"Qt.#.a.b.c.c.c.c.c.c.c.c.c.d.d.d.d.d.d.d.d.d.e.e.e.f.f.f.e.g.hQt",
".i.j.k.l.l.l.l.l.l.l.l.l.l.l.l.l.l.l.l.l.l.l.l.l.l.l.l.l.l.m.n.i",
".o.p.l.l.q.r.s.s.s.t.u.v.v.w.x.x.x.v.v.v.v.u.u.u.u.u.s.r.y.l.z.A",
".B.C.l.D.E.F.G.H.I.J.K.L.M.N.O.P.O.N.Q.R.S.T.U.V.W.X.Y.Z.0.l.1.2",
".B.3.l.4.5.6.7.8.9#.###a#b#c#d#e#f#g#h#i#j#k#l#m#n#o#p#q#r.l#s.2",
".B#t.l#u#v#w#x#y#z#A#B#C#D#E#F#G#H#E#I#J#B#K#L#M#N#O#P#Q#R#S#s.2",
"#T#t.l#U#V#W#X#Y#Z#0#1#B#2#3#4#4#5#6#7#8#A#9#ya.a#aaabacadaeafag",
"#Tah.laiajak#Oal#Yamanaoapaqararas#8atauavawaxayazaAaBaCaDaEaFag",
"aGaH.laIaJaKaLaMaNaOaPaQanaRauauauaR#zaSaTaUaVazaWaXaYaZa0a1a2a3",
"a4a5.la6a7a8a9b.aza#b##Y#M#y#Z#Z#Zbabbbc#NbdbebfaXbgbhbia0bja2a3",
"bkbl.lbmbnbobpbqbraabsa#bt#N#x#x#x#NaNbubvaLbwbxbybzbAbBbCbDa2a3",
"bkbl.lbEbFbGbHbIbJbKbwbLbMbNbsbsbvazbOb.bwbPbQbRbSbTbUbBbVbWa2bX",
"bY.k.lbZb0b1b2b3b4b5b6b7b8aXb9c.c.c#bqcacbcccdcecfcgchbBcicja2bX",
"bY.y.lckclcmcnb5cocpcqcrcsctcucuctcacvcwcpcocxcyb3czcAbBcBcCa2cD",
"bY.l.lcEcFcGcHcIbycJcKcLcMbfcNcNbfcMaXbqcObQcpcPcQcRcScTcUcVa2cD",
"cW.l.lcXcYcZc0c1b8c2c3bMaMc4c5c5c4aMc6b.a9c7c1c8c9d.d#dadbdca2cD",
"dd.l.ldedfdgcac#bfbec4dh#xdidjdjdiaUdhbdazbrbPcJcbc9dkdldmdndodp",
"dd.l.ldqdrdsaKdtbv#XaxaTamdudvdwaQdxaTaxdy#OdzbPcJc0dAdBdCdDa2dp",
"dE.l.ldFdGdHdIdJdKdLdMdNdOdPdQdQdP.9dRdSdTdUdVdIdWdXdYdZd0d1a2dp",
"d2.l.ld3d4d5d6d7d8d9e.e#eaebececedeeefe.d9egeheiejekelemeneoepeq",
"er.leseteu#tevewexeyezeAeBeCeDeEeFeGeHeIeJeKeLeMeN#seOeP.zeQa2.#",
"eRaf.l.yeseSeTeUeVaeeWeXeYeZe0e1e2e3e4e5e6cCcCe7e8e9f.f#.zeJfa.i",
"Qtfbfc#sdoa2epfdeQfeff.1#sfgePafdoa2epaFaFfhfifjfkflfjfmfn.jag.i",
"Qt.i.ifofofpfqfqfrfsfeftepfdfeeQfufvfwfxfxfyfzfA.ifBfCfCfC.i.iQt",
"QtQtQtQtQtQtfzfDfEeAfteDeAeCeCeCfFfFeCeAffeDfGfifHfIQtQtQtQtQtQt",
"QtQtQtQtQtfJfg.l.l.l.meJeA.CaHaHfKahfLfM.1aH.l.l.lfNfCQtQtQtQtQt",
"QtQtQtQtQtfO.l.ka5aH#tfPfQeHfReDfSeIaffda2fTbla5.l.lfUQtQtQtQtQt",
"QtQtQtQtQtfHfVfVfLfL.mfW.peEeIeJfXfYeJeHfF.mfLfLfKfPfZQtQtQtQtQt",
"QtQtQtQtQtfBf0eFf1f1fP.p.p.p.p.p.p.peAfPfPfWf1f2f3f4.iQtQtQtQtQt",
"QtQtQtQtQtQt.if5f6fkfYeFeEeEfSfSfSfSeEeEeFf7f8f9g..i.iQtQtQtQtQt",
"QtQtQtQtQtQtQt.i.i.2g#.gga.fgbgcgcgdgegfgggh.A.i.iQtQtQtQtQtQtQt",
"QtQtQtQtQtQtQtQtQtQt.i.i.ifqfofpfpfofq.i.i.i.iQtQtQtQtQtQtQtQtQt"
]
class Form1(QDialog):
def __init__(self,parent = None,name = None,modal = 0,fl = 0):
QDialog.__init__(self,parent,name,modal,fl)
self.image0 = QPixmap(image0_data)
if not name:
self.setName("Form1")
self.groupBox3 = QGroupBox(self,"groupBox3")
self.groupBox3.setGeometry(QRect(10,320,680,133))
self.groupBox3.setColumnLayout(0,Qt.Vertical)
self.groupBox3.layout().setSpacing(6)
self.groupBox3.layout().setMargin(11)
groupBox3Layout = QHBoxLayout(self.groupBox3.layout())
groupBox3Layout.setAlignment(Qt.AlignTop)
layout92 = QGridLayout(None,1,1,0,6,"layout92")
self.textLabel2_4 = QLabel(self.groupBox3,"textLabel2_4")
layout92.addWidget(self.textLabel2_4,0,1)
self.textLabel5 = QLabel(self.groupBox3,"textLabel5")
layout92.addWidget(self.textLabel5,1,2)
self.textLabel1_4 = QLabel(self.groupBox3,"textLabel1_4")
self.textLabel1_4.setAlignment(QLabel.WordBreak | QLabel.AlignVCenter)
layout92.addMultiCellWidget(self.textLabel1_4,2,2,0,3)
self.comboBox4 = QComboBox(0,self.groupBox3,"comboBox4")
layout92.addWidget(self.comboBox4,1,3)
self.comboBox2 = QComboBox(0,self.groupBox3,"comboBox2")
layout92.addWidget(self.comboBox2,0,3)
self.textLabel3 = QLabel(self.groupBox3,"textLabel3")
layout92.addWidget(self.textLabel3,0,0)
self.kPushButton1 = KPushButton(self.groupBox3,"kPushButton1")
layout92.addMultiCellWidget(self.kPushButton1,1,1,0,1)
self.textLabel4 = QLabel(self.groupBox3,"textLabel4")
layout92.addWidget(self.textLabel4,0,2)
groupBox3Layout.addLayout(layout92)
self.groupBox1 = QGroupBox(self,"groupBox1")
self.groupBox1.setGeometry(QRect(10,10,320,300))
self.groupBox1.setSizePolicy(QSizePolicy(7,1,0,0,self.groupBox1.sizePolicy().hasHeightForWidth()))
self.pixmapLabel1 = QLabel(self.groupBox1,"pixmapLabel1")
self.pixmapLabel1.setGeometry(QRect(11,33,16,17))
self.pixmapLabel1.setSizePolicy(QSizePolicy(0,0,0,0,self.pixmapLabel1.sizePolicy().hasHeightForWidth()))
self.pixmapLabel1.setScaledContents(1)
self.textLabel2 = QLabel(self.groupBox1,"textLabel2")
self.textLabel2.setGeometry(QRect(19,45,60,17))
self.textLabel2.setSizePolicy(QSizePolicy(1,1,0,0,self.textLabel2.sizePolicy().hasHeightForWidth()))
self.textLabel2_3 = QLabel(self.groupBox1,"textLabel2_3")
self.textLabel2_3.setGeometry(QRect(85,45,213,17))
self.textLabel2_3.setSizePolicy(QSizePolicy(3,1,0,0,self.textLabel2_3.sizePolicy().hasHeightForWidth()))
self.textLabel1_3 = QLabel(self.groupBox1,"textLabel1_3")
self.textLabel1_3.setGeometry(QRect(80,20,213,17))
self.textLabel1_3.setSizePolicy(QSizePolicy(3,1,0,0,self.textLabel1_3.sizePolicy().hasHeightForWidth()))
self.textLabel1 = QLabel(self.groupBox1,"textLabel1")
self.textLabel1.setGeometry(QRect(19,22,60,17))
self.textLabel1.setSizePolicy(QSizePolicy(1,1,0,0,self.textLabel1.sizePolicy().hasHeightForWidth()))
self.pushButton2 = QPushButton(self.groupBox1,"pushButton2")
self.pushButton2.setGeometry(QRect(160,70,144,26))
self.pushButton2.setSizePolicy(QSizePolicy(5,1,0,0,self.pushButton2.sizePolicy().hasHeightForWidth()))
self.groupBox2 = QGroupBox(self,"groupBox2")
self.groupBox2.setGeometry(QRect(350,10,348,300))
self.groupBox2.setSizePolicy(QSizePolicy(5,1,0,0,self.groupBox2.sizePolicy().hasHeightForWidth()))
LayoutWidget = QWidget(self.groupBox2,"layout11")
LayoutWidget.setGeometry(QRect(12,24,324,44))
layout11 = QHBoxLayout(LayoutWidget,11,6,"layout11")
self.pixmapLabel3 = QLabel(LayoutWidget,"pixmapLabel3")
self.pixmapLabel3.setSizePolicy(QSizePolicy(0,0,0,0,self.pixmapLabel3.sizePolicy().hasHeightForWidth()))
self.pixmapLabel3.setPixmap(self.image0)
self.pixmapLabel3.setScaledContents(1)
layout11.addWidget(self.pixmapLabel3)
layout10 = QGridLayout(None,1,1,0,6,"layout10")
self.textLabel2_2_2 = QLabel(LayoutWidget,"textLabel2_2_2")
self.textLabel2_2_2.setSizePolicy(QSizePolicy(3,1,0,0,self.textLabel2_2_2.sizePolicy().hasHeightForWidth()))
layout10.addWidget(self.textLabel2_2_2,1,1)
self.textLabel1_2_2 = QLabel(LayoutWidget,"textLabel1_2_2")
self.textLabel1_2_2.setSizePolicy(QSizePolicy(4,1,0,0,self.textLabel1_2_2.sizePolicy().hasHeightForWidth()))
layout10.addWidget(self.textLabel1_2_2,0,1)
self.textLabel1_2 = QLabel(LayoutWidget,"textLabel1_2")
self.textLabel1_2.setSizePolicy(QSizePolicy(1,1,0,0,self.textLabel1_2.sizePolicy().hasHeightForWidth()))
layout10.addWidget(self.textLabel1_2,0,0)
self.textLabel2_2 = QLabel(LayoutWidget,"textLabel2_2")
self.textLabel2_2.setSizePolicy(QSizePolicy(1,1,0,0,self.textLabel2_2.sizePolicy().hasHeightForWidth()))
layout10.addWidget(self.textLabel2_2,1,0)
layout11.addLayout(layout10)
self.pushButton2_2 = QPushButton(self.groupBox2,"pushButton2_2")
self.pushButton2_2.setGeometry(QRect(180,70,158,26))
self.pushButton2_2.setSizePolicy(QSizePolicy(5,1,0,0,self.pushButton2_2.sizePolicy().hasHeightForWidth()))
self.languageChange()
self.resize(QSize(702,472).expandedTo(self.minimumSizeHint()))
self.clearWState(Qt.WState_Polished)
def languageChange(self):
self.setCaption(self.__tr("Form1"))
self.groupBox3.setTitle(self.__tr("Default Display Settings"))
self.textLabel2_4.setText(self.__tr("1280x1024 @ 60Hz"))
self.textLabel5.setText(self.__tr("DPI:"))
self.textLabel1_4.setText(self.__tr("These settings are defaults. Each user of this computer may specify their own personal settings."))
self.comboBox4.clear()
self.comboBox4.insertItem(self.__tr("75 DPI (small fonts)"))
self.comboBox4.insertItem(self.__tr("100 DPI (large fonts)"))
self.comboBox4.insertItem(self.__tr("Auto (84 DPI)"))
self.comboBox2.clear()
self.comboBox2.insertItem(self.__tr("Millions (24bit)"))
self.textLabel3.setText(self.__tr("Screen size:"))
self.kPushButton1.setText(self.__tr("Use current settings as system default"))
self.textLabel4.setText(self.__tr("Colors:"))
self.groupBox1.setTitle(self.__tr("Graphics Card"))
self.textLabel2.setText(self.__tr("Memory:"))
self.textLabel2_3.setText(self.__tr("32 Mb"))
self.textLabel1_3.setText(self.__tr("GeForce 2"))
self.textLabel1.setText(self.__tr("Name:"))
self.pushButton2.setText(self.__tr("Configure..."))
self.groupBox2.setTitle(self.__tr("Monitor"))
self.textLabel2_2_2.setText(self.__tr("1600x1200 @ 60Hz"))
self.textLabel1_2_2.setText(self.__tr("Philips 107S"))
self.textLabel1_2.setText(self.__tr("Name:"))
self.textLabel2_2.setText(self.__tr("Max. Resolution:"))
self.pushButton2_2.setText(self.__tr("Configure..."))
def __tr(self,s,c = None):
return qApp.translate("Form1",s,c)
if __name__ == "__main__":
a = QApplication(sys.argv)
QObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()"))
w = Form1()
a.setMainWidget(w)
w.show()
a.exec_loop()

@ -0,0 +1,809 @@
from qt import *
from kdecore import *
from kdeui import *
import os
from displayconfigabstraction import *
# Running as the root user or not?
isroot = os.getuid()==0
############################################################################
class ResizeSlider(QVGroupBox):
""" An abstracted QSlider in a nice box to change the resolution of a screen """
def __init__(self,parent):
# Screen size group
QVGroupBox.__init__(self,parent)
self.updating_gui = True
self._buildGUI()
self.updating_gui = False
def _buildGUI(self):
self.setTitle(i18n("Screen Size"))
self.setInsideSpacing(KDialog.spacingHint())
self.setInsideMargin(KDialog.marginHint())
hbox3 = QHBox(self)
hbox3.setSpacing(KDialog.spacingHint())
label = QLabel(hbox3,"textLabel2_4")
label.setText(i18n("Lower"))
self.screensizeslider = QSlider(hbox3,"slider1")
self.screensizeslider.setMinValue(0)
self.screensizeslider.setMaxValue(4)
self.screensizeslider.setPageStep(1)
self.screensizeslider.setOrientation(QSlider.Horizontal)
self.screensizeslider.setTickmarks(QSlider.Below)
self.connect(self.screensizeslider,SIGNAL("valueChanged(int)"),self.slotResolutionChange)
label = QLabel(hbox3)
label.setText(i18n("Higher"))
self.resolutionlabel = QLabel(self)
self.resolutionlabel.setText("640x400")
def setScreen(self, screen):
self.updating_gui = True
self.screen = screen
self.screensizeslider.setMaxValue(len(screen.getAvailableResolutions())-1)
self.screensizeslider.setValue(screen.getResolutionIndex())
self.updating_gui = False
self.setResolutionIndex(screen.getResolutionIndex())
def slotResolutionChange(self,i):
""" Pass signal from slider through to App """
if self.updating_gui:
return
self.setResolutionIndex(i)
self.emit(PYSIGNAL("resolutionChange(int)"),(i,))
def setMaxValue(self,value):
self.updating_gui = True
self.screensizeslider.setMaxValue(value)
self.updating_gui = False
def setMinValue(self,value):
self.updating_gui = True
self.screensizeslider.setMinValue(value)
self.updating_gui = False
def setValue(self,value):
self.updating_gui = True
self.screensizeslider.setValue(value)
self.updating_gui = False
def value(self):
return self.screensizeslider.value()
def setResolutionLabel(self,text):
self.resolutionlabel.setText(text)
def setResolutionIndex(self,i):
self.updating_gui = True
width,height = self.screen.getAvailableResolutions()[i]
self.setResolutionLabel(i18n("%1 x %2").arg(width).arg(height))
self.updating_gui = False
############################################################################
class MonitorPreview(QWidget):
""" A ResizableMonitor is an Image in a grid which has resizable edges,
fixed-size corners and is thus expandable. """
ROTATE_0 = 0
ROTATE_90 = 1
ROTATE_180 = 2
ROTATE_270 = 3
def __init__(self, parent=None, imagedir="", name=None):
QWidget.__init__(self,parent)
self.rotation = MonitorPreview.ROTATE_0
self.screen_width = 1280
self.screen_height = 1024
self.reflect_x = False
self.reflect_y = False
self.setBackgroundMode(Qt.NoBackground)
self.imagedir = imagedir + "monitor_resizable/"
self.image_monitor = QPixmap(self.imagedir+"monitor.png")
self.image_monitor_wide = QPixmap(self.imagedir+"monitor_wide.png")
self.image_monitor_r90 = QPixmap(self.imagedir+"monitor_r90.png")
self.image_monitor_wide_r90 = QPixmap(self.imagedir+"monitor_wide_r90.png")
self.image_background = QPixmap(self.imagedir+"background.png")
self.image_background_wide = QPixmap(self.imagedir+"background_wide.png")
self.image_background_r90 = QPixmap(self.imagedir+"background_r90.png")
self.image_background_wide_r90 = QPixmap(self.imagedir+"background_wide_r90.png")
self.image_window = QPixmap(self.imagedir+"window_4th.png")
self.image_window_bottom_left = QPixmap(self.imagedir+"window_bottom_left_4th.png")
self.image_window_bottom_right = QPixmap(self.imagedir+"window_bottom_right_4th.png")
def sizeHint(self):
max_width = max(self.image_monitor.width(), self.image_monitor_wide.width(),
self.image_monitor_r90.width(), self.image_monitor_wide_r90.width())
max_height = max(self.image_monitor.height(), self.image_monitor_wide.height(),
self.image_monitor_r90.height(), self.image_monitor_wide_r90.height())
return QSize(max_width, max_height)
def sizePolicy(self):
return QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
def paintEvent(self,paint_event):
screen_width = self.screen_width
screen_height = self.screen_height
# Widescreen format: preview width: 176, height: 99, 16:9
is_wide = abs(float(screen_width)/float(screen_height)-16.0/9.0) < 0.2
if not is_wide:
preview_screen_width = 152
preview_screen_height = 114
else:
preview_screen_width = 176
preview_screen_height = 99
if self.rotation==MonitorPreview.ROTATE_0 or self.rotation==MonitorPreview.ROTATE_180:
# Normal, landscape orientation.
if not is_wide:
screen_x_offset = 23
screen_y_offset = 15
image_background = self.image_background
else:
screen_x_offset = 23
screen_y_offset = 29
image_background = self.image_background_wide
else:
# Portrait orientation. Swap some values around.
t = preview_screen_width
preview_screen_width = preview_screen_height
preview_screen_height = t
t = screen_width
screen_width = screen_height
screen_height = t
if not is_wide:
screen_x_offset = 42
screen_y_offset = 15
image_background = self.image_background_r90
else:
screen_x_offset = 50
screen_y_offset = 15
image_background = self.image_background_wide_r90
# Draw everything off screen in a buffer
preview_buffer = QPixmap(preview_screen_width,preview_screen_height)
painter = QPainter(preview_buffer)
# Draw the background on the monitor's screen
painter.drawPixmap(0, 0, image_background)
# Work out the scaling factor for the eye candy in the preview winodw.
scale_factor = 4.0*float(preview_screen_width) / float(screen_width)
transform_matrix = QWMatrix().scale(scale_factor,scale_factor)
# Draw the little window on the background
scaled_window = self.image_window.xForm(transform_matrix)
sx = (preview_screen_width-scaled_window.width())/2
sy = (preview_screen_height-scaled_window.height())/2
if sx < 0:
sx = 0
if sy < 0:
sy = 0
sw = scaled_window.width()
if sw>preview_screen_width:
sw = preview_screen_width
sh = scaled_window.height()
if sh>preview_screen_height:
sh = preview_screen_height
painter.drawPixmap(sx, sy, scaled_window, 0, 0, sw, sh)
# Now draw the clock in the lower right corner
scaled_window = self.image_window_bottom_right.xForm(transform_matrix)
sx = preview_screen_width - scaled_window.width()
sy = preview_screen_height - scaled_window.height()
sw = scaled_window.width()#preview_screen_width/2
sh = scaled_window.height()
sx_offset = 0
if sx<0: # Some simple clipping for the left edge
sx_offset = -sx
sw = preview_screen_width
sx = 0
painter.drawPixmap(sx, sy, scaled_window, sx_offset, 0, sw, sh)
# Now draw the k menu in the lower left corner
scaled_window = self.image_window_bottom_left.xForm(transform_matrix)
sx = 0
sy = preview_screen_height - scaled_window.height()
sw = preview_screen_width/2 # Just draw on the left side of the preview.
sh = scaled_window.height()
painter.drawPixmap(sx, sy, scaled_window, 0, 0, sw, sh)
painter.end()
# Transform the preview image. Do reflections.
reflect_x = 1
if self.reflect_x:
reflect_x = -1
reflect_y = 1
if self.reflect_y:
reflect_y = -1
preview_buffer = preview_buffer.xForm(QWMatrix().scale(reflect_x,reflect_y))
# Draw the monitor on another buffer.
off_screen_buffer = QPixmap(self.width(),self.height())
off_screen_painter = QPainter(off_screen_buffer)
# Erase the buffer first
off_screen_painter.setBackgroundColor(self.paletteBackgroundColor())
off_screen_painter.eraseRect(0, 0, off_screen_buffer.width(), off_screen_buffer.height())
if self.rotation==MonitorPreview.ROTATE_0 or self.rotation==MonitorPreview.ROTATE_180:
if not is_wide:
image_monitor = self.image_monitor
else:
image_monitor = self.image_monitor_wide
else:
if not is_wide:
image_monitor = self.image_monitor_r90
else:
image_monitor = self.image_monitor_wide_r90
top_edge = self.height()-image_monitor.height()
left_edge = (self.width()-image_monitor.width())/2
# Draw the monitor
off_screen_painter.drawPixmap(left_edge, top_edge, image_monitor)
off_screen_painter.end()
# Copy the preview onto the off screen buffer with the monitor.
bitBlt(off_screen_buffer, left_edge+screen_x_offset, top_edge+screen_y_offset, preview_buffer,
0, 0, preview_buffer.width(), preview_buffer.height(),Qt.CopyROP, False)
# Update the widget
bitBlt(self, 0, 0, off_screen_buffer, 0, 0, self.width(), self.height(), Qt.CopyROP, False)
def setResolution(self,width,height):
self.screen_width = width
self.screen_height = height
self.update()
def setRotation(self, rotation):
self.rotation = rotation
self.update()
def setReflectX(self, enable):
self.reflect_x = enable
self.update()
def setReflectY(self, enable):
self.reflect_y = enable
self.update()
############################################################################
class DualMonitorPreview(QWidget):
""" This is the Widget to use elsewhere. It consists of a canvas and an
arbitrary number of gizmos on the canvas. The gizmos can be dragged and
dropped around. Painting is double-buffered so flickering should not occur.
"""
def __init__(self, parent, size, imagedir):
QWidget.__init__(self,parent)
self.setBackgroundMode(Qt.NoBackground)
self.imagedir = imagedir + "dualhead/"
self.snap_distance = 25
self.snapping = True
self.size = size
self.position = XSetup.POSITION_LEFTOF
self.current_screen = 0
self.resize(size,size)
self.setMouseTracking(True)
self.gizmos = []
self.gizmos.append(MovingGizmo("Monitor 1","monitor_1.png",QPoint(20,50),self.imagedir))
self.gizmos.append(MovingGizmo("Monitor 2","monitor_2.png",QPoint(180,50),self.imagedir))
self.gizmos[0].setWidth(1280)
self.gizmos[0].setHeight(1024)
self.gizmos[0].setHighlightColor(self.colorGroup().highlight())
self.gizmos[1].setWidth(1280)
self.gizmos[1].setHeight(1024)
self.gizmos[1].setHighlightColor(self.colorGroup().highlight())
self.dragging = False
self.dragging_gizmo = 0
self.drag_handle = None
self._positionGizmos()
self.setCurrentScreen(0)
def minimumSizeHint(self):
return QSize(self.size,self.size)
def setCurrentScreen(self,screen):
self.current_screen = screen
self.gizmos[0].setHighlight(screen==0)
self.gizmos[1].setHighlight(screen==1)
self.update()
def getCurrentScreen(self):
return self.current_screen
def setPosition(self,position):
self.position = position
self._positionGizmos()
self.update()
def getPosition(self):
"""Returns one of XSetup.POSITION_LEFTOF, XSetup.POSITION_RIGHTOF,
XSetup.POSITION_ABOVE or XSetup.POSITION_BELOW.
"""
return self.position
def setScreenResolution(self,screenNumber,width,height):
self.gizmos[screenNumber].setWidth(width)
self.gizmos[screenNumber].setHeight(height)
self.setPosition(self.position) # Reposition and force update.
def _positionGizmos(self):
g1 = self.gizmos[0]
g2 = self.gizmos[1]
# Treat POSITION_RIGHTOF and POSITION_BELOW as LEFTOF and ABOVE with the
# gizmos swapped around.
if self.position==XSetup.POSITION_RIGHTOF or self.position==XSetup.POSITION_BELOW:
tmp = g1
g1 = g2
g2 = tmp
if self.position==XSetup.POSITION_LEFTOF or self.position==XSetup.POSITION_RIGHTOF:
x = -g1.getWidth()
y = -max(g1.getHeight(), g2.getHeight())/2
g1.setPosition(QPoint(x,y))
x = 0
g2.setPosition(QPoint(x,y))
else:
x = -max(g1.getWidth(), g2.getWidth())/2
y = -g1.getHeight()
g1.setPosition(QPoint(x,y))
y = 0
g2.setPosition(QPoint(x,y))
def mousePressEvent(self,event):
# Translate the point in the window into our gizmo space.
world_point = self._getGizmoMatrix().invert()[0].map(event.pos())
# If the mouse is in the air space of a gizmo, then we change the cursor to
# indicate that the gizmo can be dragged.
for giz in self.gizmos:
if giz.getRect().contains(world_point):
self.setCurrentScreen(self.gizmos.index(giz))
break
else:
return
# Pressing down the mouse button on a gizmo also starts a drag operation.
self.dragging = True
self.dragging_gizmo = self.getCurrentScreen()
self.drag_handle = world_point - self.gizmos[self.dragging_gizmo].getPosition()
# Let other people know that a gizmo has been selected.
self.emit(PYSIGNAL("pressed()"), (self.current_screen,) )
def mouseReleaseEvent(self,event):
if not self.dragging:
return
# Translate the point in the window into our gizmo space.
world_point = self._getGizmoMatrix().invert()[0].map(event.pos())
if self._moveGizmo(world_point):
self.setPosition(self.drag_position)
self.emit(PYSIGNAL("positionChanged()"), (self.position,) )
else:
self.setPosition(self.position)
self.dragging = False
def mouseMoveEvent(self,event):
# Translate the point in the window into our gizmo space.
world_point = self._getGizmoMatrix().invert()[0].map(event.pos())
# If the mouse is in the air space of a gizmo, then we change the cursor to
# indicate that the gizmo can be dragged.
for giz in self.gizmos:
if giz.getRect().contains(world_point):
self.setCursor(QCursor(Qt.SizeAllCursor))
break
else:
self.unsetCursor()
if self.dragging:
self._moveGizmo(world_point)
self.update()
return
def _moveGizmo(self,worldPoint):
new_drag_position = worldPoint-self.drag_handle
# Drag gizmo is simply the thing being dragged.
drag_gizmo = self.gizmos[self.dragging_gizmo]
drag_x = new_drag_position.x()
drag_y = new_drag_position.y()
# Snap gizmo is other (stationary) thing that we "snap" against.
snap_gizmo = self.gizmos[1-self.dragging_gizmo]
snap_x = snap_gizmo.getPosition().x()
snap_y = snap_gizmo.getPosition().y()
# Calculate the list of "snap points".
snap_points = [
(snap_x-drag_gizmo.getWidth(), snap_y), # Left of
(snap_x+snap_gizmo.getWidth(), snap_y), # Right of
(snap_x, snap_y-drag_gizmo.getHeight()), # Above
(snap_x, snap_y+snap_gizmo.getHeight())] # Below
# Find the snap point that the drag gizmo is closest to.
best_index = -1
best_distance = 0
i = 0
for snap_point in snap_points:
dx = snap_point[0] - drag_x
dy = snap_point[1] - drag_y
distance_squared = dx*dx + dy*dy
if best_index==-1 or distance_squared < best_distance:
best_index = i
best_distance = distance_squared
i += 1
# Lookup the best dualhead position that this configuration matches.
if self.dragging_gizmo==0:
self.drag_position = [
XSetup.POSITION_LEFTOF,
XSetup.POSITION_RIGHTOF,
XSetup.POSITION_ABOVE,
XSetup.POSITION_BELOW][best_index]
else:
self.drag_position = [
XSetup.POSITION_RIGHTOF,
XSetup.POSITION_LEFTOF,
XSetup.POSITION_BELOW,
XSetup.POSITION_ABOVE][best_index]
# Convert the auto-snap distance in pixels into a distance in the gizmo coordinate system.
world_snap_distance = self.snap_distance / self._getGizmoToPixelsScaleFactor()
# Should this drag gizmo visually snap?
snapped = False
if best_distance <= (world_snap_distance*world_snap_distance):
new_drag_position = QPoint(snap_points[best_index][0],snap_points[best_index][1])
snapped = True
# Move the gizmo
self.gizmos[self.dragging_gizmo].setPosition(new_drag_position)
return snapped
def paintEvent(self,event=None):
QWidget.paintEvent(self,event)
# Paint to an off screen buffer first. Later we copy it to widget => flicker free.
off_screen_buffer = QPixmap(self.width(),self.height())
off_screen_painter = QPainter(off_screen_buffer)
# Erase the buffer first
off_screen_painter.setBackgroundColor(self.colorGroup().mid() )
off_screen_painter.eraseRect(0, 0, off_screen_buffer.width(), off_screen_buffer.height())
#
off_screen_painter.setWorldMatrix(self._getGizmoMatrix())
# Paint the non-selected gizmo first.
self.gizmos[ 1-self.current_screen ].paint(off_screen_painter)
# Now paint the selected gizmo
self.gizmos[self.current_screen].paint(off_screen_painter)
# Turn off the world matrix transform.
off_screen_painter.setWorldXForm(False)
# Draw the rounded border
off_screen_painter.setPen(QPen(self.colorGroup().dark(),1))
off_screen_painter.drawRoundRect(0,0,self.width(),self.height(),2,2)
off_screen_painter.end()
# Update the widget
bitBlt(self, 0, 0, off_screen_buffer, 0, 0, self.width(), self.height(), Qt.CopyROP, False)
def _getGizmoMatrix(self):
matrix = QWMatrix()
matrix.translate(self.width()/2,self.height()/2)
scale_factor = self._getGizmoToPixelsScaleFactor()
matrix.scale(scale_factor,scale_factor)
return matrix
def _getGizmoToPixelsScaleFactor(self):
g1 = self.gizmos[0]
g2 = self.gizmos[1]
size = min(self.width(),self.height())
vscale = float(self.height()) / (2.1 * (g1.getHeight()+g2.getHeight()))
hscale = float(self.width()) / (2.1 * (g1.getWidth()+g2.getWidth()))
return min(vscale,hscale)
############################################################################
class MovingGizmo(object):
"""A gizmo represents a screen/monitor. It also has a width and height that
correspond to the resolution of screen."""
def __init__(self,label,filename,initial_pos=QPoint(0,0),imagedir="."):
self.width = 100
self.height = 100
self.pixmap = QPixmap(imagedir+filename)
self.highlight = False
self.highlight_color = QColor(255,0,0)
self.setPosition(initial_pos)
# Used for caching the scaled pixmap.
self.scaled_width = -1
self.scaled_height = -1
def setHighlight(self,enable):
self.highlight = enable
def setHighlightColor(self,color):
self.highlight_color = color
def setPosition(self,position):
self.position = position
def getSize(self):
return QSize(self.width,self.height)
def getPosition(self):
return self.position
def getRect(self):
return QRect(self.position,self.getSize())
def setWidth(self,width):
self.width = width
def getWidth(self):
return self.width
def setHeight(self,height):
self.height = height
def getHeight(self):
return self.height
def paint(self,painter):
painter.save()
if self.highlight:
pen = QPen(self.highlight_color,6)
painter.setPen(pen)
painter.drawRect(self.position.x(), self.position.y(), self.width, self.height)
to_pixels_matrix = painter.worldMatrix()
top_left_pixels = to_pixels_matrix.map(self.position)
bottom_right_pixels = to_pixels_matrix.map( QPoint(self.position.x()+self.width, self.position.y()+self.height) )
# Scale the pixmap.
scaled_width = bottom_right_pixels.x() - top_left_pixels.x()
scaled_height = bottom_right_pixels.y() - top_left_pixels.y()
if (scaled_width,scaled_height) != (self.scaled_width,self.scaled_height):
scale_matrix = QWMatrix()
scale_matrix.scale(
float(scaled_width)/float(self.pixmap.width()),
float(scaled_height)/float(self.pixmap.height()) )
self.scaled_pixmap = self.pixmap.xForm(scale_matrix)
(self.scaled_width,self.scaled_height) = (scaled_width,scaled_height)
# Paste in the scaled pixmap.
bitBlt(painter.device(), top_left_pixels.x(), top_left_pixels.y(), self.scaled_pixmap, 0, 0,
self.scaled_pixmap.width(), self.scaled_pixmap.height(),Qt.CopyROP, False)
painter.restore()
############################################################################
class GfxCardWidget(QVGroupBox):
def __init__(self, parent, xsetup, gfxcard, gfxcarddialog, monitordialog):
global imagedir
QVGroupBox.__init__(self,parent)
self.xsetup = xsetup
self.gfxcard = gfxcard
self.gfxcarddialog = gfxcarddialog
self.monitordialog = monitordialog
self._buildGUI()
self._syncGUI()
def _buildGUI(self):
# Create the GUI
gridwidget = QWidget(self)
grid = QGridLayout(gridwidget,2+3*len(self.gfxcard.getScreens()))
grid.setSpacing(KDialog.spacingHint())
grid.setColStretch(0,0)
grid.setColStretch(1,0)
grid.setColStretch(2,0)
grid.setColStretch(3,1)
grid.setColStretch(4,0)
gfxcardpic = QLabel(gridwidget)
gfxcardpic.setPixmap(UserIcon('hi32-gfxcard'))
grid.addMultiCellWidget(gfxcardpic,0,1,0,0)
label = QLabel(gridwidget)
label.setText(i18n("Graphics card:"))
grid.addWidget(label,0,1)
self.gfxcardlabel = QLabel(gridwidget)
grid.addWidget(self.gfxcardlabel,0,2)
label = QLabel(gridwidget)
label.setText(i18n("Driver:"))
grid.addWidget(label,1,1)
self.driverlabel = QLabel(gridwidget)
grid.addMultiCellWidget(self.driverlabel,1,1,2,3)
gfxbutton = QPushButton(gridwidget)
gfxbutton.setText(i18n("Configure..."))
self.connect(gfxbutton,SIGNAL("clicked()"),self.slotGfxCardConfigureClicked)
grid.addWidget(gfxbutton,0,4)
gfxbutton.setEnabled(self.xsetup.mayModifyXorgConfig())
# Add all of the screens
row = 2
count = 1
self.monitorlabels = []
self.monitor_buttons = []
self.monitor_roles = []
for screen in self.gfxcard.getScreens():
frame = QFrame(gridwidget)
frame.setFrameShape(QFrame.HLine)
frame.setFrameShadow(QFrame.Sunken)
grid.addMultiCellWidget(frame,row,row,0,4)
row += 1
monitorpic = QLabel(gridwidget)
monitorpic.setPixmap(UserIcon('hi32-display'))
grid.addMultiCellWidget(monitorpic,row,row+1,0,0)
# Monitor label
label = QLabel(gridwidget)
if len(self.gfxcard.getScreens())==1:
label.setText(i18n("Monitor:"))
else:
label.setText(i18n("Monitor #%1:").arg(count))
grid.addWidget(label,row,1)
self.monitorlabels.append(QLabel(gridwidget))
grid.addMultiCellWidget(self.monitorlabels[-1],row,row,2,3)
# Role pulldown
if len(self.xsetup.getAllScreens())!=1:
label = QLabel(gridwidget)
label.setText(i18n("Role:"))
grid.addWidget(label,row+1,1)
role_combo = KComboBox(False,gridwidget)
role_combo.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
self.monitor_roles.append(role_combo)
role_combo.insertItem(i18n("Primary (1)"))
role_combo.insertItem(i18n("Secondary (2)"))
if len(self.xsetup.getAllScreens())>=3:
role_combo.insertItem(i18n("Unused"))
self.connect(role_combo,SIGNAL("activated(int)"),self.slotRoleSelected)
grid.addWidget(role_combo,row+1,2)
role_combo.setEnabled(self.xsetup.mayModifyXorgConfig())
monitorbutton = QPushButton(gridwidget)
self.monitor_buttons.append(monitorbutton)
monitorbutton.setText(i18n("Configure..."))
self.connect(monitorbutton,SIGNAL("clicked()"),self.slotMonitorConfigureClicked)
grid.addWidget(monitorbutton,row,4)
monitorbutton.setEnabled(self.xsetup.mayModifyXorgConfig())
row += 2
count += 1
def syncConfig(self):
self._syncGUI()
def _syncGUI(self):
if self.gfxcard.getGfxCardModel() is not None:
self.setTitle(self.gfxcard.getGfxCardModel().getName())
self.gfxcardlabel.setText(self.gfxcard.getGfxCardModel().getName())
if self.gfxcard.isProprietaryDriver():
try:
# Displayconfig thinks there is a proprietary driver
self.driverlabel.setText(self.gfxcard.getGfxCardModel().getProprietaryDriver())
except TypeError, errormsg:
# If there isn't it dies, so try again LP: #198269
self.driverlabel.setText(self.gfxcard.getGfxCardModel().getDriver())
else:
self.driverlabel.setText(self.gfxcard.getGfxCardModel().getDriver())
else:
self.setTitle(i18n("<Unknown>"))
self.gfxcardlabel.setText(i18n("<Unknown>"))
self.driverlabel.setText(i18n("<none>"))
# Sync the screens and monitors.
for i in range(len(self.gfxcard.getScreens())):
screen = self.gfxcard.getScreens()[i]
if screen.getMonitorModel() is None:
monitor_name = i18n("<unknown>")
else:
monitor_name = QString(screen.getMonitorModel().getName())
if screen.getMonitorAspect()==ModeLine.ASPECT_16_9:
monitor_name.append(i18n(" (widescreen)"))
self.monitorlabels[i].setText(monitor_name)
if len(self.xsetup.getAllScreens())!=1:
self.monitor_roles[i].setCurrentItem(
{XSetup.ROLE_PRIMARY: 0,
XSetup.ROLE_SECONDARY: 1,
XSetup.ROLE_UNUSED: 2}
[self.xsetup.getScreenRole(screen)])
def slotGfxCardConfigureClicked(self):
result = self.gfxcarddialog.do(self.gfxcard.getGfxCardModel(), \
self.gfxcard.isProprietaryDriver(), self.gfxcard.getDetectedGfxCardModel(),
self.gfxcard.getVideoRam())
(new_card_model, new_proprietary_driver, new_video_ram) = result
if new_card_model is self.gfxcard.getGfxCardModel() and \
new_proprietary_driver==self.gfxcard.isProprietaryDriver() and \
new_video_ram==self.gfxcard.getVideoRam():
return
self.gfxcard.setGfxCardModel(new_card_model)
self.gfxcard.setProprietaryDriver(new_proprietary_driver)
self.gfxcard.setVideoRam(new_video_ram)
self._syncGUI()
self.emit(PYSIGNAL("configChanged"), () )
def slotMonitorConfigureClicked(self):
screen_index = self.monitor_buttons.index(self.sender())
screen_obj = self.gfxcard.getScreens()[screen_index]
(new_monitor_model,new_aspect) = self.monitordialog.do(screen_obj.getMonitorModel(),
screen_obj.getMonitorAspect(),
self.xsetup.getGfxCards()[0].getScreens()[0] is screen_obj)
screen_obj.setMonitorModel(new_monitor_model)
screen_obj.setMonitorAspect(new_aspect)
self._syncGUI()
self.emit(PYSIGNAL("configChanged"), () )
def slotRoleSelected(self,index):
screen_index = self.monitor_roles.index(self.sender())
screen_obj = self.gfxcard.getScreens()[screen_index]
self.xsetup.setScreenRole(screen_obj,[XSetup.ROLE_PRIMARY,XSetup.ROLE_SECONDARY,XSetup.ROLE_UNUSED][index])
self._syncGUI()
self.emit(PYSIGNAL("configChanged"), () )

File diff suppressed because it is too large Load Diff

@ -0,0 +1,86 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'energy.ui'
#
# Created: Fri Jun 24 03:45:58 2005
# by: The PyQt User Interface Compiler (pyuic) 3.14.1
#
# WARNING! All changes made in this file will be lost!
from qt import *
class DPMSTab(QDialog):
def __init__(self,parent = None,name = None,modal = 0,fl = 0):
QDialog.__init__(self,parent,name,modal,fl)
if not name:
self.setName("DPMSTab")
DPMSTabLayout = QVBoxLayout(self,11,6,"DPMSTabLayout")
titlelayout = QHBoxLayout(None,0,6,"titlelayout")
topspacer = QSpacerItem(221,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
titlelayout.addItem(topspacer)
self.energystarpix = QLabel(self,"energystarpix")
self.energystarpix.setSizePolicy(QSizePolicy(QSizePolicy.Fixed,QSizePolicy.Fixed,0,0,self.energystarpix.sizePolicy().hasHeightForWidth()))
self.energystarpix.setMinimumSize(QSize(150,77))
self.energystarpix.setPixmap(QPixmap("energystar.png"))
self.energystarpix.setScaledContents(1)
titlelayout.addWidget(self.energystarpix)
DPMSTabLayout.addLayout(titlelayout)
self.screensavergroup = QGroupBox(self,"screensavergroup")
self.screensavergroup.setCheckable(1)
self.screensavergroup.setColumnLayout(0,Qt.Vertical)
self.screensavergroup.layout().setSpacing(6)
self.screensavergroup.layout().setMargin(11)
screensavergroupLayout = QHBoxLayout(self.screensavergroup.layout())
screensavergroupLayout.setAlignment(Qt.AlignTop)
spacer4 = QSpacerItem(101,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
screensavergroupLayout.addItem(spacer4)
self.screensavertext = QLabel(self.screensavergroup,"screensavertext")
screensavergroupLayout.addWidget(self.screensavertext)
self.screensavercombo = QComboBox(0,self.screensavergroup,"screensavercombo")
screensavergroupLayout.addWidget(self.screensavercombo)
DPMSTabLayout.addWidget(self.screensavergroup)
self.dpmsgroup = QGroupBox(self,"dpmsgroup")
self.dpmsgroup.setCheckable(1)
self.dpmsgroup.setColumnLayout(0,Qt.Vertical)
self.dpmsgroup.layout().setSpacing(6)
self.dpmsgroup.layout().setMargin(11)
dpmsgroupLayout = QHBoxLayout(self.dpmsgroup.layout())
dpmsgroupLayout.setAlignment(Qt.AlignTop)
spacer4_2 = QSpacerItem(244,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
dpmsgroupLayout.addItem(spacer4_2)
self.dpmstext = QLabel(self.dpmsgroup,"dpmstext")
dpmsgroupLayout.addWidget(self.dpmstext)
self.dpmscombo = QComboBox(0,self.dpmsgroup,"dpmscombo")
dpmsgroupLayout.addWidget(self.dpmscombo)
DPMSTabLayout.addWidget(self.dpmsgroup)
bottomspacer = QSpacerItem(51,160,QSizePolicy.Minimum,QSizePolicy.Expanding)
DPMSTabLayout.addItem(bottomspacer)
self.languageChange()
self.resize(QSize(508,372).expandedTo(self.minimumSizeHint()))
self.clearWState(Qt.WState_Polished)
def languageChange(self):
self.setCaption(self.__tr("Display power saving"))
self.screensavergroup.setTitle(self.__tr("Enable screensaver"))
self.screensavertext.setText(self.__tr("Start screensaver after"))
self.dpmsgroup.setTitle(self.__tr("Enable display powermanagement"))
self.dpmstext.setText(self.__tr("Switch display off after"))
def __tr(self,s,c = None):
return qApp.translate("DPMSTab",s,c)

Binary file not shown.

@ -0,0 +1,47 @@
#!/usr/bin/env python
import os
import select
############################################################################
def ExecWithCapture(command, argv, searchPath = 0, root = '/', stdin = 0,
catchfd = 1, closefd = -1):
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)
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

@ -0,0 +1,39 @@
//
// Extra modes to include as default modes in the X server.
//
// Based on Xorg's xc/programs/Xserver/hw/xfree86/etc/extramodes file.
// The mode names have been changed to include the refresh rate.
//
# 832x624 @ 75Hz (74.55Hz) (fix if the official/Apple spec is different) hsync: 49.725kHz
ModeLine "832x624@75" 57.284 832 864 928 1152 624 625 628 667 -Hsync -Vsync
# 1280x960 @ 60.00 Hz (GTF) hsync: 59.64 kHz; pclk: 102.10 MHz
Modeline "1280x960@60" 102.10 1280 1360 1496 1712 960 961 964 994 -HSync +Vsync
# 1280x960 @ 75.00 Hz (GTF) hsync: 75.15 kHz; pclk: 129.86 MHz
Modeline "1280x960@75" 129.86 1280 1368 1504 1728 960 961 964 1002 -HSync +Vsync
# 1152x768 @ 54.8Hz (Titanium PowerBook) hsync: 44.2kHz
ModeLine "1152x768@54" 64.995 1152 1178 1314 1472 768 771 777 806 +hsync +vsync
# 1400x1050 @ 60Hz (VESA GTF) hsync: 65.5kHz
ModeLine "1400x1050@60" 122.0 1400 1488 1640 1880 1050 1052 1064 1082 +hsync +vsync
# 1400x1050 @ 75Hz (VESA GTF) hsync: 82.2kHz
ModeLine "1400x1050@75" 155.8 1400 1464 1784 1912 1050 1052 1064 1090 +hsync +vsync
# 1600x1024 @ 60Hz (SGI 1600SW) hsync: 64.0kHz
Modeline "1600x1024@60" 106.910 1600 1620 1640 1670 1024 1027 1030 1067 -hsync -vsync
# 1920x1440 @ 85Hz (VESA GTF) hsync: 128.5kHz
Modeline "1920x1440@85" 341.35 1920 2072 2288 2656 1440 1441 1444 1512 -hsync +vsync
# 2048x1536 @ 60Hz (VESA GTF) hsync: 95.3kHz
Modeline "2048x1536@60" 266.95 2048 2200 2424 2800 1536 1537 1540 1589 -hsync +vsync
# 2048x1536 @ 75Hz (VESA GTF) hsync: 120.2kHz
Modeline "2048x1536@75" 340.48 2048 2216 2440 2832 1536 1537 1540 1603 -hsync +vsync
# 2048x1536 @ 85Hz (VESA GTF) hsync: 137.0kHz
Modeline "2048x1536@85" 388.04 2048 2216 2440 2832 1536 1537 1540 1612 -hsync +vsync

@ -0,0 +1,297 @@
#!/usr/bin/python
#
# Based on inf2mondb.py from RedHat
#
# originally by Matt Wilson <msw@redhat.com>
# option parsing and database comparison by Fred New
# ini parsing completely rewritten by Matt Domsch <Matt_Domsch@dell.com> 2006
#
# Copyright 2002 Red Hat, Inc.
# Copyright 2006 Dell, Inc.
# Copyright 2007 Sebastian Heinlein
#
# 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.
"""
Provides an importer for Microsoft Windows monitor descriptions
The code can be used as a python module for or as a script to add new monitor
definitions to a monitor database.
In code example: Read the list of monitors from an inf file.
import infimport
monitors = infimport.get_monitors_from_inf(PATH)
Script example: To check for monitors of an inf file that are not yet in the database.
./infimport.py MONITORS.inf /usr/share/hwdata/MonitorsDB
"""
import sys
import string
import re
import ConfigParser
import os
import logging
logging.basicConfig()
log = logging.getLogger("infimport")
#log.setLevel(logging.DEBUG)
log.setLevel(logging.INFO)
# this is a class to deal with various file line endings and leading whitespace
# converts all \r line endings to \n.
# It also strips leading whitespace.
# NOTE: be sure to always return _something_, even if it is just "\n", or we
# break the file API. (nothing == eof)
class myFile(object):
def __init__(self, *args):
self.fd = open(*args)
def close(self):
return self.fd.close()
def readline(self, *args):
line = self.fd.readline(*args)
line = line.replace('\r', '\n')
line = line.replace('\n\n', '\n')
line = line.lstrip(" \t")
return line
# we will use this to override default option parsing in ConfigParser to handle
# Microsoft-style "INI" files. (Which do not necessarily have " = value " after
# the option name
OPTCRE = re.compile(
r'(?P<option>[^:=\s][^:=]*)' # very permissive!
r'\s*(?P<vi>[:=]{0,1})\s*' # any number of space/tab,
# optionally followed by
# separator (either : or =)
# optionally followed
# by any # space/tab
r'(?P<value>.*)$' # everything up to eol
)
percentSplit = re.compile(r'%(?P<field>.*)%')
def _percent_to_string(ini, strings, name):
mo = percentSplit.match(name)
if (mo):
field = mo.group('field')
try:
val = strings[field.lower()]
except KeyError:
return ""
return val.strip(" '\"")
return ""
def get_monitors_from_database(path):
"""Returns a dictonary of the found monitor models in the given
monitor models database"""
monitors = {}
try:
mdb = open(path, 'r')
except IOError, (errno, str):
log.error("Unable to open %s: %s" % (path, str))
return {}
for line in mdb.readlines():
if len(line.strip()) == 0 or line.startswith('#'):
continue
line_split = line.split(";")
vendor = line_split[0].strip()
name = line_split[1].strip()
id = line_split[2].strip()
if monitors.has_key((vendor, name, id)):
log.warn("Duplicated entry: %s" % line)
else:
monitors[(vendor, name, id)] = line
mdb.close()
return monitors
def get_monitors_from_inf(path):
"""Returns a dictonary of the found monitor models in the given .inf file"""
monitors = {}
ini = ConfigParser.ConfigParser()
# FIXME: perhaps could be done in a nicer way, but __builtins__ is a dict
# for imported modules
#ini.optionxform = __builtins__.str
ini.optionxform = type("")
ini.OPTCRE = OPTCRE
try:
f = myFile(path)
ini.readfp(f)
f.close()
except IOError, (errno, str):
log.error("Unable to open %s: %s" % (path, str))
sys.exit(1)
# a dictionary of manufacturers we're looking at
manufacturers = {}
# a big fat dictionary of strings to use later on.
strings = {}
# This RE is for EISA info lines
# %D5259A%=D5259A, Monitor\HWP0487
monitor1Re = re.compile(r'.*,.*Monitor\\(?P<id>[^\s]*)')
# This one is for legacy entries
# %3020% =PB3020, MonID_PB3020
monitor2Re = re.compile(r'.*,.*MonID_(?P<id>[^\s]*)')
for section in ini.sections():
if section.lower() == "manufacturer":
for mfr in ini.options(section):
# generate the vendor.arch funny entries
manufacturer_values = string.split(ini.get(section, mfr),
',')
manufacturers[manufacturer_values[0]] = mfr
while len(manufacturer_values) > 1:
manufacturers["%s.%s" % (manufacturer_values[0],
manufacturer_values[-1])] = mfr
manufacturer_values = manufacturer_values[0:-1]
elif section.lower() == "strings":
for key in ini.options(section):
strings[key.lower()] = string.strip(ini.get(section, key))
for mfr in manufacturers.keys():
if ini.has_section(mfr):
monitor_vendor_name = manufacturers[mfr]
for monitor_name in ini.options(mfr):
v = ini.get(mfr, monitor_name)
v = v.split(',')
install_key = v[0].strip()
line = ini.get(mfr, monitor_name)
# Find monitor inf IDs and EISA ids
edid = "0"
mo = monitor1Re.match(line)
if mo:
edid = mo.group('id')
else:
mo = monitor2Re.match(line)
if mo:
edid = mo.group('id').strip()
#if self.monitors.has_key(edid.lower()):
# continue
if ini.has_section(install_key):
line = ini.get(install_key, "AddReg")
if line:
sline = line.split(',')
registry = sline[0]
try:
resolution = sline[1]
except IndexError:
resolution = ""
try:
dpms = sline[2]
except IndexError:
dpms = ""
if ini.has_section(registry):
for line in ini.options(registry):
if string.find(line, 'HKR,"MODES') >= 0:
sline = line.split('"')
try:
syncline = sline[3]
except IndexError:
syncline = ","
syncline = syncline.split(',')
hsync = syncline[0].strip()
vsync = syncline[1].strip()
vendor_clear = _percent_to_string(ini,
strings, monitor_vendor_name)
monitor_clear = _percent_to_string(ini,
strings, monitor_name)
output = "%s; %s; %s; %s; %s" % \
(vendor_clear, monitor_clear,
edid, hsync, vsync)
if dpms.lower().strip() == "dpms":
output = output + "; 1"
if not monitors.has_key((vendor_clear,
monitor_clear, edid.lower())):
log.debug("added %s" % output)
monitors[(vendor_clear,
monitor_clear,
edid.lower())] = output
else:
log.warn("duplicated entry %s" % output)
return monitors
def write_monitors_to_file(monitors, path):
"""Writes monitors as a monitor models database"""
try:
if os.path.exists(path):
os.remove(path)
mdb = open(path, 'w')
mdb.writelines(map(lambda l: "%s\n" % l, monitors.values()))
mdb.close()
except IOError, (errno, str):
log.error("Unable to write %s: %s" % (path, str))
return False
def append_monitors_to_file(monitors, path):
"""Appends monitors to a monitor models database"""
try:
if os.path.exists(path):
os.remove(path)
mdb = open(path, 'a')
mdb.writelines(map(lambda l: "%s\n" % l, monitors.values()))
mdb.close()
except IOError, (errno, str):
log.error("Unable to write %s: %s" % (path, str))
return False
if __name__ == "__main__":
from optparse import OptionParser
import sys
parser = OptionParser()
parser.add_option("-a", "--append",
action="store_true", dest="append",
help="Append new models to the database")
parser.add_option("-o", "--output",
default=None,
action="store", type="string", dest="output",
help="Write changes to an alternative file")
parser.usage = "%prog [options] INF_FILE [MONITOR_DATABASE]"
(options, args) = parser.parse_args()
if len(args) == 2:
# continue with normal operation
pass
elif len(args) == 1:
# jsut print the monitors from the given inf file
monitors_inf = get_monitors_from_inf(args[0])
for mon in monitors_inf.values():
print "%s" % mon
sys.exit()
else:
parser.error("You have to specify an .inf file that contains the "
"monitor models that you want to add and a "
"monitor model database")
monitors_inf = get_monitors_from_inf(args[0])
monitors_db = get_monitors_from_database(args[1])
monitors_new = {}
for mon in monitors_inf.keys():
if not monitors_db.has_key(mon):
log.info("New monitor: %s" % monitors_inf[mon])
monitors_new[mon] = monitors_inf[mon]
if options.append:
if options.output:
append_monitors_to_file(monitors_new, options.output)
else:
append_monitors_to_file(new_monitors, args[1])

@ -0,0 +1,155 @@
#!/usr/bin/python
###########################################################################
# ktimerdialog.py - description #
# ------------------------------ #
# begin : Mon Jul 26 2004 #
# copyright : (C) 2004 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. #
# #
###########################################################################
# Based on Hamish Rodda's ktimerdialog.cpp.
from qt import *
from kdecore import *
from kdeui import *
class KTimerDialog(KDialogBase):
CountDown = 0
CountUp = 1
Manual = 2
def __init__(self, msec, style, parent, name, modal, caption="", \
buttonmask=KDialogBase.Ok|KDialogBase.Cancel|KDialogBase.Apply, \
defaultbutton=KDialogBase.Cancel, separator=False, \
user1=KGuiItem(), user2=KGuiItem(), user3=KGuiItem()):
"""Parameters:
msec - integer, timeout in milliseconds
style - TimerStyle object.
parent - parent QWidget
name - String
model - boolean.
caption - String
buttonmask - integer
defaultbutton - ButtonCode
separator - boolean
user1 - KGuiItem
user2 - KGuiItem
user3 - KGuiItem
"""
KDialogBase.__init__(self,parent, name, modal, caption, buttonmask, defaultbutton, \
separator, user1, user2, user3 )
self.totaltimer = QTimer(self)
self.updatetimer = QTimer(self)
self.msectotal = self.msecremaining = msec
self.updateinterval = 1000
self.tstyle = style
# default to cancelling the dialog on timeout
if buttonmask & self.Cancel:
self.buttonontimeout = self.Cancel
self.connect(self.totaltimer, SIGNAL("timeout()"), self.slotInternalTimeout)
self.connect(self.updatetimer, SIGNAL("timeout()"), self.slotUpdateTime)
# create the widgets
self.mainwidget = QVBox(self, "mainWidget")
self.timerwidget = QHBox(self.mainwidget, "timerWidget")
self.timerlabel = QLabel(self.timerwidget)
self.timerprogress = QProgressBar(self.timerwidget)
self.timerprogress.setTotalSteps(self.msectotal)
self.timerprogress.setPercentageVisible(False)
self.setMainWidget(self.mainwidget)
self.slotUpdateTime(False)
def show(self):
self.msecremaining = self.msectotal
self.slotUpdateTime(False)
KDialogBase.show(self)
self.totaltimer.start(self.msectotal, True)
self.updatetimer.start(self.updateinterval, False)
def exec_loop(self):
self.totaltimer.start(self.msectotal, True)
self.updatetimer.start(self.updateinterval, False)
return KDialogBase.exec_loop(self)
def setMainWidget(self, newmainwidget):
# yuck, here goes.
newwidget = QVBox(self)
if newmainwidget.parentWidget()!=self.mainwidget:
newmainwidget.reparent(newwidget, 0, QPoint(0,0))
else:
newwidget.insertChild(newmainwidget)
self.timerwidget.reparent(newwidget, 0, QPoint(0, 0))
self.mainwidget = newwidget
KDialogBase.setMainWidget(self, self.mainwidget)
def setRefreshInterval(self, msec):
self.updateinterval = msec;
if self.updatetimer.isActive():
self.updatetimer.changeInterval(self.updateinterval)
def timeoutButton(self):
return self.buttonontimeout
def setTimeoutButton(self, newbutton):
self.buttonontimeout = newbutton
def timerStyle(self):
return self.tstyle
def setTimerStyle(self, newstyle):
self.tstyle = newstyle
def slotUpdateTime(self, update=True):
if update:
if self.tstyle==self.CountDown:
self.msecremaining -= self.updateinterval
elif self.tstyle==self.CountUp:
self.msecremaining += self.updateinterval
self.timerprogress.setProgress(self.msecremaining)
self.timerlabel.setText( i18n("%1 seconds remaining:").arg(self.msecremaining/1000.0) )
def slotInternalTimeout(self):
#self.emit(SIGNAL("timerTimeout()"), () )
if self.buttonontimeout==self.Help:
self.slotHelp()
elif self.buttonontimeout==self.Default:
self.slotDefault()
elif self.buttonontimeout==self.Ok:
self.slotOk()
elif self.buttonontimeout==self.Apply:
self.applyPressed()
elif self.buttonontimeout==self.Try:
self.slotTry()
elif self.buttonontimeout==self.Cancel:
self.slotCancel()
elif self.buttonontimeout==self.Close:
self.slotClose()
#case User1:
# slotUser1();
#case User2:
# slotUser2();
# break;
elif self.buttonontimeout==self.User3:
self.slotUser3()
elif self.buttonontimeout==self.No:
self.slotNo()
elif self.buttonontimeout==self.Yes:
self.slotCancel()
elif self.buttonontimeout==self.Details:
self.slotDetails()

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

@ -0,0 +1,113 @@
#!/usr/bin/python
###########################################################################
# servertestdialog.py - #
# ------------------------------ #
# copyright : (C) 2004 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. #
# #
###########################################################################
from qt import * # Just use Qt for this.
import os
import sys
############################################################################
class ServerTestDialog(QDialog):
def __init__(self):
QDialog.__init__(self)
msec = 10000
margin = 4
spacing = 4
self.totaltimer = QTimer(self)
self.updatetimer = QTimer(self)
self.msectotal = self.msecremaining = msec
self.updateinterval = 1000
self.connect(self.totaltimer, SIGNAL("timeout()"), self.slotInternalTimeout)
self.connect(self.updatetimer, SIGNAL("timeout()"), self.slotUpdateTime)
layout = QHBoxLayout(self)
# create the widgets
self.mainwidget = QVBox(self, "mainWidget")
self.mainwidget.setMargin(margin)
self.mainwidget.setSpacing(spacing)
layout.addWidget(self.mainwidget,1)
label = QLabel(self.mainwidget)
label.setText(i18n("Are these settings acceptable?"))
QWidget(self.mainwidget)
self.timerwidget = QHBox(self.mainwidget, "timerWidget")
self.timerlabel = QLabel(self.timerwidget)
self.timerprogress = QProgressBar(self.timerwidget)
self.timerprogress.setTotalSteps(self.msectotal)
self.timerprogress.setPercentageVisible(False)
hbox = QHBox(self.mainwidget)
self.okbutton = QPushButton(i18n("Yes"),hbox)
QWidget(hbox)
self.cancelbutton = QPushButton(i18n("No"),hbox)
self.connect(self.okbutton, SIGNAL("clicked()"), self.slotOk)
self.connect(self.cancelbutton, SIGNAL("clicked()"), self.slotCancel)
self.slotUpdateTime(False)
def show(self):
QDialog.show(self)
self.totaltimer.start(self.msectotal, True)
self.updatetimer.start(self.updateinterval, False)
def exec_loop(self):
self.totaltimer.start(self.msectotal, True)
self.updatetimer.start(self.updateinterval, False)
return QDialog.exec_loop(self)
def setRefreshInterval(self, msec):
self.updateinterval = msec;
if self.updatetimer.isActive():
self.updatetimer.changeInterval(self.updateinterval)
def timeoutButton(self):
return self.buttonontimeout
def setTimeoutButton(self, newbutton):
self.buttonontimeout = newbutton
def slotUpdateTime(self, update=True):
self.msecremaining -= self.updateinterval
self.timerprogress.setProgress(self.msecremaining)
self.timerlabel.setText( i18n("Automatically cancelling in %1 seconds:").arg(self.msecremaining/1000.0) )
def slotInternalTimeout(self):
self.reject()
def slotOk(self):
self.accept()
def slotCancel(self):
self.reject()
############################################################################
os.environ["DISPLAY"] = ":9"
os.environ["XAUTHORITY"] = sys.argv[1]
# FIXME set the application name / string catalog, for i18n().
qapp = QApplication(sys.argv)
dialog = ServerTestDialog()
dialog.show()
dialog.exec_loop()
if dialog.result()==QDialog.Accepted:
sys.exit(0)
else:
sys.exit(1)

@ -0,0 +1,110 @@
//
// Default modes distilled from
// "VESA and Industry Standards and Guide for Computer Display Monitor
// Timing", version 1.0, revision 0.8, adopted September 17, 1998.
//
// Based on Xorg's xc/programs/Xserver/hw/xfree86/etc/vesamodes file.
// The mode names have been changed to include the refresh rate.
# 640x350 @ 85Hz (VESA) hsync: 37.9kHz
ModeLine "640x350@85" 31.5 640 672 736 832 350 382 385 445 +hsync -vsync
# 640x400 @ 85Hz (VESA) hsync: 37.9kHz
ModeLine "640x400@85" 31.5 640 672 736 832 400 401 404 445 -hsync +vsync
# 720x400 @ 85Hz (VESA) hsync: 37.9kHz
ModeLine "720x400@85" 35.5 720 756 828 936 400 401 404 446 -hsync +vsync
# 640x480 @ 60Hz (Industry standard) hsync: 31.5kHz
ModeLine "640x480@60" 25.2 640 656 752 800 480 490 492 525 -hsync -vsync
# 640x480 @ 72Hz (VESA) hsync: 37.9kHz
ModeLine "640x480@72" 31.5 640 664 704 832 480 489 491 520 -hsync -vsync
# 640x480 @ 75Hz (VESA) hsync: 37.5kHz
ModeLine "640x480@75" 31.5 640 656 720 840 480 481 484 500 -hsync -vsync
# 640x480 @ 85Hz (VESA) hsync: 43.3kHz
ModeLine "640x480@85" 36.0 640 696 752 832 480 481 484 509 -hsync -vsync
# 800x600 @ 56Hz (VESA) hsync: 35.2kHz
ModeLine "800x600@56" 36.0 800 824 896 1024 600 601 603 625 +hsync +vsync
# 800x600 @ 60Hz (VESA) hsync: 37.9kHz
ModeLine "800x600@60" 40.0 800 840 968 1056 600 601 605 628 +hsync +vsync
# 800x600 @ 72Hz (VESA) hsync: 48.1kHz
ModeLine "800x600@72" 50.0 800 856 976 1040 600 637 643 666 +hsync +vsync
# 800x600 @ 75Hz (VESA) hsync: 46.9kHz
ModeLine "800x600@75" 49.5 800 816 896 1056 600 601 604 625 +hsync +vsync
# 800x600 @ 85Hz (VESA) hsync: 53.7kHz
ModeLine "800x600@85" 56.3 800 832 896 1048 600 601 604 631 +hsync +vsync
# 1024x768i @ 43Hz (industry standard) hsync: 35.5kHz
ModeLine "1024x768@43" 44.9 1024 1032 1208 1264 768 768 776 817 +hsync +vsync Interlace
# 1024x768 @ 60Hz (VESA) hsync: 48.4kHz
ModeLine "1024x768@60" 65.0 1024 1048 1184 1344 768 771 777 806 -hsync -vsync
# 1024x768 @ 70Hz (VESA) hsync: 56.5kHz
ModeLine "1024x768@70" 75.0 1024 1048 1184 1328 768 771 777 806 -hsync -vsync
# 1024x768 @ 75Hz (VESA) hsync: 60.0kHz
ModeLine "1024x768@75" 78.8 1024 1040 1136 1312 768 769 772 800 +hsync +vsync
# 1024x768 @ 85Hz (VESA) hsync: 68.7kHz
ModeLine "1024x768@85" 94.5 1024 1072 1168 1376 768 769 772 808 +hsync +vsync
# 1152x864 @ 75Hz (VESA) hsync: 67.5kHz
ModeLine "1152x864@75" 108.0 1152 1216 1344 1600 864 865 868 900 +hsync +vsync
# 1280x960 @ 60Hz (VESA) hsync: 60.0kHz
ModeLine "1280x960@60" 108.0 1280 1376 1488 1800 960 961 964 1000 +hsync +vsync
# 1280x960 @ 85Hz (VESA) hsync: 85.9kHz
ModeLine "1280x960@85" 148.5 1280 1344 1504 1728 960 961 964 1011 +hsync +vsync
# 1280x1024 @ 60Hz (VESA) hsync: 64.0kHz
ModeLine "1280x1024@60" 108.0 1280 1328 1440 1688 1024 1025 1028 1066 +hsync +vsync
# 1280x1024 @ 75Hz (VESA) hsync: 80.0kHz
ModeLine "1280x1024@75" 135.0 1280 1296 1440 1688 1024 1025 1028 1066 +hsync +vsync
# 1280x1024 @ 85Hz (VESA) hsync: 91.1kHz
ModeLine "1280x1024@85" 157.5 1280 1344 1504 1728 1024 1025 1028 1072 +hsync +vsync
# 1600x1200 @ 60Hz (VESA) hsync: 75.0kHz
ModeLine "1600x1200@60" 162.0 1600 1664 1856 2160 1200 1201 1204 1250 +hsync +vsync
# 1600x1200 @ 65Hz (VESA) hsync: 81.3kHz
ModeLine "1600x1200@65" 175.5 1600 1664 1856 2160 1200 1201 1204 1250 +hsync +vsync
# 1600x1200 @ 70Hz (VESA) hsync: 87.5kHz
ModeLine "1600x1200@70" 189.0 1600 1664 1856 2160 1200 1201 1204 1250 +hsync +vsync
# 1600x1200 @ 75Hz (VESA) hsync: 93.8kHz
ModeLine "1600x1200@75" 202.5 1600 1664 1856 2160 1200 1201 1204 1250 +hsync +vsync
# 1600x1200 @ 85Hz (VESA) hsync: 106.3kHz
ModeLine "1600x1200@85" 229.5 1600 1664 1856 2160 1200 1201 1204 1250 +hsync +vsync
# 1792x1344 @ 60Hz (VESA) hsync: 83.6kHz
ModeLine "1792x1344@60" 204.8 1792 1920 2120 2448 1344 1345 1348 1394 -hsync +vsync
# 1792x1344 @ 75Hz (VESA) hsync: 106.3kHz
ModeLine "1792x1344@75" 261.0 1792 1888 2104 2456 1344 1345 1348 1417 -hsync +vsync
# 1856x1392 @ 60Hz (VESA) hsync: 86.3kHz
ModeLine "1856x1392@60" 218.3 1856 1952 2176 2528 1392 1393 1396 1439 -hsync +vsync
# 1856x1392 @ 75Hz (VESA) hsync: 112.5kHz
ModeLine "1856x1392@75" 288.0 1856 1984 2208 2560 1392 1393 1396 1500 -hsync +vsync
# 1920x1440 @ 60Hz (VESA) hsync: 90.0kHz
ModeLine "1920x1440@60" 234.0 1920 2048 2256 2600 1440 1441 1444 1500 -hsync +vsync
# 1920x1440 @ 75Hz (VESA) hsync: 112.5kHz
ModeLine "1920x1440@75" 297.0 1920 2064 2288 2640 1440 1441 1444 1500 -hsync +vsync

Binary file not shown.

@ -0,0 +1,66 @@
//
// Extra widescreen modes
//
# 1280x720 @ 50.00 Hz (GTF) hsync: 37.05 kHz; pclk: 60.47 MHz
Modeline "1280x720@50" 60.47 1280 1328 1456 1632 720 721 724 741 -HSync +Vsync
# 1280x720 @ 60.00 Hz (GTF) hsync: 44.76 kHz; pclk: 74.48 MHz
Modeline "1280x720@60" 74.48 1280 1336 1472 1664 720 721 724 746 -HSync +Vsync
# 1280x768 @ 60.00 Hz (GTF) hsync: 47.70 kHz; pclk: 80.14 MHz
Modeline "1280x768@60" 80.14 1280 1344 1480 1680 768 769 772 795 -HSync +Vsync
# 1280x768 @ 75.00 Hz (GTF) hsync: 60.15 kHz; pclk: 102.98 MHz
Modeline "1280x768@75" 102.98 1280 1360 1496 1712 768 769 772 802 -HSync +Vsync
# 1280x800 @ 60.00 Hz (GTF) hsync: 49.68 kHz; pclk: 83.46 MHz
Modeline "1280x800@60" 83.46 1280 1344 1480 1680 800 801 804 828 -HSync +Vsync
# 1280x800 @ 75.00 Hz (GTF) hsync: 62.62 kHz; pclk: 107.21 MHz
Modeline "1280x800@75" 107.21 1280 1360 1496 1712 800 801 804 835 -HSync +Vsync
# 1440x900 @ 60.00 Hz (GTF) hsync: 55.92 kHz; pclk: 106.47 MHz
Modeline "1440x900@60" 106.47 1440 1520 1672 1904 900 901 904 932 -HSync +Vsync
# 1440x900 @ 75.00 Hz (GTF) hsync: 70.50 kHz; pclk: 136.49 MHz
Modeline "1440x900@75" 136.49 1440 1536 1688 1936 900 901 904 940 -HSync +Vsync
# 1400x1050 @ 60.00 Hz (GTF) hsync: 65.22 kHz; pclk: 122.61 MHz
Modeline "1400x1050@60" 122.61 1400 1488 1640 1880 1050 1051 1054 1087 -HSync +Vsync
# 1400x1050 @ 75.00 Hz (GTF) hsync: 82.20 kHz; pclk: 155.85 MHz
Modeline "1400x1050@75" 155.85 1400 1496 1648 1896 1050 1051 1054 1096 -HSync +Vsync
# 1600x1024 @ 60.00 Hz (GTF) hsync: 63.60 kHz; pclk: 136.36 MHz
Modeline "1600x1024@60" 136.36 1600 1704 1872 2144 1024 1025 1028 1060 -HSync +Vsync
# 1680x1050 @ 60.00 Hz (GTF) hsync: 65.22 kHz; pclk: 147.14 MHz
Modeline "1680x1050@60" 147.14 1680 1784 1968 2256 1050 1051 1054 1087 -HSync +Vsync
#Modeline "1680x1050@60" 154.20 1680 1712 2296 2328 1050 1071 1081 1103
# 1680x1050 @ 75.00 Hz (GTF) hsync: 82.20 kHz; pclk: 188.07 MHz
Modeline "1680x1050@75" 188.07 1680 1800 1984 2288 1050 1051 1054 1096 -HSync +Vsync
# 1920x1200 @ 60.00 Hz (GTF) hsync: 74.52 kHz; pclk: 193.16 MHz
Modeline "1920x1200@60" 193.16 1920 2048 2256 2592 1200 1201 1204 1242 -HSync +Vsync
# 1920x1200 @ 75.00 Hz (GTF) hsync: 93.97 kHz; pclk: 246.59 MHz
Modeline "1920x1200@75" 246.59 1920 2064 2272 2624 1200 1201 1204 1253 -HSync +Vsync
# 2560x1600 @ 60.00 Hz (GTF) hsync: 99.36 kHz; pclk: 348.16 MHz
Modeline "2560x1600@60" 348.16 2560 2752 3032 3504 1600 1601 1604 1656 -HSync +Vsync
# 2560x1600 @ 75.00 Hz (GTF) hsync: 125.25 kHz; pclk: 442.88 MHz
Modeline "2560x1600@75" 442.88 2560 2768 3048 3536 1600 1601 1604 1670 -HSync +Vsync
# 3200x2048 @ 60.00 Hz (GTF) hsync: 127.14 kHz; pclk: 561.45 MHz
Modeline "3200x2048@60" 561.45 3200 3456 3808 4416 2048 2049 2052 2119 -HSync +Vsync
# 3200x2048 @ 75.00 Hz (GTF) hsync: 160.27 kHz; pclk: 712.90 MHz
Modeline "3200x2048@75" 712.90 3200 3472 3824 4448 2048 2049 2052 2137 -HSync +Vsync
# Powerbook G4 1280x854
Modeline "1280x854" 80 1280 1309 1460 1636 854 857 864 896 +HSync +VSync

@ -0,0 +1,15 @@
import xorgconfig
xconfig = xorgconfig.readConfig("/etc/X11/xorg.conf")
for screensection in xconfig.getSections("screen"):
print screensection.identifier
print screensection.option
for screensection in xconfig.getSections("device"):
print screensection.option
print screensection.option[1]
print screensection.option[2]

@ -0,0 +1,903 @@
#!/usr/bin/python
###########################################################################
# xorgconfig.py - description #
# ------------------------------ #
# begin : Wed Feb 9 2004 #
# 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. #
# #
###########################################################################
import csv
import codecs
import locale
"""
General usage:
import xorgconfig
config = readConfig("/etc/X11/xorg.conf")
input_devices = config.getSections("InputDevice")
print input_devices[0].driver
options = input_devices[0].options
for option in options:
# option is of type OptionLine.
print option._row[0],
if len(option._row)>=2:
print "=>",option._row[1]
# Add line: Option "XkbModel" "pc105"
options.append( options.makeLine("Comment text",["XkbModel" "pc105"]) )
Refactor plan
=============
New usage:
import xorgconfig
config = readConfig("/etc/X11/xorg.conf")
input_devices = config.section.InputDevice
print input_devices[0].driver
options = input_devices[0].options
for option in options:
# option is of type OptionLine.
print option[1],
if len(option)>=3:
print "=>",option[2]
module_section = config.section.module[0]
module_section.append(["load","i2c"])
assert module_section.existsLoad("i2c")
module_section.removeLoad("i2c")
device_section = config.section.device[0]
if device_section.busid is not None:
print "Found busid:",device_section.busid
* direct references to myline._row should be removed.
* A ConfigLine should be a subclass of List. With line[i] accessing the
parts of the line.
* the order of the makeLine() parameters should be reversed.
* it should be possible to directly append a list or tuple that represents
a line to a section.
"""
############################################################################
class ConfigLine(object):
"""Represents one line from the Xorg.conf file.
Each part of the line is printed without quotes.
"""
def __init__(self,comment,row):
self._row = [item for item in row if item!='']
self._comment = comment
def toString(self,depth=0):
caprow = self._row
if len(caprow) > 0:
caprow[0] = caprow[0].capitalize()
string = ('\t' * (depth/2)) + ' ' * (depth%1) + '\t'.join([unicode(item) for item in caprow])
if self._comment is not None:
string += '#' + self._comment
return string + '\n'
############################################################################
class ConfigLineQuote(ConfigLine):
"""Represents one line from the Xorg.conf file.
The first item in the line is not quoted, but the remaining items are.
"""
def toString(self,depth=0):
string = ('\t' * (depth/2) + ' ' * (depth%1))
if len(self._row)!=0:
string += self._row[0].capitalize()
if len(self._row)>1:
if len(self._row[0]) < 8:
string += '\t'
string += '\t"' + '"\t"'.join([unicode(item) for item in self._row[1:]]) + '"'
if self._comment is not None:
string += '#' + self._comment
return string + '\n'
############################################################################
class OptionLine(ConfigLineQuote):
def __init__(self,comment,row):
arg = ['option']
arg.extend(row)
ConfigLineQuote.__init__(self,comment,arg)
############################################################################
class ConfigList(list):
def toString(self,depth=0):
string = ""
for item in self:
string += item.toString(depth)
return string
############################################################################
class OptionList(ConfigList):
name = "option"
def __setitem__(self,key,value):
list.__setitem__(self,key,value)
def makeLine(self,comment,row):
return OptionLine(comment,row)
def appendOptionRow(self,row):
self.append(self.makeLine(None,row))
def removeOptionByName(self,name):
name = name.lower()
i = 0
while i < len(self):
if self[i]._row[1].lower()==name:
del self[i]
else:
i += 1
def getOptionByName(self,name):
name = name.lower()
for item in self:
try:
if item._row[1].lower()==name:
return item
except IndexError:
pass
return None
############################################################################
class ScreenConfigLine(ConfigLine):
def __init__(self,comment,row):
arg = ["screen"]
arg.extend(row)
ConfigLine.__init__(self,comment,arg)
def toString(self,depth=0):
string = (' ' * depth)
try: # Keep on building up the string until the IndexError is thrown.
string += self._row[0]
i = 1
if self._row[i].isdigit():
string += ' ' + self._row[i]
i += 1
string += ' "' + self._row[i] + '"'
i += 1
while True:
item = self._row[i].lower()
if item in ['rightof','leftof','above','below']:
string += ' %s "%s"' % (item, self._row[i+1])
i += 1
elif item=='absolute':
string += ' %s %d %d' % (item, self._row[i+1], self._row[i+2])
i += 2
elif item.isdigit():
i += 1
string += ' %s %s' % (item,self._row[i])
i += 1
except IndexError: pass
if self._comment is not None:
string += ' #' + self._comment
return string + '\n'
############################################################################
class ScreenConfigList(ConfigList):
name = "screen"
def __setitem__(self,key,value):
list.__setitem__(self,key,value)
def makeLine(self,comment,row):
return ScreenConfigLine(comment,row)
############################################################################
class ConfigContainer(object):
"""Acts as a container for ConfigLines and other ConfigContainers.
Is used for representing things like the whole config file, sections
and subsections inside the file.
"""
def __init__(self):
self._contents = []
def append(self,item):
assert (item is not None)
self._contents.append(item)
def remove(self,item):
self._contents.remove(item)
def toString(self,depth=0):
string = ''
for item in self._contents:
string += item.toString(depth+1)
return string
def makeSection(self,comment,row):
return Section(comment,row)
def isSection(self,name):
lname = name.lower()
return lname=='section'
def isEndSection(self,name):
return False
def makeLine(self,comment,row):
return ConfigLine(comment,row)
def isListAttr(self,name):
lname = name.lower()
return lname in self._listattr
def makeListAttr(self,comment,row):
listobj = self.__getattr__(row[0].lower())
listobj.append( listobj.makeLine(comment,row[1:]) )
def getSections(self,name):
"""Get all sections having the given name.
Returns a list of ConfigContainer objects.
"""
name = name.lower()
sections = []
for item in self._contents:
try:
if isinstance(item,ConfigContainer) and item._name.lower()==name:
sections.append(item)
except IndexError: pass
return sections
def __getattr__(self,name):
if not name.startswith("_"):
lname = name.lower()
if lname in self._listattr:
# Lookup list attributes.
for item in self._contents:
if isinstance(item,ConfigList) and item.name==lname:
return item
else:
listitem = self._listattr[lname]()
self._contents.append(listitem)
return listitem
else:
for item in self._contents:
try:
if isinstance(item,ConfigLine) and item._row[0].lower()==lname:
return item._row[1]
except IndexError: pass
if lname in self._attr or lname in self._quoteattr:
return None
raise AttributeError, name
def __setattr__(self,name,value):
if name.startswith('_'):
return super(ConfigContainer,self).__setattr__(name,value)
lname = name.lower()
for item in self._contents:
try:
if isinstance(item,ConfigLine) and item._row[0].lower()==lname:
item._row[1] = value
break
except IndexError: pass
else:
if lname in self._attr or lname in self._quoteattr:
line = self.makeLine(None,[name,value])
self.append(line)
else:
raise AttributeError, name
def clear(self):
self._contents = []
def getRow(self,name):
if not name.startswith("_"):
lname = name.lower()
for item in self._contents:
try:
if isinstance(item,ConfigLine) and item._row[0].lower()==lname:
return item._row[1:]
except IndexError: pass
if name in self._attr or name in self._quoteattr:
# is a valid name, just has no real value right now.
return None
raise AttributeError, name
############################################################################
class Section(ConfigContainer):
"""Represents a Section in the config file.
"""
# List of config line types allowed inside this section.
# A list of strings naming lines that need to be stored in ConfigLine objects.
_attr = []
# A list of strings naming the lines that need to be stored in ConfigLineQuote objects.
# This is often overridden in subclasses.
_quoteattr = []
_listattr = {}
def __init__(self,comment,row):
ConfigContainer.__init__(self)
self._name = row[1]
self._comment = comment
def __show__(self):
""" For debugging """
for a in self._attr:
print self._name, "Attribute:", a
for a in self._quoteattr:
print self._name, "QuoteAttribute:", a
for a in self._listattr:
print self._name, "ListAttr:", a
def isSection(self,name):
return name.lower()=='subsection'
def isEndSection(self,name):
return name.lower()=='endsection'
def makeLine(self,comment,row):
try:
lname = row[0].lower()
if lname in self._quoteattr:
return ConfigLineQuote(comment,row)
if lname in self._attr:
return ConfigLine(comment,row)
return None
except IndexError:
pass
return ConfigContainer.makeLine(self,comment,row)
def toString(self,depth=0):
if self._comment is None:
return '%sSection "%s"\n%s%sEndSection\n' % \
(' ' * depth, self._name, ConfigContainer.toString(self,depth+1), ' ' * depth)
else:
return '%sSection "%s" # %s\n%s%sEndSection\n' % \
(' ' * depth, self._name, self._comment, ConfigContainer.toString(self,depth+1), ' ' * depth)
############################################################################
class SubSection(Section):
def isSection(self,name):
return False
def isEndSection(self,name):
return name.lower()=='endsubsection'
def toString(self,depth=0):
return '%sSubSection "%s"\n%s%sEndSubSection\n' % \
('\t' * (depth/2) + ' ' * (depth%1), self._name, ConfigContainer.toString(self,depth+1), '\t' * (depth/2) + ' ' * (depth%1))
############################################################################
class DeviceSection(Section):
_attr = ["endsection","dacspeed","clocks","videoram","biosbase","membase", \
"iobase","chipid","chiprev","textclockfreq","irq","screen"]
_quoteattr = ["identifier","vendorname","boardname","chipset","ramdac", \
"clockchip","card","driver","busid"]
_listattr = {"option" : OptionList}
############################################################################
class DriSection(Section):
_attr = ["group","buffers","mode"]
def makeLine(self,comment,row):
try:
lname = row[0].lower()
if lname=="group" and not row[1].isdigit():
return ConfigLineQuote(comment,row)
except IndexError:
pass
return Section.makeLine(self,comment,row)
############################################################################
class ExtensionsSection(Section):
_listattr = {"option" : OptionList}
############################################################################
class FilesSection(Section):
_quoteattr = ["fontpath","rgbpath","modulepath","inputdevices","logfile"]
def makeLine(self,comment,row):
return ConfigLineQuote(comment,row)
############################################################################
class ModuleSection(Section):
_quoteattr = ["load","loaddriver","disable"]
def makeSection(self,comment,row):
return ModuleSubSection(comment,row)
def allowModule(self,modname):
killlist = []
for item in self._contents:
try:
if isinstance(item,ConfigLineQuote) \
and item._row[0].lower()=='disable' \
and item._row[1]==modname:
killlist.append(item)
except IndexError: pass
for item in killlist:
self._contents.remove(item)
def removeModule(self,modname):
killlist = []
for item in self._contents:
try:
if isinstance(item,ConfigLineQuote) \
and item._row[0].lower()=='load' \
and item._row[1]==modname:
killlist.append(item)
except IndexError: pass
for item in killlist:
self._contents.remove(item)
def disableModule(self,modname):
self.removeModule(modname)
self._contents.append(ConfigLineQuote(None,['disable',modname]))
def addModule(self,modname):
self.removeModule(modname)
self._contents.append(ConfigLineQuote(None,['load',modname]))
############################################################################
class ModuleSubSection(SubSection):
_listattr = {"option" : OptionList}
############################################################################
class ModeSection(Section):
_attr = ["dotclock","htimings","vtimings","hskew","bcast","vscan"]
_quoteattr = ["flags"]
def __init__(self,comment,row):
Section.__init__(self,comment,row)
self._name = row[1]
def isEndSection(self,name):
return name.lower()=='endmode'
def toString(self,depth=0):
if self._comment is None:
return '%sMode "%s"\n%s%sEndMode\n' % \
(' ' * depth, self._name, ConfigContainer.toString(self,depth+1), ' ' * depth)
else:
return '%sMode "%s" # %s\n%s%sEndMode\n' % \
(' ' * depth, self._name, self._comment, ConfigContainer.toString(self,depth+1), ' ' * depth)
############################################################################
class ModeList(ConfigList):
name = "mode"
def __setitem__(self,key,value):
list.__setitem__(self,key,value)
def makeLine(self,comment,row):
return ModeLine(comment,row)
############################################################################
class ModeLineList(ConfigList):
name = "modeline"
def __setitem__(self,key,value):
list.__setitem__(self,key,value)
def makeLine(self,comment,row):
return ModeLineConfigLine(comment,row)
############################################################################
class MonitorSection(Section):
_attr = ["displaysize","horizsync","vertrefresh","gamma"]
_quoteattr = ["identifier","vendorname","modelname","usemodes"]
_listattr = {"option" : OptionList, "mode" : ModeList, "modeline" : ModeLineList}
def makeLine(self,comment,row):
return Section.makeLine(self,comment,row)
def isSection(self,name):
lname = name.lower()
return lname=='mode'
def isEndSection(self,name):
return name.lower()=='endsection'
def makeSection(self,comment,row):
if row[0].lower()=='mode':
return ModeSection(comment,row)
else:
return Section.makeSection(self,comment,row)
############################################################################
class ModeLineConfigLine(ConfigLine):
def toString(self,depth=0):
string = (' ' * depth)+"modeline "
if len(self._row)>0:
string += ' "' + self._row[0] + '"'
if len(self._row)>1:
string += ' ' + ' '.join([unicode(item) for item in self._row[1:]])
if self._comment is not None:
string += '#' + self._comment
return string + '\n'
############################################################################
class ModesSection(MonitorSection):
# Like a MonitorSection, only smaller.
_attr = ["modeline"]
_quoteattr = ["identifier"]
############################################################################
class PointerSection(Section):
_attr = ["emulate3timeout","baudrate","samplerate","resolution",\
"devicename","buttons"]
_quoteattr = ["protocol","device","port","emulate3buttons","chordmiddle",\
"cleardtr","clearrts","zaxismapping","alwayscore"]
############################################################################
class ScreenSection(Section):
_attr = ["screenno","defaultcolordepth","defaultdepth","defaultbpp","defaultfbbpp"]
_quoteattr = ["identifier","driver","device","monitor","videoadaptor","option"]
_listattr = {"option" : OptionList}
def makeSection(self,comment,row):
if row[1].lower()=='display':
return DisplaySubSection(comment,row)
return SubSection(comment,row)
############################################################################
class DisplaySubSection(SubSection):
_attr = ["viewport","virtual","black","white","depth","fbbpp","weight"]
_quoteattr = ["modes","visual","option"]
_listattr = {"option" : OptionList}
############################################################################
class ServerFlagsSection(Section):
_quoteattr = ["notrapsignals","dontzap","dontzoom","disablevidmodeextension",\
"allownonlocalxvidtune","disablemodindev","allownonlocalmodindev","allowmouseopenfail", \
"blanktime","standbytime","suspendtime","offtime","defaultserverlayout"]
_listattr = {"option" : OptionList}
############################################################################
class ServerLayoutSection(Section):
_attr = []
_quoteattr = ["identifier","inactive","inputdevice","option"]
_listattr = {"option" : OptionList, "screen" : ScreenConfigList}
############################################################################
class InputDeviceSection(Section):
_quoteattr = ["identifier","driver"]
_listattr = {"option" : OptionList}
############################################################################
class KeyboardSection(Section):
_attr = ["autorepeat","xleds"]
_quoteattr = ["protocol","panix106","xkbkeymap","xkbcompat","xkbtypes",\
"xkbkeycodes","xkbgeometry","xkbsymbols","xkbdisable","xkbrules",\
"xkbmodel","xkblayout","xkbvariant","xkboptions","vtinit","vtsysreq",\
"servernumlock","leftalt","rightalt","altgr","scrolllock","rightctl"]
############################################################################
class VendorSection(Section):
_attr = []
_quoteattr = ["identifier"]
_listattr = {"option" : OptionList}
def isSection(self,name): return False
############################################################################
class VideoAdaptorSection(Section):
_attr = []
_quoteattr = ["identifier","vendorname","boardname","busid","driver"]
_listattr = {"option" : OptionList}
def makeSection(self,comment,row):
return VideoPortSection(comment,row)
############################################################################
class VideoPortSection(SubSection):
_attr = []
_quoteattr = ["identifier"]
_listattr = {"option" : OptionList}
############################################################################
class XorgConfig(ConfigContainer):
_sectiontypes = { \
'device': DeviceSection,
'dri': DriSection,
'extensions': ExtensionsSection,
'files': FilesSection,
'inputdevice': InputDeviceSection,
'keyboard': KeyboardSection,
'modes': ModesSection,
'monitor': MonitorSection,
'module': ModuleSection,
'pointer': PointerSection,
'serverflags': ServerFlagsSection,
'serverlayout': ServerLayoutSection,
'screen': ScreenSection,
'videoadaptor': VideoAdaptorSection}
def makeSection(self,comment,row):
lname = row[1].lower()
try:
return self._sectiontypes[lname](comment,row)
except KeyError:
return ConfigContainer.makeSection(self,comment,row)
def toString(self,depth=-1):
return ConfigContainer.toString(self,depth)
def writeConfig(self,filename):
try:
encoding = locale.getpreferredencoding()
except locale.Error:
encoding = 'ANSI_X3.4-1968'
fhandle = codecs.open(filename,'w',locale.getpreferredencoding())
fhandle.write(self.toString())
fhandle.close()
def createUniqueIdentifier(self,stem="id"):
"""Create a unique identifier for a section
"""
# Build a list of used identifiers
used_identifiers = []
for name in ['monitor','videoadaptor','inputdevice','serverlayout','device','screen']:
for section in self.getSections(name):
if section.identifier is not None:
used_identifiers.append(section.identifier)
# Generate a identifier that is not in use.
i = 1
while (stem+str(i)) in used_identifiers:
i += 1
return stem+str(i)
############################################################################
def addxorg(context, stack):
# Add minimal xorg.conf if it's missing
rows = [[None, [u'Section', u'Device']], [None, [u'Identifier', u'Configured Video Device']], \
[None, [u'EndSection']], [None, [u'Section', u'Monitor']], \
[None, [u'Identifier', u'Configured Monitor']], \
[None, [u'EndSection']], [None, [u'Section', u'Screen']], \
[None, [u'Identifier', u'Default Screen']], \
[None, [u'Monitor', u'Configured Monitor']], [None, [u'EndSection']], \
[None, [u'Section', u'ServerLayout']], \
[None, [u'Identifier', u'Default Layout']], \
[None, [u'screen', u'Default Screen']], \
[None, [u'EndSection']]]
for data in rows:
rowcomment = data[0]
row = data[1]
try:
first = row[0].lower()
if context.isSection(first):
section = context.makeSection(rowcomment,row)
context.append(section)
stack.append(context)
context = section
context_class = context.__class__
elif context.isEndSection(first):
context = stack.pop()
elif context.isListAttr(first):
context.makeListAttr(rowcomment,row)
else:
newline = context.makeLine(rowcomment,row)
if newline is None:
raise ParseException,"Unknown line type '%s' on line %i" % (first,line)
context.append(newline)
except IndexError:
context.append(ConfigLine(rowcomment,row))
return context, section, stack, first
############################################################################
def addServerLayout(context, section, stack, first):
# Add empty server layout section to xorg.conf if it's missing
rows = [[None, [u'Section', u'ServerLayout']], \
[None, [u'Identifier', u'Default Layout']], \
[None, [u'screen', u'0', u'Default Screen', u'0', u'0']], \
[None, [u'Inputdevice', u'Generic Keyboard']], \
[None, [u'Inputdevice', u'Configured Mouse']], \
[None, []], ["Uncomment if you have a wacom tablet", []], \
["InputDevice \"stylus\" \"SendCoreEvents\"", []], \
[" InputDevice \"cursor\" \"SendCoreEvents\"", []], \
[" InputDevice \"eraser\" \"SendCoreEvents\"", []], \
[None, [u'Inputdevice', u'Synaptics Touchpad']], [None, [u'EndSection']]]
for data in rows:
rowcomment = data[0]
row = data[1]
try:
first = row[0].lower()
if context.isSection(first):
section = context.makeSection(rowcomment,row)
context.append(section)
stack.append(context)
context = section
context_class = context.__class__
elif context.isEndSection(first):
context = stack.pop()
elif context.isListAttr(first):
context.makeListAttr(rowcomment,row)
else:
newline = context.makeLine(rowcomment,row)
if newline is None:
raise ParseException,"Unknown line type '%s' on line %i" % (first,line)
context.append(newline)
except IndexError:
context.append(ConfigLine(rowcomment,row))
return context, section, stack, first
############################################################################
def readConfig(filename, check_exists=False):
context = XorgConfig()
stack = []
line = 1
hasserverlayout = False
hasxorg = True
try:
import os
try:
if os.path.isfile('/etc/X11/xorg.conf'):
if os.path.getsize(filename) == 0:
raise IOError, "xorg.conf is empty - making up config"
else:
raise IOError, "xorg.conf is empty - making up config"
except OSError, errmsg:
raise IOError, errmsg
for row in XorgconfCVSReader(filename=filename).readlines():
try:
first = row[0].lower()
if context.isSection(first):
section = context.makeSection(row.comment,row)
if section._name == 'ServerLayout':
hasserverlayout = True
context.append(section)
stack.append(context)
context = section
context_class = context.__class__
elif context.isEndSection(first):
context = stack.pop()
elif context.isListAttr(first):
context.makeListAttr(row.comment,row)
else:
newline = context.makeLine(row.comment,row)
if newline is None:
raise ParseException,"Unknown line type '%s' on line %i" % (first,line)
context.append(newline)
except IndexError:
context.append(ConfigLine(row.comment,row))
line += 1
except IOError, errmsg:
ermsg = str(errmsg)
print "IOError", ermsg, " - will create xorg.conf if possible."
if ermsg[:9] == "[Errno 2]": # No such file or directory:
hasxorg = False
addxorg(context, stack)
try:
xorgfile = open(filename, 'a')
xorgfile.close()
except IOError, errmsg:
ermsg = str(errmsg)
if ermsg[:9] == "[Errno 13]": #Permission denied:
pass
# Since we aren't root, changes can't be made anyway.
elif ermsg[:9] == "xorg.conf": # xorg.conf exists, but is empty
hasxorg = False
addxorg(context, stack)
if len(stack)!=0:
raise ParseException,"Unexpected end of file on line %i" % line
if not hasserverlayout and hasxorg:
addServerLayout(context, section, stack, first)
if check_exists:
return context, hasxorg
else:
return context
############################################################################
class ParseException(Exception):
def __init__(self,*args):
Exception.__init__(self,*args)
############################################################################
def toBoolean(value):
return unicode(value).lower() in ['on','true','1','yes']
############################################################################
# Our own class for reading CSV file. This version supports unicode while
# standard Python (2.4) version doesn't. Hence the need for this class.
#
class XorgconfCVSReader(object):
def __init__(self,filename=None, text=None):
assert filename is not None or text is not None
STATE_DELIMITER = 0
STATE_ITEM = 1
STATE_QUOTE = 2
QUOTE = '"'
LINE_COMMENT = '#'
class CommentList(list):
def __init__(self):
list.__init__(self)
self.comment = None
if filename is not None:
try:
loc = locale.getpreferredencoding()
except locale.Error:
loc = 'ANSI_X3.4-1968'
fhandle = codecs.open(filename,'r',loc,'replace')
source_lines = fhandle.readlines()
fhandle.close()
else:
source_lines = text.split('\n')
self.lines = []
for line in source_lines:
if len(line)!=0 and line[-1]=='\n':
line = line[:-1]
state = STATE_DELIMITER
row = CommentList()
item = None
for i in range(len(line)):
c = line[i]
if state==STATE_DELIMITER:
if not c.isspace():
if c==QUOTE:
item = []
state = STATE_QUOTE
elif c==LINE_COMMENT:
row.comment = line[i+1:]
break
else:
item = []
item.append(c)
state = STATE_ITEM
elif state==STATE_ITEM:
if c.isspace():
row.append(u''.join(item))
state = STATE_DELIMITER
item = None
else:
item.append(c)
elif state==STATE_QUOTE:
if c==QUOTE:
row.append(u''.join(item))
state = STATE_DELIMITER
item = None
else:
item.append(c)
if item is not None:
row.append(u''.join(item))
self.lines.append(row)
def readlines(self):
return self.lines
############################################################################
if __name__=='__main__':
import sys
if len(sys.argv)==2:
filename = sys.argv[1]
else:
filename = "/etc/X11/xorg.conf"
print "Reading",filename
c = readConfig(filename)
print c.toString()

@ -0,0 +1,555 @@
<?xml version="1.0" ?>
<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.1.2-Based Variant V1.1//EN" "dtd/kdex.dtd" [
<!ENTITY guidance "<application>guidance 0.4</application>">
<!ENTITY kappname "&guidance;"><!-- Do *not* replace kappname-->
<!ENTITY package "kde-module"><!-- kdebase, kdeadmin, etc -->
<!ENTITY % addindex "IGNORE">
<!ENTITY % English "INCLUDE"><!-- change language only here -->
<!-- Do not define any other entities; instead, use the entities
from kde-genent.entities and $LANG/user.entities. -->
]>
<!-- kdoctemplate v0.8 October 1 1999
Minor update to "Credits and Licenses" section on August 24, 2000
Removed "Revision history" section on 22 January 2001
Changed to Installation/Help menu entities 18 October 2001
Other minor cleanup and changes 18 October 2001 -->
<!--
This template was designed by: David Rugge davidrugge@mindspring.com
with lots of help from: Eric Bischoff ebisch@cybercable.tm.fr
and Frederik Fouvry fouvry@sfs.nphil.uni-tuebingen.de
of the KDE DocBook team.
You may freely use this template for writing any sort of KDE documentation.
If you have any changes or improvements, please let us know.
Remember:
- in XML, the case of the <tags> and attributes is relevant ;
- also, quote all attributes.
Please don't forget to remove all these comments in your final documentation,
thanks ;-).
-->
<!-- ................................................................ -->
<!-- The language must NOT be changed here. -->
<book lang="&language;">
<!-- This header contains all of the meta-information for the document such
as Authors, publish date, the abstract, and Keywords -->
<bookinfo>
<title>The &guidance; Handbook</title>
<authorgroup>
<author>
<firstname></firstname>
<othername></othername>
<surname>Simon Edwards</surname>
<affiliation>
<address><email>simon@simonzone.com</email></address>
</affiliation>
</author>
</authorgroup>
<!-- TRANS:ROLES_OF_TRANSLATORS -->
<copyright>
<year>1999</year>
<year>%{YEAR}</year>
<holder>Simon Edwards</holder>
</copyright>
<!-- Translators: put here the copyright notice of the translation -->
<!-- Put here the FDL notice. Read the explanation in fdl-notice.docbook
and in the FDL itself on how to use it. -->
<legalnotice>&FDLNotice;</legalnotice>
<!-- Date and version information of the documentation
Don't forget to include this last date and this last revision number, we
need them for translation coordination !
Please respect the format of the date (YYYY-MM-DD) and of the version
(V.MM.LL), it could be used by automation scripts.
Do NOT change these in the translation. -->
<date>2001-10-18</date>
<releaseinfo>0.1</releaseinfo>
<!-- Abstract about this handbook -->
<abstract>
<para>
&guidance; is an application specially designed to do nothing you would
ever want.
</para>
</abstract>
<!-- This is a set of Keywords for indexing by search engines.
Please at least include KDE, the KDE package it is in, the name
of your application, and a few relevant keywords. -->
<keywordset>
<keyword>KDE</keyword>
<keyword>testapp</keyword>
<keyword>nothing</keyword>
<keyword>nothing else</keyword>
</keywordset>
</bookinfo>
<!-- The contents of the documentation begin here. Label
each chapter so with the id attribute. This is necessary for two reasons: it
allows you to easily reference the chapter from other chapters of your
document, and if there is no ID, the name of the generated HTML files will vary
from time to time making it hard to manage for maintainers and for the CVS
system. Any chapter labelled (OPTIONAL) may be left out at the author's
discretion. Other chapters should not be left out in order to maintain a
consistent documentation style across all KDE apps. -->
<chapter id="introduction">
<title>Introduction</title>
<!-- The introduction chapter contains a brief introduction for the
application that explains what it does and where to report
problems. Basically a long version of the abstract. Don't include a
revision history. (see installation appendix comment) -->
<para>
&guidance; is a program that lets you do absolutely nothing. Please report
any problems or feature requests to the &kde; mailing lists.
</para>
</chapter>
<chapter id="using-testapp">
<title>Using &guidance;</title>
<!-- This chapter should tell the user how to use your app. You should use as
many sections (Chapter, Sect1, Sect3, etc...) as is necessary to fully document
your application. -->
<para>
<!-- Note that all graphics should be in .png format. Use no gifs because of
patent issues. -->
<screenshot>
<screeninfo>Here's a screenshot of &guidance;</screeninfo>
<mediaobject>
<imageobject>
<imagedata fileref="screenshot.png" format="PNG"/>
</imageobject>
<imageobject>
<imagedata fileref="screenshot.eps" format="EPS"/>
</imageobject>
<textobject>
<phrase>Screenshot</phrase>
</textobject>
</mediaobject>
</screenshot>
</para>
<sect1 id="testapp-features">
<title>More &guidance; features</title>
<para>It slices! It dices! and it comes with a free toaster!</para>
<para>
The Squiggle Tool <guiicon><inlinemediaobject>
<imageobject>
<imagedata fileref="squiggle.png" format="PNG"/>
</imageobject>
<imageobject>
<imagedata fileref="squiggle.eps" format="EPS"/>
</imageobject>
<textobject>
<phrase>Squiggle</phrase>
</textobject>
</inlinemediaobject></guiicon> is used to draw squiggly lines all over
the &guidance; main window. It's not a bug, it's a feature!
</para>
</sect1>
</chapter>
<chapter id="commands">
<title>Command Reference</title>
<!-- (OPTIONAL, BUT RECOMMENDED) This chapter should list all of the
application windows and their menubar and toolbar commands for easy reference.
Also include any keys that have a special function but have no equivalent in the
menus or toolbars. This may not be necessary for small apps or apps with no tool
or menu bars. -->
<sect1 id="testapp-mainwindow">
<title>The main &guidance; window</title>
<sect2>
<title>The File Menu</title>
<para>
<variablelist>
<varlistentry>
<term><menuchoice>
<shortcut>
<keycombo action="simul">&Ctrl;<keycap>N</keycap></keycombo>
</shortcut>
<guimenu>File</guimenu>
<guimenuitem>New</guimenuitem>
</menuchoice></term>
<listitem><para><action>Creates a new document</action></para></listitem>
</varlistentry>
<varlistentry>
<term><menuchoice>
<shortcut>
<keycombo action="simul">&Ctrl;<keycap>S</keycap></keycombo>
</shortcut>
<guimenu>File</guimenu>
<guimenuitem>Save</guimenuitem>
</menuchoice></term>
<listitem><para><action>Saves the document</action></para></listitem>
</varlistentry>
<varlistentry>
<term><menuchoice>
<shortcut>
<keycombo action="simul">&Ctrl;<keycap>Q</keycap></keycombo>
</shortcut>
<guimenu>File</guimenu>
<guimenuitem>Quit</guimenuitem>
</menuchoice></term>
<listitem><para><action>Quits</action> &guidance;</para></listitem>
</varlistentry>
</variablelist>
</para>
</sect2>
<sect2>
<title>The <guimenu>Help</guimenu> Menu</title>
<!-- Assuming you have a standard help menu (help, what's this, about -->
<!-- &guidance;, about KDE) then the documentation is already written. -->
<!-- The following entity is valid anywhere that a variablelist is -->
<!-- valid. -->
&help.menu.documentation;
</sect2>
</sect1>
</chapter>
<chapter id="developers">
<title>Developer's Guide to &guidance;</title>
<!-- (OPTIONAL) A Programming/Scripting reference chapter should be
used for apps that use plugins or that provide their own scripting hooks
and/or development libraries. -->
<para>
Programming &guidance; plugins is a joy to behold. Just read through the next
66 pages of API's to learn how!
</para>
<!-- Use refentries to describe APIs. Refentries are fairly complicated and you
should consult the docbook reference for further details. The example below was
taken from that reference and shortened a bit for readability. -->
<refentry id="re-1007-unmanagechildren-1">
<refmeta>
<refentrytitle>XtUnmanageChildren</refentrytitle>
<refmiscinfo>Xt - Geometry Management</refmiscinfo>
</refmeta>
<refnamediv>
<refname>XtUnmanageChildren
</refname>
<refpurpose>remove a list of children from a parent widget's managed
list.
<indexterm id="ix-1007-unmanagechildren-1"><primary>widgets</primary><secondary>removing</secondary></indexterm>
<indexterm id="ix-1007-unmanagechildren-2"><primary>XtUnmanageChildren</primary></indexterm>
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>4 March 1996</date>
</refsynopsisdivinfo>
<synopsis>
void XtUnmanageChildren(<replaceable class="parameter">children</replaceable>, <replaceable class="parameter">num_children</replaceable>)
WidgetList <replaceable class="parameter">children</replaceable>;
Cardinal <replaceable class="parameter">num_children</replaceable>;
</synopsis>
<refsect2 id="r2-1007-unmanagechildren-1">
<title>Inputs</title>
<variablelist>
<varlistentry>
<term><replaceable class="parameter">children</replaceable>
</term>
<listitem>
<para>Specifies an array of child widgets. Each child must be of
class RectObj or any subclass thereof.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">num_children</replaceable>
</term>
<listitem>
<para>Specifies the number of elements in <replaceable class="parameter">children</replaceable>.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect2></refsynopsisdiv>
<refsect1 id="r1-1007-unmanagechildren-1">
<title>Description
</title>
<para><function>XtUnmanageChildren()</function> unmaps the specified widgets
and removes them from their parent's geometry management.
The widgets will disappear from the screen, and (depending
on its parent) may no longer have screen space allocated for
them.
</para>
<para>Each of the widgets in the <replaceable class="parameter">children</replaceable> array must have
the same parent.
</para>
<para>See the &ldquo;Algorithm&rdquo; section below for full details of the
widget unmanagement procedure.
</para>
</refsect1>
<refsect1 id="r1-1007-unmanagechildren-2">
<title>Usage</title>
<para>Unmanaging widgets is the usual method for temporarily
making them invisible. They can be re-managed with
<function>XtManageChildren()</function>.
</para>
<para>You can unmap a widget, but leave it under geometry
management by calling <function>XtUnmapWidget()</function>. You can
destroy a widget's window without destroying the widget by
calling <function>XtUnrealizeWidget()</function>. You can destroy a
widget completely with <function>XtDestroyWidget()</function>.
</para>
<para>If you are only going to unmanage a single widget, it is
more convenient to call <function>XtUnmanageChild()</function>. It is
often more convenient to call <function>XtUnmanageChild()</function>
several times than it is to declare and initialize an array
of widgets to pass to <function>XtUnmanageChildren()</function>. Calling
<function>XtUnmanageChildren()</function> is more efficient, however,
because it only calls the parent's <function>change_managed()</function>
method once.
</para>
</refsect1>
<refsect1 id="r1-1007-unmanagechildren-3">
<title>Algorithm
</title>
<para><function>XtUnmanageChildren()</function> performs the following:
</para>
<variablelist>
<varlistentry>
<term>-
</term>
<listitem>
<para>Ignores the child if it already is unmanaged or is being
destroyed.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-
</term>
<listitem>
<para>Otherwise, if the child is realized, it makes it nonvisible
by unmapping it.
</para>
</listitem>
</varlistentry>
</variablelist>
<para>
</para>
</refsect1>
<refsect1 id="r1-1007-unmanagechildren-4">
<title>Structures</title>
<para>The <type>WidgetList</type> type is simply an array of widgets:
</para>
<screen id="sc-1007-unmanagechildren-1">typedef Widget *WidgetList;
</screen>
</refsect1>
</refentry>
</chapter>
<chapter id="faq">
<title>Questions and Answers</title>
<!-- (OPTIONAL but recommended) This chapter should include all of the silly
(and not-so-silly) newbie questions that fill up your mailbox. This chapter
should be reserved for BRIEF questions and answers! If one question uses more
than a page or so then it should probably be part of the
"Using this Application" chapter instead. You should use links to
cross-reference questions to the parts of your documentation that answer them.
This is also a great place to provide pointers to other FAQ's if your users
must do some complicated configuration on other programs in order for your
application work. -->
&reporting.bugs;
&updating.documentation;
<qandaset id="faqlist">
<qandaentry>
<question>
<para>My Mouse doesn't work. How do I quit &guidance;?</para>
</question>
<answer>
<para>You silly goose! Check out the <link linkend="commands">Commands
Section</link> for the answer.</para>
</answer>
</qandaentry>
<qandaentry>
<question>
<para>Why can't I twiddle my documents?</para>
</question>
<answer>
<para>You can only twiddle your documents if you have the foobar.lib
installed.</para>
</answer>
</qandaentry>
</qandaset>
</chapter>
<chapter id="credits">
<!-- Include credits for the programmers, documentation writers, and
contributors here. The license for your software should then be included below
the credits with a reference to the appropriate license file included in the KDE
distribution. -->
<title>Credits and License</title>
<para>
&guidance;
</para>
<para>
Program copyright %{YEAR} Simon Edwards <email>simon@simonzone.com</email>
</para>
<para>
Contributors:
<itemizedlist>
<listitem><para>Konqui the KDE Dragon <email>konqui@kde.org</email></para>
</listitem>
<listitem><para>Tux the Linux Penguin <email>tux@linux.org</email></para>
</listitem>
</itemizedlist>
</para>
<para>
Documentation copyright %{YEAR} Simon Edwards <email>simon@simonzone.com</email>
</para>
<!-- TRANS:CREDIT_FOR_TRANSLATORS -->
&underFDL; <!-- FDL: do not remove -->
<!-- Determine which license your application is licensed under,
and delete all the remaining licenses below:
(NOTE: All documentation are licensed under the FDL,
regardless of what license the application uses) -->
&underGPL; <!-- GPL License -->
&underBSDLicense; <!-- BSD License -->
&underArtisticLicense; <!-- BSD Artistic License -->
&underX11License; <!-- X11 License -->
</chapter>
<appendix id="installation">
<title>Installation</title>
<sect1 id="getting-testapp">
<title>How to obtain &guidance;</title>
<!-- This first entity contains boiler plate for applications that are
part of KDE CVS. You should remove it if you are releasing your
application -->
&install.intro.documentation;
</sect1>
<sect1 id="requirements">
<title>Requirements</title>
<!--
List any special requirements for your application here. This should include:
.Libraries or other software that is not included in kdesupport,
kdelibs, or kdebase.
.Hardware requirements like amount of RAM, disk space, graphics card
capabilities, screen resolution, special expansion cards, etc.
.Operating systems the app will run on. If your app is designed only for a
specific OS, (you wrote a graphical LILO configurator for example) put this
information here.
-->
<para>
In order to successfully use &guidance;, you need &kde; 1.1. Foobar.lib is
required in order to support the advanced &guidance; features. &guidance; uses
about 5 megs of memory to run, but this may vary depending on your
platform and configuration.
</para>
<para>
All required libraries as well as &guidance; itself can be found
on <ulink url="ftp://ftp.testapp.org">The &guidance; home page</ulink>.
</para>
<!-- For a list of updates, you may refer to the application web site
or the ChangeLog file, or ... -->
<para>
You can find a list of changes at <ulink
url="http://apps.kde.org/testapp">http://apps.kde.org/testapp</ulink>.
</para>
</sect1>
<sect1 id="compilation">
<title>Compilation and Installation</title>
<!-- This entity contains the boilerplate text for standard -->
<!-- compilation instructions. If your application requires any -->
<!-- special handling, remove it, and replace with your own text. -->
&install.compile.documentation;
</sect1>
<sect1 id="configuration">
<title>Configuration</title>
<para>Don't forget to tell your system to start the <filename>dtd</filename>
dicer-toaster daemon first, or &guidance; won't work !</para>
</sect1>
</appendix>
&documentation.index;
</book>
<!--
Local Variables:
mode: sgml
sgml-minimize-attributes:nil
sgml-general-insert-case:lower
sgml-indent-step:0
sgml-indent-data:nil
End:
vim:tabstop=2:shiftwidth=2:expandtab
-->

@ -0,0 +1,49 @@
[Desktop Entry]
Name=Boot Loader Configuration
Name[el]=Ρύθμιση φορτωτή εκκίνησης συστήματος
Name[es]=Configuración del cargador de arranque
Name[et]=Alglaaduri seadistamine
Name[it]=Configurazione dell'avviamento del sistema
Name[ja]=ブートローダの設定
Name[nl]=Bootloaderconfiguratie
Name[pt]=Configuração do Gestor de Arranque
Name[pt_BR]=Configuração do Gerenciador de Inicialização
Name[sr]=Подешавање подизања система
Name[sr@Latn]=Podešavanje podizanja sistema
Name[sv]=Startprograminställning
Name[xx]=xxBoot Loader Configurationxx
Comment=Boot Options Management
Comment[el]=Διαχείριση επιλογών εκκίνησης συστήματος
Comment[es]=Administración de las opciones de arranque
Comment[et]=Alglaadimise võtmete haldamine
Comment[it]=Gestione delle opzioni di avviamento del sistema
Comment[ja]=起動オプションの管理
Comment[nl]=Opstartopties beheren
Comment[pt]=Gestão das Opções de Arranque
Comment[pt_BR]=Gerenciamento das Opções de Inicialização
Comment[sr]=Управљање опцијама бутовања
Comment[sr@Latn]=Upravljanje opcijama butovanja
Comment[sv]=Hantering av startalternativ
Comment[xx]=xxBoot Options Managementxx
Icon=grubconfig.png
Encoding=UTF-8
X-KDE-ModuleType=Library
X-KDE-Library=grubconfig
X-KDE-FactoryName=grubconfig
X-KDE-RootOnly=true
Type=Application
Exec=kcmshell System/grubconfig
Categories=Qt;KDE;X-KDE-settings-system;
GenericName=Boot Loader Configuration
GenericName[el]=Ρυθμίσεις φορτωτή εκκίνησης συστήματος
GenericName[es]=Configuración del cargador de arranque
GenericName[et]=Alglaaduri seadistamine
GenericName[it]=Configurazione dell'avviamento del sistema
GenericName[ja]=ブートローダの設定
GenericName[nl]=Bootloaderconfiguratie
GenericName[pt]=Configuração do Gestor de Arranque
GenericName[pt_BR]=Configuração do Gerenciador de Inicialização
GenericName[sr]=Подешавање подизања система
GenericName[sr@Latn]=Podešavanje podizanja sistema
GenericName[sv]=Inställning av startprogram
GenericName[xx]=xxBoot Loader Configurationxx

@ -0,0 +1,697 @@
#!/usr/bin/python
# -*- coding: UTF-8 -*-
###########################################################################
# grubconfig.py - description #
# ------------------------------ #
# begin : Sun Dec 10 2006 #
# copyright : (C) 2006-2007 by Martin Böhm #
# email : martin.bohm@kubuntu.org #
# #
###########################################################################
# #
# 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. #
# #
###########################################################################
from qt import *
from kdeui import *
from kdecore import *
from kfile import *
import sys, os, string, re
import os.path
import shutil
import locale
import tempfile
programname = "Boot Loader Configuration"
version = "0.0.2"
standalone = __name__=='__main__'
if standalone:
programbase = KDialogBase
else:
programbase = KCModule
parsable = ["default","menu","color","timeout","hiddenmenu","title","root","kernel","initrd"]
cat1 = ["default","menu","color","timeout","hiddenmenu","root","initrd"]
cat2 = ["savedefault","makeactive","chainloader"]
cat3 = ["kernel"]
class GreyListViewItem(KListViewItem):
def paintCell(self, p, cg, column, width, align ):
cgGrey = cg
cgGrey.setColor(QColorGroup.Text,QColor("grey"))
KListViewItem.paintCell(self, p, cgGrey, column, width, align)
cg.restore()
class BoldListViewItem(KListViewItem):
def paintCell(self, p, cg, column, width, align ):
p.save()
f = p.font()
f.setBold(True)
KListViewItem.paintCell(self, p, cg, column, width, align)
p.restore()
class GrubConfigAppClass(programbase):
def __init__(self,parent=None,name=None):
if standalone:
KDialogBase.__init__(self,KJanusWidget.Tabbed,i18n("Boot Loader Configuration"),
KDialogBase.Help|KDialogBase.Ok|KDialogBase.Close, KDialogBase.Close)
# no need to include About button yet
self.menulstlocation = "/boot/grub/menu.lst"
self.readfilename = self.menulstlocation
self.globalvars = {}
self.itemslist = []
#--- Load menu.lst using the load_menulst() method
self.load_menulst()
print self.globalvars
print self.itemslist
# - GRUB Options Tab -
if standalone:
usershbox = self.addHBoxPage(i18n("Grub Options"))
vbox = QVBox(usershbox)
else:
vbox = QVBox(tabcontrol)
vbox.setMargin(KDialog.marginHint())
# -- Operating Systems List & MakeDefault Button --
horizontalbox = QHBox(vbox)
self.itemslistview = KListView(horizontalbox)
self.itemslistview.addColumn("")
self.itemslistview.setSorting(-1)
self.itemslistview.header().hide()
self.itemslistviewitems = []
arrowsbox = QVBox(horizontalbox)
self.upbutton = KPushButton(i18n("Move Up"),arrowsbox)
self.connect(self.upbutton,SIGNAL("clicked()"),self.slotUpButtonClicked)
self.downbutton = KPushButton(i18n("Move Down"),arrowsbox)
self.connect(self.downbutton,SIGNAL("clicked()"),self.slotDownButtonClicked)
self.defaultbutton = KPushButton(i18n("Make Default"),vbox)
self.connect(self.defaultbutton,SIGNAL("clicked()"),self.slotSetDefaultButtonClicked)
# -- Boot Options Group Box --
bootoptionsbasebox = QVGroupBox(vbox,"Boot Options")
bootoptionsbasebox.setTitle(i18n("Boot Options"));
bootoptionsbasevbox = QWidget(bootoptionsbasebox)
infogrid = QGridLayout(bootoptionsbasevbox,3,2)
infogrid.setSpacing(KDialog.spacingHint())
# --- Timeout ---
label = QLabel(i18n("Timeout:"),bootoptionsbasevbox)
infogrid.addWidget(label,0,0)
timeoutbox = QHBox(bootoptionsbasevbox)
timeoutbox.setSpacing(KDialog.spacingHint())
self.timeout = KIntSpinBox(timeoutbox,"Timeout")
if "timeout" in self.globalvars:
self.timeout.setValue(int(self.globalvars['timeout'][0]))
label = QLabel(i18n("seconds"),timeoutbox)
infogrid.addWidget(timeoutbox,0,1)
infogrid.addWidget(self.timeout,0,1)
# --- Hide Menu on Boot ---
self.hidemenuonboot = QCheckBox(i18n("Hide Menu on Boot"),bootoptionsbasevbox)
if 'hiddenmenu' in self.globalvars:
self.hidemenuonboot.setChecked(int(self.globalvars['hiddenmenu'][0]))
infogrid.addWidget(self.hidemenuonboot,1,1)
# --- Make Last OS Default ---
self.lastdefault = QCheckBox(i18n("Make Last Operating System Default"),bootoptionsbasevbox)
infogrid.addWidget(self.lastdefault,2,1)
# -- Security Group Box --
securitybox = QVGroupBox(vbox,"Security")
securitybox.setTitle(i18n("Security"));
securityvbox = QWidget(securitybox)
infogrid = QGridLayout(securityvbox,2,2)
infogrid.setSpacing(KDialog.spacingHint())
# --- Password ---
label = QLabel(i18n("Password:"),securityvbox)
infogrid.addWidget(label,0,0)
self.userpassword = KPasswordEdit(securityvbox)
infogrid.addWidget(self.userpassword,0,1)
# --- Repeat Password ---
label = QLabel(i18n("Repeat Password:"),securityvbox)
infogrid.addWidget(label,1,0)
self.userrepeatpassword = KPasswordEdit(securityvbox)
infogrid.addWidget(self.userrepeatpassword,1,1)
# -- Splash Screen Group Box --
splashbox = QVGroupBox(vbox,"Splash screen")
splashbox.setTitle(i18n("Splash screen"));
# --- Background Color ---
labelandeditbox = QHBox(splashbox)
label = QLabel(i18n("Background Color:"),labelandeditbox)
self.backgroundcolor = QComboBox(labelandeditbox)
# --- Highlight Color ---
labelandeditbox = QHBox(splashbox)
label = QLabel(i18n("Highlight Color:"),labelandeditbox)
self.highlightcolor = QComboBox(labelandeditbox)
# - Operating Systems Tab -
if standalone:
groupsvbox = self.addVBoxPage(i18n("Operating Systems"))
vb = QVBox(groupsvbox)
else:
groupsvbox = QVBox(tabcontrol)
roupsvbox.setMargin(KDialog.marginHint())
vb = QVBox(groupsvbox)
# -- Operating Systems List --
horizontalbox = QHBox(vb)
self.oslistview = KListView(horizontalbox)
self.oslistview.addColumn("")
self.oslistview.addColumn("")
self.oslistview.setSorting(-1)
self.oslistview.header().hide()
self.oslistviewitems = []
self.connect(self.oslistview,SIGNAL("selectionChanged()"),self.oslistviewitemSelected)
# -- Operating Systems Details Box --
osdetailsbox = QVGroupBox(vb,"Operating System Details")
# label = QLabel(i18n("Security"),securitybox)
detailsvbox = QWidget(osdetailsbox)
infogrid = QGridLayout(detailsvbox,7,2)
infogrid.setSpacing(KDialog.spacingHint())
osdetailsbox.setTitle(i18n("Operating System Details"));
# --- List in GRUB Menu ---
self.listingrub = QCheckBox(i18n("List in GRUB Menu"),detailsvbox)
infogrid.addWidget(self.listingrub,0,1)
# --- Display Name ---
label = QLabel(i18n("Display Name:"),detailsvbox)
infogrid.addWidget(label,1,0)
self.displaynamelabel = QLineEdit("",detailsvbox)
infogrid.addWidget(self.displaynamelabel,1,1)
self.connect(self.displaynamelabel,SIGNAL("textChanged(const QString &)"),self.slotDisplayNameLabelChanged)
# --- Operating System ---
label = QLabel(i18n("Operating System:"),detailsvbox)
infogrid.addWidget(label,2,0)
self.operatingsystem = QComboBox(detailsvbox)
infogrid.addWidget(self.operatingsystem,2,1)
# --- Kernel ---
label = QLabel(i18n("Kernel:"),detailsvbox)
infogrid.addWidget(label,3,0)
self.kernel = KURLRequester(detailsvbox)
infogrid.addWidget(self.kernel,3,1)
# --- Failsafe Kernel ---
# not sure if that is possible - requested by seele
label = QLabel(i18n("Failsafe Kernel:"),detailsvbox)
infogrid.addWidget(label,4,0)
self.failsafekernel = QComboBox(detailsvbox)
infogrid.addWidget(self.failsafekernel,4,1)
# --- Initial RAM Disk ---
label = QLabel(i18n("Initial RAM Disk:"),detailsvbox)
infogrid.addWidget(label,5,0)
self.initrd = KURLRequester(detailsvbox)
infogrid.addWidget(self.initrd,5,1)
# --- Root Filesystem ---
label = QLabel(i18n("Root Filesystem:"),detailsvbox)
infogrid.addWidget(label,6,0)
self.rootfilesystem = QComboBox(detailsvbox)
infogrid.addWidget(self.rootfilesystem,6,1)
# -- Boot Options Box --
bootoptionsbox = QVGroupBox(vb,"Boot Options")
# label = QLabel(i18n("Security"),securitybox)
bootoptionsbox.setTitle(i18n("Boot Options"));
self.acpibox = QCheckBox(i18n("Power Management (ACPI) "),bootoptionsbox)
self.debugbox = QCheckBox(i18n("Debugging Messages "),bootoptionsbox)
self.selinuxbox = QCheckBox(i18n("SELinux Support "),bootoptionsbox)
self.splashbox = QCheckBox(i18n("Splash Screen"),bootoptionsbox)
labelandeditbox = QHBox(bootoptionsbox)
label = QLabel(i18n("Custom Options:"),labelandeditbox)
self.customoptions = KLineEdit("",labelandeditbox)
# -- (static) UI finished --
self.reloadListViews("oslist")
self.reloadListViews("itemslist")
try:
self.oslistview.setSelected(self.oslistviewitems[int(self.globalvars['default'][0])],True)
except ValueError:
self.oslistview.setSelected(self.oslistviewitems[0],True)
ops_list = self.load_osprobe()
print ops_list # mhb debug
#######################################################################
# reload listviews, because they have changed
def reloadListViews(self,name):
print "reloaded"
# you should repaint the one that is not changed on screen
if name == "oslist":
self.oslistview.clear()
for item in self.itemslist:
try:
if self.itemslist.index(item) == int(self.globalvars['default'][0]):
self.oslistviewitems.append(BoldListViewItem(self.oslistview,self.oslistview.lastItem(),item['title'][0]))
else:
self.oslistviewitems.append(KListViewItem(self.oslistview,self.oslistview.lastItem(),item['title'][0]))
except ValueError:
self.oslistviewitems.append(KListViewItem(self.oslistview,self.oslistview.lastItem(),item['title'][0]))
# if it has a root option (other than 1 which means only root by itself), it is an OS
else:
self.itemslistview.clear()
#repaint main list
for item in self.itemslist:
try:
if self.itemslist.index(item) == int(self.globalvars['default'][0]):
print "bam!"
self.itemslistviewitems.append(BoldListViewItem(self.itemslistview,self.itemslistview.lastItem(),item['title'][0]))
else:
self.itemslistviewitems.append(KListViewItem(self.itemslistview,self.itemslistview.lastItem(),item['title'][0]))
except ValueError:
self.itemslistviewitems.append(KListViewItem(self.itemslistview,self.itemslistview.lastItem(),item['title'][0]))
#######################################################################
def slotUser1(self):
self.aboutus.show()
#######################################################################
# def slotClose(self):
# self.close()
#######################################################################
def slotOk(self):
self.save_menulst()
# mhb TODO: catching exceptions here would be useful
self.close()
#######################################################################
def slotCheckOsClicked(self):
self.OsProbedList = self.load_osprobe()
#######################################################################
def oslistviewitemSelected(self):
# save current item changes & select another one
i = self.oslistviewitems.index(self.oslistview.selectedItem())
self.updatingGUI = True
self.displaynamelabel.setText(self.itemslist[i]["title"][0])
# visible in GRUB reload
# kernel reload
try:
self.kernel.setURL(self.itemslist[i]["kernel"][0])
except KeyError:
self.initrd.setURL("unavailable") # mhb debug
# initrd reload
try:
self.initrd.setURL(self.itemslist[i]["initrd"][0])
except KeyError:
self.initrd.setURL("unavailable") # mhb debug
# custom options reload
customoptions = ""
for word in self.itemslist[i]["kernel"][1:-1]:
customoptions += word + " "
self.customoptions.setText(customoptions[:-1])
self.updatingGUI = False
print "oslistview item selected" #mhb debug
pass
#######################################################################
def slotDisplayNameLabelChanged(self, string):
if(self.updatingGUI == False):
print "display name changed" #mhb debug
i = self.oslistviewitems.index(self.oslistview.selectedItem())
self.itemslist[i]["title"][0] = string
self.oslistview.selectedItem().setText(0,string)
self.reloadListViews("itemslist")
pass
#######################################################################
def slotUpButtonClicked(self):
print "UpButton clicked" #mhb debug
i = self.itemslistviewitems.index(self.itemslistview.selectedItem())
self.itemslistview.selectedItem().itemAbove().moveItem(self.itemslistview.selectedItem())
# itemslist should have the same i for the same option
if(i != 0):
container = self.itemslist[i]
self.itemslist[i] = self.itemslist[i-1]
self.itemslist[i-1] = container
self.reloadListViews("oslist")
return "not working yet"
#######################################################################
def slotDownButtonClicked(self):
print "DownButton clicked" #mhb debug
i = self.itemslistviewitems.index(self.itemslistview.selectedItem())
self.itemslistview.selectedItem().moveItem(self.itemslistview.selectedItem().itemBelow())
if(i != len(self.itemslist)-1):
container = self.itemslist[i]
self.itemslist[i] = self.itemslist[i+1]
self.itemslist[i+1] = container
self.reloadListViews("oslist")
return "not working yet"
#######################################################################
def slotSetDefaultButtonClicked(self):
print "SetDefaultButton cliicked" #mhb debug
try:
defaultn = int(self.globalvars["default"][0])
except ValueError:
pass
else:
container = self.itemslistviewitems[defaultn]
self.itemslistviewitems[defaultn] = KListViewItem(self.itemslistview,container,self.itemslist[defaultn]['title'][0])
self.itemslistview.takeItem(container)
indexn = self.itemslistviewitems.index(self.itemslistview.selectedItem())
self.globalvars["default"] = str(indexn)
self.itemslistviewitems[indexn] = BoldListViewItem(self.itemslistview,self.itemslistview.selectedItem(),self.itemslist[indexn]['title'][0])
self.itemslistview.takeItem(self.itemslistview.selectedItem())
self.reloadListViews("oslist")
return "not working yet"
#######################################################################
# loop
def exec_loop(self):
global programbase
# self.__loadOptions()
self.updatingGUI = True
#self.__updateUserList()
#self.__updateGroupList()
self.updatingGUI = False
programbase.exec_loop(self)
print "done"
#######################################################################
# loads menu.lst
# NOT YET parsing:
#  fallback
# currently parsing: (type of the location number)
# default <int>
# timeout <int>
# hiddenmenu <int>
# color <int>
#  password (consider an md5 sum?) <int>
#  AUTOMAGIC KERNELS LIST <interval - two ints>
# GRUBCONFIG DISABLED ITEMS <interval - two ints>
# IMPORTANT note:
# any value that is not parsed MUST not be ommited at the end!
#  any value that is commented (parsed or not) MUST not be omitted at the end!
# not so important note:
# if a value we parse is not defined:
# apply defaults (how do find them out?)
# but specify it in the menu.lst when saving
# mhb TODO: somehow handle automagic kernel list (target: feisty)
# mhb TODO: adapt to more distributions, find menu.lst on different locations
def load_menulst(self):
self.modifiedlines = []
menufd = open(self.menulstlocation,"r")
linenum = 0
lock = 0
itemlock = 0
currentitem = 0
for line in menufd:
# Checks if the first non-white char in a line is a #
if re.search(r'^(/s)*#',line) or re.search(r'^(/s)*$',line):
print "a commented line" # mhb debug
if itemlock == 1:
itemlock = 0
currentitem += 1
# if it is a start of an area we parse, use a lock
if re.search(r'sumthin',line) and (lock == 0):
lock = 1
elif re.search(r'sumthin_other',line) and (lock == 0):
lock = 2
# else if it is an end of an area we parse, close the lock
elif re.search(r'sumthin_other_end',line) and (lock == 2):
lock = 0
elif re.search(r'sumthin_end',line) and (lock == 1):
lock = 0
# errors
# mhb TODO: exception catching
elif re.search(r'sumthin',line) and (lock == 0):
raise IdentationError
elif re.search(r'sumthin_other',line) and (lock == 1):
raise EndOfNotOpenedError
# if it is in the lock, do the mumbo-jumbo
# find out what kind of lock it is
# AUTOCONFIG
if lock == 1:
# automagic kernels list?
if re.search(r'sumthin',line):
pass
# or the other one (grubconfig disabled kernel's list )?
else:
self.modifiedlines.append(linenum)
# else save it as a commented line (does not save the locks)
# GRUBCONFiG commented item
elif lock == 2:
# remove leading spaces and one #
# the parse as a normal menu item
pass
# it's a commented, no need to do anything
else:
pass
# okay, it's not commented
else:
print "a not commented line" # mhb debug
self.modifiedlines.append(linenum)
# we presume the first character is already a name
var_name = line.split()[0]
#print "variable name is " + var_name # mhb debug
# var_value's last item is always the line that has to be changed
var_value = []
if var_name in parsable:
# cat 0 - a title - triggers itemlock, has a name and a value, which should be stored as text
if var_name == "title":
print line.split(None,1)
var_value.append(line.split(None,1)[1][:-1])
itemlock = 1
self.itemslist.append({})
# cat 1 - has a name and 1 value
elif var_name in cat1:
try:
var_value.append(line.split()[1])
except IndexError:
var_value.append(1)
# cat 2 - has a name, but no value ( implicit 1 )
elif var_name in cat2:
var_value.append(1)
# cat 3 - has a name, has multiple values, should be saved as list
elif var_name in cat3:
var_value = line.split()[1:]
# now, append the number
var_value.append(linenum)
if itemlock == 1:
self.itemslist[currentitem][var_name] = var_value
else:
self.globalvars[var_name] = var_value
#if var_name in parsable:
#print "variable name " + var_name + " is parsable " # mhb debug
#if var_name == "title":
#itemlock = 1
#self.itemslist.append({})
#if(len(line.split()) > 1):
#var_value = line.split()[1]
#if itemlock == 1:
#else:
#print "variable value is " + var_value # mhb debug
#else:
#if itemlock == 1:
#self.itemslist[currentitem][var_name] = var_value
#else:
#self.globalvars[var_name] = 1
#else:
#print "variable name " + var_name + " is currently not parsable" # mhb debug
#print "it has no value" # mhb debug
# print "parsed another line" # mhb debug
linenum += 1;
print "load_menulst() called" # mhb debug
return "not working yet"
#######################################################################
# writes menu.lst
def save_menulst(self):
delimeter = " "
# phase 1: preparing the values
lines = []
linecontent = []
# this consists of:
#  1. concatenating the list of lines that were modified
# 2. writing the lines in another list (or something more efficient
output = {}
# the globals first
for unit, value in self.globalvars.items():
lines.append(value[-1])
temp_str=""
temp_str+=(str(unit)+" ")
for index in range(len(value)-1):
temp_str+=(str(value[index])+" ")
linecontent.append(temp_str)
# itemslist next (abattoir)
for item in self.itemslist:
for unit, value in reversed(item.items()):
lines.append(value[-1])
temp_str=""
temp_str+=(str(unit)+" ")
for index in range(len(value)-1):
temp_str+=(str(value[index])+" ")
linecontent.append(temp_str)
# phase 2: writing the file
# by now we have a list of numbers (let's call it lines[])
# and a list of mofified lines (let's call it linecontent[] )
# lines[i] corresponds with linecontent[]
trfile = open(self.readfilename, "r" )
twfilename = tempfile.mkstemp("menulst")[1]
twfile = open(twfilename,"w")
# the current solution is:
# read the menu.lst again (or rather its copy, to prevent the file being changed)
# line by line write it in the output file (to be exact, to a file in /tmp)
linenum = 0
print linecontent
print lines
# foreach file as line:
for originalline in trfile:
# if its number isn't in the location list, simply write it
if linenum in lines:
twfile.writelines(linecontent[linenum])
else:
twfile.writelines(originalline)
linenum += 1;
# if there are any more lines to be written (newly detected options)
# write them at the end (now)
# when that process works out fine do a quick rewrite to /boot/grub/menu.lst
# mhb TODO: declare self.menulstlocation
twfile.close()
shutil.move(twfilename,self.menulstlocation)
# mhb TODO: Exception handling
os.remove(self.readfilename)
print "save_menulst() called" # mhb debug
return "not working yet"
#######################################################################
# loads output from os-probe
def load_osprobe(self):
detected = os.popen('os-prober').readlines()
ops_list = []
for ops in detected:
ops = string.replace(ops,"\n","")
temp_list = ops.split(':')
partition = temp_list[0]
temp_list[0] = string.replace(temp_list[0],"/dev/","")
re_obj = re.search(r'([sh]d)([a-z])([0-9])*$',temp_list[0])
disk = ord(re_obj.group(2))%97
part = int(re_obj.group(3))-1
if re_obj == None:
re_obj = re.search(r'(fd[0-9]*)$',temp_list[0])
if re_obj:
disk = temp_list[0]
part = ""
else : re_obj = re.search(r'(part[0-9]*$', temp_list[0])
if re_obj:
disk = '/disc'
part = temp_list[0]
temp_list[0] = '('+re_obj.group(1)+str(disk)+','+str(part)+')'
if temp_list[3].lower() == "linux":
mounted = os.popen('mount | grep '+partition).readlines()
if mounted:
linux_os = os.popen('linux-boot-prober --mounted '+partition).readlines()
else:
linux_os = os.popen('linux-boot-prober '+partition).readlines()
linux_list = []
for lops in linux_os:
lops = string.replace(lops,"\n","")
temp_linux_list = lops.split(':')
linux_list.append(temp_linux_list)
temp_list.append(linux_list)
ops_list.append(temp_list)
temp_list = []
return ops_list
############################################################################
# Factory function for KControl
def create_grubconfig(parent,name):
return GrubConfigAppClass(parent, name)
##########################################################################
def MakeAboutData():
aboutdata = KAboutData("guidance", programname, version,
unicode(i18n("Boot Loader Configuration Tool")).encode(locale.getpreferredencoding()),
KAboutData.License_GPL, "Copyright (C) 2006-2007 Martin Böhm")
aboutdata.addAuthor("Martin Böhm", "Developer", "martin.bohm@kubuntu.org", "http://mhb.ath.cx/")
aboutdata.addAuthor("Simon Edwards", "Developer", "simon@simonzone.com", "http://www.simonzone.com/software/")
aboutdata.addAuthor("Sebastian Kügler", "Developer", "sebas@kde.org", "http://vizZzion.org")
return aboutdata
if standalone:
aboutdata = MakeAboutData()
KCmdLineArgs.init(sys.argv,aboutdata)
kapp = KApplication()
grubconfigapp = GrubConfigAppClass()
grubconfigapp.exec_loop()

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -0,0 +1,982 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://web.resource.org/cc/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="128"
height="128"
id="svg1307"
sodipodi:version="0.32"
inkscape:version="0.44+devel"
version="1.0"
sodipodi:docbase="/home/kwwii/Desktop/actions"
sodipodi:docname="power-manager.svg"
inkscape:export-filename="/home/kwwii/Desktop/tempsvn/powermanager/icons/power-manager-64.png"
inkscape:export-xdpi="45"
inkscape:export-ydpi="45"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
sodipodi:modified="true">
<defs
id="defs1309">
<linearGradient
id="linearGradient13461">
<stop
style="stop-color:#fd0;stop-opacity:1;"
offset="0"
id="stop13463" />
<stop
style="stop-color:#e3ad00;stop-opacity:1;"
offset="1"
id="stop13465" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient13461"
id="radialGradient13467"
cx="64"
cy="64.968025"
fx="64"
fy="64.968025"
r="19.72229"
gradientTransform="matrix(1.611098,0,0,3.009366,-79.1103,-131.5445)"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
id="linearGradient3846">
<stop
style="stop-color:#590000;stop-opacity:1;"
offset="0"
id="stop3848" />
<stop
style="stop-color:#590000;stop-opacity:0;"
offset="1"
id="stop3850" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient3832">
<stop
style="stop-color:white;stop-opacity:1;"
offset="0"
id="stop3834" />
<stop
style="stop-color:white;stop-opacity:0;"
offset="1"
id="stop3836" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient3822">
<stop
style="stop-color:white;stop-opacity:1;"
offset="0"
id="stop3824" />
<stop
style="stop-color:white;stop-opacity:0;"
offset="1"
id="stop3826" />
</linearGradient>
<linearGradient
id="linearGradient2895">
<stop
style="stop-color:white;stop-opacity:1;"
offset="0"
id="stop2897" />
<stop
style="stop-color:white;stop-opacity:0;"
offset="1"
id="stop2899" />
</linearGradient>
<linearGradient
id="linearGradient2877">
<stop
style="stop-color:#390000;stop-opacity:1;"
offset="0"
id="stop2879" />
<stop
style="stop-color:#970000;stop-opacity:0;"
offset="1"
id="stop2881" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient3164">
<stop
style="stop-color:white;stop-opacity:1;"
offset="0"
id="stop3166" />
<stop
style="stop-color:white;stop-opacity:0;"
offset="1"
id="stop3168" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient3140">
<stop
style="stop-color:white;stop-opacity:1;"
offset="0"
id="stop3142" />
<stop
style="stop-color:white;stop-opacity:0;"
offset="1"
id="stop3144" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient3082">
<stop
style="stop-color:black;stop-opacity:1;"
offset="0"
id="stop3084" />
<stop
style="stop-color:black;stop-opacity:0;"
offset="1"
id="stop3086" />
</linearGradient>
<linearGradient
id="linearGradient3041">
<stop
id="stop3043"
offset="0"
style="stop-color:#303030;stop-opacity:1;" />
<stop
style="stop-color:#555;stop-opacity:1;"
offset="0.11538462"
id="stop3045" />
<stop
id="stop3053"
offset="0.26590282"
style="stop-color:#3b3b3b;stop-opacity:1;" />
<stop
style="stop-color:#646464;stop-opacity:1;"
offset="0.28553563"
id="stop3057" />
<stop
style="stop-color:#7b7b7b;stop-opacity:1;"
offset="0.43724003"
id="stop3055" />
<stop
style="stop-color:#888;stop-opacity:1;"
offset="0.69156802"
id="stop3047" />
<stop
id="stop3049"
offset="0.90384614"
style="stop-color:#747474;stop-opacity:1;" />
<stop
id="stop3051"
offset="1"
style="stop-color:#5d5d5d;stop-opacity:1;" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient2916">
<stop
style="stop-color:white;stop-opacity:1;"
offset="0"
id="stop2918" />
<stop
style="stop-color:white;stop-opacity:0;"
offset="1"
id="stop2920" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient2874">
<stop
style="stop-color:#414141;stop-opacity:1;"
offset="0"
id="stop2876" />
<stop
style="stop-color:#414141;stop-opacity:0;"
offset="1"
id="stop2878" />
</linearGradient>
<linearGradient
id="linearGradient2858">
<stop
style="stop-color:#303030;stop-opacity:1;"
offset="0"
id="stop2860" />
<stop
id="stop2863"
offset="0.05769231"
style="stop-color:white;stop-opacity:0.59215689;" />
<stop
id="stop2868"
offset="0.11538462"
style="stop-color:#4b4b4b;stop-opacity:0.18431373;" />
<stop
id="stop2866"
offset="0.69156802"
style="stop-color:black;stop-opacity:0;" />
<stop
style="stop-color:black;stop-opacity:0.09747292;"
offset="0.90384614"
id="stop2870" />
<stop
id="stop2867"
offset="0.95192307"
style="stop-color:white;stop-opacity:0.54509807;" />
<stop
style="stop-color:#5d5d5d;stop-opacity:1;"
offset="1"
id="stop2862" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient3291">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop3293" />
<stop
style="stop-color:#000000;stop-opacity:0;"
offset="1"
id="stop3295" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3164"
id="linearGradient3170"
x1="73.511299"
y1="1"
x2="73.511299"
y2="5.7553549"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.672581,0,0,1.903227,22.30711,6.096774)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3846"
id="linearGradient3852"
x1="10.073669"
y1="18.5"
x2="13.3511"
y2="18.5"
gradientUnits="userSpaceOnUse"
spreadMethod="reflect" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3291"
id="radialGradient3163"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1,0,0,0.197802,0,92.82166)"
cx="63.912209"
cy="115.70919"
fx="66.022942"
fy="115.70919"
r="63.912209" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3041"
id="linearGradient3165"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(5.390888,0,0,5.390888,53.1978,7.426068)"
x1="1.4227993"
y1="1.022699"
x2="5.5960732"
y2="1.022699" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3082"
id="linearGradient3167"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(5.390888,0,0,5.390888,53.1978,7.426068)"
x1="6.4523492"
y1="-2.8016193"
x2="5.5593128"
y2="1.0485095" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3822"
id="linearGradient3169"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(6.07834,0,0,5.82831,6.789136,0)"
x1="11.434079"
y1="1.0289581"
x2="11.174653"
y2="2.2792649" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3082"
id="linearGradient3171"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(5.390888,0,0,5.390888,53.1978,7.426068)"
x1="5.6568542"
y1="6.0850325"
x2="5.6568542"
y2="1.4639859" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2858"
id="linearGradient3173"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.084878,0,0,0.961444,23.50461,6.682619)"
x1="18.01074"
y1="65.760353"
x2="72.498932"
y2="65.760353" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2874"
id="linearGradient3175"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.069646,0,0,0.962358,24.70483,6.672295)"
x1="69.07917"
y1="1.0128831"
x2="63.575024"
y2="39.769947" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2916"
id="linearGradient3177"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.545256,0,0,0.962358,56.01045,6.672295)"
x1="38.875084"
y1="67.528122"
x2="90.409752"
y2="67.528122" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2874"
id="linearGradient3179"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.083993,0,0,0.84067,23.52057,-131.7705)"
x1="63.948738"
y1="-163.6496"
x2="43.918915"
y2="54.970299" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2874"
id="linearGradient3181"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.085374,0,0,0.865765,23.49566,-132.0539)"
x1="43.918915"
y1="7.8450942"
x2="43.918915"
y2="15.315003" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3140"
id="radialGradient3183"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.055718,0,0,1.666364,0.815341,73.26644)"
cx="68.000046"
cy="-117.34602"
fx="68.000046"
fy="-117.34602"
r="27.999956" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2895"
id="linearGradient3185"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(5.82831,0,0,5.82831,9,0)"
x1="11.543377"
y1="3.4375"
x2="10.88339"
y2="5.9006019" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2916"
id="linearGradient3187"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.545256,0,0,0.821275,56.01045,8.410494)"
x1="38.875084"
y1="67.528122"
x2="90.409752"
y2="67.528122" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2916"
id="linearGradient3189"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.545256,0,0,1.808891,56.01045,-3.756896)"
x1="38.875084"
y1="67.528122"
x2="90.409752"
y2="67.528122" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3832"
id="radialGradient3191"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1,0,0,2.962963e-2,0,2.950605)"
cx="12.308078"
cy="3.0406888"
fx="13.944797"
fy="3.0406888"
r="2.9831069" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3832"
id="radialGradient3193"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1,0,0,2.962963e-2,0,2.950605)"
cx="12.308078"
cy="3.0406888"
fx="13.944797"
fy="3.0406888"
r="2.9831069" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2916"
id="linearGradient4093"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.545256,0,0,1.808891,63.01045,-3.756896)"
x1="38.875084"
y1="67.528122"
x2="90.409752"
y2="67.528122" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2916"
id="linearGradient4096"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.545256,0,0,0.821275,63.01045,8.410494)"
x1="38.875084"
y1="67.528122"
x2="90.409752"
y2="67.528122" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2895"
id="linearGradient4099"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(5.82831,0,0,5.82831,16,0)"
x1="11.543377"
y1="3.4375"
x2="10.88339"
y2="5.9006019" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3140"
id="radialGradient4102"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.055718,0,0,1.666364,7.815341,73.26644)"
cx="68.000046"
cy="-117.34602"
fx="68.000046"
fy="-117.34602"
r="27.999956" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2874"
id="linearGradient4105"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.085374,0,0,0.865765,30.49566,-132.0539)"
x1="43.918915"
y1="7.8450942"
x2="43.918915"
y2="15.315003" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2874"
id="linearGradient4108"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.083993,0,0,0.84067,30.52057,-131.7705)"
x1="63.948738"
y1="-163.6496"
x2="43.918915"
y2="54.970299" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2916"
id="linearGradient4111"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.545256,0,0,0.962358,63.01045,6.672295)"
x1="38.875084"
y1="67.528122"
x2="90.409752"
y2="67.528122" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2874"
id="linearGradient4114"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.069646,0,0,0.962358,31.70483,6.672295)"
x1="69.07917"
y1="1.0128831"
x2="63.575024"
y2="39.769947" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2858"
id="linearGradient4117"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.084878,0,0,0.961444,30.50461,6.682619)"
x1="18.01074"
y1="65.760353"
x2="72.498932"
y2="65.760353" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3082"
id="linearGradient4121"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(5.390888,0,0,5.390888,60.1978,7.426068)"
x1="5.6568542"
y1="6.0850325"
x2="5.6568542"
y2="1.4639859" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3822"
id="linearGradient4124"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(6.07834,0,0,5.82831,13.78914,0)"
x1="11.434079"
y1="1.0289581"
x2="11.174653"
y2="2.2792649" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3082"
id="linearGradient4127"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(5.390888,0,0,5.390888,60.1978,7.426068)"
x1="6.4523492"
y1="-2.8016193"
x2="5.5593128"
y2="1.0485095" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3041"
id="linearGradient4130"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(5.390888,0,0,5.390888,60.1978,7.426068)"
x1="1.4227993"
y1="1.022699"
x2="5.5960732"
y2="1.022699" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3291"
id="radialGradient5374"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1,0,0,0.197802,0,92.82166)"
cx="63.912209"
cy="115.70919"
fx="66.022942"
fy="115.70919"
r="63.912209" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3041"
id="linearGradient5376"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(5.390888,0,0,5.390888,60.1978,7.426068)"
x1="1.4227993"
y1="1.022699"
x2="5.5960732"
y2="1.022699" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3082"
id="linearGradient5378"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(5.390888,0,0,5.390888,60.1978,7.426068)"
x1="6.4523492"
y1="-2.8016193"
x2="5.5593128"
y2="1.0485095" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3822"
id="linearGradient5380"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(6.07834,0,0,5.82831,13.78914,0)"
x1="11.434079"
y1="1.0289581"
x2="11.174653"
y2="2.2792649" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3082"
id="linearGradient5382"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(5.390888,0,0,5.390888,60.1978,7.426068)"
x1="5.6568542"
y1="6.0850325"
x2="5.6568542"
y2="1.4639859" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2858"
id="linearGradient5384"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.084878,0,0,0.961444,30.50461,6.682619)"
x1="18.01074"
y1="65.760353"
x2="72.498932"
y2="65.760353" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2874"
id="linearGradient5386"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.069646,0,0,0.962358,31.70483,6.672295)"
x1="69.07917"
y1="1.0128831"
x2="63.575024"
y2="39.769947" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2916"
id="linearGradient5388"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.545256,0,0,0.962358,63.01045,6.672295)"
x1="38.875084"
y1="67.528122"
x2="90.409752"
y2="67.528122" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2874"
id="linearGradient5390"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.083993,0,0,0.84067,30.52057,-131.7705)"
x1="63.948738"
y1="-163.6496"
x2="43.918915"
y2="54.970299" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2874"
id="linearGradient5392"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.085374,0,0,0.865765,30.49566,-132.0539)"
x1="43.918915"
y1="7.8450942"
x2="43.918915"
y2="15.315003" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3140"
id="radialGradient5394"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.055718,0,0,1.666364,7.815341,73.26644)"
cx="68.000046"
cy="-117.34602"
fx="68.000046"
fy="-117.34602"
r="27.999956" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2895"
id="linearGradient5396"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(5.82831,0,0,5.82831,16,0)"
x1="11.543377"
y1="3.4375"
x2="10.88339"
y2="5.9006019" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2916"
id="linearGradient5398"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.545256,0,0,0.821275,63.01045,8.410494)"
x1="38.875084"
y1="67.528122"
x2="90.409752"
y2="67.528122" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2916"
id="linearGradient5400"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.545256,0,0,1.808891,63.01045,-3.756896)"
x1="38.875084"
y1="67.528122"
x2="90.409752"
y2="67.528122" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3832"
id="radialGradient5402"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1,0,0,2.962963e-2,0,2.950605)"
cx="12.308078"
cy="3.0406888"
fx="13.944797"
fy="3.0406888"
r="2.9831069" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3832"
id="radialGradient5404"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1,0,0,2.962963e-2,0,2.950605)"
cx="12.308078"
cy="3.0406888"
fx="13.944797"
fy="3.0406888"
r="2.9831069" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2916"
id="linearGradient2290"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.545256,0,0,1.808891,65.89819,-3.756896)"
x1="38.875084"
y1="67.528122"
x2="90.409752"
y2="67.528122" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2916"
id="linearGradient2293"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.545256,0,0,0.821275,65.89819,8.410494)"
x1="38.875084"
y1="67.528122"
x2="90.409752"
y2="67.528122" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2895"
id="linearGradient2296"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(5.82831,0,0,5.82831,18.88774,0)"
x1="11.543377"
y1="3.4375"
x2="10.88339"
y2="5.9006019" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3140"
id="radialGradient2299"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.055718,0,0,1.666364,10.70308,73.26644)"
cx="68.000046"
cy="-117.34602"
fx="68.000046"
fy="-117.34602"
r="27.999956" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2874"
id="linearGradient2302"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.085374,0,0,0.865765,33.3834,-132.0539)"
x1="43.918915"
y1="7.8450942"
x2="43.918915"
y2="15.315003" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2874"
id="linearGradient2305"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.083993,0,0,0.84067,33.40831,-131.7705)"
x1="63.948738"
y1="-163.6496"
x2="43.918915"
y2="54.970299" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2916"
id="linearGradient2308"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.545256,0,0,0.962358,65.89819,6.672295)"
x1="38.875084"
y1="67.528122"
x2="90.409752"
y2="67.528122" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2874"
id="linearGradient2316"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.069646,0,0,0.962358,34.59257,6.672295)"
x1="69.07917"
y1="1.0128831"
x2="63.575024"
y2="39.769947" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2858"
id="linearGradient2319"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.084878,0,0,0.961444,33.39235,6.682619)"
x1="18.01074"
y1="65.760353"
x2="72.498932"
y2="65.760353" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3082"
id="linearGradient2322"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(5.390888,0,0,5.390888,63.08554,7.426068)"
x1="5.6568542"
y1="6.0850325"
x2="5.6568542"
y2="1.4639859" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3822"
id="linearGradient2325"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(6.07834,0,0,5.82831,16.67688,0)"
x1="11.434079"
y1="1.0289581"
x2="11.174653"
y2="2.2792649" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3082"
id="linearGradient2328"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(5.390888,0,0,5.390888,63.08554,7.426068)"
x1="6.4523492"
y1="-2.8016193"
x2="5.5593128"
y2="1.0485095" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3041"
id="linearGradient2331"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(5.390888,0,0,5.390888,63.08554,7.426068)"
x1="1.4227993"
y1="1.022699"
x2="5.5960732"
y2="1.022699" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3291"
id="radialGradient2340"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1,0,0,0.197802,0,92.82166)"
cx="63.912209"
cy="115.70919"
fx="66.022942"
fy="115.70919"
r="63.912209" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient13461"
id="radialGradient2342"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.611098,0,0,3.009366,-79.1103,-131.5445)"
cx="64"
cy="64.968025"
fx="64"
fy="64.968025"
r="19.72229" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="3.0214592"
inkscape:cx="63.5"
inkscape:cy="61.5"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:document-units="px"
inkscape:grid-bbox="true"
guidetolerance="0.1px"
showguides="true"
inkscape:guide-bbox="true"
inkscape:window-width="1106"
inkscape:window-height="904"
inkscape:window-x="304"
inkscape:window-y="0"
width="128px"
height="128px" />
<metadata
id="metadata1312">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<cc:license
rdf:resource="http://creativecommons.org/licenses/GPL/2.0/" />
<dc:contributor>
<cc:Agent>
<dc:title>Oxygen team</dc:title>
</cc:Agent>
</dc:contributor>
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/LGPL/2.1/">
<cc:permits
rdf:resource="http://web.resource.org/cc/Reproduction" />
<cc:permits
rdf:resource="http://web.resource.org/cc/Distribution" />
<cc:requires
rdf:resource="http://web.resource.org/cc/Notice" />
<cc:permits
rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
<cc:requires
rdf:resource="http://web.resource.org/cc/ShareAlike" />
<cc:requires
rdf:resource="http://web.resource.org/cc/SourceCode" />
</cc:License>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<rect
style="opacity:0;fill:#590000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.59500003;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:4;stroke-opacity:1"
id="rect2869"
width="128.16599"
height="128.16599"
x="0"
y="-4.5116963e-07"
ry="0.017196547"
rx="0.017196547" />
<path
sodipodi:nodetypes="ccc"
id="path2276"
d="M 50.892799,3.2812959 L 50.892799,0.48658747 L 50.892799,3.2812959 z "
style="fill:white;fill-opacity:0.75688076;fill-rule:nonzero;stroke:none;stroke-width:0.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:4;stroke-opacity:1" />
<path
sodipodi:type="arc"
style="opacity:0.38139535;fill:url(#radialGradient2340);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:4;stroke-opacity:1"
id="path3289"
sodipodi:cx="63.912209"
sodipodi:cy="115.70919"
sodipodi:rx="63.912209"
sodipodi:ry="12.641975"
d="M 127.82442 115.70919 A 63.912209 12.641975 0 1 1 0,115.70919 A 63.912209 12.641975 0 1 1 127.82442 115.70919 z"
transform="matrix(0.637727,0,0,0.417459,23.24146,74.4977)" />
<g
id="g2335"
transform="translate(39.98659,-3)">
<path
sodipodi:nodetypes="ccccccc"
id="path2247"
d="M 33.430369,12.681554 L 30.372339,54.257815 L 44.249109,53.082135 L 15.935969,117.25449 L 17.887679,70.301791 L 4.804529,71.410233 L 33.430369,12.681554 z "
style="fill:#555753;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000012;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />