Title caseFrom Enso Wiki[edit] PythonNote: the parameter to this function is an "ensoEndpoint", i.e., a proxy object to Enso's XML-RPC server. See the Python HOWTO for more information on how Enso Extensions work. def titleCase( ensoEndpoint ): # Call an Enso Developer Prototype API function to get the # user's current unicode selection. text = ensoEndpoint.getUnicodeSelection() if len( text ) == 0: # Use the Enso Developer Prototype API to display a # transparent primary message to the end-user. ensoEndpoint.displayMessage( "<p>No text selected!</p>" ) else: titleText = text.title() ensoEndpoint.setUnicodeSelection( titleText, "title case" ) [edit] Command Server Versionfrom base import BaseCommand import time import urllib import threading class Command(BaseCommand): def __init__(self, *args): BaseCommand.__init__(self, *args) self.newCommand("title case", self._titlecase, "Title Case", "This causes every word to start upper cased, which is known as Titled Caseing.") def _titlecase(self, postfix): # Call an Enso Developer Prototype API function to get the # user's current unicode selection. text = self.getUnicodeSelection() if len(text) == 0: # Use the Enso Developer Prototype API to display a # transparent primary message to the end-user. self.displayMessage("<p>No text selected!</p>") else: titleText = text.title() self.setUnicodeSelection(titleText, "title case") |

