-
Notifications
You must be signed in to change notification settings - Fork 156
/
installDefault
executable file
·84 lines (78 loc) · 2.62 KB
/
installDefault
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/usr/bin/env python
import os, sys, pygtk,time,subprocess,urllib2
root = ''.join([e+'/' for e in os.path.realpath(__file__).split('/')[0:-1]])
home = subprocess.Popen("echo $HOME", shell=True, stdout=subprocess.PIPE).communicate()[0].replace('\n','')
pygtk.require('2.0')
import gtk
from subprocess import call
if gtk.pygtk_version < (2,3,90):
print "PyGtk 2.3.90 or later required for this example"
raise SystemExit
class EntryExample:
def pluginToggle(self, widget, plugin):
x = 0
for e in self.plugins:
if e == plugin:
self.plugins.pop(x)
return 1
x = x + 1
self.plugins.append(plugin)
def install(self,widget):
print "Install!"
print self.plugins
for w in self.checks:
self.vbox.remove(w)
self.vbox.set_border_width(10)
self.window.resize(20,20)
self.vbox.add(self.pbar)
self.pbar.show()
self.vbox.show()
self.window.show()
for e in self.plugins:
os.system("./plugins -p "+e+" -f -q")
gtk.main_quit()
def __init__(self):
self.plugins = []
plugins = urllib2.urlopen("http://palaver.bmandesigns.com/functions.php?f=corePlugins").read().split("|#|")
for p in plugins:
if p != "":
self.plugins.append(p)
self.checks = []
# create a new window
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.set_default_size(200,400)
self.window.set_title("Palaver Default Plugins Installation")
self.window.connect("delete_event", lambda w,e: gtk.main_quit())
#self.window.set_logo(gtk.gdj.pixbuf_new_from_file("Microphone/Indicator/mic.png"))
self.pbar = gtk.Label("Done")
self.vbox = gtk.VBox(False, 0)
self.window.add(self.vbox)
self.vbox.show()
for e in self.plugins:
check = gtk.CheckButton(e)
check.set_active(True)
check.connect("toggled", self.pluginToggle, e)
self.checks.append(check)
self.vbox.add(check)
check.show()
button = gtk.Button("Install")
self.checks.append(button)
button.connect("clicked", self.install)
self.vbox.pack_start(button, True, True, 0)
button.set_flags(gtk.CAN_DEFAULT)
button.grab_default()
button.show()
self.window.show()
def main():
gtk.main()
return 0
if __name__ == "__main__":
res = subprocess.Popen("zenity --forms --add-entry='First Name' --add-entry='Last Name' --add-entry='Email' --add-entry='Language (en,es,fr,pt)' --text='User Information' --title='Palaver User Configuration'", shell=True, stdout=subprocess.PIPE).communicate()[0].replace('\n','')
res = res.split("|")
with open(home+"/.palaver.d/UserInfo",'w') as data:
data.write("FIRST="+res[0])
data.write("\nLAST="+res[1])
data.write("\nEMAIL="+res[2])
data.write("\nLANGUAGE="+res[3]+"\n")
EntryExample()
main()