Fixed a bug in the user selection dialog

This commit is contained in:
Manuel Cortez 2016-09-05 13:13:45 -05:00
parent 03f73564da
commit 53196b5dda
2 changed files with 8 additions and 9 deletions

View File

@ -47,9 +47,8 @@ class post(object):
if select.get_response() == widgetUtils.OK and select.users.GetCount() > 0:
self.tagged_people = []
tagged_users = select.get_all_users()
for i in friends["items"]:
if u"{0} {1}".format(i["first_name"], i["last_name"]) in tagged_users:
self.tagged_people.append(u"[id%s|%s]" % (str(i["id"]), i["first_name"]))
for i in tagged_users:
self.tagged_people.append(u"[id%s|%s]" % (str(friends["items"][i]["id"]), friends["items"][i]["first_name"]))
self.message.text.SetValue(self.message.text.GetValue()+ u", ".join(self.tagged_people))
def translate(self, *args, **kwargs):

View File

@ -35,6 +35,7 @@ class selectPeople(widgetUtils.BaseDialog):
def __init__(self, users=[]):
super(selectPeople, self).__init__(parent=None, title=_(u"Tag friends"))
self.indexes = []
self.users_list = users
panel = wx.Panel(self)
sizer = wx.BoxSizer(wx.HORIZONTAL)
@ -74,13 +75,12 @@ class selectPeople(widgetUtils.BaseDialog):
selection = self.get_user()
if selection in self.users_list:
self.users.Append(selection)
self.indexes.append(self.cb.GetSelection())
def remove_user(self, *args, **kwargs):
self.users.Delete(self.users.GetSelection())
n = self.users.GetSelection()
self.users.Delete(n)
self.indexes.remove(n)
def get_all_users(self):
users = []
for i in xrange(0, self.users.GetCount()):
self.users.Select(i)
users.append(self.users.GetStringSelection())
return users
return self.indexes