KalziumGLWidget::KalziumGLWidget(QWidget *parent) : Avogadro::GLWidget(parent),
  m_lastEngine1(0), m_lastEngine2(0)
{
    // work around a bug in OpenBabel: the chemical data files parsing
    // is dependent on the LC_NUMERIC locale.
    m_lc_numeric = QByteArray(setlocale(LC_NUMERIC, 0));
    setlocale(LC_NUMERIC, "C");

    // Prevent What's this from intercepting right mouse clicks
    setContextMenuPolicy(Qt::PreventContextMenu);
    // Load the tools and set navigate as the default
    // first set the Avogadro plugin directory,
    // avoiding overwriting an already set envvar
    static bool s_pluginDirSet = false;
    if (!s_pluginDirSet) {
        if (qgetenv("AVOGADRO_PLUGINS").isEmpty()) {
            qputenv("AVOGADRO_PLUGINS", AVOGADRO_PLUGIN_DIR);
        }
        s_pluginDirSet = true;
    }
    Avogadro::PluginManager *manager = Avogadro::PluginManager::instance();
    manager->loadFactories();
    Avogadro::ToolGroup* tools = new Avogadro::ToolGroup(this);
    tools->append(manager->tools(this));
    tools->setActiveTool("Navigate");
    setToolGroup(tools);
    // Set the default engine to be active
    loadDefaultEngines();

    // Set the default quality level to high
    setQuality(2);

    setMolecule(new Avogadro::Molecule(this));
    update();
}
Exemple #2
0
ThreeDMolDialog::ThreeDMolDialog(QtGui::Molecule *mol, QWidget *parent_)
  : QDialog(parent_),
    m_molecule(NULL),
    m_ui(new Ui::ThreeDMolDialog)
{
  m_ui->setupUi(this);
  setMolecule(mol);
}
bool KalziumGLWidget::openFile(const QString &file)
{
    Avogadro::Molecule* mol = OpenBabel2Wrapper::readMolecule(file);
    if (!mol) {
        return false;
    }
    Avogadro::Molecule* oldmol = molecule();
    if (oldmol) {
        oldmol->deleteLater();
    }
    setMolecule(mol);
    update();
    return true;
}
Exemple #4
0
// --- Construction and Destruction ---------------------------------------- //
OplsAtomTyper::OplsAtomTyper(const chemkit::Molecule *molecule)
    : chemkit::AtomTyper("opls")
{
    setMolecule(molecule);
}