I felt the need to blog about this small settings app that is being developed by Luis and myself called ubuntustudio-controls. The aim of this app is create an easier way for users to modify several settings that are currently modified by hand.
The design of -controls is such that it is DE agnostic. Currently we are only developing a front-end for Gnome, but the backend class that I wrote can be used in any python code.
A quick explanation on how it works
When the changesettings class is initialized it needs to be given three pieces of information :
1) The file to operate on
2) A python regular expression
3) The string you want to replace or add.
import changesettings
inst = changesettings('file', '\d', '1')
inst.ch_setting()
inst.rm_setting()
changesettings defines two methods, ch_setting and rm_setting. ch_setting will search the file for a string matching the python regular expression and if it exists, change it. Otherwise, it will append it to the second last line. (This may change in the future to allow the class to append it anywhere in the file.)
The second method defined does the same as the first, except it will remove the string.
The code is available from the ubuntustudio-controls project page on launchpad, but here is a link for all you lazy people.