diff options
| author | glatzor@ubuntu.com <> | 2006-09-09 23:07:01 +0200 |
|---|---|---|
| committer | glatzor@ubuntu.com <> | 2006-09-09 23:07:01 +0200 |
| commit | 55dc951dc39a68249435256da79bacfd2961e1c4 (patch) | |
| tree | 4eaf74f7e56334a1a8c787b2ac5d8ee1f675c3bd /SoftwareProperties | |
| parent | 3afcdfc4f30173672b5745f69e2bc401f20e1d90 (diff) | |
| parent | a5a1685317f25de0a0d7bd8ccc5317a17fa219bf (diff) | |
| download | python-apt-55dc951dc39a68249435256da79bacfd2961e1c4.tar.gz | |
* merge with mvo
Diffstat (limited to 'SoftwareProperties')
| -rw-r--r-- | SoftwareProperties/SoftwareProperties.py | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/SoftwareProperties/SoftwareProperties.py b/SoftwareProperties/SoftwareProperties.py index a3dfdd06..a18fec20 100644 --- a/SoftwareProperties/SoftwareProperties.py +++ b/SoftwareProperties/SoftwareProperties.py @@ -79,6 +79,7 @@ class SoftwareProperties(SimpleGladeApp): def __init__(self, datadir=None, options=None, parent=None, file=None): gtk.window_set_default_icon_name("software-properties") + self.popconfile = "/etc/popularity-contest.conf" # FIXME: some saner way is needed here if datadir == None: @@ -223,6 +224,22 @@ class SoftwareProperties(SimpleGladeApp): self.treeview_sources.connect("drag_data_received",\ self.on_sources_drag_data_received) + # popcon + if os.path.exists(self.popconfile): + # read it + lines = open(self.popconfile).read().split("\n") + active = False + for line in lines: + try: + (key,value) = line.split("=") + if key == "PARTICIPATE": + if value.strip('"').lower() == "yes": + active = True + except ValueError: + continue + self.checkbutton_popcon.set_active(active) + + # call the add sources.list dialog if we got a file from the cli if self.file != None: self.open_file(file) @@ -505,14 +522,13 @@ class SoftwareProperties(SimpleGladeApp): def on_checkbutton_popcon_toggled(self, widget): """ The user clicked on the popcon paritipcation button """ - popcon = "/etc/popularity-contest.conf" if widget.get_active(): new_value = "yes" else: new_value = "no" - if os.path.exists(popcon): + if os.path.exists(self.popconfile): # read it - lines = open(popcon).read().split("\n") + lines = open(self.popconfile).read().split("\n") for line in lines: try: (key,value) = line.split("=") @@ -521,7 +537,7 @@ class SoftwareProperties(SimpleGladeApp): except ValueError: continue # write it - open(popcon,"w").write("\n".join(lines)) + open(self.popconfile,"w").write("\n".join(lines)) def open_file(self, file): |
