Example #1
0
 def get_ui(self, cfg, id = None):
     s = self._b.getstats()
     ui = self.app.inflate("openvpn:widget")
     ui.find("nclients").set("text", s["nclients"])
     ui.find("bytesin").set("text", str_fsize(float(s["bytesin"])))
     ui.find("bytesout").set("text", str_fsize(float(s["bytesout"])))
     return ui
Example #2
0
 def get_ui(self, cfg, id=None):
     s = self._b.getstats()
     ui = self.app.inflate("openvpn:widget")
     ui.find("nclients").set("text", s["nclients"])
     ui.find("bytesin").set("text", str_fsize(float(s["bytesin"])))
     ui.find("bytesout").set("text", str_fsize(float(s["bytesout"])))
     return ui
Example #3
0
    def get_info(self, iface):
        ui = UI.LayoutTable(
            UI.LayoutTableRow(
                UI.Image(file="/dl/network/%s.png" % ("up" if iface.up else "down")),
                UI.Label(text="Interface:", bold=True),
                UI.Label(text=iface.name, bold=True),
            ),
            UI.LayoutTableRow(UI.Label(), UI.Label(text="Address:"), UI.Label(text=self.get_ip(iface))),
            UI.LayoutTableRow(UI.Label(), UI.Label(text="Sent:"), UI.Label(text=str_fsize(self.get_tx(iface)))),
            UI.LayoutTableRow(UI.Label(), UI.Label(text="Received:"), UI.Label(text=str_fsize(self.get_rx(iface)))),
        )

        return ui
Example #4
0
    def get_info(self, iface):
        ui = UI.LayoutTable(
            UI.LayoutTableRow(
                UI.Image(file='/dl/network/%s.png' %
                         ('up' if iface.up else 'down')),
                UI.Label(text='Interface:', bold=True),
                UI.Label(text=iface.name, bold=True)),
            UI.LayoutTableRow(UI.Label(), UI.Label(text='Address:'),
                              UI.Label(text=self.get_ip(iface))),
            UI.LayoutTableRow(UI.Label(), UI.Label(text='Sent:'),
                              UI.Label(text=str_fsize(self.get_tx(iface)))),
            UI.LayoutTableRow(UI.Label(), UI.Label(text='Received:'),
                              UI.Label(text=str_fsize(self.get_rx(iface)))))

        return ui
Example #5
0
 def get_info(self, iface):
     ui = UI.Container(
         UI.Formline(
             UI.HContainer(
                 UI.Image(file='/dl/network/%s.png' %
                          ('up' if iface.up else 'down')),
                 UI.Label(text=iface.name, bold=True)),
             text='Interface',
         ),
         UI.Formline(
             UI.Label(text=self.get_ip(iface)),
             text='Address',
         ),
         UI.Formline(
             UI.Label(text='Up %s, down %s' % (
                 str_fsize(self.get_tx(iface)),
                 str_fsize(self.get_rx(iface)),
             )),
             text='Traffic',
         ),
     )
     return ui
Example #6
0
 def get_info(self, iface):
     ui = UI.Container( 
         UI.Formline(
             UI.HContainer(
                 UI.Image(file='/dl/network/%s.png'%('up' if iface.up else 'down')),
                 UI.Label(text=iface.name, bold=True)
             ),
             text='Interface',
         ),
         UI.Formline(
             UI.Label(text=self.get_ip(iface)),
             text='Address',
         ),
         UI.Formline(
             UI.Label(text='Up %s, down %s' % (
                 str_fsize(self.get_tx(iface)),
                 str_fsize(self.get_rx(iface)),
             )),
             text='Traffic',
         ),
     )
     return ui
Example #7
0
    def get_ui(self):
        ui = self.app.inflate("openvpn:main")

        try:
            self._b.connect()
            status =   self._b.getstatus()
            stats =    self._b.getstats()
            messages = self._b.getmessages()
            self._b.disconnect()
        except Exception, e:
            self.put_message("err", e)
            return ui

        ui.find("nclients").set("text",   "Clients: {0}".format(stats["nclients"]))
        ui.find("bytesin").set( "text",  "Bytes in: {0}".format(str_fsize(float(stats["bytesin"]))))
        ui.find("bytesout").set("text", "Bytes out: {0}".format(str_fsize(float(stats["bytesout"]))))

        map(lambda c: ui.append("clients", UI.DTR(
            UI.Icon(icon="/dl/core/ui/stock/user.png"),
            UI.Label(text=c["cn"]),
            UI.Label(text=c["raddress"]),
            UI.Label(text=c["vaddress"]),
            UI.Label(text=str_fsize(float(c["brecv"]))),
            UI.Label(text=str_fsize(float(c["bsent"]))),
            UI.Label(text=c["connsince"]),
            UI.TipIcon(
                icon="/dl/core/ui/stock/delete.png",
                text="Disconnect",
                warning="Disconnect {0} ({1})?".format(c["cn"], c["raddress"]),
                id="disconnect/{0}".format(c["raddress"]))
Example #8
0
def trans_fsize(x):
    return str_fsize(int(x['value']))
Example #9
0
File: main.py Project: vlara/ajenti
        ui = self.app.inflate("openvpn:main")

        try:
            self._b.connect()
            status = self._b.getstatus()
            stats = self._b.getstats()
            messages = self._b.getmessages()
            self._b.disconnect()
        except Exception, e:
            self.put_message("err", e)
            return ui

        ui.find("nclients").set("text",
                                "Clients: {0}".format(stats["nclients"]))
        ui.find("bytesin").set(
            "text", "Bytes in: {0}".format(str_fsize(float(stats["bytesin"]))))
        ui.find("bytesout").set(
            "text",
            "Bytes out: {0}".format(str_fsize(float(stats["bytesout"]))))

        map(
            lambda c: ui.append(
                "clients",
                UI.DTR(
                    UI.Icon(icon="/dl/core/ui/stock/user.png"),
                    UI.Label(text=c["cn"]), UI.Label(text=c["raddress"]),
                    UI.Label(text=c["vaddress"]),
                    UI.Label(text=str_fsize(float(c["brecv"]))),
                    UI.Label(text=str_fsize(float(c["bsent"]))),
                    UI.Label(text=c["connsince"]),
                    UI.TipIcon(icon="/dl/core/ui/stock/delete.png",
Example #10
0
def trans_fsize(x):
    return str_fsize(int(x['value']))