Пример #1
0
 def actionPerformed(self, event):
   browsers = ["google-chrome", "firefox", "opera", "epiphany", "konqueror", "conkeror", "midori", "kazehakase", "mozilla"]
   osName = System.getProperty("os.name")
   helpHTML = ClassLoader.getSystemResource("help.html").toString()
   if osName.find("Mac OS") == 0:
     Class.forName("com.apple.eio.FileManager").getDeclaredMethod( "openURL", [String().getClass()]).invoke(None, [helpHTML])
   elif osName.find("Windows") == 0:
     Runtime.getRuntime().exec( "rundll32 url.dll,FileProtocolHandler " + helpHTML)
   else:
     browser = None
     for b in browsers:
       if browser == None and Runtime.getRuntime().exec(["which", b]).getInputStream().read() != -1:
         browser = b
         Runtime.getRuntime().exec([browser, helpHTML])
Пример #2
0
def getResourceDirectoryForModuleName(moduleName):
    resourceDirectory = None
    try:
        prefix = "content/"
        moduleNamePath = moduleName.replace(".", "/")
        resourcePath = prefix + moduleNamePath
        
        if PYCYCLE_DEBUG_RESOURCE_ROOT is None:
            # serving from the "content" directory embedded in the JAR file
            resourceDirectory = _ClassLoader.getSystemResource(resourcePath).toExternalForm()
        #
        else:
            # serving from the "content" directory from the debug root
            resourceDirectory = _File(PYCYCLE_DEBUG_RESOURCE_ROOT, resourcePath).toString()
        #
    #
    except Exception as ex:
        message = "Could not get resource directory for module '" + str(moduleName) + "'. "
        message += "Caused by: \n" + repr(ex)
        raise RuntimeError(message)
    #
    return resourceDirectory