Beispiel #1
0
    def __init__(self, parent, task, *args, **kwargs):
        super(AttachmentPage, self).__init__(parent, task, *args, **kwargs)
        attachmentBox = widgets.BoxWithBoxSizer(self, label=_('Attachments'))
        self._listCtrl = wx.ListCtrl(attachmentBox, style=wx.LC_REPORT)
        self._listCtrl.InsertColumn(0, _('Attachment filenames'))
        self._listCtrl.SetColumnWidth(0, 500)
        attachmentBox.add(self._listCtrl, flag=wx.EXPAND|wx.ALL, proportion=1)

        boxSizer = wx.BoxSizer(wx.HORIZONTAL)
        self._buttonBox = widgets.ButtonBox(attachmentBox, 
            (_('Open attachment'), self.onOpen),
            (_('Remove attachment'), self.onRemove),
            (_('Edit filename'), self.onEdit), 
            orientation=wx.HORIZONTAL)        
        boxSizer.Add(self._buttonBox)
        buttonBox2 = widgets.ButtonBox(attachmentBox, 
            (_('Browse for new attachment...'), self.onBrowse),
            orientation=wx.HORIZONTAL)
        boxSizer.Add(buttonBox2)
        attachmentBox.add(boxSizer)
        attachmentBox.fit()

        filenameBox = widgets.BoxWithBoxSizer(self, 
            label=_('Attachment filename'), orientation=wx.HORIZONTAL)
        self._urlEntry = widgets.SingleLineTextCtrlWithEnterButton(filenameBox, 
            label=_('Add attachment'), onEnter=self.onAdd)
        filenameBox.add(self._urlEntry, proportion=1)
        filenameBox.fit()

        self.add(attachmentBox, proportion=1, border=5)
        self.add(filenameBox, proportion=0, border=5)
        self.fit()
        self.bindEventHandlers()
        self.onFileDrop(task.attachments())
        if task.attachments():
            self._listCtrl.SetItemState(0, wx.LIST_STATE_SELECTED, 
                                        wx.LIST_STATE_SELECTED)
        else:
            self.onDeselectItem()
Beispiel #2
0
 def attachmentImageIndex(self, task, which):
     if task.attachments():
         return self.imageIndex['attachment'] 
     else:
         return -1