Beispiel #1
0
    def __init__(self, parent, session):
        Frame.__init__(self, parent)

        self.session = session

        self.size_hint_align = FILL_HORIZ
        self.text = "Listen port (range)"

        port = session.listen_port()

        b = Box(parent)
        b.size_hint_weight = EXPAND_HORIZ

        lp = self.lp = RangeSpinners(
            parent,
            low=session.conf.getint("Settings", "listen_low"),
            high=session.conf.getint("Settings", "listen_high"),
            minim=0,
            maxim=65535)
        lp.show()
        b.pack_end(lp)

        save = Button(parent)
        save.text = "Apply"
        save.callback_clicked_add(self.save_cb)
        save.show()
        b.pack_end(save)

        b.show()

        self.content = b
    def __init__(self, parent, session):
        Frame.__init__(self, parent)

        self.text = "Limits"
        self.size_hint_align = FILL_HORIZ

        base = 1024
        units = ( "bytes/s", "KiB/s", "MiB/s", "GiB/s", "TiB/s" )

        t = Table(parent)
        for r, values in enumerate((
            ("Upload limit", session.upload_rate_limit, session.set_upload_rate_limit),
            ("Download limit", session.download_rate_limit, session.set_download_rate_limit),
            ("Upload limit for local connections", session.local_upload_rate_limit, session.set_local_upload_rate_limit),
            ("Download limit for local connections", session.local_download_rate_limit, session.set_local_download_rate_limit),
        )):
            title, rfunc, wfunc = values

            l = Label(parent)
            l.text = title
            l.size_hint_align = FILL_HORIZ
            t.pack(l, 0, r, 1, 1)
            l.show()

            usw = UnitSpinner(parent, base, units)
            usw.size_hint_weight = EXPAND_HORIZ
            usw.size_hint_align = FILL_HORIZ
            usw.set_value(rfunc())
            usw.callback_changed_add(wfunc, delay=2.0)
            t.pack(usw, 1, r, 1, 1)
            usw.show()

        self.content = t
Beispiel #3
0
    def __init__(self, parent, conf):
        Frame.__init__(self, parent)

        self.size_hint_align = -1.0, 0.0
        self.size_hint_weight = 1.0, 0.0
        self.text = "Data storage"

        self.conf = conf

        b = Box(parent)

        lbl = self.path_lbl = Label(parent)
        lbl.text = conf.get("Settings", "storage_path")

        self.dlsel = dlsel = FileselectorButton(self)
        dlsel.size_hint_align = -1.0, 0.0
        dlsel.inwin_mode = False
        dlsel.folder_only = True
        dlsel.expandable = False
        dlsel.text = "Change path"
        dlsel.path = conf.get("Settings", "storage_path")
        dlsel.callback_file_chosen_add(self.save_dlpath)

        for w in lbl, dlsel:
            w.show()
            b.pack_end(w)

        b.show()
        self.content = b
    def __init__(self, parent, session):
        Frame.__init__(self, parent)

        self.session = session

        self.size_hint_align = FILL_HORIZ
        self.text = "Listen port (range)"

        port = session.listen_port()

        b = Box(parent)
        b.size_hint_weight = EXPAND_HORIZ

        lp = self.lp = RangeSpinners(
            parent,
            low = session.conf.getint("Settings", "listen_low"),
            high = session.conf.getint("Settings", "listen_high"),
            minim = 0, maxim = 65535)
        lp.show()
        b.pack_end(lp)

        save = Button(parent)
        save.text = "Apply"
        save.callback_clicked_add(self.save_cb)
        save.show()
        b.pack_end(save)

        b.show()

        self.content = b
    def __init__(self, parent, conf):
        Frame.__init__(self, parent)

        self.size_hint_align = -1.0, 0.0
        self.size_hint_weight = 1.0, 0.0
        self.text = "Data storage"

        self.conf = conf

        b = Box(parent)

        lbl = self.path_lbl = Label(parent)
        lbl.text = conf.get("Settings", "storage_path")

        self.dlsel = dlsel = FileselectorButton(self)
        dlsel.size_hint_align = -1.0, 0.0
        dlsel.inwin_mode = False
        dlsel.folder_only = True
        dlsel.expandable = False
        dlsel.text = "Change path"
        dlsel.path = conf.get("Settings", "storage_path")
        dlsel.callback_file_chosen_add(self.save_dlpath)

        for w in lbl, dlsel:
            w.show()
            b.pack_end(w)

        b.show()
        self.content = b
    def __init__(self, parent_widget, ourText=None, image=None, *args, **kwargs):
        Frame.__init__(self, parent_widget, *args, **kwargs)
        
        self.text = ourText
        
        self.ourImage = Image(self)
        self.ourImage.size_hint_weight = EXPAND_BOTH
        
        if image:
			self.ourImage.file_set(image)
        
        self.content_set(self.ourImage)
    def __init__(self,
                 parent_widget,
                 ourText=None,
                 image=None,
                 *args,
                 **kwargs):
        Frame.__init__(self, parent_widget, *args, **kwargs)

        self.text = ourText

        self.ourImage = Image(self)
        self.ourImage.size_hint_weight = EXPAND_BOTH

        if image:
            self.ourImage.file_set(image)

        self.content_set(self.ourImage)
Beispiel #8
0
    def __init__(self, parent, session):
        self.session = session

        Frame.__init__(self, parent)
        self.size_hint_align = -1.0, 0.0
        self.text = "Encryption settings"

        pes = self.pes = session.get_pe_settings()

        b = Box(parent)

        enc_values = lt.enc_policy.disabled, lt.enc_policy.enabled, lt.enc_policy.forced
        enc_levels = lt.enc_level.plaintext, lt.enc_level.rc4, lt.enc_level.both

        inc = self.inc = ActSWithLabel(parent, "Incoming encryption",
                                       enc_values, pes.in_enc_policy)
        b.pack_end(inc)
        inc.show()

        out = self.out = ActSWithLabel(parent, "Outgoing encryption",
                                       enc_values, pes.out_enc_policy)
        b.pack_end(out)
        out.show()

        lvl = self.lvl = ActSWithLabel(parent, "Allowed encryption level",
                                       enc_levels, pes.allowed_enc_level)
        b.pack_end(lvl)
        lvl.show()

        prf = self.prf = Check(parent)
        prf.style = "toggle"
        prf.text = "Prefer RC4 ecryption"
        prf.state = pes.prefer_rc4
        b.pack_end(prf)
        prf.show()

        a_btn = Button(parent)
        a_btn.text = "Apply"
        a_btn.callback_clicked_add(self.apply)
        b.pack_end(a_btn)
        a_btn.show()

        b.show()
        self.content = b
    def __init__(self, parent, session):
        self.session = session

        Frame.__init__(self, parent)
        self.size_hint_align = -1.0, 0.0
        self.text = "Encryption settings"

        pes = self.pes = session.get_pe_settings()

        b = Box(parent)

        enc_values = lt.enc_policy.disabled, lt.enc_policy.enabled, lt.enc_policy.forced
        enc_levels = lt.enc_level.plaintext, lt.enc_level.rc4, lt.enc_level.both

        inc = self.inc = ActSWithLabel(parent,
            "Incoming encryption", enc_values, pes.in_enc_policy)
        b.pack_end(inc)
        inc.show()

        out = self.out = ActSWithLabel(parent,
            "Outgoing encryption", enc_values, pes.out_enc_policy)
        b.pack_end(out)
        out.show()

        lvl = self.lvl = ActSWithLabel(parent,
            "Allowed encryption level", enc_levels, pes.allowed_enc_level)
        b.pack_end(lvl)
        lvl.show()

        prf = self.prf = Check(parent)
        prf.style = "toggle"
        prf.text = "Prefer RC4 ecryption"
        prf.state = pes.prefer_rc4
        b.pack_end(prf)
        prf.show()

        a_btn = Button(parent)
        a_btn.text = "Apply"
        a_btn.callback_clicked_add(self.apply)
        b.pack_end(a_btn)
        a_btn.show()

        b.show()
        self.content = b
    def __init__(self, parent):
        Frame.__init__(self, parent, text="Signals")
        self._parent = parent

        vbox = Box(self)
        vbox.show()
        self.content = vbox

        self.siglist = Genlist(self, homogeneous=True, mode=ELM_LIST_SCROLL)
        self.siglist.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
        self.siglist.size_hint_align = EVAS_HINT_FILL, EVAS_HINT_FILL
        self.siglist.callback_clicked_double_add(self.signal_clicked_cb)
        self.siglist.show()
        vbox.pack_end(self.siglist)
        self.itc = SignalItemClass()

        hbox = Box(self, horizontal=True)
        hbox.size_hint_align = 0.0, 0.5
        hbox.show()
        vbox.pack_end(hbox)

        bt = Button(self, text='Clear')
        bt.callback_clicked_add(lambda b: self.siglist.clear())
        hbox.pack_end(bt)
        bt.show()

        def scroll_on_signal_clicked_cb(chk):
            options.scroll_on_signal = chk.state

        ck = Check(self, text='Scroll on signal')
        ck.state = options.scroll_on_signal
        ck.callback_changed_add(scroll_on_signal_clicked_cb)
        hbox.pack_end(ck)
        ck.show()

        for b in session_bus, system_bus:
            b.add_signal_receiver(self.signal_cb,
                                  sender_keyword='sender',
                                  destination_keyword='dest',
                                  interface_keyword='iface',
                                  member_keyword='signal',
                                  path_keyword='path')
Beispiel #11
0
    def __init__(self, parent, session):
        Frame.__init__(self, parent)

        self.text = "Limits"
        self.size_hint_align = FILL_HORIZ

        base = 1024
        units = ("bytes/s", "KiB/s", "MiB/s", "GiB/s", "TiB/s")

        t = Table(parent)
        for r, values in enumerate((
            ("Upload limit", session.upload_rate_limit,
             session.set_upload_rate_limit),
            ("Download limit", session.download_rate_limit,
             session.set_download_rate_limit),
            ("Upload limit for local connections",
             session.local_upload_rate_limit,
             session.set_local_upload_rate_limit),
            ("Download limit for local connections",
             session.local_download_rate_limit,
             session.set_local_download_rate_limit),
        )):
            title, rfunc, wfunc = values

            l = Label(parent)
            l.text = title
            l.size_hint_align = FILL_HORIZ
            t.pack(l, 0, r, 1, 1)
            l.show()

            usw = UnitSpinner(parent, base, units)
            usw.size_hint_weight = EXPAND_HORIZ
            usw.size_hint_align = FILL_HORIZ
            usw.set_value(rfunc())
            usw.callback_changed_add(wfunc, delay=2.0)
            t.pack(usw, 1, r, 1, 1)
            usw.show()

        self.content = t
Beispiel #12
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
Beispiel #14
0
 def __init__(self, parent, color, tag_name):
     Frame.__init__(self, parent, style='pad_small', propagate_events=False)
     self._rect = Rectangle(self.evas, color=color)
     self._rect.on_mouse_down_add(lambda o,i: self._popup_build())
     self.content = self._rect
     self._tag_name = tag_name