Esempio n. 1
0
#!/usr/bin/env python

import ratopen as rat

old = rat.activewindow()

for id in filter(
    lambda x: x >= 0, [rat.findwindow("Navigator"), rat.findwindow("chromium-browser")]  # Firefox  # chrome
):
    rat.chwindow(id)
    rat.rat_cmd("meta C-F5")
    rat.chwindow(old)  # If you don't do this inside the loop, you can end in a different frame
Esempio n. 2
0
@proxyaction
def svn_proxy(on):
    sed_proxy(on,"s/^http-proxy/#http-proxy/","s/^#http-proxy/http-proxy/","/home/carl/.subversion/servers")

def proxy(on):
    for f in proxy_actions:
        try:
            f(on)
        except Exception, ex:
            print ex

    for protocol in ("http","https","ftp"):
        remp = {"p":protocol,"P":protocol.upper()}
        if on:
            rat.rat_cmd("setenv %(p)s_proxy %(p)s://proxy.alu.uma.es:3128/" % remp)
            rat.rat_cmd("setenv %(P)s_PROXY %(p)s://proxy.alu.uma.es:3128/" % remp)
        else:
            rat.rat_cmd("unsetenv %(p)s_proxy" % remp)
            rat.rat_cmd("unsetenv %(P)s_PROXY" % remp)
        f = open("/home/carl/.proxy","w")
        if on:
            f.write("proxy.alu.uma.es:3128")
        f.close()


if __name__ == "__main__":
  import sys
  action = sys.argv[1]
  if action == "uni":
    proxy(True)