-
Notifications
You must be signed in to change notification settings - Fork 0
/
tftpg_main.py
executable file
·87 lines (68 loc) · 2.41 KB
/
tftpg_main.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import pygtk
pygtk.require('2.0')
import gtk
import gobject
class Tftp_Server_GUI:
""" fenetre principale de tftps """
def __init__(self,srv):
#Thread
gobject.threads_init()
self.srv = srv
# Conf of main win
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.set_title("TftpS")
self.window.set_default_size(500,400)
self.box_main = gtk.VBox(False)
#Top win
self.fra_conf = gtk.Frame("Configuration")
self.box_conf_main = gtk.VBox()
#1st row
self.box_conf_row1 = gtk.HBox()
self.lab_dir = gtk.Label("Current directory: ")
self.com_file = gtk.combo_box_new_text()
self.but_bro = gtk.Button("Browse ")
self.box_conf_row1.pack_start(self.lab_dir)
self.box_conf_row1.pack_start(self.com_file)
self.box_conf_row1.pack_start(self.but_bro)
self.box_conf_main.pack_start(self.box_conf_row1)
#2nd row
self.box_conf_row2 = gtk.HBox()
self.lab_srv_int = gtk.Label("Listen interface: ")
self.com_srv_ip = gtk.combo_box_new_text()
self.but_dir = gtk.Button("Show dir ")
self.box_conf_row2.pack_start(self.lab_srv_int)
self.box_conf_row2.pack_start(self.com_srv_ip)
self.box_conf_row2.pack_start(self.but_dir)
self.box_conf_main.pack_start(self.box_conf_row2)
self.fra_conf.add(self.box_conf_main)
self.box_main.pack_start(self.fra_conf,False,False)
#Middle win
self.fra_srv = gtk.Frame("Serveur activities")
self.tvi_srv = gtk.TextView()
self.tvi_srv.set_editable(False)
self.fra_srv.add(self.tvi_srv)
self.box_main.pack_start(self.fra_srv)
#Bottom win
self.box_bottom = gtk.HBox()
self.but_about = gtk.Button(stock=gtk.STOCK_ABOUT)
self.but_sett = gtk.Button("Settings")
self.but_help = gtk.Button(stock=gtk.STOCK_HELP)
self.but_quit = gtk.Button(stock=gtk.STOCK_QUIT)
self.but_quit.connect("clicked",self.quit,None)
self.box_bottom.pack_start(self.but_about)
self.box_bottom.pack_start(self.but_sett)
self.box_bottom.pack_start(self.but_help)
self.box_bottom.pack_start(self.but_quit)
self.box_main.pack_start(self.box_bottom,False,False)
self.window.add(self.box_main)
self.window.connect("delete_event",self.delete_event)
self.window.connect("destroy",self.quit)
self.window.show_all()
def main(self):
gtk.main()
def delete_event(self, widget, event, data=None):
return False
def quit(self,widget,data=None):
print "Thanks using TftpS :) Bye..."
self.srv.Thread_Clt._Thread__stop()
gtk.main_quit()