From 8328f140d06a78b7b24d3a1c48e168881b7e2fdb Mon Sep 17 00:00:00 2001 From: Keith Brown Date: Tue, 7 Jan 2014 11:11:01 +0000 Subject: [PATCH] Refs #8633. Changed search to use xml and a fixed cycle depth The search now uses xml again and is fixed to 1 cycle into the past (although this will be fixed to a spinbox in another ticket to allow the user to set how many cycles into the past they want to search) --- .../isis_reflgui/latest_isis_runs.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Code/Mantid/scripts/Reflectometry/isis_reflgui/latest_isis_runs.py b/Code/Mantid/scripts/Reflectometry/isis_reflgui/latest_isis_runs.py index 4e902c546f16..3ab2a1b3696d 100644 --- a/Code/Mantid/scripts/Reflectometry/isis_reflgui/latest_isis_runs.py +++ b/Code/Mantid/scripts/Reflectometry/isis_reflgui/latest_isis_runs.py @@ -99,11 +99,13 @@ def gettextway(self, eID): item = line[3:8] + ": " + line[28:52].strip() runnames.append(item) return runnames - def getxmlway(self, eID): + def getxmlway(self, eID, maxDepth): runnames = [] tree = xml.parse(self.main_path) dom = tree.getroot() - for cycle in dom: + depth = 0 + revDom = reversed(dom) + for cycle in revDom: journal_file = cycle.attrib.get('name') journal_path = os.path.join(self.base_path, journal_file) cycle_id = self.__findCycleId(journal_path) @@ -122,6 +124,11 @@ def getxmlway(self, eID): if title and runno: journalentry = runno + ": " + title runnames.append(journalentry) + depth = depth + 1 + if depth == maxDepth: + break return runnames - def getJournalRuns(self, eID): - return self.gettextway(eID) + def getJournalRuns(self, eID, maxDepth = 1): + if maxDepth < 1: + maxDepth = 1 + return self.getxmlway(eID, maxDepth)