def get_save_db_locator_from_gui(parent, obj_type, locator=None): config, name = QOpenDBWindow.getSaveDBObject(obj_type) if config == {} or name == '': return None return DBLocator(config['host'], config['port'], config['db'], config['user'], config['passwd'], name, obj_id=None, obj_type=obj_type, connection_id=config.get('id', None))
def get_load_db_locator_from_gui(parent, obj_type): config, obj_id, obj_name = QOpenDBWindow.getOpenDBObject(obj_type) if config == {} or obj_id == -1: return None return DBLocator(config['host'], config['port'], config['db'], config['user'], config['passwd'], obj_name, obj_id=obj_id, obj_type=obj_type, connection_id=config.get('id', None))
'port': int(dialog.portEdt.value()), 'user': unicode(dialog.userEdt.text()), 'passwd': unicode(dialog.passwdEdt.text()), 'db': str(dialog.databaseEdt.text()) } try: vistrails.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 return config #check if the information is already there dbwindow = QOpenDBWindow.getInstance() config = dbwindow.connectionList.findConnectionInfo(host,port,database) if config: testconfig = dict(config) del testconfig['id'] del testconfig['name'] try: vistrails.db.services.io.test_db_connection(testconfig) config['succeeded'] = True except VistrailsDBException, e: config = show_dialog(parent, config['id'], config['name'], host, port, config['user'], passwd, database, create = False)
'user': unicode(dialog.userEdt.text()), 'passwd': unicode(dialog.passwdEdt.text()), 'db': str(dialog.databaseEdt.text()) } try: vistrails.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', e) config['succeeded'] = False return config #check if the information is already there dbwindow = QOpenDBWindow.getInstance() config = dbwindow.connectionList.findConnectionInfo(host, port, database) if config: testconfig = dict(config) del testconfig['id'] del testconfig['name'] try: vistrails.db.services.io.test_db_connection(testconfig) config['succeeded'] = True except VistrailsDBException, e: config = show_dialog(parent, config['id'], config['name'], host,