def OnManageDone(self, evt):

        for share in sharing.SharedItem(self.collection).shares:
            self._saveAttributeFilterState(share)

        if self.IsModal():
            self.EndModal(False)
        self.Destroy()

        share = sharing.getShare(self.collection)
        needsSync = False
        if isinstance(share.conduit, sharing.RecordSetConduit):
            for filter in self.originalFilters:
                if filter not in share.conduit.filters:
                    # A filter has been removed so we need to re-synchronize
                    needsSync = True
                    break
        else:
            if share.filterAttributes != self.originalFilterAttributes:
                needsSync = True

        if needsSync:
            self.view.commit()
            sharing.scheduleNow(self.view, collection=share.contents,
                                forceUpdate=True)
    def on_debug_BackgroundSyncGetOnlyEvent(self, event):

        rv = self.itsView
        collection = self.getSidebarSelectedCollection()
        if collection is not None:
            # Ensure changes in attribute editors are saved
            wx.GetApp().mainFrame.SetFocus()

            rv.commit()
            sharing.scheduleNow(rv, collection=collection, modeOverride='get')
    def on_debug_BackgroundSyncAllEvent(self, event):

        # Specifically *not* doing a commit here.  This is to simulate
        # a scheduled background sync.  Only manually.
        sharing.scheduleNow(self.itsView)