Commit df27dade authored by j_stru18's avatar j_stru18

add HDF5local with guard statements merge conflict

parents 462584a8 7dc45055
......@@ -457,10 +457,20 @@ class InputManager(QtWidgets.QWidget):
@return whether or not the adding of the db was successful
"""
def _addDB(self, db):
if "isRemote" in db and db["isRemote"]:
return self._addDBRemote(db)
if not self._locationIsImported(db):
if "isRemote" in db and db["isRemote"]:
return self._addDBRemote(db)
else:
return self._addDBLocal(db)
else:
return self._addDBLocal(db)
if "isRemote" in db and db["isRemote"]:
QtWidgets.QMessageBox.information(self, self.tr("Importing Failed"),
self.tr("There is already a file imported from \n\"{0}\"\n"
" at the host: \n{1}".format(db["path"], db["host"])))
else:
QtWidgets.QMessageBox.information(self, self.tr("Importing Failed"),
self.tr("There is already a file imported from \n\"{}\"".format(db["path"])))
return False
"""
add this new database to the dict. only for databases WITHOUT IDs
......@@ -583,7 +593,7 @@ class InputManager(QtWidgets.QWidget):
checks if a db dict is constructed in a valid way (contains keys for type, name and path and type is one of the
three expected types
@param db a dict containing
@param db a dict containing the attributes of a database
"""
def _dbCheck(self, db):
validDB = True
......@@ -602,6 +612,29 @@ class InputManager(QtWidgets.QWidget):
return validDB
"""
Checks if there is already a db with the same location as the inout in the input managers dict of databases.
For local dbs the path is compared only; for remote dbs the host and port are taken into consideration as well.
@author: j_stru18
@param: dbToCheck: a dict containing the attributes of a database
@return: whether or not a database with the same location already exists in the input managers dict of databases
"""
def _locationIsImported(self, dbToCheck):
locationIsImported = False
for id, dict in self.dict["dblist"].iteritems():
if dict["path"] == dbToCheck["path"]:
if "isRemote" in dbToCheck and dbToCheck["isRemote"]:
if dict["isRemote"]:
# both are remote and share the same path and host/port
if (dict["host"] == dbToCheck["host"]) and (dict["port"] == dbToCheck["port"]):
locationIsImported = True
else:
if not dict["isRemote"]: # both are local and share the same path
locationIsImported = True
return locationIsImported
def getDBDict(self):
'''export the dict'''
self._initDict()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment