Meshing: Add minimal meshing option dialog.

setup.py
Pierre-Antoine Rouby 2024-02-07 16:04:59 +01:00
parent 34038d2844
commit ab276db78c
5 changed files with 274 additions and 7 deletions

View File

@ -294,7 +294,7 @@ class MeshingWithMageMailleurTT(AMeshingTool):
proc = QProcess() proc = QProcess()
proc.setWorkingDirectory(tmp) proc.setWorkingDirectory(tmp)
logger.debug(f"! mailleurTT {st_file} {m_file} {str(step)}") logger.info(f"! mailleurTT {st_file} {m_file} {str(step)}")
proc.start( proc.start(
self._exe_path(), [st_file, m_file, str(step)] self._exe_path(), [st_file, m_file, str(step)]
) )

View File

@ -237,7 +237,10 @@ class MeshingCommand(QUndoCommand):
def redo(self): def redo(self):
if self._new_profiles is None: if self._new_profiles is None:
self._mesher.meshing(self._reach) self._mesher.meshing(
self._reach,
step=self._step
)
self._new_profiles = self._reach.profiles.copy() self._new_profiles = self._reach.profiles.copy()
self._new_profiles.reverse() self._new_profiles.reverse()

View File

@ -54,6 +54,7 @@ from View.Geometry.Table import GeometryReachTableModel
from View.Geometry.PlotXY import PlotXY from View.Geometry.PlotXY import PlotXY
from View.Geometry.PlotAC import PlotAC from View.Geometry.PlotAC import PlotAC
from View.Geometry.PlotKPZ import PlotKPZ from View.Geometry.PlotKPZ import PlotKPZ
from View.Geometry.MeshingDialog import MeshingDialog
from View.Geometry.Translate import GeometryTranslate from View.Geometry.Translate import GeometryTranslate
from View.Geometry.Profile.Window import ProfileWindow from View.Geometry.Profile.Window import ProfileWindow
@ -260,14 +261,17 @@ class GeometryWindow(PamhyrWindow):
def edit_meshing(self): def edit_meshing(self):
try: try:
self._edit_meshing() dlg = MeshingDialog(parent=self)
except Exception: if dlg.exec():
step = dlg.space_step
self._edit_meshing(step)
except Exception as e:
return return
def _edit_meshing(self): def _edit_meshing(self, step):
try: try:
mesher = MeshingWithMageMailleurTT() mesher = MeshingWithMageMailleurTT()
self._table.meshing(mesher, -1) self._table.meshing(mesher, step)
except Exception as e: except Exception as e:
logger_exception(e) logger_exception(e)
raise ExternFileMissingError( raise ExternFileMissingError(

View File

@ -35,7 +35,7 @@ from PyQt5.QtWidgets import (
QRadioButton, QComboBox, QFileDialog, QRadioButton, QComboBox, QFileDialog,
QMessageBox, QTableView, QAction, QMessageBox, QTableView, QAction,
QDateTimeEdit, QWidget, QPlainTextEdit, QDateTimeEdit, QWidget, QPlainTextEdit,
QLabel, QLabel, QDoubleSpinBox,
) )
from PyQt5.QtCore import ( from PyQt5.QtCore import (
QTime, QDateTime, QTime, QDateTime,
@ -324,6 +324,29 @@ class ASubWindowFeatures(object):
""" """
return self.find(QSpinBox, name).value() return self.find(QSpinBox, name).value()
def set_double_spin_box(self, name: str, value: int):
"""Set value of spinbox component
Args:
name: The spinbox component name
value: The new value
Returns:
Nothing
"""
self.find(QDoubleSpinBox, name).setValue(value)
def get_double_spin_box(self, name: str):
"""Get time of spin box component
Args:
name: The spin box component
Returns:
The value of spin box
"""
return self.find(QDoubleSpinBox, name).value()
def set_action_checkable(self, name: str, checked: bool): def set_action_checkable(self, name: str, checked: bool):
"""Set value of action """Set value of action

View File

@ -0,0 +1,237 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>416</width>
<height>234</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>First cross section</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_begin_kp">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_2">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Last cross section</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_end_kp">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QLabel" name="label_5">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>First guide line</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_begin_kp_2">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QLabel" name="label_6">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Last guide line</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_end_kp_2">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Section space step</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="doubleSpinBox_space_step"/>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="3" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="label_4">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>lm</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_lm">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="checkBox_lplan">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Lplan</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="checkBox_linear">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Linear</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>Dialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>Dialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>