示例#1
0
def createViewSelection(node):
    if node is None:
        return None

    if node.getType() == NODE_TYPE_ACCOUNT:
        return ZViewSelection(IZViewSelectionTypes.ACCOUNT_SELECTION,
                              node.getAccount().getId())
    elif node.getType() == NODE_TYPE_BLOG:
        blogId = node.getBlog().getId()
        accountId = node.getBlog().getAccount().getId()
        return ZViewSelection(IZViewSelectionTypes.BLOG_SELECTION,
                              (accountId, blogId))
    elif node.getType() == NODE_TYPE_IMAGES:
        accountId = None
        blogId = None
        if node.getParentBlog() is not None:
            blogId = node.getParentBlog().getId()
            accountId = node.getParentBlog().getAccount().getId()
        return ZViewSelection(IZViewSelectionTypes.BLOG_IMAGES_SELECTION,
                              (accountId, blogId))
    elif node.getType() == NODE_TYPE_LINKS:
        accountId = None
        blogId = None
        if node.getParentBlog() is not None:
            blogId = node.getParentBlog().getId()
            accountId = node.getParentBlog().getAccount().getId()
        return ZViewSelection(IZViewSelectionTypes.BLOG_LINKS_SELECTION,
                              (accountId, blogId))
    elif node.getType() == NODE_TYPE_TAGS:
        accountId = None
        blogId = None
        if node.getParentBlog() is not None:
            blogId = node.getParentBlog().getId()
            accountId = node.getParentBlog().getAccount().getId()
        return ZViewSelection(IZViewSelectionTypes.BLOG_TAGS_SELECTION,
                              (accountId, blogId))
    elif node.getType(
    ) == NODE_TYPE_DRAFTED:  #Vaigai-Zoundry-Raven pitchaimuthu
        accountId = None
        blogId = None
        if node.getParentBlog() is not None:
            blogId = node.getParentBlog().getId()
            accountId = node.getParentBlog().getAccount().getId()
        return ZViewSelection(IZViewSelectionTypes.BLOG_EDITED_SELECTION,
                              (accountId, blogId))
    elif node.getType() == NODE_TYPE_POSTS:
        accountId = None
        blogId = None
        if node.getParentBlog() is not None:
            blogId = node.getParentBlog().getId()
            accountId = node.getParentBlog().getAccount().getId()
        return ZViewSelection(IZViewSelectionTypes.BLOG_POSTS_SELECTION,
                              (accountId, blogId))
    elif node.getType() == NODE_TYPE_UNPUBLISHED:
        accountId = None
        blogId = None
        return ZViewSelection(IZViewSelectionTypes.BLOG_POSTS_SELECTION,
                              (accountId, blogId))

    return None
示例#2
0
 def onAccountSelected(self, event):
     account = self._getSelectedAccount()
     if account is not None:
         selection = None
         if account.getId() == -1:
             selection = ZViewSelection(
                 IZViewSelectionTypes.UNPUBLISHED_ACCOUNT_SELECTION, None)
         else:
             selection = ZViewSelection(
                 IZViewSelectionTypes.ACCOUNT_SELECTION, account.getId())
         fireViewSelectionEvent(selection, self)
     else:
         fireViewUnselectionEvent()
     event.Skip()
示例#3
0
 def onCollapseAllButton(self, event):
     self.treeView.UnselectAll()
     self.treeView.collapseAll()
     fireViewSelectionEvent(
         ZViewSelection(IZViewSelectionTypes.UNPUBLISHED_ACCOUNT_SELECTION,
                        None), self)
     event.Skip()
示例#4
0
    def onAccountDeleted(self, account):  #@UnusedVariable
        if self._getSelectedAccount().getId() == account.getId():
            selection = ZViewSelection(
                IZViewSelectionTypes.UNPUBLISHED_ACCOUNT_SELECTION, None)
            fireViewSelectionEvent(selection, self)

        self.accountListProvider.refresh()
        fireRefreshEvent(self)
示例#5
0
 def onBlogSelected(self, event):
     blog = self._getSelectedBlog()
     if blog is not None:
         account = blog.getAccount()
         accountId = account.getId()
         blogId = blog.getId()
         selection = ZViewSelection(IZViewSelectionTypes.BLOG_SELECTION,
                                    (accountId, blogId))
         fireViewSelectionEvent(selection, self)
     else:
         fireViewUnselectionEvent()
     event.Skip()
示例#6
0
 def onFolderSelected(self, event):
     folderType = self._getSelectedFolderType()
     if folderType is not None:
         accountId = self.folderListProvider.getAccountId()
         blogId = self.folderListProvider.getBlogId()
         if accountId == UNPUBLISHED_ACCOUNT_ID:
             accountId = None
             blogId = None
         selection = ZViewSelection(folderType, (accountId, blogId))
         fireViewSelectionEvent(selection, self)
     else:
         fireViewUnselectionEvent()
     event.Skip()
示例#7
0
文件: viewutil.py 项目: mpm2050/Raven
def fireViewUnselectionEvent():
    fireViewSelectionEvent(
        ZViewSelection(IZViewSelectionTypes.EMPTY_SELECTION, None))