Tag people in posts and comments. Closes #6
This commit is contained in:
@@ -59,6 +59,7 @@ class post(textMessage):
|
||||
self.create_privacy_box()
|
||||
self.mainBox.Add(self.privacyBox, 0, wx.ALL, 5)
|
||||
self.attach = wx.Button(self.panel, -1, _(u"Attach"), size=wx.DefaultSize)
|
||||
self.mention = wx.Button(self.panel, wx.NewId(), _(u"Tag a friend"))
|
||||
self.spellcheck = wx.Button(self.panel, -1, _("Spelling &correction"), size=wx.DefaultSize)
|
||||
self.translateButton = wx.Button(self.panel, -1, _(u"&Translate message"), size=wx.DefaultSize)
|
||||
self.okButton = wx.Button(self.panel, wx.ID_OK, _(u"Send"), size=wx.DefaultSize)
|
||||
@@ -66,6 +67,7 @@ class post(textMessage):
|
||||
cancelButton = wx.Button(self.panel, wx.ID_CANCEL, _(u"Close"), size=wx.DefaultSize)
|
||||
self.buttonsBox1 = wx.BoxSizer(wx.HORIZONTAL)
|
||||
self.buttonsBox1.Add(self.attach, 0, wx.ALL, 10)
|
||||
self.buttonsBox1.Add(self.mention, 0, wx.ALL, 10)
|
||||
self.buttonsBox1.Add(self.spellcheck, 0, wx.ALL, 10)
|
||||
self.buttonsBox1.Add(self.translateButton, 0, wx.ALL, 10)
|
||||
self.mainBox.Add(self.buttonsBox1, 0, wx.ALL, 10)
|
||||
@@ -92,12 +94,14 @@ class comment(textMessage):
|
||||
self.createTextArea(message, text)
|
||||
self.mainBox.Add(self.textBox, 0, wx.ALL, 5)
|
||||
self.spellcheck = wx.Button(self.panel, -1, _("Spelling correction"), size=wx.DefaultSize)
|
||||
self.mention = wx.Button(self.panel, wx.NewId(), _(u"Tag a friend"))
|
||||
self.translateButton = wx.Button(self.panel, -1, _(u"Translate message"), size=wx.DefaultSize)
|
||||
self.okButton = wx.Button(self.panel, wx.ID_OK, _(u"Send"), size=wx.DefaultSize)
|
||||
self.okButton.SetDefault()
|
||||
cancelButton = wx.Button(self.panel, wx.ID_CANCEL, _(u"Close"), size=wx.DefaultSize)
|
||||
self.buttonsBox1 = wx.BoxSizer(wx.HORIZONTAL)
|
||||
self.buttonsBox1.Add(self.spellcheck, 0, wx.ALL, 10)
|
||||
self.buttonsBox1.Add(self.mention, 0, wx.ALL, 10)
|
||||
self.buttonsBox1.Add(self.translateButton, 0, wx.ALL, 10)
|
||||
self.mainBox.Add(self.buttonsBox1, 0, wx.ALL, 10)
|
||||
self.ok_cancelSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
|
@@ -1,5 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import wx
|
||||
import widgetUtils
|
||||
|
||||
class selectAlbum(wx.Dialog):
|
||||
def __init__(self, title, albums):
|
||||
@@ -28,4 +29,58 @@ class selectAlbum(wx.Dialog):
|
||||
return self.lista.GetSelection()
|
||||
|
||||
def get_response(self):
|
||||
return self.ShowModal()
|
||||
return self.ShowModal()
|
||||
|
||||
class selectPeople(widgetUtils.BaseDialog):
|
||||
|
||||
def __init__(self, users=[]):
|
||||
super(selectPeople, self).__init__(parent=None, title=_(u"Tag friends"))
|
||||
self.users_list = users
|
||||
panel = wx.Panel(self)
|
||||
sizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
userLabel = wx.StaticText(panel, -1, _(u"All friends"))
|
||||
self.cb = wx.ComboBox(panel, -1, choices=users, value=users[0])
|
||||
self.cb.SetFocus()
|
||||
userSizer = wx.BoxSizer()
|
||||
userSizer.Add(userLabel, 0, wx.ALL, 5)
|
||||
userSizer.Add(self.cb, 0, wx.ALL, 5)
|
||||
self.add = wx.Button(panel, wx.NewId(), _(u"Select"))
|
||||
self.add.Bind(wx.EVT_BUTTON, self.add_user)
|
||||
userSizer.Add(self.add, 0, wx.ALL, 5)
|
||||
sizer.Add(userSizer, 0, wx.ALL, 5)
|
||||
lbl = wx.StaticText(panel, wx.NewId(), _(u"Tagged users"))
|
||||
self.users = wx.ListBox(panel, -1)
|
||||
self.remove = wx.Button(panel, wx.NewId(), _(u"Remove"))
|
||||
self.remove.Bind(wx.EVT_BUTTON, self.remove_user)
|
||||
selectionSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
selectionSizer.Add(lbl, 0, wx.ALL, 5)
|
||||
selectionSizer.Add(self.users, 0, wx.ALL, 5)
|
||||
selectionSizer.Add(self.remove, 0, wx.ALL, 5)
|
||||
sizer.Add(selectionSizer, 0, wx.ALL, 5)
|
||||
ok = wx.Button(panel, wx.ID_OK, _(u"&OK"))
|
||||
ok.SetDefault()
|
||||
cancel = wx.Button(panel, wx.ID_CANCEL, _(u"&Close"))
|
||||
btnsizer = wx.BoxSizer()
|
||||
btnsizer.Add(ok, 0, wx.ALL, 5)
|
||||
btnsizer.Add(cancel, 0, wx.ALL, 5)
|
||||
sizer.Add(btnsizer, 0, wx.ALL, 5)
|
||||
panel.SetSizer(sizer)
|
||||
self.SetClientSize(sizer.CalcMin())
|
||||
|
||||
def get_user(self):
|
||||
return self.cb.GetValue()
|
||||
|
||||
def add_user(self, *args, **kwargs):
|
||||
selection = self.get_user()
|
||||
if selection in self.users_list:
|
||||
self.users.Append(selection)
|
||||
|
||||
def remove_user(self, *args, **kwargs):
|
||||
self.users.Delete(self.users.GetSelection())
|
||||
|
||||
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
|
Reference in New Issue
Block a user