Exemplo n.º 1
0
 def setUp(self):
     settings = config.Settings(load=False)
     self.taskFile = persistence.TaskFile()
     attachments = attachment.AttachmentList()
     self.viewer = gui.viewer.AttachmentViewer(self.frame, self.taskFile, 
         settings, attachmentsToShow=attachments, 
         settingsSection='attachmentviewer')
Exemplo n.º 2
0
    def testOpenAttachmentWithNonAsciiFileNameThrowsException(
            self):  # pragma: no cover
        ''' os.startfile() does not accept unicode filenames. This will be 
            fixed in Python 2.5. This test will fail if the bug is fixed. '''
        self.errorMessage = ''  # pylint: disable-msg=W0201

        def onError(*args, **kwargs):  # pylint: disable-msg=W0613
            self.errorMessage = args[0]

        att = attachment.FileAttachment(u'tést.é')
        openAttachment = uicommand.AttachmentOpen(\
            viewer=self.editor._interior[6].viewer,
            attachments=attachment.AttachmentList([att]),
            settings=self.settings)
        openAttachment.doCommand(None, showerror=onError)
        if '__WXMSW__' in wx.PlatformInfo:  # pragma: no cover
            if sys.version_info < (2, 5):
                errorMessageStart = "'ascii' codec can't encode character"
            else:
                errorMessageStart = ''
        elif '__WXMAC__' in wx.PlatformInfo and sys.version_info >= (2, 5):
            errorMessageStart = ''  # pragma: no cover
        elif '__WXGTK__' in wx.PlatformInfo:  # pragma: no cover
            errorMessageStart = ''
        else:
            errorMessageStart = '[Error 2] '
        self.failUnless(self.errorMessage.startswith(errorMessageStart))
Exemplo n.º 3
0
 def setUp(self):
     super(AttachmentEditorTestCase, self).setUp()
     self.settings = config.Settings(load=False)
     self.taskFile = persistence.TaskFile()
     self.attachments = attachment.AttachmentList()
     self.attachments.extend(self.createAttachments())
     self.editor = self.createEditor()
Exemplo n.º 4
0
 def setUp(self):
     super(AttachmentEditorTest, self).setUp()
     self.settings = config.Settings(load=False)
     self.taskFile = persistence.TaskFile()
     self.attachment = attachment.FileAttachment('Attachment')
     self.attachments = attachment.AttachmentList()
     self.attachments.append(self.attachment)
     self.editor = gui.dialog.editor.AttachmentEditor(
         self.frame, self.attachments, self.settings, self.attachments,
         self.taskFile)
Exemplo n.º 5
0
 def testOpenAttachmentWithNonAsciiFileName(self):
     self.errorMessage = ''  # pylint: disable=W0201
     
     def onError(*args, **kwargs):  # pylint: disable=W0613
         self.errorMessage = args[0]  # pragma: no cover
         
     att = attachment.FileAttachment(u'tést.é')
     openAttachment = uicommand.AttachmentOpen(\
         viewer=self.editor._interior[6].viewer,
         attachments=attachment.AttachmentList([att]),
         settings=self.settings)
     openAttachment.doCommand(None, showerror=onError)
     self.failIf(self.errorMessage)
Exemplo n.º 6
0
 def createToolBarUICommands(self):
     commands = super(AttachmentViewer, self).createToolBarUICommands()
     commands[-2:-2] = [
         None,
         uicommand.AttachmentNew(attachments=self.presentation(),
                                 settings=self.settings),
         uicommand.AttachmentEdit(attachments=self.presentation(),
                                  viewer=self),
         uicommand.AttachmentDelete(attachments=self.presentation(),
                                    viewer=self), None,
         uicommand.AttachmentOpen(attachments=attachment.AttachmentList(),
                                  viewer=self,
                                  settings=self.settings)
     ]
     return commands
Exemplo n.º 7
0
 def createActionToolBarUICommands(self):
     return (uicommand.AttachmentOpen(attachments=attachment.AttachmentList(),
                                      viewer=self, settings=self.settings),) + \
        super(AttachmentViewer, self).createActionToolBarUICommands()