def testEmbeddedPDF(self): class app(Application): def init(self): pass e = Embedded('A pdf', ClassResource('file.pddf', app())) self.assertEquals('application/octet-stream', e.getMimeType(), 'Invalid mimetype') e = Embedded('A pdf', ClassResource('file.pdf', app())) self.assertEquals('application/pdf', e.getMimeType(), 'Invalid mimetype')
def showFile(self, name, typ, bas): # resource for serving the file contents streamSource = FileStreamSource(bas) resource = StreamResource(streamSource, name, self._component.getApplication()) # show the file contents - images only for now embedded = Embedded(name, resource) self.showComponent(embedded, name)
def __init__(self): self._usernameCaption = 'Username' self._passwordCaption = 'Password' self._loginButtonCaption = 'Login' self._iframe = Embedded() self._window = None super(LoginForm, self).__init__() self._iframe.setType(Embedded.TYPE_BROWSER) self._iframe.setSizeFull() self.setSizeFull() self.setCompositionRoot(self._iframe) self.addStyleName('v-loginform') self.loginPage = LoginPage(self) self.parameterHandler = ParameterHandler(self) self.uriHandler = UriHandler(self)
def __init__(self): super(ImageEmbedExample, self).__init__() e = Embedded('Image from a theme resource', ThemeResource('../runo/icons/64/document.png')) self.addComponent(e)