Fixed a bug in the user selection dialog
This commit is contained in:
parent
03f73564da
commit
53196b5dda
@ -47,9 +47,8 @@ class post(object):
|
|||||||
if select.get_response() == widgetUtils.OK and select.users.GetCount() > 0:
|
if select.get_response() == widgetUtils.OK and select.users.GetCount() > 0:
|
||||||
self.tagged_people = []
|
self.tagged_people = []
|
||||||
tagged_users = select.get_all_users()
|
tagged_users = select.get_all_users()
|
||||||
for i in friends["items"]:
|
for i in tagged_users:
|
||||||
if u"{0} {1}".format(i["first_name"], i["last_name"]) in tagged_users:
|
self.tagged_people.append(u"[id%s|%s]" % (str(friends["items"][i]["id"]), friends["items"][i]["first_name"]))
|
||||||
self.tagged_people.append(u"[id%s|%s]" % (str(i["id"]), i["first_name"]))
|
|
||||||
self.message.text.SetValue(self.message.text.GetValue()+ u", ".join(self.tagged_people))
|
self.message.text.SetValue(self.message.text.GetValue()+ u", ".join(self.tagged_people))
|
||||||
|
|
||||||
def translate(self, *args, **kwargs):
|
def translate(self, *args, **kwargs):
|
||||||
|
@ -35,6 +35,7 @@ class selectPeople(widgetUtils.BaseDialog):
|
|||||||
|
|
||||||
def __init__(self, users=[]):
|
def __init__(self, users=[]):
|
||||||
super(selectPeople, self).__init__(parent=None, title=_(u"Tag friends"))
|
super(selectPeople, self).__init__(parent=None, title=_(u"Tag friends"))
|
||||||
|
self.indexes = []
|
||||||
self.users_list = users
|
self.users_list = users
|
||||||
panel = wx.Panel(self)
|
panel = wx.Panel(self)
|
||||||
sizer = wx.BoxSizer(wx.HORIZONTAL)
|
sizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||||
@ -74,13 +75,12 @@ class selectPeople(widgetUtils.BaseDialog):
|
|||||||
selection = self.get_user()
|
selection = self.get_user()
|
||||||
if selection in self.users_list:
|
if selection in self.users_list:
|
||||||
self.users.Append(selection)
|
self.users.Append(selection)
|
||||||
|
self.indexes.append(self.cb.GetSelection())
|
||||||
|
|
||||||
def remove_user(self, *args, **kwargs):
|
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):
|
def get_all_users(self):
|
||||||
users = []
|
return self.indexes
|
||||||
for i in xrange(0, self.users.GetCount()):
|
|
||||||
self.users.Select(i)
|
|
||||||
users.append(self.users.GetStringSelection())
|
|
||||||
return users
|
|
Loading…
Reference in New Issue
Block a user