Commit f7fdb9ae authored by j_stru18's avatar j_stru18

reloading of remote dbs

parents df27dade 93cca1c5
......@@ -412,8 +412,23 @@ class InputManager(QtWidgets.QWidget):
self.updateListWidget()
self.parent.networkManager.setModifiedFlag()
"""
Create a new HDF5TXT file with the paths of one or more HDF5 files.
Opens a TableEditor where you can add, remove and edit lines and also select HDF5 files with a file dialog. This new
file can be saved, when you enter a name for it. When a file was created and its path exists, it is added to the
input manager, which will also be updated.
@author: j_schi48, j_stru18
"""
def createTxt(self):
self.editor = TableEditor()
newPath = self.editor.path
if newPath:
addingSuccessful = self.addDBbyPathLocal(self.editor.path) # create TXT is only implemented for local dbs
if addingSuccessful:
QtWidgets.QMessageBox.information(self, self.tr("File Saved"), self.tr("File saved at \"{}\"".format(newPath)))
self.updateListWidget()
def importdb(self, dict):
'''receive a new db dict, clear the old and open all'''
......@@ -1110,6 +1125,7 @@ class InputManager(QtWidgets.QWidget):
QtWidgets.QMessageBox.warning(self, "Reloading Failed", "Reloading of database on remote host"
" failed.")
return
if hashedID != self.id: # file was changed outside of Barista
QtWidgets.QMessageBox.warning(self, "File was Changed", "This HDF5TXT file's paths were changed "
"outside of Barista - check for duplicate "
......
......@@ -344,7 +344,7 @@ class TableEditor(QtWidgets.QDialog):
item.setFlags(Qt.NoItemFlags)
def reload(self, row=0, column=0):
""" reloads all path avalibilities """
""" reloads all path avalabilities """
if column == 0:
for index in range(self.table.rowCount()):
item = self.table.item(index, 0)
......@@ -367,13 +367,14 @@ class TableEditor(QtWidgets.QDialog):
if len(path) > 0:
path, extension = os.path.splitext(path)
path = path + ".txt" # ensure .txt is the suffix
self.path = path
txtfile = open(path, "w+")
for index in range(self.table.rowCount()):
line = self.table.item(index, 0).text()
if self.checkIfExists(line):
txtfile.write(line+"\n")
txtfile.close()
QtWidgets.QMessageBox.information(self, self.tr("File Saved"), self.tr("File saved at \"{}\"".format(path)))
self.accept()
def keyReleaseEvent(self, QKeyEvent):
if QKeyEvent.key() == QtCore.Qt.Key_Delete:
......
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