def OnUnPubSub(self, evt): share = Sharing.getShare(self.collection) if Sharing.isSharedByMe(share): Sharing.unpublish(self.collection) else: Sharing.unsubscribe(self.collection) self.EndModal(True)
def onUnpublishSidebarCollectionEventUpdateUI(self, event): collection = self.getSidebarSelectedCollection () if collection is not None: share = Sharing.getShare(collection) sharedByMe = Sharing.isSharedByMe(share) event.arguments['Enable'] = collection is not None and Sharing.isShared(collection) and sharedByMe
def ShowManagePanel(self): # "Manage" mode -- i.e., the collection has already been shared self.Bind(wx.EVT_BUTTON, self.OnManageDone, id=wx.ID_OK) self.Bind(wx.EVT_BUTTON, self.OnCancel, id=wx.ID_CANCEL) self.Bind(wx.EVT_BUTTON, self.OnCopy, id=wx.xrc.XRCID("BUTTON_CLIPBOARD")) self.Bind(wx.EVT_BUTTON, self.OnUnPubSub, id=wx.xrc.XRCID("BUTTON_UNPUBLISH")) name = self.collection.displayName wx.xrc.XRCCTRL(self, "TEXT_MANAGE_COLLNAME").SetLabel(name) name = self.shareXML.conduit.account.displayName wx.xrc.XRCCTRL(self, "TEXT_ACCOUNT").SetLabel(name) url = self.shareXML.conduit.getLocation() wx.xrc.XRCCTRL(self, "TEXT_URL").SetLabel(url) self.UnPubSub = wx.xrc.XRCCTRL(self, "BUTTON_UNPUBLISH") share = Sharing.getShare(self.collection) if Sharing.isSharedByMe(share): self.UnPubSub.SetLabel("Unpublish") else: self.UnPubSub.SetLabel("Unsubscribe") # Controls for managing filtered shares: self.RadioItems = wx.xrc.XRCCTRL(self, "RADIO_ITEMS") self.RadioItemsHidden = wx.xrc.XRCCTRL(self, "RADIO_ITEMS_HIDDEN") self.RadioItemsHidden.Hide() wx.EVT_RADIOBUTTON(self.RadioItems, self.RadioItems.GetId(), self.OnAllItemsClicked) self.CheckboxMail = wx.xrc.XRCCTRL(self, "CHECK_MAIL") wx.EVT_CHECKBOX(self.CheckboxMail, self.CheckboxMail.GetId(), self.OnFilterClicked) self.CheckboxTasks = wx.xrc.XRCCTRL(self, "CHECK_TASKS") wx.EVT_CHECKBOX(self.CheckboxTasks, self.CheckboxTasks.GetId(), self.OnFilterClicked) self.CheckboxEvents = wx.xrc.XRCCTRL(self, "CHECK_EVENTS") wx.EVT_CHECKBOX(self.CheckboxEvents, self.CheckboxEvents.GetId(), self.OnFilterClicked) self.CheckboxShareAlarms = wx.xrc.XRCCTRL(self, "CHECKBOX_ALARMS") self.CheckboxShareAlarms.Enable(False) self.CheckboxShareStatus = wx.xrc.XRCCTRL(self, "CHECKBOX_STATUS") self.CheckboxShareStatus.Enable(False) self.filterKinds = self.shareXML.filterKinds self._loadKindFilterState() self._loadAttributeFilterState(self.shareXML) self.SetDefaultItem(wx.xrc.XRCCTRL(self, "wxID_OK"))
def onUnpublishSidebarCollectionEventUpdateUI(self, event): collection = self.getSidebarSelectedCollection() if collection is not None: share = Sharing.getShare(collection) sharedByMe = Sharing.isSharedByMe(share) event.arguments["Enable"] = collection is not None and Sharing.isShared(collection) and sharedByMe