def ShowPublishPanel(self): # "Publish" mode -- i.e., the collection has not yet been shared self.Bind(wx.EVT_BUTTON, self.OnPublish, id=wx.ID_OK) self.Bind(wx.EVT_BUTTON, self.OnCancel, id=wx.ID_CANCEL) collName = Sharing.getFilteredCollectionDisplayName(self.collection, self.filterKinds) wx.xrc.XRCCTRL(self, "TEXT_COLLNAME").SetLabel(collName) self.currentAccount = Sharing.getWebDAVAccount(self.view) # Populate the listbox of sharing accounts self.accounts = self._getSharingAccounts() self.accountsControl = wx.xrc.XRCCTRL(self, "CHOICE_ACCOUNT") self.accountsControl.Clear() for account in self.accounts: newIndex = self.accountsControl.Append(account.displayName) self.accountsControl.SetClientData(newIndex, account) if account is self.currentAccount: self.accountsControl.SetSelection(newIndex) self.Bind(wx.EVT_CHOICE, self.OnChangeAccount, id=wx.xrc.XRCID("CHOICE_ACCOUNT")) self.CheckboxShareAlarms = wx.xrc.XRCCTRL(self, "CHECKBOX_ALARMS") self.CheckboxShareAlarms.SetValue(False) self.CheckboxShareStatus = wx.xrc.XRCCTRL(self, "CHECKBOX_STATUS") self.CheckboxShareStatus.SetValue(False) self.SetDefaultItem(wx.xrc.XRCCTRL(self, "wxID_OK"))
def onShareSidebarCollectionEventUpdateUI(self, event): """ Update the menu to reflect the selected collection name """ collection = self.getSidebarSelectedCollection() if collection is not None: sidebar = Block.findBlockByName("Sidebar") if sidebar.filterKind is None: filterKindPath = [] else: filterKindPath = [str(sidebar.filterKind.itsPath)] collName = Sharing.getFilteredCollectionDisplayName(collection, filterKindPath) menuTitle = _('Share "%s"...') % collName else: menuTitle = _("Share a collection...") event.arguments["Text"] = menuTitle event.arguments["Enable"] = collection is not None and (not Sharing.isShared(collection))
def onShareSidebarCollectionEventUpdateUI (self, event): """ Update the menu to reflect the selected collection name """ collection = self.getSidebarSelectedCollection () if collection is not None: sidebar = Block.findBlockByName("Sidebar") if sidebar.filterKind is None: filterKindPath = [] else: filterKindPath = [str(sidebar.filterKind.itsPath)] collName = Sharing.getFilteredCollectionDisplayName(collection, filterKindPath) menuTitle = _('Share "%s"...') % collName else: menuTitle = _('Share a collection...') event.arguments ['Text'] = menuTitle event.arguments['Enable'] = collection is not None and (not Sharing.isShared(collection))
def onSyncCollectionEventUpdateUI(self, event): """ Update the menu to reflect the selected collection name """ collection = self.getSidebarSelectedCollection() if collection is not None: sidebar = Block.findBlockByName("Sidebar") if sidebar.filterKind is None: filterKindPath = [] else: filterKindPath = [str(sidebar.filterKind.itsPath)] collName = Sharing.getFilteredCollectionDisplayName(collection, filterKindPath) menuTitle = _('Sync "%s"') % collName if Sharing.isShared(collection): event.arguments["Enable"] = True else: event.arguments["Enable"] = False else: event.arguments["Enable"] = False menuTitle = _("Sync a collection") event.arguments["Text"] = menuTitle