def load(self, row):
   mol = self.molFile.molecule(row)
   self.objects.append(mol)
   glWidget = self.newGLWidget()
   glWidget.molecule = mol
   mdiWindow = self.ui.mdiArea.addSubWindow(Avogadro.toPyQt(glWidget))
   print glWidget
   print Avogadro.toPyQt(glWidget)
   mdiWindow.setWindowTitle(self.molFile.titles[row])
   mdiWindow.show()
  def performAction(self, action, glwidget):
    
    for i,engine in enumerate(glwidget.engines):
      if engine.name == "Surfaces":
        surfaceEngine = engine  # This should work...
      print "Name",engine.name       # Bug, it gives nothing intelligible
      print "Alias",engine.alias     # Bug, same as before  
      print "Primitives", engine.primitiveTypes # Gives Surface, 3, Atoms etc...
      print "index",i

    cube = glwidget.molecule.addCube()

    dim = array([5,5,5])
    min = -array([10.0,10.0,10.0])
    max = array([10.0,10.0,10.0])
    cube.setLimits(min,max,dim)

    data = []
    for i in range(125):
      data.append(sin(i/5.0))
    cube.setData(data)

    mesh = glwidget.molecule.addMesh()
    ID = mesh.id

    mesh.cube = cube.id

    iso = 1.0
    mesh_gen = Avogadro.MeshGenerator()
    initialized = mesh_gen.initialize(cube,mesh,iso)
    mesh_gen.run()

    Avogadro.toPyQt(mesh_gen).wait()

    print "finished"  

    #settings = QSettings("mesh1Id", ID)   This doesn't set values!!
    settings = QSettings()
    settings.setValue("mesh1Id", ID)
    surfaceEngine.readSettings(settings)

    surfaceEngine.enabled = True
    glwidget.molecule.update()  
Beispiel #3
0
 def test_engine(self):
   engines = Avogadro.PluginManager.instance.identifiers(Avogadro.PluginType.EngineType)
   engine = Avogadro.PluginManager.instance.engine(engines[0], Avogadro.toPyQt(self.glwidget))
   self.assertNotEqual(engine, None)
   self.glwidget.addEngine(engine)
   self.glwidget.removeEngine(engine)
 def open(self):
   filename = str(QFileDialog.getOpenFileName(self, 'Open', QDir.currentPath(), 
         'Chemistry files (*.cml *.sdf *.mol *.xyz)'))
   self.molFile = Avogadro.MoleculeFile.readFile(filename, '', '', False)
   self.connect(Avogadro.toPyQt(self.molFile), SIGNAL('ready()'), self, SLOT('readThreadFinnished()'))
   self.ui.statusbar.showMessage('Reading file...')
Beispiel #5
0
 def test_engine(self):
   engine = Avogadro.PluginManager.instance.engine("Label", Avogadro.toPyQt(self.glwidget))
   #engine = Avogadro.PluginManager.instance.engine("foo", N)
   self.assertNotEqual(engine, None)
   self.glwidget.addEngine(engine)
   self.glwidget.removeEngine(engine)