Skip to content
Snippets Groups Projects
Commit 7e69712d authored by Michael Wedel's avatar Michael Wedel
Browse files

Merge pull request #13929 from mantidproject/13660_save_workspaces

Works as described. Only workspaces that are not WorkspaceGroup show up in the list.
parents 7746374c ed3bc866
No related merge requests found
#pylint: disable=invalid-name #pylint: disable-all
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
import os import os
from mantid.simpleapi import * from mantid.simpleapi import *
from mantid.api import WorkspaceGroup from mantid.api import WorkspaceGroup, AnalysisDataService
import xml.etree.ElementTree as xml import xml.etree.ElementTree as xml
from isis_reflectometry.quick import * from isis_reflectometry.quick import *
from isis_reflectometry.procedures import * from isis_reflectometry.procedures import *
...@@ -239,9 +239,15 @@ class Ui_SaveWindow(object): ...@@ -239,9 +239,15 @@ class Ui_SaveWindow(object):
self.pushButton.setText(QtGui.QApplication.translate("SaveWindow", "SAVE", None, QtGui.QApplication.UnicodeUTF8)) self.pushButton.setText(QtGui.QApplication.translate("SaveWindow", "SAVE", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton_2.setText(QtGui.QApplication.translate("SaveWindow", "Refresh", None, QtGui.QApplication.UnicodeUTF8)) self.pushButton_2.setText(QtGui.QApplication.translate("SaveWindow", "Refresh", None, QtGui.QApplication.UnicodeUTF8))
def _get_saveable_workspace_names(self):
names = mtd.getObjectNames()
# Exclude WorkspaceGroups from our list. We cannot save them to ASCII.
names = [i for i in names if not isinstance(AnalysisDataService.retrieve(i), WorkspaceGroup)]
return names
def filterWksp(self): def filterWksp(self):
self.listWidget.clear() self.listWidget.clear()
names = mtd.getObjectNames() names = self._get_saveable_workspace_names()
if self.regExCheckBox.isChecked(): if self.regExCheckBox.isChecked():
regex=re.compile(self.filterEdit.text()) regex=re.compile(self.filterEdit.text())
filtered = list() filtered = list()
...@@ -268,7 +274,7 @@ class Ui_SaveWindow(object): ...@@ -268,7 +274,7 @@ class Ui_SaveWindow(object):
def populateList(self): def populateList(self):
self.listWidget.clear() self.listWidget.clear()
names = mtd.getObjectNames() names = self._get_saveable_workspace_names()
if len(names): if len(names):
RB_Number=groupGet(names[0],'samp','rb_proposal') RB_Number=groupGet(names[0],'samp','rb_proposal')
for ws in names: for ws in names:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment