Exemplo n.º 1
0
    def __init__(self, parent, title, rfunc, wfunc):
        Frame.__init__(self, parent)
        self.size_hint_weight = EXPAND_HORIZ
        self.size_hint_align = FILL_HORIZ
        self.text = title

        t = Table(self, homogeneous=True, padding=(3, 3))
        t.size_hint_weight = EXPAND_HORIZ
        t.size_hint_align = FILL_HORIZ
        t.show()

        l = Label(self, text="Proxy type")
        l.size_hint_align = 0.0, 0.5
        l.show()
        ptype = Hoversel(parent)
        ptype.size_hint_align = -1.0, 0.5
        ptype.text = rfunc().type.name
        for n in self.proxy_types.iterkeys():
            ptype.item_add(n, callback=lambda x, y, z=n: ptype.text_set(z))
        ptype.show()
        t.pack(l, 0, 0, 1, 1)
        t.pack(ptype, 1, 0, 1, 1)

        l = Label(self, text="Hostname")
        l.size_hint_align = 0.0, 0.5
        l.show()
        phost = Entry(parent)
        phost.size_hint_weight = EXPAND_HORIZ
        phost.size_hint_align = FILL_HORIZ
        phost.single_line = True
        phost.scrollable = True
        phost.entry = rfunc().hostname
        phost.show()
        t.pack(l, 0, 1, 1, 1)
        t.pack(phost, 1, 1, 1, 1)

        l = Label(self, text="Port")
        l.size_hint_align = 0.0, 0.5
        l.show()
        pport = Spinner(parent)
        pport.size_hint_align = -1.0, 0.5
        pport.min_max = 0, 65535
        pport.value = rfunc().port
        pport.show()
        t.pack(l, 0, 2, 1, 1)
        t.pack(pport, 1, 2, 1, 1)

        l = Label(self, text="Username")
        l.size_hint_align = 0.0, 0.5
        l.show()
        puser = Entry(parent)
        puser.size_hint_weight = EXPAND_HORIZ
        puser.size_hint_align = FILL_HORIZ
        puser.single_line = True
        puser.scrollable = True
        puser.entry = rfunc().username
        puser.show()
        t.pack(l, 0, 3, 1, 1)
        t.pack(puser, 1, 3, 1, 1)

        l = Label(self, text="Password")
        l.size_hint_align = 0.0, 0.5
        l.show()
        ppass = Entry(parent)
        ppass.size_hint_weight = EXPAND_HORIZ
        ppass.size_hint_align = FILL_HORIZ
        ppass.single_line = True
        ppass.scrollable = True
        ppass.password = True
        ppass.entry = rfunc().password
        ppass.show()
        t.pack(l, 0, 4, 1, 1)
        t.pack(ppass, 1, 4, 1, 1)

        entries = [ptype, phost, pport, puser, ppass]

        save = Button(parent, text="Apply")
        save.callback_clicked_add(self.save_conf, wfunc, entries)
        save.show()
        t.pack(save, 0, 5, 2, 1)

        self.content = t
    def __init__(self, parent, title, rfunc, wfunc):
        Frame.__init__(self, parent)
        self.size_hint_weight = EXPAND_HORIZ
        self.size_hint_align = FILL_HORIZ
        self.text = title

        t = Table(self, homogeneous=True, padding=(3,3))
        t.size_hint_weight = EXPAND_HORIZ
        t.size_hint_align = FILL_HORIZ
        t.show()

        l = Label(self, text="Proxy type")
        l.size_hint_align = 0.0, 0.5
        l.show()
        ptype = Hoversel(parent)
        ptype.size_hint_align = -1.0, 0.5
        ptype.text = rfunc().type.name
        for n in self.proxy_types.iterkeys():
            ptype.item_add(n, callback=lambda x, y, z=n: ptype.text_set(z))
        ptype.show()
        t.pack(l, 0, 0, 1, 1)
        t.pack(ptype, 1, 0, 1, 1)

        l = Label(self, text="Hostname")
        l.size_hint_align = 0.0, 0.5
        l.show()
        phost = Entry(parent)
        phost.size_hint_weight = EXPAND_HORIZ
        phost.size_hint_align = FILL_HORIZ
        phost.single_line = True
        phost.scrollable = True
        phost.entry = rfunc().hostname
        phost.show()
        t.pack(l, 0, 1, 1, 1)
        t.pack(phost, 1, 1, 1, 1)

        l = Label(self, text="Port")
        l.size_hint_align = 0.0, 0.5
        l.show()
        pport = Spinner(parent)
        pport.size_hint_align = -1.0, 0.5
        pport.min_max = 0, 65535
        pport.value = rfunc().port
        pport.show()
        t.pack(l, 0, 2, 1, 1)
        t.pack(pport, 1, 2, 1, 1)

        l = Label(self, text="Username")
        l.size_hint_align = 0.0, 0.5
        l.show()
        puser = Entry(parent)
        puser.size_hint_weight = EXPAND_HORIZ
        puser.size_hint_align = FILL_HORIZ
        puser.single_line = True
        puser.scrollable = True
        puser.entry = rfunc().username
        puser.show()
        t.pack(l, 0, 3, 1, 1)
        t.pack(puser, 1, 3, 1, 1)

        l = Label(self, text="Password")
        l.size_hint_align = 0.0, 0.5
        l.show()
        ppass = Entry(parent)
        ppass.size_hint_weight = EXPAND_HORIZ
        ppass.size_hint_align = FILL_HORIZ
        ppass.single_line = True
        ppass.scrollable = True
        ppass.password = True
        ppass.entry = rfunc().password
        ppass.show()
        t.pack(l, 0, 4, 1, 1)
        t.pack(ppass, 1, 4, 1, 1)

        entries = [ptype, phost, pport, puser, ppass]

        save = Button(parent, text="Apply")
        save.callback_clicked_add(self.save_conf, wfunc, entries)
        save.show()
        t.pack(save, 0, 5, 2, 1)

        self.content = t