- self.connection_info = Label(self.master, text = "No
+ self.connection_info = Label(self.master, text = "No ", \
padx = 10, pady = 10, justify = LEFT, **labelTextStyle)
self.connection_info.grid(row = 1, column = 4, sticky = W)
"""Launch the connection with Tux Droid.
- Called in a new thread.
+ Called in a new thread.
self.tuxy = tuxdroid.Tux() # blocking instruction
+ pass # already managed at 'tuxdroid' import
+ print e
username_entry = Entry(msg)
username_entry.grid(row = 0, column = 1, pady = 2)
Label(msg, text='Password : ').grid(row = 1, column = 0)
def block_sender(self, event = None):
+ Block the selected client.
- print self.client_agent.blocked_sender
def connect_to_client(self, event = None, client = None):
def add_client(self, client, ontology, pubkey):
- The method is called by clienAgent when the authentication agent
- has given the requested informations about the new
+ The method is called by the client agent when the
+ authentication agent has given the requested informations
+ about the new interlocutor.
- # add the new interlocutor to the dic of interlocutors
+ if ontology == 'None' and pubkey == 'None':
+ self.show_info(client + ' is not registered.\n' + \
+ 'You would not be able to communicate with ' + client + '.')
+ # Construct the RSA key of the new interlocutor
rsa_interlocutor = rsa.RSA(nb_bits = 128)
rsa_interlocutor.b = int(pubkey.split('-'))
rsa_interlocutor.n = int(pubkey.split('-'))
+ # Add the interlocutor with its ontology and RSA public KEY
self.client_agent.receiver[client] = (ontology, \
update the connection info label
+ # pdate the connection info label
Update the label wich contains the
list of current interlocutors.
- connection_info = "Connected with:\n"
+ if len(self.client_agent.receiver) == 1:
+ connection_info = "Interlocutor:\n"
+ connection_info = "Interlocutors:\n"
for a_client in self.client_agent.receiver.keys()[:-1]:
connection_info += " - " + a_client + ";\n"
connection_info += " - " + self.client_agent.receiver.keys()[-1] + "."
+ self.connection_info.configure(text="No ")
' would like to chat with you.\n' + \
'Add this person to the conversation ?') :
+ # Try to connect to the new client. This step will
+ # success if the client is already registered.
self.connect_to_client(client = name)
+ # If the new client is not registered to the
+ # authentication agent.
+ if name in self.client_agent.receiver.keys():
def update_conversation_zone(self, msg):