Ejemplo n.º 1
0
    def do_homepage(self):
        sel = self.w.packagebrowser.getselection()[0]
        if not self.ic:
            import ic

            self.ic = ic.IC()
        self.ic.launchurl(self.packages[sel].homepage())
Ejemplo n.º 2
0
    def getproxies():
        """Return a dictionary of scheme -> proxy server URL mappings.

        By convention the mac uses Internet Config to store
        proxies.  An HTTP proxy, for instance, is stored under
        the HttpProxy key.

        """
        try:
            import ic
        except ImportError:
            return {}

        try:
            config = ic.IC()
        except ic.error:
            return {}
        proxies = {}
        # HTTP:
        if config.has_key('UseHTTPProxy') and config['UseHTTPProxy']:
            try:
                value = config['HTTPProxyHost']
            except ic.error:
                pass
            else:
                proxies['http'] = 'http://%s' % value
        # FTP: XXXX To be done.
        # Gopher: XXXX To be done.
        return proxies
Ejemplo n.º 3
0
def htmlwindow(url):
    # Workaround (hack) for Explorer bug, which doesn't recognize file:/disk/...
    if url[:6] == 'file:/' and url[6] != '/':
        url = 'file:///' + url[6:]
    try:
        import ic
        ic_instance = ic.IC()
        ic_instance.launchurl(url)
    except:
        showmessage('Cannot start webbrowser.\nInternet configuration error?')
    return None
Ejemplo n.º 4
0
    def getproxies_internetconfig():
        
        try:
            import ic as ic
        except ImportError:
            return { }

        
        try:
            config = ic.IC()
        except ic.error:
            return { }

        proxies = { }
        if 'UseHTTPProxy' in config and config['UseHTTPProxy']:
            
            try:
                value = config['HTTPProxyHost']
            except ic.error:
                pass

            proxies['http'] = 'http://%s' % value
        
        return proxies
Ejemplo n.º 5
0
    def domenu_opendatabasepage(self):
        import ic

        icr = ic.IC()
        icr.launchurl(PACKMAN_HOMEPAGE)
Ejemplo n.º 6
0
import grins_mimetypes
mimetypes.types_map.update(grins_mimetypes.mimetypes)
mimetypes.init()

# Platform-specific extensions.
# XXXX This should also be implemented for Windows: we should lookup
# the extension in the registry if we don't know of it.
import sys
if sys.platform in ('mac', 'darwin'):
    import MMurl
    import urlparse
    import MacOS
    import os
    try:
        import ic
        _ic_instance = ic.IC()
    except:
        _ic_instance = None

    # Warn only once per URL last part
    warned_names = {}

    def guess_type(url):
        # On the mac we can have serious conflicts between the
        # extension and the cretor/type of the file. As there is
        # no 100% correct way to solve this we let the extension
        # override the creator/type. This will only lead to unexpected
        # results when a file is given an extension _and_ that extension
        # belongs to files with a different mimetype.
        type, encoding = mimetypes.guess_type(url)
        if type:
Ejemplo n.º 7
0
"""Open an arbitrary URL.