示例#1
0
 def write_doc(self, module):
     try:
         # get our file object
         f = open(self.path, "w")
         # write document
         pypredefcomp.pypredefmodule(f, eval(module))
     except IOError as error:
         # oops
         self.log_error(module, error.strerror)
     else:
         # close file
         f.close()
示例#2
0
        doc_path = _get_browse_dialog( doc_path, Addon.getLocalizedString( 30110 ) )
    # if doc_path create html docs
    if ( doc_path ):
        # show feedback
        pDialog = xbmcgui.DialogProgress()
        pDialog.create( Addon.getAddonInfo( "name" ) )
        # set the doc_path setting incase the browse dialog was used
        Addon.setSetting( "doc_path", doc_path )
        # modules
        modules = [ "xbmc", "xbmcgui", "xbmcplugin", "xbmcaddon" ]

        try:
            import xbmcvfs
            modules.append('xbmcvfs')
        except ImportError:
            pass

        # enumerate thru and print our help docs
        for count, module in enumerate( modules ):
            # set correct path
            predefcompath = xbmc.validatePath( xbmc.translatePath( os.path.join( doc_path, "%s.pypredef" % ( module, ) ) ) )
            # update dialog
            pDialog.update( count * 25, Addon.getLocalizedString( 30711 ) % ( module + ".pypredef", ), Addon.getLocalizedString( 30712 ) % ( predefcompath, ) )
            # print document
            predefcomf = open ( predefcompath, "w" )
            pypredefcomp.pypredefmodule(predefcomf, eval( module ))
            predefcomf.close();
        #close dialog
        pDialog.update( 100 )
        pDialog.close()
        pDialog.create(Addon.getAddonInfo("name"))
        # set the doc_path setting incase the browse dialog was used
        Addon.setSetting("doc_path", doc_path)
        # modules
        modules = ["xbmc", "xbmcgui", "xbmcplugin", "xbmcaddon"]

        try:
            import xbmcvfs
            modules.append('xbmcvfs')
        except ImportError:
            pass

        # enumerate thru and print our help docs
        for count, module in enumerate(modules):
            # set correct path
            predefcompath = xbmc.validatePath(
                xbmc.translatePath(
                    os.path.join(doc_path, "%s.pypredef" % (module, ))))
            # update dialog
            pDialog.update(
                count * 25,
                Addon.getLocalizedString(30711) % (module + ".pypredef", ),
                Addon.getLocalizedString(30712) % (predefcompath, ))
            # print document
            predefcomf = open(predefcompath, "w")
            pypredefcomp.pypredefmodule(predefcomf, eval(module))
            predefcomf.close()
        #close dialog
        pDialog.update(100)
        pDialog.close()