CMS 3D CMS Logo

Public Member Functions | Public Attributes

python::cmscompleter::CMSCompleter Class Reference

List of all members.

Public Member Functions

def __init__
def global_matches

Public Attributes

 cmsnamespace
 namespace
 use_main_ns

Detailed Description

Definition at line 17 of file cmscompleter.py.


Constructor & Destructor Documentation

def python::cmscompleter::CMSCompleter::__init__ (   self,
  namespace = None 
)

Definition at line 18 of file cmscompleter.py.

00019                                         :
00020         
00021         if namespace and not isinstance(namespace, dict):
00022             raise TypeError,'namespace must be a dictionary'
00023 
00024         # Don't bind to namespace quite yet, but flag whether the user wants a
00025         # specific namespace or to use __main__.__dict__. This will allow us
00026         # to bind to __main__.__dict__ at completion time, not now.
00027         if namespace is None:
00028             self.use_main_ns = 1
00029         else:
00030             self.use_main_ns = 0
00031             self.namespace = namespace          
00032         try:
00033             # loading cms namespace
00034             import namespaceDict
00035             self.cmsnamespace = namespaceDict.getNamespaceDict()
00036         except:
00037             print 'Could not load CMS namespace'
00038 
 

Member Function Documentation

def python::cmscompleter::CMSCompleter::global_matches (   self,
  text 
)
Compute matches when text is a simple name.

Return a list of all keywords, built-in functions and names currently
defined in self.namespace and self.cmsnamespace that match.

Definition at line 39 of file cmscompleter.py.

00040                                   :
00041         """Compute matches when text is a simple name.
00042 
00043         Return a list of all keywords, built-in functions and names currently
00044         defined in self.namespace and self.cmsnamespace that match.
00045 
00046         """
00047         import keyword
00048         matches = []
00049         n = len(text)
00050         for list in [keyword.kwlist,
00051                      __builtin__.__dict__,
00052                                          self.cmsnamespace]:
00053             for word in list:
00054                 if word[:n] == text and word != "__builtins__":
00055                     matches.append(word)
00056         return matches
00057 
00058 # connect CMSCompleter with readline
00059 readline.set_completer(CMSCompleter().complete)
00060 readline.parse_and_bind('tab: complete')
00061 
00062 

Member Data Documentation

Definition at line 18 of file cmscompleter.py.

Definition at line 18 of file cmscompleter.py.

Definition at line 18 of file cmscompleter.py.