A simple, python, PyQt4 chat user interface with emoji support
It's as simple as running main.py
with the dependencies installed.
When connecting back-end code, make use of the methods (in main.py
- UIHandler
class):
-
refresh_users(users)
- to refresh the list of participants shown. It takes adict
argument with the following structure:users = {username: [user_id, access_level, last-seen_time], ...}
access_level: 1 = admin, 2 = moderator, 3 = regular user
-
display_error(text)
- to display errors. It takes astr
argument with the error text -
sendslot()
- to send a typed in message in thetext_input
widget when the send button has been clicked -
recvslot(type_, mesg)
- to display received messages. It takes anint
argument(type_
) to determine what kind of message has been received so as to render it correctly, as well as atuple
argument(mesg
) containing the message and details:mesg = (sender, message, time_sent)
type_: 1 = message from server, 2 = message from group, 3 = direct message
This is front-end code meant to be connected to the chat back-end. When doing this, make use of PyQt slots and signals to prevent freezing of the UI.