Commit a9820c9c authored by Staiger, Christine's avatar Staiger, Christine
Browse files

- Enabling and disabling of buttons ans filesystem trees

- Returning file sizes as  string from qt thread
parent 1e785bb4
......@@ -116,13 +116,14 @@ class dataTransfer(QDialog):
# Callback for the getDataSize worker
def updateUiWithDataState(self, addFiles, diff, addSize, updateSize):
self.updateSize = updateSize
print(int(addSize), int(updateSize))
#checksumSizeStr = self.bytesToStr(updateSize)
self.ChecksumSizeLbl.setText(self.bytesToStr(updateSize))
self.ChecksumSizeLbl.setText(self.bytesToStr(int(updateSize)))
self.diff = diff
self.addSize = addSize
#newSizeStr = self.bytesToStr(addSize)
self.newFSizeLbl.setText(self.bytesToStr(addSize))
self.newFSizeLbl.setText(self.bytesToStr(int(addSize)))
self.addFiles = addFiles
self.loading_movie.stop()
......@@ -132,7 +133,7 @@ class dataTransfer(QDialog):
def bytesToStr(self, bytes):
bytes = bytes / (1024**3)
bytes = bytes / (1000**3)
if bytes < 1000:
bytesStr = f"{round(bytes, 3)} GB"
else:
......@@ -158,7 +159,7 @@ class dataTransfer(QDialog):
class getDataState(QObject):
# Signals
updLabels = pyqtSignal(int, int) # Num files
finished = pyqtSignal(list, list, int, int) # Lists with size in bytes
finished = pyqtSignal(list, list, str, str) # Lists with size in bytes
def __init__(self, ic, localFsPath, coll, upload):
super(getDataState, self).__init__()
......@@ -208,8 +209,14 @@ class getDataState(QObject):
if self.upload == True:
fsDiffFiles = [d[1] for d in diff]
updateSize = getSize(fsDiffFiles)
addSize = getSize(onlyFS)
self.finished.emit(onlyFS, diff, addSize, updateSize)
fullOnlyFsPaths = [self.localFsPath+os.sep+d for d in onlyFS
if not d.startswith('/') or ':' not in d]
fullOnlyFsPaths.extend([d for d in onlyFS
if d.startswith('/') or ':' in d])
addSize = getSize(fullOnlyFsPaths)
print(str(fsDiffFiles)+" "+str(updateSize))
print(str(onlyFS)+" "+str(addSize))
self.finished.emit(onlyFS, diff, str(addSize), str(updateSize))
else:
irodsDiffFiles = [d[0] for d in diff]
updateSize = self.ic.getSize(irodsDiffFiles)
......@@ -218,7 +225,7 @@ class getDataState(QObject):
if not onlyIrods[i].startswith(self.coll.path):
onlyIrodsFullPath[i] = self.coll.path+'/'+ onlyIrods[i]
addSize = self.ic.getSize(onlyIrodsFullPath)
self.finished.emit(onlyIrods, diff, addSize, updateSize)
self.finished.emit(onlyIrods, diff, str(addSize), str(updateSize))
# Background worker for the up/download
......
......@@ -102,6 +102,8 @@ class irodsUpDownload():
self.widget.uplSetGB_2.setEnabled(enable)
self.widget.createFolderButton.setEnabled(enable)
self.widget.createCollButton.setEnabled(enable)
self.widget.localFsTreeView.setEnabled(enable)
self.widget.localFsTreeView.setEnabled(enable)
def infoPopup(self, message):
......@@ -158,10 +160,12 @@ class irodsUpDownload():
if fsSource == None or irodsDestPath == None:
self.widget.errorLabel.setText(
"ERROR Up/Download: Please select source and destination.")
self.enableButtons(True)
return
if not self.ic.session.collections.exists(irodsDestPath):
self.widget.errorLabel.setText(
"ERROR UPLOAD: iRODS destination is file, must be collection.")
self.enableButtons(True)
return
destColl = self.ic.session.collections.get(irodsDestPath)
#if os.path.isdir(fsSource):
......@@ -191,10 +195,12 @@ class irodsUpDownload():
if fsDest == None or irodsSourcePath == None:
self.widget.errorLabel.setText(
"ERROR Up/Download: Please select source and destination.")
self.enableButtons(True)
return
if os.path.isfile(fsDest):
self.widget.errorLabel.setText(
"ERROR DOWNLOAD: Local Destination is file, must be folder.")
self.enableButtons(True)
return
# File
if self.ic.session.data_objects.exists(irodsSourcePath):
......
Supports Markdown
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