Back to index

salome-gui  6.5.0
Public Member Functions | Public Attributes | Private Member Functions
GUI_PY.selectvars.MySelectVarsDialog Class Reference
Inheritance diagram for GUI_PY.selectvars.MySelectVarsDialog:
Inheritance graph
[legend]
Collaboration diagram for GUI_PY.selectvars.MySelectVarsDialog:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def setExchangeVariables
def initPotentialVariablesFromSelection
def addSelectedInputVar
def removeSelectedInputVar
def newInputVar
def addSelectedOutputVar
def removeSelectedOutputVar
def newOutputVar
def getSelectedExchangeVariables
def loadVars
def saveVars

Public Attributes

 refEntry

Private Member Functions

def _initPotentialVariables

Detailed Description

Definition at line 37 of file selectvars.py.


Constructor & Destructor Documentation

def GUI_PY.selectvars.MySelectVarsDialog.__init__ (   self,
  parent = None,
  modal = 0 
)

Definition at line 39 of file selectvars.py.

00039 
00040     def __init__(self, parent = None, modal = 0):
00041         QtGui.QDialog.__init__(self, parent)
00042         Ui_SelectVarsDialog.__init__(self)
00043         self.setupUi(self)
00044         self.connect(self.cancelButton, QtCore.SIGNAL("clicked()"), self.close)
00045         self.connect(self.OKButton, QtCore.SIGNAL("clicked()"), self.accept)
00046         self.connect(self.selectButton, QtCore.SIGNAL("clicked()"), self.initPotentialVariablesFromSelection)
00047         self.connect(self.addInputVarButton, QtCore.SIGNAL("clicked()"), self.addSelectedInputVar)
00048         self.connect(self.removeInputVarButton, QtCore.SIGNAL("clicked()"), self.removeSelectedInputVar)
00049         self.connect(self.newInputVarButton, QtCore.SIGNAL("clicked()"), self.newInputVar)
00050         self.connect(self.addOutputVarButton, QtCore.SIGNAL("clicked()"), self.addSelectedOutputVar)
00051         self.connect(self.removeOutputVarButton, QtCore.SIGNAL("clicked()"), self.removeSelectedOutputVar)
00052         self.connect(self.newOutputVarButton, QtCore.SIGNAL("clicked()"), self.newOutputVar)
00053         self.connect(self.loadVarsButton, QtCore.SIGNAL("clicked()"), self.loadVars)
00054         self.connect(self.saveVarsButton, QtCore.SIGNAL("clicked()"), self.saveVars)
00055         self.refEntry = None

Here is the call graph for this function:


Member Function Documentation

def GUI_PY.selectvars.MySelectVarsDialog._initPotentialVariables (   self,
  entry 
) [private]

Definition at line 71 of file selectvars.py.

00071 
00072     def _initPotentialVariables(self, entry):
00073         sobj = getStudyEditor().study.FindObjectID(entry)
00074         if sobj is None:
00075             QtGui.QMessageBox.warning(self, self.tr("Error"),
00076                                       self.tr('No item at entry %s' % entry))
00077             return
00078         exchangeVariables = study_exchange_vars.getExchangeVariablesFromSObject(sobj)
00079         if exchangeVariables is None:
00080             QtGui.QMessageBox.warning(self, self.tr("Error"),
00081                                       self.tr('Item at entry %s is not a valid '
00082                                               '"Variable List" object' % entry))
00083             return
00084         self.refEntry = entry
00085         self.varListObjLineEdit.setText(sobj.GetName())
00086         self.allInputVarListWidget.clear()
00087         self.allOutputVarListWidget.clear()
00088         self.allInputVarListWidget.addItems([x.name for x in exchangeVariables.inputVarList])
00089         self.allOutputVarListWidget.addItems([x.name for x in exchangeVariables.outputVarList])

Here is the caller graph for this function:

Definition at line 90 of file selectvars.py.

00090 
00091     def addSelectedInputVar(self):
00092         for item in self.allInputVarListWidget.selectedItems():
00093             self.selectedInputVarListWidget.addItem(QtGui.QListWidgetItem(item))

Here is the caller graph for this function:

Definition at line 103 of file selectvars.py.

00103 
00104     def addSelectedOutputVar(self):
00105         for item in self.allOutputVarListWidget.selectedItems():
00106             self.selectedOutputVarListWidget.addItem(QtGui.QListWidgetItem(item))

Here is the caller graph for this function:

Definition at line 116 of file selectvars.py.

00116 
00117     def getSelectedExchangeVariables(self):
00118         inputVarList = []
00119         outputVarList = []
00120         for row in range(self.selectedInputVarListWidget.count()):
00121             name = str(self.selectedInputVarListWidget.item(row).text())
00122             inputVarList.append(study_exchange_vars.Variable(name))
00123         for row in range(self.selectedOutputVarListWidget.count()):
00124             name = str(self.selectedOutputVarListWidget.item(row).text())
00125             outputVarList.append(study_exchange_vars.Variable(name))
00126         return study_exchange_vars.ExchangeVariables(inputVarList, outputVarList, self.refEntry)

Here is the caller graph for this function:

Definition at line 62 of file selectvars.py.

00062 
00063     def initPotentialVariablesFromSelection(self):
00064         entries = salome.sg.getAllSelected()
00065         if len(entries) != 1 :
00066             QtGui.QMessageBox.warning(self, self.tr("Error"),
00067                                       self.tr("One item must be selected in the object browser"))
00068             return
00069         selectedEntry = entries[0]
00070         self._initPotentialVariables(selectedEntry)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 127 of file selectvars.py.

00127 
00128     def loadVars(self):
00129         filename = QtGui.QFileDialog.getOpenFileName(self, self.tr("Import variables from file"),
00130                                                      os.getenv("HOME"),
00131                                                      self.tr("XML Files (*.xml)"))
00132         if not filename:
00133             return
00134         try:
00135             filename = str(filename)
00136             exchange_variables = study_exchange_vars.loadExchangeVariablesFromXmlFile(filename)
00137             self.setExchangeVariables(exchange_variables)
00138         except Exception, e:
00139             QtGui.QMessageBox.critical(self, self.tr("Error"),
00140                                        self.tr("Cannot load file %s:\n%s" % (filename, e)))

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 98 of file selectvars.py.

00098 
00099     def newInputVar(self):
00100         newItem = QtGui.QListWidgetItem("TO EDIT!")
00101         newItem.setFlags(Qt.ItemIsSelectable|Qt.ItemIsEditable|Qt.ItemIsUserCheckable|Qt.ItemIsEnabled)
00102         self.selectedInputVarListWidget.addItem(newItem);

Here is the caller graph for this function:

Definition at line 111 of file selectvars.py.

00111 
00112     def newOutputVar(self):
00113         newItem = QtGui.QListWidgetItem("TO EDIT!")
00114         newItem.setFlags(Qt.ItemIsSelectable|Qt.ItemIsEditable|Qt.ItemIsUserCheckable|Qt.ItemIsEnabled)
00115         self.selectedOutputVarListWidget.addItem(newItem);

Here is the caller graph for this function:

Definition at line 94 of file selectvars.py.

00094 
00095     def removeSelectedInputVar(self):
00096         for item in self.selectedInputVarListWidget.selectedItems():
00097             self.selectedInputVarListWidget.takeItem(self.selectedInputVarListWidget.row(item))

Here is the caller graph for this function:

Definition at line 107 of file selectvars.py.

00107 
00108     def removeSelectedOutputVar(self):
00109         for item in self.selectedOutputVarListWidget.selectedItems():
00110             self.selectedOutputVarListWidget.takeItem(self.selectedOutputVarListWidget.row(item))

Here is the caller graph for this function:

Definition at line 141 of file selectvars.py.

00141 
00142     def saveVars(self):
00143         default = os.path.join(os.getenv("HOME"), "vars.xml")
00144         filename = QtGui.QFileDialog.getSaveFileName(self, self.tr("Export variables to file"),
00145                                                      default, self.tr("XML Files (*.xml)"))
00146         if not filename:
00147             return
00148         try:
00149             filename = str(filename)
00150             exchange_variables = self.getSelectedExchangeVariables()
00151             exchange_variables.saveToXmlFile(filename)
00152         except Exception, e:
00153             QtGui.QMessageBox.critical(self, self.tr("Error"),
00154                                        self.tr("Cannot save file %s:\n%s" % (filename, e)))

Here is the call graph for this function:

Here is the caller graph for this function:

def GUI_PY.selectvars.MySelectVarsDialog.setExchangeVariables (   self,
  exchangeVariables 
)

Definition at line 56 of file selectvars.py.

00056 
00057     def setExchangeVariables(self, exchangeVariables):
00058         if exchangeVariables.refEntry is not None:
00059             self._initPotentialVariables(exchangeVariables.refEntry)
00060         self.selectedInputVarListWidget.addItems([x.name for x in exchangeVariables.inputVarList])
00061         self.selectedOutputVarListWidget.addItems([x.name for x in exchangeVariables.outputVarList])

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 54 of file selectvars.py.


The documentation for this class was generated from the following file: