wikkit
Specifying a new page
Saving the current page. Exiting or creating a new page will also save.
Viewing the list of existing nodes.
A program designed to make your note taking life easier. WikiPad is a wiki-like scratchpad for Nokia Series 60 phones. By Christopher Schmidt
To install: You must have the Python for Nokia Series 60 executable installed on your phone in order to use this software. Once you have this installed, transfer the source code to your phone: It will then ask you to install it. Choose to install it as a script. Open Python, and run "my/wikkit.py": This will (after several seconds) open the wiki.
Use: To create a new node, simply press the "action" button while
on a word. On my 3650, this is the center button. The current page is then
saved, and you enter the page which you selected. Note that case is important:
Test, test, and tesT are all different wiki pages. In order to go back to the
previous page, you can press "EKeyYes" - this is the call button on my 3650.
Note: When pressing the action button, ensure
that you are not still in the T9 section of the word. Doing so in a Text
element causes Python to crash. This is a problem with the Python T9
implementation.
Features in testing: Uploading data to webpage for storage/retrieval.
import appuifw import anydbm import e32 import re import key_codes print """ wikkit Copyright 2005, Christopher Schmidt MIT License, Share and Enjoy """ r_endword = re.compile(r'[A-Za-z0-9]+$') r_startword = re.compile(r'^[A-Za-z0-9]+') class Application: def getword(self, input, pos): """From Sean B. Palmer, http://inamidst.com/sbp/""" try: eword = r_endword.search(input[:pos]).group(0) except AttributeError: eword = '' try: sword = r_startword.match(input[pos:]).group(0) except AttributeError: sword = '' if not (eword or sword): return None return eword + sword def upload(self): import urllib d = {} for i in self.db.keys(): d[i] = self.db[i].replace(u'\u2029', "\n\n") s = urllib.urlencode(d) uri = appuifw.query(u"URI to POST to?", "text") u = urllib.urlopen("%s"%uri, data=s) appuifw.note(u"Uploaded data.", "info") def open_page(self, page): """Change the current page, saving the text and opening a new one.""" self.db[self.current_page] = appuifw.app.body.get() if not self.history: self.old_page.append(self.current_page) self.history = 0 self.current_page = page if self.current_page in self.db: appuifw.app.body.set(self.db[self.current_page]) else: appuifw.app.body.set(u"") self.db.sync() appuifw.app.title=u"%s"%page def callback_new(self): """Open a new wiki page.""" new_page = appuifw.query(u"Title?", "text") self.open_page(new_page) def callback_save(self): """Save the current page, and sync.""" self.db[self.current_page] = appuifw.app.body.get() self.db.sync() def __init__(self): """Open an anydbm file, open the "main" wiki page.""" self.db = anydbm.open("C:\\wikidb", "c") self.current_page = "main" self.old_page = [] self.history = 0 if not u'main' in self.db: self.db[u'main'] = u"Main Page" self.orig_menu = appuifw.app.menu appuifw.app.menu = [(u"New", self.callback_new), (u"Open", self.launch_list), (u"Save",self.callback_save), (u"Upload to Web",self.upload), (u"Exit", self.callback_exit)] self.orig_exit = appuifw.app.exit_key_handler appuifw.app.exit_key_handler=self.callback_exit appuifw.app.body = appuifw.Text(self.db[u'main']) self.old_title = appuifw.app.title appuifw.app.title = u"main" appuifw.app.body.bind(key_codes.EKeyDevice3,self.callback_key) appuifw.app.body.bind(key_codes.EKeyYes,self.callback_back) self.lock = e32.Ao_lock() self.lock.wait() def callback_back(self): if self.old_page: self.history = 1 self.open_page(self.old_page.pop()) def callback_key(self): i = self.getword(appuifw.app.body.get(), appuifw.app.body.get_pos()) if i: self.open_page(i) def callback_exit(self): """Cleanup after ourselves.""" self.callback_save() appuifw.app.exit_key_handler = self.orig_exit appuifw.app.title = self.old_title self.db.close() self.lock.signal() def launch_list(self): self.text_body = appuifw.app.body appuifw.app.body = appuifw.Listbox(self.db.keys(),self.list_switch) def list_switch(self): i = appuifw.app.body.current() appuifw.app.body = self.text_body self.open_page(self.db.keys()[i]) A = Application()