Skip to content

Commit

Permalink
test running the program through bash script
Browse files Browse the repository at this point in the history
  • Loading branch information
Dragon2fly committed Nov 13, 2016
1 parent 5dabe59 commit adbc8c2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
3 changes: 3 additions & 0 deletions run
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
stdbuf -oL python vpn_indicator.py > indicator.log &
sudo python vpnproxy_tui.py
24 changes: 19 additions & 5 deletions vpn_indicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,34 @@

from Queue import Empty, Queue
from threading import Thread
from subprocess import call
from subprocess import call, Popen, PIPE
import select
import signal, os
import signal, os, sys
import socket, errno
import time
import platform

if 'buntu' in platform.platform() and \
not Popen(['pgrep', '-f', 'python vpn_indicator.py'], stdout=PIPE).communicate()[0]:
print 'Launch vpn_indicator'
else:
sys.exit()

try:
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, GLib

gi.require_version('AppIndicator3', '0.1')
from gi.repository import AppIndicator3 as appindicator

gi.require_version('Notify', '0.7')
from gi.repository import Notify as notify
except ImportError:
print 'Lack of Gtk related modules!'
print 'VPN indicator will not run!'
print 'You should try "sudo apt-get install gir1.2-appindicator3-0.1"'
print >> sys.stderr, 'Lack of Gtk related modules!'
print >> sys.stderr, 'VPN indicator will not run!'
print >> sys.stderr, 'You should try "sudo apt-get install gir1.2-appindicator3-0.1 python-gobject"'
sys.exit()


class InfoServer:
Expand Down
4 changes: 3 additions & 1 deletion vpnproxy_tui.py
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,9 @@ def exit(self, loop, data=None):
from ui_elements import *

# -------- all dependencies should be available after this line --------
# raw_input('haha')
# raw_input('for debugging')

# clear system proxy so that request only go through the one specified
screen = Display(vpn_connect)
screen.get_data_status = 'call'
screen.run()

0 comments on commit adbc8c2

Please sign in to comment.