def accept(self): iok, mess = CheckCFD_CodeEnv(CFD_Code()) if iok: if mess != "" : mess = cfdstudyMess.trMessage(self.tr("CFDSTUDY_INVALID_ENV"),[]) + mess cfdstudyMess.criticalMessage(mess) else : InfoDialog.accept(self) else: mess = cfdstudyMess.trMessage(self.tr("INFO_DLG_INVALID_ENV"),[]) + mess cfdstudyMess.criticalMessage(mess)
def accept(self): iok, mess = CheckCFD_CodeEnv(CFD_Code()) if iok: if mess != "": Error = "Error : " + self.tr("CFDSTUDY_INVALID_ENV") QMessageBox.critical(ActionHandler.dskAgent().workspace(), Error, mess, QMessageBox.Ok, 0) else: InfoDialog.accept(self) else: Error = "Error : " + self.tr("INFO_DLG_INVALID_ENV") QMessageBox.critical(self, Error, mess, QMessageBox.Ok, 0)
def activate(): """ This method is called when GUI module is being activated. @rtype: C{True} or C{False} @return: C{True} only if the activation is successful. """ log.debug("activate") dsk = sgPyQt.getDesktop() dsk.setTabPosition(Qt.RightDockWidgetArea,QTabWidget.South) dsk.setTabPosition(Qt.LeftDockWidgetArea,QTabWidget.South) ActionHandler = _DesktopMgr.getActionHandler(dsk) env_saturne, msg = CheckCFD_CodeEnv(CFD_Saturne) log.debug("activate -> env_saturne = %s" % env_saturne) if not env_saturne: QMessageBox.critical(ActionHandler.dskAgent().workspace(), "Error", msg, QMessageBox.Ok, 0) return False if msg != "": mess = cfdstudyMess.trMessage(ObjectTR.tr("CFDSTUDY_INVALID_ENV"),[]) + " ; "+ msg cfdstudyMess.aboutMessage(msg) return False else: ActionHandler.DialogCollector.InfoDialog.setCode(env_saturne) ActionHandler._SalomeSelection.currentSelectionChanged.connect(ActionHandler.updateActions) ActionHandler.connectSolverGUI() # Hide the Python Console window layout for dock in sgPyQt.getDesktop().findChildren(QDockWidget): dockTitle = dock.windowTitle() log.debug("activate -> QDockWidget: %s" % dockTitle) if "Object Browser" in str(dockTitle): dock.raise_() dock.show() if dsk.dockWidgetArea(dock) == 0: dsk.addDockWidget(Qt.LeftDockWidgetArea,dock) if dockTitle in ("Python Console", "Console Python", "Message Window"): dock.setVisible(False) dock.hide() return True
def activate(): """ This method is called when GUI module is being activated. @rtype: C{True} or C{False} @return: C{True} only if the activation is successful. """ log.debug("activate") global d_activation, studyId dsk = sgPyQt.getDesktop() studyId = sgPyQt.getStudyId() dsk.setTabPosition(Qt.RightDockWidgetArea, QTabWidget.South) dsk.setTabPosition(Qt.LeftDockWidgetArea, QTabWidget.South) if salome_version.getVersion() <= '7.4.0': if salome.myStudy.FindComponent(__MODULE_NAME__) == None: CFDSTUDYGUI_SolverGUI._c_CFDGUI.cleanAllDock(sgPyQt.getDesktop()) log.debug( "activate -> CFDSTUDYGUI_SolverGUI._c_CFDGUI.d_CfdCases = %s" % CFDSTUDYGUI_SolverGUI._c_CFDGUI.d_CfdCases) # instance of the CFDSTUDYGUI_ActionsHandler class for the current desktop ActionHandler = _DesktopMgr.getActionHandler(dsk) if studyId not in list(d_activation.keys()): d_activation[studyId] = 1 if d_activation[studyId] == 1: d_activation[studyId] = 0 env_saturne, mess1 = CheckCFD_CodeEnv(CFD_Saturne) env_neptune, mess2 = CheckCFD_CodeEnv(CFD_Neptune) log.debug("activate -> env_saturne = %s" % env_saturne) log.debug("activate -> env_neptune = %s" % env_neptune) if not env_saturne and not env_neptune: QMessageBox.critical(ActionHandler.dskAgent().workspace(), "Error", mess1, QMessageBox.Ok, 0) QMessageBox.critical(ActionHandler.dskAgent().workspace(), "Error", mess2, QMessageBox.Ok, 0) d_activation[studyId] = 1 return False if env_neptune: if mess2 != "": mess = cfdstudyMess.trMessage( ObjectTR.tr("CFDSTUDY_INVALID_ENV"), []) + " ; " + mess2 cfdstudyMess.aboutMessage(mess) d_activation[studyId] = 1 return False else: ActionHandler.DialogCollector.InfoDialog.setCode( env_saturne, env_neptune) elif env_saturne: if mess1 != "": mess = cfdstudyMess.trMessage( ObjectTR.tr("CFDSTUDY_INVALID_ENV"), []) + " ; " + mess2 cfdstudyMess.aboutMessage(mess) d_activation[studyId] = 1 return False else: ActionHandler.DialogCollector.InfoDialog.setCode( env_saturne, False) ActionHandler._SalomeSelection.currentSelectionChanged.connect( ActionHandler.updateActions) ActionHandler.connectSolverGUI() ActionHandler.updateObjBrowser() # Hide the Python Console window layout for dock in sgPyQt.getDesktop().findChildren(QDockWidget): dockTitle = dock.windowTitle() log.debug("activate -> QDockWidget: %s" % dockTitle) if dockTitle in ("Python Console", "Console Python", "Message Window"): dock.setVisible(False) return True
def __init__(self, parent=None): """ Constructor. Initialize text and label of the QDialog. """ SetTreeLocationDialog.__init__(self, parent) self.isCaseMode = False aBtn = self.findChild(QtGui.QPushButton, "OKButton") if not aBtn == None: aBtn.setText(self.tr("DLG_OK_BUTTON_TEXT")) aBtn = self.findChild(QtGui.QPushButton, "CancelButton") if not aBtn == None: aBtn.setText(self.tr("DLG_CANCEL_BUTTON_TEXT")) self.setWindowTitle(self.tr("LOCATION_DLG_CAPTION")) aLabel = self.findChild(QtGui.QLabel, "CaseLabel") if not aLabel == None: aLabel.setText(self.tr("LOCATION_DLG_CASE_NAME")) aLabel = self.findChild(QtGui.QLabel, "StudyDirLabel") if not aLabel == None: aLabel.setText(self.tr("LOCATION_DLG_STUDY_DIR_LABEL")) aLE = self.findChild(QtGui.QLineEdit, "StudyDirName") if aLE != None: aLE.clear() # Installing validator on case name aLE = self.findChild(QtGui.QLineEdit, "CaseLineEdit") if aLE != None: aLE.clear() aLE = self.findChild(QtGui.QLineEdit, "StudyLineEdit") if aLE != None: aLE.clear() self.StudyPath = '' self.StudyName = '' self.CaseRefName = '' neptune_status, mess2 = CheckCFD_CodeEnv(CFD_Neptune) if not neptune_status: self.findChild(QtGui.QRadioButton, "radioButtonNeptune").setEnabled(False) self.Create = self.findChild(QtGui.QCheckBox, "checkBoxCreate") self.connect(self.Create, SIGNAL("clicked()"), self.slotCreateCase) self.Load = self.findChild(QtGui.QCheckBox, "checkBoxLoad") self.connect(self.Load, SIGNAL("clicked()"), self.slotLoadCase) self.CopyFrom = self.findChild(QtGui.QCheckBox, "checkBoxCopyFrom") self.connect(self.CopyFrom, SIGNAL("clicked()"), self.slotCopyFrom) # Define option when openning self.findChild(QtGui.QCheckBox, "checkBoxCreate").setChecked(False) self.findChild(QtGui.QCheckBox, "checkBoxLoad").setChecked(True) self.findChild(QtGui.QRadioButton, "radioButtonSaturne").setChecked(True) self.findChild(QtGui.QRadioButton, "radioButtonNeptune").setChecked(False) self.findChild(QtGui.QGroupBox, "CaseGroupBox").setEnabled(False) self.findChild(QtGui.QCheckBox, "checkBoxMesh").setChecked(True) self.findChild(QtGui.QCheckBox, "checkBoxPOST").setChecked(True) self.findChild(QtGui.QPushButton, "BrowseButtonCopy").setEnabled(False) self.setCaseMode(self.isCaseMode)