def showConnConfig(connectionList, *args, **keywords): """showConnConfig(*args, **keywords) -> None shows a window to configure the connection. The valid keywords are defined in QConnectionDBSetupWindow.__init__() """ dialog = QConnectionDBSetupWindow(**keywords) if dialog.exec_() == QtGui.QDialog.Accepted: config = {'id': int(dialog.id), 'name': str(dialog.nameEdt.text()), 'host': str(dialog.hostEdt.text()), 'port': int(dialog.portEdt.value()), 'user': str(dialog.userEdt.text()), 'passwd': str(dialog.passwdEdt.text()), 'db': str(dialog.databaseEdt.text())} id = connectionList.setConnectionInfo(**config) connectionList.setCurrentId(id) return True else: return False
def show_dialog(parent, id, name, host, port, user, passwd, databaseb, create): dialog = QConnectionDBSetupWindow(parent, id, name, host, port, user, passwd, database, create) config = None if dialog.exec_() == QtGui.QDialog.Accepted: config = {'host': str(dialog.hostEdt.text()), 'port': int(dialog.portEdt.value()), 'user': str(dialog.userEdt.text()), 'passwd': str(dialog.passwdEdt.text()), 'db': str(dialog.databaseEdt.text()) } try: db.services.io.test_db_connection(config) config['succeeded'] = True config['name'] = str(dialog.nameEdt.text()) config['id'] = dialog.id except VistrailsDBException, e: debug.critical('VisTrails DB Exception', str(e)) config['succeeded'] = False
def showConnConfig(connectionList, *args, **keywords): """showConnConfig(*args, **keywords) -> None shows a window to configure the connection. The valid keywords are defined in QConnectionDBSetupWindow.__init__() """ dialog = QConnectionDBSetupWindow(**keywords) if dialog.exec_() == QtGui.QDialog.Accepted: config = { 'id': int(dialog.id), 'name': str(dialog.nameEdt.text()), 'host': str(dialog.hostEdt.text()), 'port': int(dialog.portEdt.value()), 'user': str(dialog.userEdt.text()), 'passwd': str(dialog.passwdEdt.text()), 'db': str(dialog.databaseEdt.text()) } id = connectionList.setConnectionInfo(**config) connectionList.setCurrentId(id) return True else: return False