Example #1
0
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():
    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_()
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 #5
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 #6
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]
        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 #8
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 #9
0
    def __init__(self):
        conn_data = ConnectionData()
        conn_data.demo_connection()

        AdminConnection.__init__(self, conn_data)
    def sizeHint(self):
        return QtCore.QSize(500,300)

if __name__ == "__main__":
    import gettext

    def advise(*args):
        print args

    from lib_openmolar.common.datatypes import ConnectionData

    app = QtGui.QApplication([])

    gettext.install("")

    dl = QtGui.QDialog()
    dl.advise = advise

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

    cd1.is_default = True
    obj = ManageDatabasesWidget(dl)
    obj.set_connections([cd1, cd2])

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

    dl.exec_()
Example #11
0
            self.set_label()
            self.multiple_db_widg.setEnabled(False)
            QtCore.QTimer.singleShot(500, self.more_but.click)

    @property
    def chosen_connection(self):
        return self.connection

    def exec_(self):
        self.set_label()
        self._connect_signals()
        return ExtendableDialog.exec_(self)

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

    app = QtGui.QApplication([])

    dl = ConnectDialog()

    cd1, cd2 = ConnectionData(), ConnectionData()
    cd1.demo_connection()
    cd2.demo_connection()
    cd2._connection_name = "alternate"
    dl.set_known_connections([cd1, cd2])

    if dl.exec_():
        print dl.chosen_connection
    app.closeAllWindows()
Example #12
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_()
        return QtCore.QSize(500, 300)


if __name__ == "__main__":
    import gettext

    def advise(*args):
        print args

    from lib_openmolar.common.datatypes import ConnectionData

    app = QtGui.QApplication([])

    gettext.install("")

    dl = QtGui.QDialog()
    dl.advise = advise

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

    cd1.is_default = True
    obj = ManageDatabasesWidget(dl)
    obj.set_connections([cd1, cd2])

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

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

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

        ClientConnection.__init__(self, conn_data)