Commit 02c70103 authored by Mark Tearle's avatar Mark Tearle

Remove vvend.py redundant code

parent 1e7cd560
......@@ -294,191 +294,3 @@ Mark Tearle, October 2014
if __name__ == "__main__":
App = VirtualSnackApp()
App.run()
# code below from vvend.py
# FIXME
# class appgui:
# def __init__(self):
# """
# In this init we are going to display the main
# serverinfo window
# """
# gladefile="vvend.glade"
# windowname="vvend"
# self.wTree=gtk.glade.XML (gladefile,windowname)
# # we only have two callbacks to register, but
# # you could register any number, or use a
# # special class that automatically
# # registers all callbacks. If you wanted to pass
# # an argument, you would use a tuple like this:
# # dic = { "on button1_clicked" :
# # (self.button1_clicked, arg1,arg2) , ...
#
# dic = {
# "on_button1_clicked" : self.keypad_clicked,
# "on_button2_clicked" : self.keypad_clicked,
# "on_button3_clicked" : self.keypad_clicked,
# "on_button4_clicked" : self.keypad_clicked,
# "on_button5_clicked" : self.keypad_clicked,
# "on_button6_clicked" : self.keypad_clicked,
# "on_button7_clicked" : self.keypad_clicked,
# "on_button8_clicked" : self.keypad_clicked,
# "on_button9_clicked" : self.keypad_clicked,
# "on_button10_clicked" : self.keypad_clicked,
# "on_button11_clicked" : self.keypad_clicked,
# "on_button11_clicked" : self.keypad_clicked,
# "on_door_toggled" : self.door_changed,
# "on_vvend_destroy_event" : self.quit,
# "on_vvend_delete_event" : self.quit }
# self.wTree.signal_autoconnect (dic)
# display = self.wTree.get_widget("label1")
# label_font = pango.FontDescription('monospace 28')
# display.modify_font(label_font)
#
# label_style = display.get_style().copy()
# fg_color = display.get_colormap().alloc_color('lightgreen')
# label_style.fg[gtk.STATE_NORMAL] = fg_color
# display.set_style(label_style)
#
# w = self.wTree.get_widget("eventbox1")
# wstyle = w.get_style().copy()
# bg_color = w.get_colormap().alloc_color('black')
# wstyle.bg[gtk.STATE_NORMAL] = bg_color
# w.set_style(wstyle)
#
# display.set_text("*5N4CK0RZ*")
#
# self.messageid = None
#
# #s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# #s.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1)
##
## listenhost=""
## listenport=5150
## s.bind((listenhost, listenport))
## # only one connection
## s.listen(1)
## s.setblocking(1)
## #GDK->gtk.gdk in GTK V 2.0
## id=gtk.input_add(s, gtk.gdk.INPUT_READ, self.handleNewConnection)
#
# self.server()
#
#
# return
#
# def __del__(self):
# try:
# self.sock.close()
# self.sock.shutdown()
# except:
# pass
#
#####CALLBACKS
# FIXME
# def handleNewConnection(self,source,condition):
# #source is a socket in GTK v 1 and a fd in version 2
# conn, addr = source.accept()
# sys.stdout.write(conn.recv(1))
# conn.send("bing\n")
# return gtk.TRUE
# from http://www.pythonbrasil.com.br/moin.cgi/MonitorandoSocketsComPygtk
# FIXME
# def send(self, data=None, widget=None):
# text = self.entry.get_text()
# self.do_send(text)
# self.entry.set_text('')
#
# FIXME
# def server(self):
#
# # inicializa o servidor
# port = 5150
#
# self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
# self.sock.bind(('localhost', port))
# self.sock.listen(0)
# print "listening on ", port
#
# #
# #
#
# self.server_tag = gtk.input_add(self.sock, gtk.gdk.INPUT_READ, self.accept)
#
# # mantemos uma lista dos clientes conectados
#
# self.clients = {}
# FIXME
# def accept(self, source, condition):
#
# #
# # esperando para ser aceito
#
# conn, addr = source.accept()
# self.insert("%s:%s conectado\n" % addr)
#
#
# self.do_prompt()
# self.clients[addr] = (conn, gtk.input_add(conn, gtk.gdk.INPUT_READ, self.write))
# FIXME
# def write(self, source, condition):
#
# data = source.recv(1024)
# if data.strip() == 'bye' or not len(data):
#
# # se o cliente enviar um ''bye'', desconecte-o :)
#
# source.close()
# for addr, (conn, tag) in self.clients.iteritems():
# if source is conn:
# gtk.input_remove(tag)
# self.insert('%s:%s desconectado\n' % addr)
# del self.clients[addr]
#
# self.server_tag = gtk.input_add(self.sock, gtk.gdk.INPUT_READ, self.accept)
# break
# elif data.strip() == 'quit':
# self.quit()
# else:
# for (addr, port), (conn, tag) in self.clients.iteritems():
# if source is conn:
# self.insert('%s:%s >>> %s\n'%(addr, port, data.strip()))
# self.handle_command(data.strip())
# break
#
# return gtk.TRUE
# FIXME
# def insert(self, data):
# statusbar = self.wTree.get_widget("statusbar1")
# if self.messageid:
# statusbar.remove(1, self.messageid)
# self.messageid=statusbar.push(1,data)
#
# def quit(self, *args):
# sys.stdout.write("quiting...\n")
# gtk.input_remove(self.server_tag)
# for addr, (conn, tag) in self.clients.iteritems():
# gtk.input_remove(tag)
# conn.close()
# self.sock.close()
# self.sock.shutdown()
#
# gtk.mainquit()
# sys.stdout.write("quit!\n")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment