From bb87576ca356d608198468758e572ad177a08490 Mon Sep 17 00:00:00 2001 From: Wenduo Zhou Date: Wed, 11 Oct 2017 00:29:48 -0500 Subject: [PATCH 1/3] Refs #20889. Fixed url download file issue. --- .../HFIRPowderReduction/HfirPDReductionGUI.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/HFIRPowderReduction/HfirPDReductionGUI.py b/scripts/HFIRPowderReduction/HfirPDReductionGUI.py index a1ba82c676bf..bc62b7145319 100644 --- a/scripts/HFIRPowderReduction/HfirPDReductionGUI.py +++ b/scripts/HFIRPowderReduction/HfirPDReductionGUI.py @@ -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() @@ -2141,7 +2141,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 From 5ddfe070616f1671d01817e473fedbbf93b6bf92 Mon Sep 17 00:00:00 2001 From: Wenduo Zhou Date: Wed, 11 Oct 2017 00:45:25 -0500 Subject: [PATCH 2/3] Refs #20889. Fixed flake8. --- scripts/HFIRPowderReduction/HfirPDReductionGUI.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/HFIRPowderReduction/HfirPDReductionGUI.py b/scripts/HFIRPowderReduction/HfirPDReductionGUI.py index bc62b7145319..926632292f3f 100644 --- a/scripts/HFIRPowderReduction/HfirPDReductionGUI.py +++ b/scripts/HFIRPowderReduction/HfirPDReductionGUI.py @@ -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 From 4047f70cad3eb2ddf78cc6d3f26102959f92e8ee Mon Sep 17 00:00:00 2001 From: Wenduo Zhou Date: Wed, 11 Oct 2017 01:01:02 -0500 Subject: [PATCH 3/3] Refs #20889. Suppress flake8 warning for change in master already. --- scripts/HFIRPowderReduction/HfirPDReductionGUI.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/HFIRPowderReduction/HfirPDReductionGUI.py b/scripts/HFIRPowderReduction/HfirPDReductionGUI.py index 926632292f3f..2774b62559e1 100644 --- a/scripts/HFIRPowderReduction/HfirPDReductionGUI.py +++ b/scripts/HFIRPowderReduction/HfirPDReductionGUI.py @@ -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'