def getBlog(self): blog = None if self.viewSelection is not None and self.viewSelection.getType() == IZViewSelectionTypes.BLOG_SELECTION: (accId, blogId) = self.viewSelection.getData() blog = getBlogFromIds(accId, blogId) elif self.viewSelection is not None and self.viewSelection.getType() == IZViewSelectionTypes.DOCUMENT_SELECTION: (blog, document) = self.viewSelection.getData() #@UnusedVariable return blog
def refreshUI(self): # update UI from model pubMetaDataList = self.model.getPubMetaDataList() if pubMetaDataList and len(pubMetaDataList) > 0: for index in range( len(pubMetaDataList) ): pubMetaData = pubMetaDataList[index] if index < len(self.infoWidgets): # update existing info widget blog = getBlogFromIds(pubMetaData.getAccountId(), pubMetaData.getBlogId()) if blog is not None: widget = self.infoWidgets[index] widget.setPubMetaData(pubMetaData) else: # add new widget and populate it. self._addNewInfoWidget(pubMetaData)
def runAction(self, actionContext): selection = actionContext.getViewSelection() url = None if selection.getType() == IZViewSelectionTypes.BLOG_SELECTION: (accountId, blogId) = selection.getData() blog = getBlogFromIds(accountId, blogId) url = blog.getUrl() elif selection.getType() == IZViewSelectionTypes.DOCUMENT_SELECTION: (blog, document) = selection.getData() url = getBlogPostUrl(document, blog.getId()) elif selection.getType() == IZViewSelectionTypes.LINK_SELECTION: url = selection.getData()[1].getUrl() elif selection.getType() == IZViewSelectionTypes.IMAGE_SELECTION: url = selection.getData()[1].getUrl() if url is not None: getOSUtil().openUrlInBrowser(url)
def onBlogPostSelected(self, event): index = event.GetIndex() docIDO = self.model.getBlogPosts()[index] docId = docIDO.getId() self.document = self.docStore.getDocument(docId) self.blog = None if docIDO.getPubDataIDOs(): pubDataIDO = docIDO.getPubDataIDOs()[0] self.blog = getBlogFromIds(pubDataIDO.getAccountId(), pubDataIDO.getBlogId()) if self.document: fireViewSelectionEvent(ZDocumentSelection(self.document, self.blog)) else: fireViewUnselectionEvent() event.Skip()
def getRowText(self, rowIndex, columnIndex): if self.document is not None and rowIndex < len(self.document.getBlogInfoList()) : blogInfo = self.document.getBlogInfoList()[rowIndex] pubData = blogInfo.getPublishInfo() blog = getBlogFromIds(blogInfo.getAccountId(), blogInfo.getBlogId()) if columnIndex == 0 and blog is not None: return blog.getName() elif columnIndex == 1: issuedTime = pubData.getPublishedTime() return formatLocalDateAndTime(issuedTime) elif columnIndex == 2: return unicode(pubData.getBlogEntryId()) elif columnIndex == 3: return u"" # FIXME impl this #$NON-NLS-1$ elif columnIndex == 4: return u"False" # FIXME impl this #$NON-NLS-1$ return u"" #$NON-NLS-1$
def getRowText(self, rowIndex, columnIndex): if self.document is not None and rowIndex < len( self.document.getBlogInfoList()): blogInfo = self.document.getBlogInfoList()[rowIndex] pubData = blogInfo.getPublishInfo() blog = getBlogFromIds(blogInfo.getAccountId(), blogInfo.getBlogId()) if columnIndex == 0 and blog is not None: return blog.getName() elif columnIndex == 1: issuedTime = pubData.getPublishedTime() return formatLocalDateAndTime(issuedTime) elif columnIndex == 2: return unicode(pubData.getBlogEntryId()) elif columnIndex == 3: return u"" # FIXME impl this #$NON-NLS-1$ elif columnIndex == 4: return u"False" # FIXME impl this #$NON-NLS-1$ return u"" #$NON-NLS-1$
def selectBlog(self, accountId, blogId): self.blog = getBlogFromIds(accountId, blogId) if self.blog is not None: self.popupCtrl.setBlog(self.blog) self.SetValue(self.blog.getName())