|
Revision 28, 1.8 kB
(checked in by gerhard, 8 years ago)
|
|
implemented a new plugin type that adds extension menu items and toolbars.
a simple example plugin was added that creates a list of referers in the current wiki
|
| Line | |
|---|
| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | WIKIDPAD_PLUGIN = (("EditorFunctions",1),) |
|---|
| 19 | |
|---|
| 20 | def describeMenuItem(wiki): |
|---|
| 21 | return (referrals, "Show Referring Wikis\tctrl-r", "Show Referring Wikis") |
|---|
| 22 | |
|---|
| 23 | def describeToolbarItem(wiki): |
|---|
| 24 | (index, icon) = wiki.iconLookup["rename"] |
|---|
| 25 | return (referrals, "Referers", icon, "Show Referring Wikis") |
|---|
| 26 | |
|---|
| 27 | def referrals(wiki): |
|---|
| 28 | wiki.editor.AddText("\n------------------------\n") |
|---|
| 29 | parents = wiki.wikiData.getParentRelationships(wiki.currentWikiWord) |
|---|
| 30 | wiki.editor.AddText("*%s Wikis referring to* %s\n" % (len(parents), wiki.currentWikiWord)) |
|---|
| 31 | for word in parents: |
|---|
| 32 | wiki.editor.AddText("%s\n" % word) |
|---|
| 33 | wiki.editor.AddText("------------------------\n") |
|---|
| 34 | children = wiki.wikiData.getChildRelationships(wiki.currentWikiWord) |
|---|
| 35 | wiki.editor.AddText("*%s Wikis referred to by* %s\n" % (len(children), wiki.currentWikiWord)) |
|---|
| 36 | for word in children: |
|---|
| 37 | wiki.editor.AddText("%s\n" % word) |
|---|
| 38 | wiki.editor.AddText("------------------------\n") |
|---|