'*_form,RSS,*login*,logged_in,*logout*,logged_out,createObject*,select_default_page,selectViewTemplate*,object_cut,object_copy,object_rename,delete_confirmation,content_status_*,addtoFavorites,pdf.html,print.html',
import xml.etree.cElementTree as ET
from urlparse import urlparse
"command-line Plone help"
version = "casa-%d.%d.%d" % tuple(cu.version( )[:3])
self.remote_source_url = "https://casa.nrao.edu/casadocs/%s" % version
self.remote_source_url_components = urlparse(self.remote_source_url)
self.remote_toc_url = 'https://%s/PloneResource/%s/toc.xml' % (self.remote_source_url_components[1],version)
self.local_toc_url = None if casa['dirs']['doc'] is None else casa['dirs']['doc'] + '/casa.nrao.edu/casadocs/toc.xml'
self.local_start_path = "usingcasa/starting-casa.html"
self.local_base = "/casadocs/%s/" % version
def __welcome( self, welcome="\nOpening packaged documentation.\n" ):
print "The most recent version of all CASA documentation is available online from:"
print "\thttps://casa.nrao.edu/casadocs/\n"
def __call__( self, sec=None ):
"open browser with documentation, try \"doc('toc')\""
def show_toc( toc_dict ):
width = max(len(key) for key in toc_dict.keys( ))+3
for i in sorted(toc_dict.iterkeys( )):
if "external" in toc_dict[i]['visibility']:
print "".join([i.ljust(width),toc_dict[i]['desc'].replace('\n','')])
def entry_to_dict(acc,e):
acc[e.find('key').text] = {
'desc': e.find('desc').text,
'type': e.find('type').text,
'visibility': e.find('visibility').text,
'path': e.find('path').text }
return webbrowser.open("https://casa.nrao.edu/casadocs/")
if self.remote_toc is None:
self.remote_toc = reduce( entry_to_dict, ET.ElementTree(file=urllib2.urlopen(self.remote_toc_url)).getroot( ).getchildren( ), { } )
show_toc(self.remote_toc)
elif self.remote_toc.has_key(sec):
return webbrowser.open("https://casa.nrao.edu/casadocs/stable/" + self.remote_toc[sec]['path'])
print "Sorry '%s' is not a recognized section..." % sec
print "------------------------------------------------------------------------------"