forked from butscher/WikidPad
-
Notifications
You must be signed in to change notification settings - Fork 0
CopyPageName
Christian Ziemski edited this page Mar 7, 2016
·
4 revisions
# -*- coding: utf-8 -*-
# copyPageName.py
# Copies the name of the current page to the clipboard.
# The keybindung as it is now in code (Ctrl-t) will only work if you put
# ShowTreeControl=""
# into your KeyBindings.py, because otherwise ShowTreeControls lives on that key.
# Or change the "Ctrl-t" in the code.
import re
WIKIDPAD_PLUGIN = (("MenuFunctions",1),)
def describeMenuItems(wiki):
global nextNumber
return ((copyPageName, "copyPageName\tCtrl-t", "copyPageName"),)
def copyPageName(wiki, evt):
editor=wiki.getActiveEditor()
beginSel=editor.GetSelectionStart()
endSel=editor.GetSelectionEnd()
#select nothing:
editor.SetSelectionStart(endSel)
editor.AddText(wiki.getCurrentWikiWord())
editor.SetSelectionStart(endSel)
editor.Cut()
editor.SetSelectionStart(beginSel)
editor.SetSelectionEnd(endSel)
Source: http://trac.wikidpad2.webfactional.com/wiki/CopyPageName