-
Notifications
You must be signed in to change notification settings - Fork 0
/
denic-vpn.py
executable file
·66 lines (48 loc) · 1.47 KB
/
denic-vpn.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
__kupfer_name__ = _("VPN Denic")
__kupfer_sources__ = ("VPN",)
__description__ = _("handle VPN connections")
__version__ = "2018-9"
__author__ = "thorko"
from kupfer.objects import Source, RunnableLeaf, TextLeaf
from kupfer import utils, plugin_support, config
class VPN (Source):
def __init__(self):
super().__init__(_("VPN denic"))
def initialize(self):
pass
def finalize(self):
pass
def get_items(self):
yield Start()
yield Stop()
yield Restart()
def provides(self):
yield RunnableLeaf
def description(self):
return __description__
def get_icon_name(self):
return "im-user"
class Start (RunnableLeaf):
def __init__(self):
super().__init__(name=_("Start"))
def run(self):
vpnstart=["/usr/local/bin/vpnconnect.sh", "start"]
utils.spawn_async(vpnstart)
def get_icon_name(self):
return "im-user-online"
class Stop (RunnableLeaf):
def __init__(self):
super().__init__(name=_("Stop"))
def run(self):
vpnstop=["/usr/local/bin/vpnconnect.sh", "stop"]
utils.spawn_async(vpnstop)
def get_icon_name(self):
return "im-kick-user"
class Restart (RunnableLeaf):
def __init__(self):
super().__init__(name=_("Restart"))
def run(self):
restart=["/usr/local/bin/vpnconnect.sh", "restart"]
utils.spawn_async(restart)
def get_icon_name(self):
return "im-user-away"