Esempio n. 1
0
    def open(self, prjfile):
        from epydoc.css import STYLESHEETS
        self._filename = prjfile
        try:
            opts = load(open(prjfile, 'r'))
            
            modnames = list(opts.get('modules', []))
            modnames.sort()
            self._module_list.delete(0, 'end')
            for name in modnames:
                self.add_module(name)
            self._module_entry.delete(0, 'end')
                
            self._name_entry.delete(0, 'end')
            if opts.get('prj_name'):
                self._name_entry.insert(0, opts['prj_name'])
                
            self._url_entry.delete(0, 'end')
            if opts.get('prj_url'):
                self._url_entry.insert(0, opts['prj_url'])

            self._docformat_var.set(opts.get('docformat', 'epytext'))
            self._inheritance_var.set(opts.get('inheritance', 'grouped'))

            self._help_entry.delete(0, 'end')
            if opts.get('help') is None:
                self._help_var.set('default')
            else:
                self._help_var.set('-other-')
                self._help_entry.insert(0, opts.get('help'))
                
            self._out_entry.delete(0, 'end')
            self._out_entry.insert(0, opts.get('outdir', 'html'))

            self._frames_var.set(opts.get('frames', 1))
            self._private_var.set(opts.get('private', 1))
            self._imports_var.set(opts.get('show_imports', 0))
            
            self._css_entry.delete(0, 'end')
            if opts.get('css', 'default') in STYLESHEETS.keys():
                self._css_var.set(opts.get('css', 'default'))
            else:
                self._css_var.set('-other-')
                self._css_entry.insert(0, opts.get('css', 'default'))

            if opts.get('private_css', 'default') in STYLESHEETS.keys():
                self._private_css_var.set(opts.get('private_css', 'default'))
            else:
                self._private_css_var.set('-other-')
                self._css_entry.insert(0, opts.get('private_css', 'default'))
                                                   
        except Exception, e:
            sys.stderr.write('!!!Error opening %s: %s\n!!!' % (prjfile, e))
            self._root.bell()
Esempio n. 2
0
def _help(arg):
    """
    Display a speficied help message, and exit.

    @param arg: The name of the help message to display.  Currently,
        only C{"css"} and C{"usage"} are recognized.
    @type arg: C{string}
    @rtype: C{None}
    """
    arg = arg.strip().lower()
    if arg == 'css':
        from epydoc.css import STYLESHEETS
        print '\nThe following built-in CSS stylesheets are available:'
        names = STYLESHEETS.keys()
        names.sort()
        maxlen = max(*[len(name) for name in names])
        format = '    %'+`-maxlen-1`+'s %s'
        for name in names:
            print format % (name, STYLESHEETS[name][1])
        print
    elif arg == 'version':
        _version()
    elif arg in ('checks', 'tests', 'test', 'check'):
        print '\nBy default, epydoc checks to make sure that all public'
        print 'objects have descriptions.  The following additional tests'
        print 'can be specified with the "--tests" option:'
        print '    - private: Check private objects.'
        print '    - vars: Check variables and parameters.'
        print '    - types: Check that variables and parameters have types.'
        print '    - authors: Check that all modules have authors.'
        print '    - versions: Check that all modules have versions.'
        print '    - all: Run all tests\n'
    elif arg in ('inheritance', 'inheritence'):
        print '\nThe following inheritance formats are currently supported:'
        print '    - grouped: inherited objects are gathered into groups,'
        print '      based on what class they were inherited from.'
        print '    - listed: inherited objects are listed in a short list'
        print '      at the end of their section.'
        print '    - included: inherited objects are mixed in with '
        print '      non-inherited objects.\n'
    elif arg in ('docformat', 'doc_format', 'doc-format'):
        print '\n__docformat__ is a module variable that specifies the markup'
        print 'language for the docstrings in a module.  Its value is a '
        print 'string, consisting the name of a markup language, optionally '
        print 'followed by a language code (such as "en" for English).  Epydoc'
        print 'currently recognizes the following markup language names:'
        import epydoc.objdoc
        for format in epydoc.objdoc.KNOWN_DOCFORMATS:
            print '  - %s' % format
        print
    else:
        _usage(0)
    sys.exit(0)