def textActivate(self, widget): text = self.molEntry.get_text() self.label.set_text(text) dbg = "" #smiles = Smiles(text) #numAtoms = smiles.num_atoms() numAtoms = 0 dbg += "\n\nNum Atoms: %d" % numAtoms self.atom = create_graph(text) dbg += "\n\nGraph\n===============\n" dbg += str(self.atom) self.debugText.set_text(dbg) ctx = self.drawable.window.cairo_create() draw_molecule(ctx, self.atom)
from cairo import * import math from gui import Window # Examples hexane = "CCCCCC" hexene = "C=CCCCC" # 1-hexene hexyne = "C#CCCCC" # 1-hexyne isohex = "CC(C)CCC" # isohexane or 2-methylpentane adenine = "n1c(c2c(nc1)ncn2)N" acetic = "CC(=O)O" # Acetic Acid pbromo = "C1=CC(=CC=C1Cl)Br" # p-BromoChloro Benzene vanillin = "O=Cc1ccc(O)c(OC)c1" naph = "c1cccc2c1cccc2" # Naphthalene """mol = create_graph(hexane) create_graph(hexene) create_graph(hexyne) create_graph(isohex) surface = ImageSurface(FORMAT_ARGB32, 500, 500) ctx = Context(surface) # Background height = 500 pat = SolidPattern(1.0, 1.0, 1.0, 0.9) ctx.rectangle (0,0, 500, 500) ctx.set_source (pat) ctx.fill () """
from atom import Atom, create_graph from cairo import * import math from gui import Window # Examples hexane = "CCCCCC" hexene = "C=CCCCC" # 1-hexene hexyne = "C#CCCCC" # 1-hexyne isohex = "CC(C)CCC" # isohexane or 2-methylpentane adenine = "n1c(c2c(nc1)ncn2)N" acetic = "CC(=O)O" # Acetic Acid pbromo = "C1=CC(=CC=C1Cl)Br" # p-BromoChloro Benzene vanillin = "O=Cc1ccc(O)c(OC)c1" naph = "c1cccc2c1cccc2" # Naphthalene """mol = create_graph(hexane) create_graph(hexene) create_graph(hexyne) create_graph(isohex) surface = ImageSurface(FORMAT_ARGB32, 500, 500) ctx = Context(surface) # Background height = 500 pat = SolidPattern(1.0, 1.0, 1.0, 0.9) ctx.rectangle (0,0, 500, 500) ctx.set_source (pat) ctx.fill () """