From 0578cc67087b8609599e22576ffcd83348c32152 Mon Sep 17 00:00:00 2001 From: Paul RASCLE Date: Fri, 8 Jan 2016 16:38:11 +0100 Subject: [PATCH] remise en marche du plugin t_shape_fluid --- CMakeLists.txt | 1 + src/CMakeLists.txt | 2 +- src/GEOMGUI/GEOM_msg_en.ts | 2 +- src/GEOMGUI/GEOM_msg_fr.ts | 2 +- src/Tools/geom_plugins.py | 4 +- src/Tools/t_shape/CMakeLists.txt | 18 ++++- src/Tools/t_shape/__init__.py | 1 + src/Tools/t_shape/t_shape_builder.py | 2 +- src/Tools/t_shape/t_shape_dialog.py | 16 ++-- src/Tools/t_shape/t_shape_dialog.ui | 76 ++++++++++++++---- src/Tools/t_shape/t_shape_dialog_ui.py | 103 ------------------------- 11 files changed, 96 insertions(+), 131 deletions(-) create mode 100644 src/Tools/t_shape/__init__.py delete mode 100644 src/Tools/t_shape/t_shape_dialog_ui.py diff --git a/CMakeLists.txt b/CMakeLists.txt index dbe3a9531..c61b04e28 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -127,6 +127,7 @@ IF(SALOME_BUILD_GUI) # Qt4 FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui QtXml) + FIND_PACKAGE(SalomePyQt4) ENDIF(SALOME_BUILD_GUI) ## diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bd7e3428d..13d33e444 100755 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -24,7 +24,7 @@ SET(SUBDIRS_COMMON ARCHIMEDE BlockFix GEOMAlgo SKETCHER GEOM ShHealOper GEOMUtils XAO XAO_Swig GEOMImpl GEOM_I GEOMClient GEOM_I_Superv GEOM_SWIG GEOM_PY AdvancedEngine OCC2VTK - STLPlugin BREPPlugin STEPPlugin IGESPlugin XAOPlugin VTKPlugin + STLPlugin BREPPlugin STEPPlugin IGESPlugin XAOPlugin VTKPlugin Tools ) ## diff --git a/src/GEOMGUI/GEOM_msg_en.ts b/src/GEOMGUI/GEOM_msg_en.ts index 491d964f8..9b4a8ddde 100644 --- a/src/GEOMGUI/GEOM_msg_en.ts +++ b/src/GEOMGUI/GEOM_msg_en.ts @@ -5350,7 +5350,7 @@ shells and solids on the other hand. GEOM_PLUGINS_OTHER - Other + Python Plugins SHOW_ONLY_SELECTED diff --git a/src/GEOMGUI/GEOM_msg_fr.ts b/src/GEOMGUI/GEOM_msg_fr.ts index 1a1231364..01acd20ca 100644 --- a/src/GEOMGUI/GEOM_msg_fr.ts +++ b/src/GEOMGUI/GEOM_msg_fr.ts @@ -5342,7 +5342,7 @@ le paramètre '%1' aux préférences du module Géométrie. GEOM_PLUGINS_OTHER - Autre + Plugins Python SHOW_ONLY_SELECTED diff --git a/src/Tools/geom_plugins.py b/src/Tools/geom_plugins.py index 00ad4f149..a1f6ab394 100644 --- a/src/Tools/geom_plugins.py +++ b/src/Tools/geom_plugins.py @@ -22,8 +22,8 @@ import salome_pluginsmanager def t_shape_fluid(context): - import t_shape_builder - import t_shape_dialog + from t_shape import t_shape_builder + from t_shape import t_shape_dialog import xalome from PyQt4.QtGui import QMessageBox activeStudy = context.study diff --git a/src/Tools/t_shape/CMakeLists.txt b/src/Tools/t_shape/CMakeLists.txt index 35cc00554..4701fc26d 100644 --- a/src/Tools/t_shape/CMakeLists.txt +++ b/src/Tools/t_shape/CMakeLists.txt @@ -17,16 +17,28 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # +INCLUDE(UsePyQt4) + # --- scripts --- # scripts / static SET(plugin_SCRIPTS + __init__.py t_shape_builder.py t_shape_dialog.py t_shape_dialog.ui - t_shape_dialog_ui.py - ) + ) + +# uic files / to be processed by pyuic +SET(_pyuic_files + t_shape_dialog.ui +) + +# scripts / pyuic wrappings +PYQT4_WRAP_UIC(_pyuic_SCRIPTS ${_pyuic_files}) + # --- rules --- -SALOME_INSTALL_SCRIPTS("${plugin_SCRIPTS}" ${SALOME_SMESH_INSTALL_PLUGINS}/t_shape) +SALOME_INSTALL_SCRIPTS("${plugin_SCRIPTS}" ${SALOME_GEOM_INSTALL_PLUGINS}/t_shape) +SALOME_INSTALL_SCRIPTS("${_pyuic_SCRIPTS}" ${SALOME_GEOM_INSTALL_PLUGINS}/t_shape) \ No newline at end of file diff --git a/src/Tools/t_shape/__init__.py b/src/Tools/t_shape/__init__.py new file mode 100644 index 000000000..40a96afc6 --- /dev/null +++ b/src/Tools/t_shape/__init__.py @@ -0,0 +1 @@ +# -*- coding: utf-8 -*- diff --git a/src/Tools/t_shape/t_shape_builder.py b/src/Tools/t_shape/t_shape_builder.py index 09a818b29..3082dc849 100644 --- a/src/Tools/t_shape/t_shape_builder.py +++ b/src/Tools/t_shape/t_shape_builder.py @@ -1,4 +1,4 @@ -# -*- coding: iso-8859-1 -*- +# -*- coding: utf-8 -*- import sys import salome diff --git a/src/Tools/t_shape/t_shape_dialog.py b/src/Tools/t_shape/t_shape_dialog.py index ce6032994..9fb4f9b28 100644 --- a/src/Tools/t_shape/t_shape_dialog.py +++ b/src/Tools/t_shape/t_shape_dialog.py @@ -34,19 +34,23 @@ class TShapeDialog(QtGui.QDialog): self.ui.setupUi(self) self.show() self._wasOk = False - self.ui.doubleSpinBox_5.setEnabled(False) + self.ui.dsb_solidThickness.setEnabled(False) self.ui.label_5.setEnabled(False) + self.ui.dsb_bigRadius.setValue(50.0) + self.ui.dsb_smallRadius.setValue(40.0) + self.ui.dsb_bigHeight.setValue(80.0) + self.ui.dsb_smallHeight.setValue(80.0) def accept(self): self._wasOk = True QtGui.QDialog.accept(self) def getData(self): - r1 = self.ui.doubleSpinBox.value() - r2 = self.ui.doubleSpinBox_2.value() - h1 = self.ui.doubleSpinBox_3.value() - h2 = self.ui.doubleSpinBox_4.value() - thickness = self.ui.doubleSpinBox_5.value() + r1 = self.ui.dsb_bigRadius.value() + r2 = self.ui.dsb_smallRadius.value() + h1 = self.ui.dsb_bigHeight.value() + h2 = self.ui.dsb_smallHeight.value() + thickness = self.ui.dsb_solidThickness.value() return r1, r2, h1, h2, thickness diff --git a/src/Tools/t_shape/t_shape_dialog.ui b/src/Tools/t_shape/t_shape_dialog.ui index 8caa136b5..55a48232e 100644 --- a/src/Tools/t_shape/t_shape_dialog.ui +++ b/src/Tools/t_shape/t_shape_dialog.ui @@ -17,7 +17,17 @@ - + + + 5 + + + 100000.000000000000000 + + + 40.000000000000000 + + @@ -27,13 +37,43 @@ - + + + 5 + + + 1000000.000000000000000 + + + 80.000000000000000 + + - + + + 5 + + + 1000000.000000000000000 + + + 80.000000000000000 + + - + + + 5 + + + 100000.000000000000000 + + + 50.000000000000000 + + @@ -61,7 +101,7 @@ - + Build solid part @@ -75,7 +115,17 @@ - + + + 5 + + + 1000000.000000000000000 + + + 5.000000000000000 + + @@ -126,14 +176,14 @@ - checkBox + cb_buildSolid clicked(bool) label_5 setEnabled(bool) - 89 - 184 + 99 + 170 107 @@ -142,14 +192,14 @@ - checkBox + cb_buildSolid clicked(bool) - doubleSpinBox_5 + dsb_solidThickness setEnabled(bool) - 140 - 178 + 150 + 170 277 diff --git a/src/Tools/t_shape/t_shape_dialog_ui.py b/src/Tools/t_shape/t_shape_dialog_ui.py deleted file mode 100644 index b034e677a..000000000 --- a/src/Tools/t_shape/t_shape_dialog_ui.py +++ /dev/null @@ -1,103 +0,0 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 't_shape_dialog.ui' -# -# Created: Tue Nov 4 16:52:09 2014 -# by: PyQt4 UI code generator 4.9.6 -# -# WARNING! All changes made in this file will be lost! - -from PyQt4 import QtCore, QtGui - -try: - _fromUtf8 = QtCore.QString.fromUtf8 -except AttributeError: - def _fromUtf8(s): - return s - -try: - _encoding = QtGui.QApplication.UnicodeUTF8 - def _translate(context, text, disambig): - return QtGui.QApplication.translate(context, text, disambig, _encoding) -except AttributeError: - def _translate(context, text, disambig): - return QtGui.QApplication.translate(context, text, disambig) - -class Ui_Dialog(object): - def setupUi(self, Dialog): - Dialog.setObjectName(_fromUtf8("Dialog")) - Dialog.resize(349, 283) - self.gridLayout_3 = QtGui.QGridLayout(Dialog) - self.gridLayout_3.setObjectName(_fromUtf8("gridLayout_3")) - self.gridLayout = QtGui.QGridLayout() - self.gridLayout.setObjectName(_fromUtf8("gridLayout")) - self.doubleSpinBox_2 = QtGui.QDoubleSpinBox(Dialog) - self.doubleSpinBox_2.setObjectName(_fromUtf8("doubleSpinBox_2")) - self.gridLayout.addWidget(self.doubleSpinBox_2, 2, 1, 1, 1) - self.label = QtGui.QLabel(Dialog) - self.label.setObjectName(_fromUtf8("label")) - self.gridLayout.addWidget(self.label, 0, 0, 1, 1) - self.doubleSpinBox_3 = QtGui.QDoubleSpinBox(Dialog) - self.doubleSpinBox_3.setObjectName(_fromUtf8("doubleSpinBox_3")) - self.gridLayout.addWidget(self.doubleSpinBox_3, 3, 1, 1, 1) - self.doubleSpinBox_4 = QtGui.QDoubleSpinBox(Dialog) - self.doubleSpinBox_4.setObjectName(_fromUtf8("doubleSpinBox_4")) - self.gridLayout.addWidget(self.doubleSpinBox_4, 4, 1, 1, 1) - self.doubleSpinBox = QtGui.QDoubleSpinBox(Dialog) - self.doubleSpinBox.setObjectName(_fromUtf8("doubleSpinBox")) - self.gridLayout.addWidget(self.doubleSpinBox, 0, 1, 1, 1) - self.label_3 = QtGui.QLabel(Dialog) - self.label_3.setObjectName(_fromUtf8("label_3")) - self.gridLayout.addWidget(self.label_3, 3, 0, 1, 1) - self.label_2 = QtGui.QLabel(Dialog) - self.label_2.setObjectName(_fromUtf8("label_2")) - self.gridLayout.addWidget(self.label_2, 2, 0, 1, 1) - self.label_4 = QtGui.QLabel(Dialog) - self.label_4.setObjectName(_fromUtf8("label_4")) - self.gridLayout.addWidget(self.label_4, 4, 0, 1, 1) - self.gridLayout_3.addLayout(self.gridLayout, 0, 0, 1, 1) - self.gridLayout_2 = QtGui.QGridLayout() - self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2")) - self.checkBox = QtGui.QCheckBox(Dialog) - self.checkBox.setObjectName(_fromUtf8("checkBox")) - self.gridLayout_2.addWidget(self.checkBox, 0, 0, 1, 1) - self.label_5 = QtGui.QLabel(Dialog) - self.label_5.setObjectName(_fromUtf8("label_5")) - self.gridLayout_2.addWidget(self.label_5, 1, 0, 1, 1) - self.doubleSpinBox_5 = QtGui.QDoubleSpinBox(Dialog) - self.doubleSpinBox_5.setObjectName(_fromUtf8("doubleSpinBox_5")) - self.gridLayout_2.addWidget(self.doubleSpinBox_5, 1, 1, 1, 1) - self.gridLayout_3.addLayout(self.gridLayout_2, 1, 0, 1, 1) - self.buttonBox = QtGui.QDialogButtonBox(Dialog) - self.buttonBox.setOrientation(QtCore.Qt.Horizontal) - self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok) - self.buttonBox.setObjectName(_fromUtf8("buttonBox")) - self.gridLayout_3.addWidget(self.buttonBox, 2, 0, 1, 1) - - self.retranslateUi(Dialog) - QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), Dialog.accept) - QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), Dialog.reject) - QtCore.QObject.connect(self.checkBox, QtCore.SIGNAL(_fromUtf8("clicked(bool)")), self.label_5.setEnabled) - QtCore.QObject.connect(self.checkBox, QtCore.SIGNAL(_fromUtf8("clicked(bool)")), self.doubleSpinBox_5.setEnabled) - QtCore.QMetaObject.connectSlotsByName(Dialog) - - def retranslateUi(self, Dialog): - Dialog.setWindowTitle(_translate("Dialog", "Dialog", None)) - self.label.setText(_translate("Dialog", "Big pipe radius", None)) - self.label_3.setText(_translate("Dialog", "Big pipe height", None)) - self.label_2.setText(_translate("Dialog", "Small pipe radius", None)) - self.label_4.setText(_translate("Dialog", "Small pipe height", None)) - self.checkBox.setText(_translate("Dialog", "Build solid part", None)) - self.label_5.setText(_translate("Dialog", "Solid thickness", None)) - -if __name__ == "__main__": - import sys - app = QtGui.QApplication(sys.argv) - Dialog = QtGui.QDialog() - ui = Ui_Dialog() - ui.setupUi(Dialog) - Dialog.show() - sys.exit(app.exec_()) - - - -- 2.39.2