Advertisement
Guest User

Global Discrepency

a guest
Feb 18th, 2014
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.31 KB | None | 0 0
  1. #configuration.py
  2. 4  USER = ''
  3.  
  4.  
  5. #communicator.py
  6.  10     def login(username,password):
  7.   9         f = open(USER_PATH, 'r')
  8.   8         global USER
  9.   7         while True:
  10.   6             line = f.readline()
  11.   5             if len(line) == 0:
  12.   4                 login_status_label.set_label("No user found")
  13.   3                 break
  14.   2             data = line.split(",")
  15.   1             if data[0] == username:
  16. 65                  if data[4] == password:
  17.   1                     login_status_label.set_label("Success!")
  18.   2                     USER = username
  19.   3                     authorize.close()
  20.   4                     break
  21.   5                 else:
  22.   6                     login_status_label.set_label("Incorrect Passwo
  23.  7                     break
  24.  8         if USER != '':
  25.  9             login_button.set_label(USER)
  26.  
  27. #handler.py
  28. 15     def on_submitButton_clicked(self, *args):
  29. 16         info_buffer = info_display.get_buffer()
  30. 17         chat_input = chat_entry.get_text()
  31. 18         if (chat_input != ""):
  32. 19             chat_input += '\n'
  33. 20             info_buffer.insert(info_buffer.get_end_iter(),USER + "
  34.  21             f = open(ACTIVE_LOG_PATH, 'a')
  35.  22             f.write(USER + ": " + chat_input)
  36.  23             f.close()
  37.  24             chat_entry.set_text("")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement