diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2006-09-09 10:53:25 +0200 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2006-09-09 10:53:25 +0200 |
| commit | e4b06af1ace3bbb4281a9c762113f8a2699116c3 (patch) | |
| tree | 4eaf74f7e56334a1a8c787b2ac5d8ee1f675c3bd /SoftwareProperties | |
| parent | b9d9d686af1fc980482b5d0b23c5d29194e35136 (diff) | |
| download | python-apt-e4b06af1ace3bbb4281a9c762113f8a2699116c3.tar.gz | |
* merged with the latest upload (fix popcon participate value)
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): |
