Skip to content

Commit

Permalink
Merge pull request #20896 from mantidproject/fix_pdgui_release
Browse files Browse the repository at this point in the history
Fix file downloading issue with HFIR PD GUI
  • Loading branch information
martyngigg authored Oct 11, 2017
2 parents 39aa220 + 4047f70 commit 2f15ec5
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions scripts/HFIRPowderReduction/HfirPDReductionGUI.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pylint: disable=invalid-name, relative-import, too-many-lines,too-many-instance-attributes,too-many-arguments
#pylint: disable=invalid-name, relative-import, too-many-lines,too-many-instance-attributes,too-many-arguments,C901
################################################################################
# Main class for HFIR powder reduction GUI
# Key word for future developing: FUTURE, NEXT, REFACTOR, RELEASE 2.0
Expand Down Expand Up @@ -407,14 +407,14 @@ def __init__(self, parent=None):
cache_dir = str(self.ui.lineEdit_cache.text()).strip()
if len(cache_dir) == 0 or os.path.exists(cache_dir) is False:
invalid_cache = cache_dir
if False:
cache_dir = os.path.expanduser('~')
else:
cache_dir = os.getcwd()
cache_dir = os.path.expanduser('~')
self.ui.lineEdit_cache.setText(cache_dir)
self._logWarning("Cache directory %s is not valid. "
"Using current workspace directory %s as cache." %
(invalid_cache, cache_dir))
if len(invalid_cache) == 0:
warning_msg = 'Cache directory is not set. '
else:
warning_msg = 'Cache directory {0} does not exist. '.format(invalid_cache)
warning_msg += 'Using {0} for caching dowloaded file instead.'.format(cache_dir)
print ('[WARNING] {0}'.format(warning_msg))

# Get on hold of raw data file
useserver = self.ui.radioButton_useServer.isChecked()
Expand Down Expand Up @@ -614,6 +614,7 @@ def doHelp(self):
mqt.MantidQt.API.MantidDesktopServices.openUrl(QtCore.QUrl(self.externalUrl))
return

# flake8: noqa
def doLoadData(self, exp=None, scan=None):
""" Load and reduce data
It does not support for tab 'Advanced Setup'
Expand Down Expand Up @@ -2141,7 +2142,7 @@ def _uiDownloadDataFile(self, exp, scan):

filename = '%s_exp%04d_scan%04d.dat' % (self._instrument.upper(), exp, scan)
srcFileName = os.path.join(cachedir, filename)
status, errmsg = urllib.downloadFile(fullurl, srcFileName)
status, errmsg = HfirPDReductionControl.downloadFile(fullurl, srcFileName)
if status is False:
self._logError(errmsg)
srcFileName = None
Expand Down

0 comments on commit 2f15ec5

Please sign in to comment.