Update API version
This commit is contained in:
@@ -3,7 +3,7 @@ import wx
|
||||
import widgetUtils
|
||||
|
||||
class attachDialog(widgetUtils.BaseDialog):
|
||||
def __init__(self):
|
||||
def __init__(self, voice_messages=False):
|
||||
super(attachDialog, self).__init__(None, title=_(u"Add an attachment"))
|
||||
panel = wx.Panel(self)
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
@@ -15,10 +15,16 @@ class attachDialog(widgetUtils.BaseDialog):
|
||||
sizer.Add(box, 0, wx.ALL, 5)
|
||||
static = wx.StaticBox(panel, label=_(u"Add attachments"))
|
||||
self.photo = wx.Button(panel, wx.NewId(), _(u"&Photo"))
|
||||
self.audio = wx.Button(panel, wx.NewId(), _(u"Audio file"))
|
||||
if voice_messages:
|
||||
self.voice_message = wx.Button(panel, wx.NewId(), _(u"Voice message"))
|
||||
self.remove = wx.Button(panel, wx.NewId(), _(u"Remove attachment"))
|
||||
self.remove.Enable(False)
|
||||
btnsizer = wx.StaticBoxSizer(static, wx.HORIZONTAL)
|
||||
btnsizer.Add(self.photo, 0, wx.ALL, 5)
|
||||
btnsizer.Add(self.audio, 0, wx.ALL, 5)
|
||||
if voice_messages:
|
||||
btnsizer.Add(self.voice_message, 0, wx.ALL, 5)
|
||||
sizer.Add(btnsizer, 0, wx.ALL, 5)
|
||||
ok = wx.Button(panel, wx.ID_OK)
|
||||
ok.SetDefault()
|
||||
|
@@ -83,4 +83,58 @@ class selectPeople(widgetUtils.BaseDialog):
|
||||
self.indexes.remove(n)
|
||||
|
||||
def get_all_users(self):
|
||||
return self.indexes
|
||||
|
||||
class selectAttachment(widgetUtils.BaseDialog):
|
||||
|
||||
def __init__(self, title="", attachments=[]):
|
||||
super(selectAttachment, self).__init__(parent=None, title=title)
|
||||
self.indexes = []
|
||||
self.attachments_list = attachments
|
||||
panel = wx.Panel(self)
|
||||
sizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
label = wx.StaticText(panel, -1, _(u"Available attachments"))
|
||||
self.cb = wx.ComboBox(panel, -1, choices=attachments, value=attachments[0])
|
||||
self.cb.SetFocus()
|
||||
attachmentSizer = wx.BoxSizer()
|
||||
attachmentSizer.Add(label, 0, wx.ALL, 5)
|
||||
attachmentSizer.Add(self.cb, 0, wx.ALL, 5)
|
||||
self.add = wx.Button(panel, wx.NewId(), _(u"Select"))
|
||||
self.add.Bind(wx.EVT_BUTTON, self.add_attachment)
|
||||
attachmentSizer.Add(self.add, 0, wx.ALL, 5)
|
||||
sizer.Add(attachmentSizer, 0, wx.ALL, 5)
|
||||
lbl = wx.StaticText(panel, wx.NewId(), _(u"Selected attachments"))
|
||||
self.attachments = wx.ListBox(panel, -1)
|
||||
self.remove = wx.Button(panel, wx.NewId(), _(u"Remove"))
|
||||
self.remove.Bind(wx.EVT_BUTTON, self.remove_attachment)
|
||||
selectionSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
selectionSizer.Add(lbl, 0, wx.ALL, 5)
|
||||
selectionSizer.Add(self.attachments, 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_attachment(self):
|
||||
return self.cb.GetValue()
|
||||
|
||||
def add_attachment(self, *args, **kwargs):
|
||||
selection = self.get_attachment()
|
||||
if selection in self.attachments_list:
|
||||
self.attachments.Append(selection)
|
||||
self.indexes.append(self.cb.GetSelection())
|
||||
|
||||
def remove_attachment(self, *args, **kwargs):
|
||||
n = self.attachments.GetSelection()
|
||||
self.attachments.Delete(n)
|
||||
self.indexes.remove(n)
|
||||
|
||||
def get_all_attachments(self):
|
||||
return self.indexes
|
@@ -32,6 +32,7 @@ class mainWindow(wx.Frame):
|
||||
self.player_stop = player.Append(wx.NewId(), _(u"Stop"))
|
||||
self.player_previous = player.Append(wx.NewId(), _(u"Previous"))
|
||||
self.player_next = player.Append(wx.NewId(), _(u"Next"))
|
||||
self.player_shuffle = player.AppendCheckItem(wx.NewId(), _(u"Shuffle"))
|
||||
self.player_volume_down = player.Append(wx.NewId(), _(u"Volume down"))
|
||||
self.player_volume_up = player.Append(wx.NewId(), _(u"Volume up"))
|
||||
self.player_mute = player.Append(wx.NewId(), _(u"Mute"))
|
||||
|
@@ -143,6 +143,8 @@ class chatTab(wx.Panel):
|
||||
sizer.Add(self.create_controls())
|
||||
sizer.Add(self.create_attachments(), 0, wx.ALL, 5)
|
||||
sizer.Add(self.create_chat(), 0, wx.ALL, 5)
|
||||
self.attachment = wx.Button(self, wx.NewId(), _(u"Add"))
|
||||
sizer.Add(self.attachment, 0, wx.ALL, 5)
|
||||
self.send = wx.Button(self, -1, _(u"Send"))
|
||||
self.send.SetDefault()
|
||||
sizer.Add(self.send, 0, wx.ALL, 5)
|
||||
|
Reference in New Issue
Block a user