wiki:ResetPresentation

"Reset Presentation" is a simple plugin to add a menu entry for resetting the so-called presentation information of all wiki words in a wiki. It works with 2.0 and 2.1 versions of WikidPad.

The presentation information stores the last cursor position in editor and the scroll position in editor and internal preview. Resetting it deletes this data for all wiki pages which are currently not open. Open pages must be reset manually.

It is helpful, e.g. before sending a wiki to someone else to ensure that the user is not irritated by pages scrolled to somewhere in the middle when opened.

Save the code below to a file called e.g. "ResetPresentation.py" in your "user_extensions" directory in the WikidPad installation directory.

import traceback


WIKIDPAD_PLUGIN = (("MenuFunctions",1),)

def describeMenuItems(wiki):
    return ((resetPresentation, u"Reset presentation",
            u"Reset presentation settings"),)



def resetPresentation(wiki, evt):
    wikiData = wiki.getWikiData()
    if wikiData is None:
        return
    
    for word in wikiData.getAllDefinedWikiPageNames():
        try:
            wikiData.setPresentationBlock(word, "")
        except:
            traceback.print_exc()
    
    wikiData.commit()
Last modified 7 years ago Last modified on Apr 12, 2010 2:27:54 PM