Re: [Open Babel] generate image dynamically
On 1/7/19 11:04 AM, Dmitri Maziuk via OpenBabel-discuss wrote: > .. subscribe as e.g. > person@work, then have their @work address forwarded to gmail, later > try to unsubscribe their person@work address and wonder why that is not > working. Sorry, braino: I meant "trying to usubscribe person@gmail" -- Dimitri Maziuk Programmer/sysadmin BioMagResBank, UW-Madison -- http://www.bmrb.wisc.edu signature.asc Description: OpenPGP digital signature ___ OpenBabel-discuss mailing list OpenBabel-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Re: [Open Babel] generate image dynamically
On Mon, 7 Jan 2019 09:42:06 +0200 Devora Witty wrote: > There is some kind of bug in the unscubscribe option for the openbabel > mailing list, despite attempting to unsubscribe several times I am > still receiving emails > > On Sun, Jan 6, 2019 at 10:35 PM Christina Frances Sandall < > cfsan...@ucalgary.ca> wrote: > > > Please remove me from this mailing list. Thanks very much! First check if you're unsubscribing the same address that is subscribed: it is very common for people to subscribe as e.g. person@work, then have their @work address forwarded to gmail, later try to unsubscribe their person@work address and wonder why that is not working. That said, I wouldn't be surprised if SF's excuse for the MLM is indeed full of bugs. -- Dmitri Maziuk ___ OpenBabel-discuss mailing list OpenBabel-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Re: [Open Babel] generate image dynamically
Please remove me from this mailing list. Thanks very much! > On Dec 23, 2018, at 12:52 PM, Dmitri Maziuk via OpenBabel-discuss > wrote: > > On Sat, 22 Dec 2018 14:22:31 -0500 > Spencer Trinh wrote: > >> How may one approach this? > > One starts with Reading The Fine Manual, specifically the parts where > one gets the SVG as a string from pybel and sends it out in werkzeug > Response. > > -- > Dmitri Maziuk > > > ___ > OpenBabel-discuss mailing list > OpenBabel-discuss@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/openbabel-discuss ___ OpenBabel-discuss mailing list OpenBabel-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Re: [Open Babel] generate image dynamically
Noel, Geoff, this sounds like a bug: On 12/23/18 2:52 PM, Spencer Trinh wrote: > > output=pybel.Outputfile('svg',filename='testsvg.svg',opt={'u':None,'C':None}) > for name,mol in mols.items(): > mol.removeh() > mol.title=name > output.write(mol) > output.close() > ... The svg file itself has errors. The error is: > > This page contains the following errors: > error on line 36 at column 6: XML declaration allowed only at the start of > the document I am guessing every write() writes out the whole shebang starting with "http://www.bmrb.wisc.edu signature.asc Description: OpenPGP digital signature ___ OpenBabel-discuss mailing list OpenBabel-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Re: [Open Babel] generate image dynamically
On 12/23/18 2:52 PM, Spencer Trinh wrote: > output=pybel.Outputfile('svg',filename='testsvg.svg',opt={'u':None,'C':None}) > > for name,mol in mols.items(): > > mol.removeh() > > mol.title=name > > output.write(mol) > > output.close() From http://openbabel.org/docs/dev/UseTheLibrary/Python_PybelAPI.html#pybel.Outputfile: """ Although it’s possible to write a single molecule to a file by calling the write() method of a Molecule, if multiple molecules are to be written to the same file you should use the Outputfile class. """ Conversely, to write a single molecule: http://openbabel.org/docs/dev/UseTheLibrary/Python_PybelAPI.html#pybel.Molecule.write: """ Write the molecule to a file or return a string. """ svg = mol.write( format = "svg", opt = { "a" : None, "b" : "none", "i" : None } ) However, laying multiple images out on a grid is a different question. I would recommend re-posting your question with a better subject, like "how to draw multiple SVGs on a grid". Merry Christmas, -- Dimitri Maziuk Programmer/sysadmin BioMagResBank, UW-Madison -- http://www.bmrb.wisc.edu signature.asc Description: OpenPGP digital signature ___ OpenBabel-discuss mailing list OpenBabel-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Re: [Open Babel] generate image dynamically
On Sat, 22 Dec 2018 14:22:31 -0500 Spencer Trinh wrote: > How may one approach this? One starts with Reading The Fine Manual, specifically the parts where one gets the SVG as a string from pybel and sends it out in werkzeug Response. -- Dmitri Maziuk ___ OpenBabel-discuss mailing list OpenBabel-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Re: [Open Babel] generate image dynamically
Sure. Have the html include an img with src pointing to an svg file, and have this request handled by flask which should return the svg file generated dynamically based on the url. The important step is that flask should set the mimetype correctly. On Sat, 22 Dec 2018, 19:22 Spencer Trinh Hi, > > Im new to openbabel. I wanted to make a webservice (using Flask) that can > do smart searching on a database. How can I dynamically display SVG images > on html template without having to write the file to a directory and point > it to a physical location. Is it possible to render the image dynamically > based on a user's query search and not save it to a physical location? I've > seen some plotting packages that are able to use a function, i.e. > `render_to_uri()` and embed it into the html code. Is there a similar > function in pybel? How may one approach this? Thanks. > > > > Regards, > ___ > OpenBabel-discuss mailing list > OpenBabel-discuss@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/openbabel-discuss > ___ OpenBabel-discuss mailing list OpenBabel-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-discuss