コード例 #1
0
ファイル: brz.py プロジェクト: 1797890817/FuckWFW
    def _launch_browser(self, url, tab=False):
        addrs = {}
        if self.http_proxy_enabled:
            addrs[HTTP] = self.coordinator.IPC_http_proxy_addr()
        if self.socks_proxy_enabled:
            addrs[SOCKS5] = self.coordinator.IPC_socks_proxy_addr()
        if not addrs or not self.set_proxy:
            open_url(url)
            return None

        browsers = []
        for (name, executable, default, _) in iterate_browsers():
            for k in implemented.keys():
                if k in name:
                    priority, types, (launch_func, launch_tab_func,
                                      resume_proxy_func) = implemented[k]
                    addr = None
                    for t in types:
                        if t in addrs:
                            addr = (t, addrs[t])
                            break
                    if not addr:
                        break
                    if default:
                        priority = PRIORITY_OF_DEFAULT
                    browsers.append((priority, addr,
                                     (launch_func, launch_tab_func,
                                      resume_proxy_func), executable, default))
                    break
        if not browsers:
            open_url(url)
            return None
        # sort available browsers by pritority
        browsers.sort(key=lambda x: x[0], reverse=True)
        (_, (proxy_type, (proxy_ip, proxy_port)),
         (launch_func, launch_tab_func,
          resume_proxy_func), executable, default) = browsers[0]

        self.resume_proxy_func = resume_proxy_func
        rootdir = self.coordinator.get('rootdir')
        if not url.startswith("http"):
            url = urlparse.urljoin(
                'file:',
                urllib.pathname2url(url.encode(sys.getfilesystemencoding())))

        if tab:
            return launch_tab_func(executable, url, rootdir)
        else:
            return launch_func(executable, url, rootdir, proxy_type, proxy_ip,
                               proxy_port)
コード例 #2
0
ファイル: brz.py プロジェクト: 52M/firefly-proxy
 def _launch_browser(self, url, tab=False):
     addrs = {}
     if self.http_proxy_enabled:
         addrs[HTTP] = self.coordinator.IPC_http_proxy_addr()
     if self.socks_proxy_enabled:
         addrs[SOCKS5] = self.coordinator.IPC_socks_proxy_addr()
     if not addrs or not self.set_proxy:
         open_url(url)
         return None
     
     browsers = []
     for (name, executable, default, _) in iterate_browsers():
         for k in implemented.keys():
             if k in name:
                 priority, types, (launch_func, launch_tab_func, resume_proxy_func) = implemented[k] 
                 addr = None
                 for t in types:
                     if t in addrs:
                         addr = (t, addrs[t])
                         break
                 if not addr:
                     break            
                 if default:
                     priority = PRIORITY_OF_DEFAULT    
                 browsers.append((priority, addr, (launch_func, launch_tab_func, resume_proxy_func), executable, default))
                 break       
     if not browsers:
         open_url(url)
         return None
     # sort available browsers by pritority
     browsers.sort(key=lambda x: x[0], reverse=True)
     (_, (proxy_type, (proxy_ip, proxy_port)), (launch_func, launch_tab_func, resume_proxy_func), executable, default) = browsers[0]
     
     self.resume_proxy_func = resume_proxy_func
     rootdir = self.coordinator.get('rootdir')
     if not url.startswith("http"):
         url = urlparse.urljoin('file:', urllib.pathname2url(url.encode(sys.getfilesystemencoding())))
         
     if tab:
         return launch_tab_func(executable, url, rootdir)
     else:
         return launch_func(executable, url, rootdir, proxy_type, proxy_ip, proxy_port)
コード例 #3
0
ファイル: animelist.py プロジェクト: FSX/animelist
    def _menu_get_help(self, widget):
        # Private.  Opens the manual.

        open_url('http://61924.nl/animelist-manual.html')
コード例 #4
0
ファイル: widgets.py プロジェクト: FSX/animelist
 def _open_url(self, dialog, link, data=None):
     utils.open_url(link)
コード例 #5
0
ファイル: anime.py プロジェクト: FSX/animelist
    def _on_click(self, button):

        if self.mal_url is None:
            return

        utils.open_url(self.mal_url)