~ubuntu-branches/ubuntu/oneiric/compizconfig-settings-manager/oneiric

« back to all changes in this revision

Viewing changes to ccm/Utils.py

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2007-08-14 20:25:36 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20070814202536-932o1ced05xhfb4w
Tags: 0.5.2+git20070814-0ubuntu1
updated to current git to get global-profile-reset feature

Show diffs side-by-side

added added

removed removed

Lines of Context:
124
124
class Updater:
125
125
        def __init__(self, context):
126
126
                self.VisibleSettings = []
 
127
                self.NotRemoved = []
127
128
                self.Context = context
128
129
 
129
130
                gobject.timeout_add(2000, self.Update)
134
135
        def Update(self):
135
136
                changed = self.Context.ProcessEvents()
136
137
                if changed:
 
138
                        changedSettings = self.Context.ChangedSettings
137
139
                        for settingWidget in self.VisibleSettings:
138
 
                                if settingWidget.Widget.get_parent():
139
 
                                        settingWidget.Read()
 
140
                                # Remove already destroyed widgets
 
141
                                if not settingWidget.Widget.get_parent():
 
142
                                        self.VisibleSettings.remove(settingWidget)
 
143
                                
 
144
                                # Exception for multi settings widgets (multi list widget, action page, etc.)
 
145
                                if settingWidget.Setting.__class__ != list:
 
146
                                        if settingWidget.Setting in changedSettings:
 
147
                                                settingWidget.Read()
 
148
                                                changedSettings.remove(settingWidget.Setting)
140
149
                                else:
141
 
                                        self.VisibleSettings.remove(settingWidget)
142
 
                        self.Context.ClearChangedSettings()
 
150
                                        read = False
 
151
                                        for setting in settingWidget.Setting:
 
152
                                                if setting in changedSettings:
 
153
                                                        read = True
 
154
                                                        changedSettings.remove(setting)
 
155
                                        if read:
 
156
                                                settingWidget.Read()
 
157
                        # For removing non-visible settings
 
158
                        for oldSetting in self.NotRemoved:
 
159
                                if oldSetting in changedSettings:
 
160
                                        changedSettings.remove(oldSetting)
 
161
                        self.NotRemoved = changedSettings
 
162
                        self.Context.ChangedSettings = changedSettings
 
163
 
143
164
                return True
144
165
 
145
166
class PureVirtualError(Exception):