def load(self): proxy = conf.get_proxy() if proxy is not None: ptype, ip, port = proxy self.port_box.setValue(port) self.entry_proxy_ip.setText(ip) if conf.get_proxy_active(): self.radio_manual.setChecked(True) #emit toggled. else: self.radio_without.setChecked(True)
def __init__(self): """""" #connection-proxy #gtk.VBox.__init__(self, False) #self.set_border_width(10) gtk.Frame.__init__(self, _("Proxy:")) #frame_poxy = gtk.Frame("Proxy:") vbox_proxy = gtk.VBox(False, 10) hbox_proxy = gtk.HBox(False, 10) vbox_proxy.set_border_width(10) #outside-space #proxy choice-menu self.proxy_without = gtk.RadioButton(group=None, label=_("Without proxy")) self.proxy_without.connect("toggled", self.on_proxy_toggle, hbox_proxy) self.proxy_http = gtk.RadioButton(group=self.proxy_without, label=_("Manual proxy config")) self.proxy_http.connect("toggled", self.on_http_proxy_toggle, hbox_proxy) vbox_proxy.pack_start(self.proxy_without, False, False) vbox_proxy.pack_start(self.proxy_http, False, False) #proxy ip field label_http_proxy = gtk.Label(_("HTTP Proxy:")) hbox_proxy.pack_start(label_http_proxy, False, False) proxy_ip, proxy_port, proxy_type = conf.get_proxy() self.entry_proxy_ip = gtk.Entry() self.entry_proxy_ip.add_events(gtk.gdk.KEY_RELEASE_MASK) self.entry_proxy_ip.set_width_chars(25) #entry width self.entry_proxy_ip.set_text(proxy_ip) hbox_proxy.pack_start(self.entry_proxy_ip) #proxy port spin-field label_port = gtk.Label(_("Port:")) hbox_proxy.pack_start(label_port, False, False) self.spin_proxy_port = gtk.SpinButton(None, 1, 0) self.spin_proxy_port.set_property("shadow-type", gtk.SHADOW_NONE) self.spin_proxy_port.set_range(0, 100000) self.spin_proxy_port.set_increments(1, 1) self.spin_proxy_port.set_numeric(True) self.spin_proxy_port.set_value(proxy_port) hbox_proxy.pack_start(self.spin_proxy_port, False, False) hbox_proxy.set_sensitive(False) self.proxy_active_choice(hbox_proxy) vbox_proxy.pack_start(hbox_proxy, False, False) #frame_poxy.add(vbox_proxy) #self.pack_start(frame_poxy, False, False) self.add(vbox_proxy)
def load_proxy(self): if conf.get_proxy_active(): proxy_tup = conf.get_proxy() if proxy_tup is not None: ptype, ip, port = proxy_tup self.set_proxy(ptype, ip, port)