def _test():
    logging.basicConfig(level=logging.DEBUG)

    app = QtGui.QApplication([])
    parent = QtGui.QWidget()
    conn_data = ConnectionData()
    conn_data.demo_connection()
    db = OpenmolarDatabase(conn_data)
    logging.debug(db)
    message = '<body>'
    try:
        db.connect()
        message += '<h4>connection Ok... </h4>'
        message += 'Schema Version %s' % db.schema_version
        db.emit_notification("test_notification")

    except ConnectionError as e:
        message = u"connection error<hr />%s" % e
        app.restoreOverrideCursor()
    message += "</body>"

    QtGui.QMessageBox.information(parent, "result", message)
    db.close()

    app.closeAllWindows()
def _test():
    app = QtGui.QApplication([])
    conn_data = ConnectionData()
    conn_data.demo_connection()
    session = OpenmolarDatabase(conn_data)
    session.connect()
    psw = PostgresSessionWidget()
    psw.set_session(session)
    psw.update_status()
    psw.show()
    app.exec_()
Example #3
0
    def connection(self):
        if not self.known_connections:
            QtGui.QMessageBox.information(
                self.parent(), _("information"), u'<b>%s</b><br/>%s' %
                (_('NO database details found'),
                 _('will offer connection to the demo database on localhost.'))
            )

            conn_data = ConnectionData()
            conn_data.demo_connection()
            self._known_connections = [conn_data]
            return conn_data

        return self.known_connections[self._chosen_index]
Example #4
0
        def parse_conf(filepath):
            try:
                LOGGER.debug("checking %s for config" % filepath)

                conn_data = ConnectionData()
                conn_data.get_password = self.get_password
                conn_data.from_conf_file(filepath)

                LOGGER.info("loaded connection %s" % conn_data)
                known_session_params.append(conn_data)

            except Exception as exc:
                LOGGER.exception("error loading %s" % filepath)
                message = "%s '%s'<pre>%s</pre>" % (_("Bad Config file"),
                                                    filepath, exc.message)
                self.advise(message, 2)
Example #5
0
        if not valid_selection:
            message = _("please choose a connection")
        else:
            message = conn_data.to_html()

        self.details_browser.setText(message)
        self.connection_chosen.emit(conn_data)


if __name__ == "__main__":
    import gettext
    gettext.install("")

    from lib_openmolar.common.datatypes import ConnectionData

    app = QtGui.QApplication([])

    dl = QtGui.QDialog()

    cd1, cd2 = ConnectionData(), ConnectionData()
    cd1.demo_connection()
    cd2.demo_connection()

    widg = MultipleDatabaseWidget(dl)
    widg.set_connections([cd1, cd2])

    layout = QtGui.QVBoxLayout(dl)
    layout.addWidget(widg)

    dl.exec_()
Example #6
0
    def __init__(self):
        conn_data = ConnectionData()
        conn_data.demo_connection()

        AdminConnection.__init__(self, conn_data)
Example #7
0
    def __init__(self):
        conn_data = ConnectionData()
        conn_data.demo_connection()

        ClientConnection.__init__(self, conn_data)