Skip to content

Commit

Permalink
Supporting PySide2 and addressing Grid defect (#1008)
Browse files Browse the repository at this point in the history
* new verbage

* Closes #1007

* andrea

* Closes #1003. Closes #973

* fixed ascii character problem

* cleaned csv loader

* skiped ui

* modified plugin test

* initial porting to PySide2

* oka

* removed folder accidentally added

* Scene needs to have the path item added.

* Switching to Qt5 because that is the default with Pyside2.

* Fixing problems with UI and python 3 compatibility.

* Qt5 does not have a rotate for simple text.

* Updating for python 3 and qt5/Pyside2

* Use Agg backend in windows, and nothing uses self.ddata so don't save

Even the docstring said it wasn't returned.

* addressed Paul comment

* reverted input param for global grid
  • Loading branch information
alfoa authored and wangcj05 committed Aug 30, 2019
1 parent 203e4be commit 549d26e
Show file tree
Hide file tree
Showing 35 changed files with 252 additions and 902 deletions.
Binary file modified doc/sqa/CIlist/LST-1136_RAVEN_Configuration_Items_List.docx
Binary file not shown.
6 changes: 3 additions & 3 deletions doc/user_manual/Installation/clone.tex
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,6 @@ \subsubsection{Updating RAVEN}
\end{itemize}

\subsubsection{In-use Testing}

At any time, tests can be checked by re-running the installation tests as
described in Section \ref{sec:testing raven}.
Whenever RAVEN is installed on a new computer or whenever there is a significant change to the operating system,
in-use tests shall be conducted.
Acceptable performance of RAVEN shall be confirmed by running the installation tests as described in \ref{sec:testing raven}.
7 changes: 6 additions & 1 deletion framework/Application.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@
import PySide.QtCore as qtc
__QtAvailable = True
except ImportError as e:
__QtAvailable = False
try:
import PySide2.QtWidgets as qtw
import PySide2.QtCore as qtc
__QtAvailable = True
except ImportError as e:
__QtAvailable = False

if __QtAvailable:
class InteractiveApplication(qtw.QApplication, MessageHandler.MessageUser):
Expand Down
7 changes: 4 additions & 3 deletions framework/CodeInterfaces/RAVEN/RAVENInterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ def _readMoreXML(self,xmlNode):
@ In, xmlNode, xml.etree.ElementTree.Element, Xml element node
@ Out, None.
"""
if os.path.basename(xmlNode.find("executable").text) != 'raven_framework':
raise IOError(self.printTag+' ERROR: executable must be "raven_framework" (in whatever location)!')
baseName = os.path.basename(xmlNode.find("executable").text)
if baseName not in ['raven_framework','Driver.py']:
raise IOError(self.printTag+' ERROR: executable must be "raven_framework" (in whatever location)! Got "'+baseName+'"!')

linkedDataObjects = xmlNode.find("outputExportOutStreams")
if linkedDataObjects is None:
Expand Down Expand Up @@ -162,7 +163,7 @@ def generateCommand(self,inputFiles,executable,clargs=None,fargs=None, preExec=N
outputfile = self.outputPrefix+inputFiles[index].getBase()
# we set the command type to serial since the SLAVE RAVEN handles the parallel on its own
pre = ""
if "python" not in executable.lower() or executable.endswith(".py"):
if "python" not in executable.lower() or not executable.endswith(".py"):
pre = self.preCommand.strip() + " "
executeCommand = [('serial',pre + executable+ ' '+inputFiles[index].getFilename())]
returnCommand = executeCommand, outputfile
Expand Down
489 changes: 0 additions & 489 deletions framework/CsvLoader.py

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions framework/GridEntities.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#External Modules End--------------------------------------------------------------------------------

#Internal Modules------------------------------------------------------------------------------------
from utils.utils import UreturnPrintTag,partialEval,compare, metaclass_insert
from utils.utils import UreturnPrintTag,partialEval,floatConversion,compare, metaclass_insert
from BaseClasses import BaseType
import utils.TreeStructure as ETS
from utils.RAVENiterators import ravenArrayIterator
Expand Down Expand Up @@ -351,7 +351,7 @@ def _fillGrid(self,child):
self.raiseAnError(IOError,"Each <grid> XML node needs to have the attribute type!!!!")
nameGrid = None
if constrType in ['custom','equal']:
bounds = [partialEval(element) for element in child.text.split()]
bounds = [floatConversion(element) for element in child.text.split()]
bounds.sort()
lower, upper = min(bounds), max(bounds)
if 'name' in child.attrib.keys():
Expand Down
14 changes: 10 additions & 4 deletions framework/PostProcessors/DataMining.py
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,15 @@ def __runTemporalSciKitLearn(self, Input):

try:
import PySide.QtCore as qtc
__QtAvailable = True
except ImportError as e:
try:
import PySide2.QtCore as qtc
__QtAvailable = True
except ImportError as e:
__QtAvailable = False

if __QtAvailable:
class QDataMining(DataMining,qtc.QObject):
"""
DataMining class - Computes a hierarchical clustering from an input point
Expand Down Expand Up @@ -966,7 +974,7 @@ def userInteraction(self):

## Give this UI a unique id in case other threads are requesting UI
## elements
uiID = unicode(id(self))
uiID = str(id(self))

## Send the request for a UI thread to the main application
self.requestUI.emit('HierarchyWindow', uiID,
Expand All @@ -993,7 +1001,5 @@ def signalDone(self,uiID):
until the correct one has signaled it is done.
@Out, None
"""
if uiID == unicode(id(self)):
if uiID == str(id(self)):
self.uiDone = True
except ImportError as e:
pass
259 changes: 0 additions & 259 deletions framework/PostProcessors/RavenOutput.py

This file was deleted.

15 changes: 11 additions & 4 deletions framework/PostProcessors/TopologicalDecomposition.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,15 @@ def run(self, inputIn):

try:
import PySide.QtCore as qtc
__QtAvailable = True
except ImportError as e:
try:
import PySide2.QtCore as qtc
__QtAvailable = True
except ImportError as e:
__QtAvailable = False

if __QtAvailable:
class QTopologicalDecomposition(TopologicalDecomposition,qtc.QObject):
"""
TopologicalDecomposition class - Computes an approximated hierarchical
Expand Down Expand Up @@ -431,7 +440,7 @@ def userInteraction(self):

## Give this UI a unique id in case other threads are requesting UI
## elements
uiID = unicode(id(self))
uiID = str(id(self))

## Send the request for a UI thread to the main application
self.requestUI.emit('TopologyWindow', uiID,
Expand Down Expand Up @@ -467,7 +476,5 @@ def signalDone(self,uiID):
until the correct one has signaled it is done.
@Out, None
"""
if uiID == unicode(id(self)):
if uiID == str(id(self)):
self.uiDone = True
except ImportError as e:
pass
1 change: 1 addition & 0 deletions framework/Samplers/Grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def localInputAndChecks(self,xmlNode, paramInput):
if 'limit' in paramInput.parameterValues:
self.raiseAnError(IOError,'limit is not used in Grid sampler')
self.limit = 1
##FIXME: THIS READ MORE XML MUST BE CONVERTED IN THE INPUTPARAMETER COLLECTOR!!!!!!!
self.gridEntity._readMoreXml(xmlNode,dimensionTags=["variable","Distribution"],messageHandler=self.messageHandler, dimTagsPrefix={"Distribution":"<distribution>"})
grdInfo = self.gridEntity.returnParameter("gridInfo")
for axis, value in grdInfo.items():
Expand Down
Loading

0 comments on commit 549d26e

Please sign in to comment.