Exemple #1
0
class ZNavigatorTreeImagesNode(ZNavigatorTreeSubNode):
    def __init__(self):
        ZNavigatorTreeSubNode.__init__(self, NODE_TYPE_IMAGES)
        self.filter = ZImageSearchFilter()
        self.imagesCount = -1

    # end __init__()

    def getSearchFilter(self):
        return self.filter

    # end getSearchFilter()

    def getImagesCount(self):
        if self.imagesCount == -1:
            self._configureFilter()
            self.imagesCount = self._getImagesCount()
        return self.imagesCount

    # end getImagesCount()

    def _configureFilter(self):
        if self.parentBlog:
            self.filter.setBlogIdCriteria(self.parentBlog.getId())

    # end _configureFilter()

    def _getImagesCount(self):
        docIndex = getApplicationModel().getEngine().getService(
            IZBlogAppServiceIDs.DOCUMENT_INDEX_SERVICE_ID)
        return docIndex.getImageCount(self.filter)

    # end _getImagesCount()

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

    # end getLabel()

    def addImageIDO(self, imageIDO):
        if self.imagesCount != -1 and self.filter.matches(imageIDO):
            self.imagesCount = self.imagesCount + 1
            return True
        return False

    # end addImageIDO()

    def removeImageIDO(self, imageIDO):
        if self.imagesCount != -1 and self.filter.matches(imageIDO):
            self.imagesCount = self.imagesCount - 1
            return True
        return False
class ZNavigatorTreeImagesNode(ZNavigatorTreeSubNode):

    def __init__(self):
        ZNavigatorTreeSubNode.__init__(self, NODE_TYPE_IMAGES)
        self.filter = ZImageSearchFilter()
        self.imagesCount = -1
    # end __init__()

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

    def getImagesCount(self):
        if self.imagesCount == -1:
            self._configureFilter()
            self.imagesCount = self._getImagesCount()
        return self.imagesCount
    # end getImagesCount()

    def _configureFilter(self):
        if self.parentBlog:
            self.filter.setBlogIdCriteria(self.parentBlog.getId())
    # end _configureFilter()

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

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

    def addImageIDO(self, imageIDO):
        if self.imagesCount != -1 and self.filter.matches(imageIDO):
            self.imagesCount = self.imagesCount + 1
            return True
        return False
    # end addImageIDO()

    def removeImageIDO(self, imageIDO):
        if self.imagesCount != -1 and self.filter.matches(imageIDO):
            self.imagesCount = self.imagesCount - 1
            return True
        return False
Exemple #3
0
    def refreshContent(self, selection):
        (accountId, blogId) = selection.getData()

        filter = ZImageSearchFilter()
        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(
                IZImageSearchFilter.UNPUBLISHED_ACCOUNT_ID)
            filter.setBlogIdCriteria(IZImageSearchFilter.UNPUBLISHED_BLOG_ID)

        self.model = ZContextInfoImagesModel(filter)
        self.imagesTreeView.setContentProvider(
            ZImageTreeContentProvider(self.model))
        self.imagesTreeView.refresh()
        self.imagesTreeView.deselectAll()
        self.onInvalidSelection()
        fireViewUnselectionEvent()
Exemple #4
0
    def refreshContent(self, selection):
        (accountId, blogId) = selection.getData()

        filter = ZImageSearchFilter()
        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(IZImageSearchFilter.UNPUBLISHED_ACCOUNT_ID)
            filter.setBlogIdCriteria(IZImageSearchFilter.UNPUBLISHED_BLOG_ID)

        self.model = ZContextInfoImagesModel(filter)
        self.imagesTreeView.setContentProvider(ZImageTreeContentProvider(self.model))
        self.imagesTreeView.refresh()
        self.imagesTreeView.deselectAll()
        self.onInvalidSelection()
        fireViewUnselectionEvent()
Exemple #5
0
    def __init__(self, parent):
        self.image = None
        self.blog = None
        self.indexService = getApplicationModel().getService(
            IZBlogAppServiceIDs.DOCUMENT_INDEX_SERVICE_ID)
        self.accountStore = getApplicationModel().getService(
            IZBlogAppServiceIDs.ACCOUNT_STORE_SERVICE_ID)
        self.model = ZContextInfoImagesModel(ZImageSearchFilter())
        self.openImageAction = getApplicationModel().getActionRegistry(
        ).findAction(IZAppActionIDs.OPEN_IMAGE_ACTION)

        ZBoxedView.__init__(self, parent)

        self._registerAsIndexListener()

        self.validSelection = False
 def __init__(self):
     ZNavigatorTreeSubNode.__init__(self, NODE_TYPE_IMAGES)
     self.filter = ZImageSearchFilter()
     self.imagesCount = -1
 def __init__(self):
     ZNavigatorTreeSubNode.__init__(self, NODE_TYPE_IMAGES)
     self.filter = ZImageSearchFilter()
     self.imagesCount = -1