Пример #1
0
    def refreshContent(self, selection):
        isUnselecting = False
        if self.entriesListView.getSelection():
            isUnselecting = True

        (accountId, blogId) = selection.getData()

        filter = ZDocumentSearchFilter()
        if blogId is not None:
            account = self.accountStore.getAccountById(accountId)
            self.blog = account.getBlogById(blogId)
            filter.setAccountIdCriteria(accountId)
            filter.setBlogIdCriteria(blogId)
        else:
            self.blog = None
            filter.setAccountIdCriteria(
                IZDocumentSearchFilter.UNPUBLISHED_ACCOUNT_ID)
            filter.setBlogIdCriteria(
                IZDocumentSearchFilter.UNPUBLISHED_BLOG_ID)

        self.model = ZContextInfoPostsModel(filter)
        self.entriesListView.setContentProvider(
            ZBlogEntryListContentProvider(self.model))
        self.entriesListView.refresh()
        self.entriesListView.deselectAll()
        self.onInvalidSelection()
        if isUnselecting:
            fireViewUnselectionEvent()
Пример #2
0
    def refreshContent(self, selection):
        isUnselecting = False
        if self.entriesListView.getSelection():
            isUnselecting = True

        (accountId, blogId) = selection.getData()

        filter = ZDocumentSearchFilter()
        if blogId is not None:
            account = self.accountStore.getAccountById(accountId)
            self.blog = account.getBlogById(blogId)
            filter.setAccountIdCriteria(accountId)
            filter.setBlogIdCriteria(blogId)
        else:
            self.blog = None
            filter.setAccountIdCriteria(IZDocumentSearchFilter.UNPUBLISHED_ACCOUNT_ID)
            filter.setBlogIdCriteria(IZDocumentSearchFilter.UNPUBLISHED_BLOG_ID)

        self.model = ZContextInfoPostsModel(filter)
        self.entriesListView.setContentProvider(ZBlogEntryListContentProvider(self.model))
        self.entriesListView.refresh()
        self.entriesListView.deselectAll()
        self.onInvalidSelection()
        if isUnselecting:
            fireViewUnselectionEvent()
Пример #3
0
class ZNavigatorTreeEditedPostsNode(ZNavigatorTreeSubNode):
    def __init__(self):
        ZNavigatorTreeSubNode.__init__(self, NODE_TYPE_DRAFTED)
        self.filter = ZDocumentSearchFilter()
        self.postsCount = -1

    # end __init__()

    def getPostsCount(self):
        if self.postsCount == -1:
            self._configureFilter()
            self.postsCount = self._getPostsCount()
        return self.postsCount

    # end getPostsCount()

    def _configureFilter(self):
        self.filter.setAccountIdCriteria(
            IZDocumentSearchFilter.UNPUBLISHED_ACCOUNT_ID)
        if self.parentBlog:
            self.filter.setBlogIdCriteria(
                IZDocumentSearchFilter.UNPUBLISHED_POSTS)
        self.filter.setBlogIdCriteria(True)

    # end _configureFilter()

    def _getPostsCount(self):
        docIndex = getApplicationModel().getEngine().getService(
            IZBlogAppServiceIDs.DOCUMENT_INDEX_SERVICE_ID)
        return docIndex.getDocumentCount(self.filter)

    # end _getPostsCount()

    def getSearchFilter(self):
        return self.filter

    # end getSearchFilter()

    def getLabel(self):
        label = ZNavigatorTreeSubNode.getLabel(self)
        return u"%s (%d)" % (label, self.getPostsCount())  #$NON-NLS-1$

    # end getLabel()

    def addDocumentIDO(self, documentIDO):
        if self.postsCount != -1 and self.filter.matches(documentIDO):
            self.postsCount = self.postsCount + 1
            return True
        return False

    # end addDocumentIDO()

    def removeDocumentIDO(self, documentIDO):
        if self.postsCount != -1 and self.filter.matches(documentIDO):
            self.postsCount = self.postsCount - 1
            return True
        return False
Пример #4
0
class ZNavigatorTreeEditedPostsNode(ZNavigatorTreeSubNode):

    def __init__(self):
        ZNavigatorTreeSubNode.__init__(self, NODE_TYPE_DRAFTED)
        self.filter = ZDocumentSearchFilter()
        self.postsCount = -1
    # end __init__()

    def getPostsCount(self):
        if self.postsCount == -1:
            self._configureFilter()
            self.postsCount = self._getPostsCount()
        return self.postsCount
    # end getPostsCount()

    def _configureFilter(self):
        self.filter.setAccountIdCriteria(IZDocumentSearchFilter.UNPUBLISHED_ACCOUNT_ID)
        if self.parentBlog:
        	self.filter.setBlogIdCriteria(IZDocumentSearchFilter.UNPUBLISHED_POSTS)
        self.filter.setBlogIdCriteria(True)
    # end _configureFilter()

    def _getPostsCount(self):
        docIndex = getApplicationModel().getEngine().getService(IZBlogAppServiceIDs.DOCUMENT_INDEX_SERVICE_ID)
        return docIndex.getDocumentCount(self.filter)
    # end _getPostsCount()

    def getSearchFilter(self):
        return self.filter
    # end getSearchFilter()

    def getLabel(self):
        label = ZNavigatorTreeSubNode.getLabel(self)
        return u"%s (%d)" % (label, self.getPostsCount()) #$NON-NLS-1$
    # end getLabel()

    def addDocumentIDO(self, documentIDO):
        if self.postsCount != -1 and self.filter.matches(documentIDO):
            self.postsCount = self.postsCount + 1
            return True
        return False
    # end addDocumentIDO()

    def removeDocumentIDO(self, documentIDO):
        if self.postsCount != -1 and self.filter.matches(documentIDO):
            self.postsCount = self.postsCount - 1
            return True
        return False
Пример #5
0
    def __init__(self, parent):
        filter = ZDocumentSearchFilter()
        filter.setAccountIdCriteria(IZDocumentSearchFilter.UNPUBLISHED_ACCOUNT_ID)
        filter.setBlogIdCriteria(IZDocumentSearchFilter.UNPUBLISHED_BLOG_ID)
        self.model = ZContextInfoPostsModel(filter)
        self.openAction = getApplicationModel().getActionRegistry().findAction(IZBlogAppActionIDs.OPEN_BLOG_POST_ACTION)
        self.blogPostContextMenu = ZBlogPostMenuModel()
        self.postsAccelTable = ZBlogPostsListAcceleratorTable(self)
        self.document = None
        self.blog = None
        self.hasFocus = False

        self.indexService = getApplicationModel().getService(IZBlogAppServiceIDs.DOCUMENT_INDEX_SERVICE_ID)
        self.docStore = getApplicationModel().getService(IZBlogAppServiceIDs.DATA_STORE_SERVICE_ID)
        self.accountStore = getApplicationModel().getService(IZBlogAppServiceIDs.ACCOUNT_STORE_SERVICE_ID)

        ZBoxedView.__init__(self, parent)

        self._registerAsIndexListener()
Пример #6
0
    def __init__(self, parent):
        filter = ZDocumentSearchFilter()
        filter.setAccountIdCriteria(
            IZDocumentSearchFilter.UNPUBLISHED_ACCOUNT_ID)
        filter.setBlogIdCriteria(IZDocumentSearchFilter.UNPUBLISHED_BLOG_ID)
        self.model = ZContextInfoPostsModel(filter)
        self.openAction = getApplicationModel().getActionRegistry().findAction(
            IZBlogAppActionIDs.OPEN_BLOG_POST_ACTION)
        self.blogPostContextMenu = ZBlogPostMenuModel()
        self.postsAccelTable = ZBlogPostsListAcceleratorTable(self)
        self.document = None
        self.blog = None
        self.hasFocus = False

        self.indexService = getApplicationModel().getService(
            IZBlogAppServiceIDs.DOCUMENT_INDEX_SERVICE_ID)
        self.docStore = getApplicationModel().getService(
            IZBlogAppServiceIDs.DATA_STORE_SERVICE_ID)
        self.accountStore = getApplicationModel().getService(
            IZBlogAppServiceIDs.ACCOUNT_STORE_SERVICE_ID)

        ZBoxedView.__init__(self, parent)

        self._registerAsIndexListener()