source: branches/mbutscher/work/WikidPadHelp/data/ApiDocs.wiki @ 195

Last change on this file since 195 was 178, checked in by mbutscher, 11 years ago

2.0preAlpha (internal)

Works so far, now editing help wiki.

File size: 7.7 KB
Line 
1++ wikidPad Hooks
2
3Under the wikidPad install directory:
4
5file:///C|/Program%20Files/WikidPad by default
6
7There is a directory called "extensions".  In this folder there is a
8file called "wikidpadhooks.py". If you know Python you can extend
9wikidPad by hooking into the events sent to the methods defined
10in this file. For example, you could integrate wikidPad with cvs
11by plugging into the onopen, onsave, ondelete, onrename events.
12
13file:///C|/Program%20Files/WikidPad/extensions/WikidPadHooks.py
14file:///C|/Program%20Files/WikidPad/user_extensions/WikidPadHooks.py
15
16++ API Documentation
17
18The first argument to each hook function is the instance of the
19PersonalWikiFrame object which is the main window of the application.
20In scripts, this instance is automatically assigned to the variable
21"pwiki".
22
23If you are reading the source code of WikidPad, this instance is often
24stored in member variable "pWiki", for some newer objects it has the
25name "mainControl".
26
27*Selected functions of PersonalWikiFrame instance*
28
29newWiki(wikiName, wikiDir)
30    Create a new wiki
31
32openWiki(wikiConfigFilename, wikiWordToOpen=None, ignoreWdhName=False)
33    Open a wiki, and optionally a page in that wiki. if ignoreWdhName
34    is True, the program asks for the database type (same as
35    "Open as Type" in menu)
36
37saveCurrentWikiState()
38    Write any changes to the wiki to disk.
39   
40openWikiPage(wikiWord)
41    Open a specific wiki word.
42
43findCurrentWordInTree()
44    Select the currently open page in the tree control.
45   
46viewParents(word)
47    Pop up the dialog that shows the parents of the node passed in.
48
49viewChildren()
50    Pop up the dialog that shows the children of the node passed in.
51
52viewParentLess()
53    Pop up the dialog that shows the parentless nodes.
54
55viewBookmarks()
56    Pop up the dialog that shows the bookmarked nodes.
57
58viewHistory()
59    Pop up the dialog that shows the history of visited pages.
60
61saveCurrentWikiPage()
62    Save the current wiki page to disk.
63
64stdDialog(dlgtype, title, message, additional=None)
65    Show one of the standard dialogs. dlgtype is a string giving the type
66    of the desired dialog. title and message are strings to show in the
67    dialog, the meaning of additional and the return value depends on
68    the dialog type.
69   
70    Possible types:
71
72    "text": input text to dialog, additional is the default text.
73        The function returns the entered text on OK or an empty string on Cancel
74    "o": Shows only OK button
75    "oc": Shows OK and Cancel buttons, returns either "ok" or "cancel"
76    "yn": Yes and No buttons, returns either "yes" or "no"
77    "ync": like "yn" but with additional cancel button, can also return
78        "cancel"
79
80
81displayErrorMessage(errorStr, exception)
82    Popup an exception dialog.
83
84
85getWikiData()
86    Get currently active WikiData object.
87   
88getActiveEditor()
89    Returns currently active editor control (currently there only can be one).
90
91getCurrentWikiWord()
92    The currently open wiki word.
93   
94getCurrentDocPage()
95    Get the current DocPage object. (TODO)
96
97
98
99
100
101
102
103
104
105
106
107*The following documentation is outdated!*
108
109The first argument to each hook function is wikidPad itself.  Here are
110the available methods on the wikidPad object.
111
112*wikidPad functions*
113
114
115addToHistory(word)
116    Add the word passed in to the history.
117   
118goInHistory(positionDelta)
119    Go back or forward in history by the amount passed in.
120   
121goBackInHistory()
122    Go back in history one position.
123   
124goForwardInHistory()
125    Go forward in history one position.
126   
127       
128showWikiWordOpenDialog()
129showWikiWordRenameDialog()
130showWikiWordRenameConfirmDialog()
131showSearchDialog()
132showSavedSearchesDialog()
133showWikiWordDeleteDialog()
134showFindReplaceDialog()
135
136displayMessage(title, msg)
137    Popup a dialog with the message passed in.
138   
139   
140*wikidPad.variables*
141
142globalConfigDir
143    The directory of the wikidPad.config file.
144
145globalConfigLoc
146    The wikidpad.config file.
147
148globalConfig
149    The parsed wikidpad.config file.
150
151wikiAppDir
152    The installation directory of wikidPad.
153   
154wikiPadHelp
155    The location of the help wiki.
156   
157config
158    The parsed configuration of the opened wiki.
159   
160wikiName
161    The name of the currently opened wiki.
162   
163dataDir
164    The data directory of the currently opened wiki.
165   
166wikiData
167    The database object for the currently open wiki. More on this below.
168   
169tree
170    The tree control on the left. The is a wxTreeCtrl. More on this below.
171
172   
173editor
174    The text editor for wikidPad. This is a wxStyledTextCtrl. More on this below.
175   
176   
177*wikiData - The wiki database interface*
178
179getPage(wikiWord, itemsToLoad)
180    Get the data for a wiki word. Pass in an array of strings for the items to load.
181    Valid items are: info, parents, children, props, todos.
182    For performance you specify which items should be loaded from the db. If you only
183    need info and children call:
184   
185    getPage(word, ["info", "children"])
186   
187    More on the return value of this function below.
188   
189getChildRelationships(wikiWord)
190    Returns array of the words that are children of the word passed in.
191   
192getParentRelationships(wikiWord)
193    Returns array of the words that are parents of the word passed in.
194   
195getAllWords()
196    Get all of the wiki words in the wiki.
197   
198getAllAliases()
199    Get all of the aliases in the wiki.
200   
201getAllRelations()
202    Get all of the relationships in the wiki. Returns array of tuples, (word, relatedTo).
203   
204getWikiWordsStartingWith(string)
205getWikiWordsWith(string)
206getWikiWordsModifiedWithin(days)
207getParentLessWords()
208
209renameWord(word, toWord)
210    Rename a wiki word.
211   
212deleteWord(word)
213    Delete a wiki word.
214   
215getWordsWithPropertyValue(key, value)
216    Get all of the wiki words with a certain property value. For example
217    getWordsWithPropertyValue("icon", "pin") would get all of the wiki
218    words with "icon" set to "pin".
219
220findBestPathFromWordToWord(word, toWord)
221    Returns the shortest path in the wiki from "word" to "toWord". Returned
222    as an array of wiki words.
223   
224search(forPattern)
225    Search the entire wiki using a regex.
226
227getTodos()
228    Get all of the todos in the wiki. Returned as an array of tuples.
229
230*wikiPage object*
231
232wikiWord
233    The word.
234
235wikiFile
236    The file that contains the data for this page.
237
238parentRelations
239    Array of the parents words for this node.
240
241childRelations
242    Array of the child words for this node.
243
244todos
245    Array of todos
246
247props
248    Hashtable of properties for the node.
249   
250getContent()
251    Get the string content for the node.
252
253save()
254    Save the changes to this page to disk.
255   
256   
257*tree control*
258
259collapse()
260    collapse the tree.
261   
262buildTreeForWord(wikiword)
263    Open the tree control to the wiki word passed in.
264   
265*text control*
266
267setWrap(onOrOffBoolean)
268    Set the wrap mode to on/off.
269
270SetText()
271    Set the text of the control.
272   
273snip()
274    Copy the currently selected text to the ScratchPad.
275
276startIncrementalSearch(searchStr)
277    Set the search mode to incremental.
278   
279endIncrementalSearch()
280    Stop incremental search.
281
282executeSearch(searchStr, searchStartPos=-1)
283    Execute a search of the text in the control.
284   
285getWikiWordText(position)
286    If position is in a wiki word return that word.
287   
288getWikiWordBeginEnd(position)
289    If position is in a wiki word return the start/end positions of the word.
290   
291isPositionInWikiWord(position)
292    Is the position in a wiki word?
293   
294isPositionInLink(position)
295    Is the position in a URL link?
296
297See the wxWindows/wxPython documentation for info about the wxTreeCtrl and wxStyledTextCtrl.
298
299[alias: WikidPadHooks]
Note: See TracBrowser for help on using the repository browser.