Logo Search packages:      
Sourcecode: pythoncard version File versions  Download package

def textRouter::TextRouter::on_menuBloggerInsertPrevPost_select (   self,
  event 
)

Gets an existing post for editting.

Definition at line 1399 of file textRouter.py.

01399                                                         :
        """Gets an existing post for editting."""
        if not self.checkBloggerAccounts(3):
            return

        curBlogAccount = self.theBloggerAccounts[self.theCurrentBloggerAccount]
        
        # check logged in
        if (not curBlogAccount.checkSetupOK(0)):
            self.status(curBlogAccount.getErrorMessage())
            return 0
        
        if ("previousPosts" not in curBlogAccount.blogs[curBlogAccount.prefs["activeBlog"]-1]) or \
               curBlogAccount.blogs[curBlogAccount.prefs["activeBlog"]-1]["previousPosts"] == []:
            self.showWaitMsg("Fetching previous posts...")

            postid = curBlogAccount.bloggerFetchPreviousPosts()
            if curBlogAccount.anErrorOccured():
                self.status(curBlogAccount.getErrorMessage())
                return
            else:
                self.status("Previous posts fetched, now choose one to edit...")

        #if (not curBlogAccount.checkSetupOK(8)):
            #self.status(curBlogAccount.getErrorMessage())
            #return
        
        activeBlogIndex = curBlogAccount.prefs["activeBlog"]-1
        prevPosts = curBlogAccount.blogs[activeBlogIndex]["previousPosts"]


        options = []
        for index in range(len(curBlogAccount.blogs[activeBlogIndex]["previousPosts"])):
            text = prevPosts[index]["content"].replace("\n"," ")
            options.append( "%d: %s%s" % (index+1, text[0:50], (len(text) > 50) and "..." or "") )

        default = options[0]
        dlg = ChooserDialog(self, 'Choose Post To Edit', \
                            "Choose the post to edit...", \
                            options, default)
        dlg.showModal()
        
        if not dlg.accepted():
            self.status("Post editing cancelled.")
        else:
            i = dlg.components.options.findString(dlg.components.options.stringSelection)
            if i == -1:
                self.status("No previous post selected.")
            else:
                curBlogAccount.currentPostId = prevPosts[i]["postid"]
                self.updateTextBox(prevPosts[i]["content"])

            self.status("Editing previous post, use 'Blogger->Update Post' to save you edits when done.")

            self.saveState()

        dlg.destroy()


    def on_menuBloggerGetPost_select(self, event):


Generated by  Doxygen 1.6.0   Back to index