mirror of https://gitlab.com/pamhyr/pamhyr2
add orientation option for update KP
parent
57d43cd5d3
commit
98feca7fca
|
|
@ -371,7 +371,8 @@ class MeshingWithMageMailleurTT(AMeshingTool):
|
||||||
lplan: bool = False,
|
lplan: bool = False,
|
||||||
lm: int = 3,
|
lm: int = 3,
|
||||||
linear: bool = False,
|
linear: bool = False,
|
||||||
origin_value=0.0):
|
origin_value = 0.0,
|
||||||
|
orientation = 0):
|
||||||
if reach is None or len(reach.profiles) == 0:
|
if reach is None or len(reach.profiles) == 0:
|
||||||
return reach
|
return reach
|
||||||
|
|
||||||
|
|
@ -400,7 +401,7 @@ class MeshingWithMageMailleurTT(AMeshingTool):
|
||||||
f"{str(step)} " +
|
f"{str(step)} " +
|
||||||
f"{limites[0]} {limites[1]} " +
|
f"{limites[0]} {limites[1]} " +
|
||||||
f"{directrices[0]} {directrices[1]} " +
|
f"{directrices[0]} {directrices[1]} " +
|
||||||
f"{lplan} {lm} {linear} " +
|
f"{orientation} {lm} {linear} " +
|
||||||
f"{origin} "
|
f"{origin} "
|
||||||
)
|
)
|
||||||
proc.start(
|
proc.start(
|
||||||
|
|
@ -413,7 +414,7 @@ class MeshingWithMageMailleurTT(AMeshingTool):
|
||||||
"update_kp", step,
|
"update_kp", step,
|
||||||
limites[0], limites[1],
|
limites[0], limites[1],
|
||||||
directrices[0], directrices[1],
|
directrices[0], directrices[1],
|
||||||
lplan, lm, linear, origin, origin_value
|
orientation, lm, linear, origin, origin_value
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ from PyQt5.QtCore import (
|
||||||
|
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
QDialogButtonBox, QComboBox, QUndoStack, QShortcut,
|
QDialogButtonBox, QComboBox, QUndoStack, QShortcut,
|
||||||
QDoubleSpinBox,
|
QDoubleSpinBox, QButtonGroup,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -50,12 +50,7 @@ class UpdateKPDialog(PamhyrDialog):
|
||||||
self._init_default_values()
|
self._init_default_values()
|
||||||
|
|
||||||
def _init_default_values(self):
|
def _init_default_values(self):
|
||||||
self._space_step = 50.0
|
self._orientation = 0
|
||||||
self._lplan = False
|
|
||||||
self._lm = "3"
|
|
||||||
self._linear = False
|
|
||||||
self._begin_cs = -1
|
|
||||||
self._end_cs = -1
|
|
||||||
self._begin_dir = "un"
|
self._begin_dir = "un"
|
||||||
self._end_dir = "np"
|
self._end_dir = "np"
|
||||||
self._origin = self._reach.profile(0)
|
self._origin = self._reach.profile(0)
|
||||||
|
|
@ -72,6 +67,15 @@ class UpdateKPDialog(PamhyrDialog):
|
||||||
self.find(QComboBox, "comboBox_origin").currentIndexChanged.connect(
|
self.find(QComboBox, "comboBox_origin").currentIndexChanged.connect(
|
||||||
self.changed_profile)
|
self.changed_profile)
|
||||||
|
|
||||||
|
buttonbox = self.find(QButtonGroup, "buttonGroup_orientation")
|
||||||
|
|
||||||
|
i = 0
|
||||||
|
for button in buttonbox.buttons():
|
||||||
|
if button.objectName() == "radioButton_0": i = 0
|
||||||
|
if button.objectName() == "radioButton_1": i = 1
|
||||||
|
if button.objectName() == "radioButton_2": i = 2
|
||||||
|
buttonbox.setId(button, i)
|
||||||
|
|
||||||
def changed_profile(self):
|
def changed_profile(self):
|
||||||
origin = self.get_combobox_text("comboBox_origin")
|
origin = self.get_combobox_text("comboBox_origin")
|
||||||
self.set_double_spin_box(
|
self.set_double_spin_box(
|
||||||
|
|
@ -114,6 +118,10 @@ class UpdateKPDialog(PamhyrDialog):
|
||||||
self.set_combobox_text("comboBox_begin_gl", self._begin_dir)
|
self.set_combobox_text("comboBox_begin_gl", self._begin_dir)
|
||||||
self.set_combobox_text("comboBox_end_gl", self._end_dir)
|
self.set_combobox_text("comboBox_end_gl", self._end_dir)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def orientation(self):
|
||||||
|
return self._orientation
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def origin(self):
|
def origin(self):
|
||||||
return self._origin
|
return self._origin
|
||||||
|
|
@ -133,11 +141,10 @@ class UpdateKPDialog(PamhyrDialog):
|
||||||
def accept(self):
|
def accept(self):
|
||||||
origin = self.get_combobox_text("comboBox_origin")
|
origin = self.get_combobox_text("comboBox_origin")
|
||||||
self._origin = self.profiles.index(origin)
|
self._origin = self.profiles.index(origin)
|
||||||
|
|
||||||
self._origin_value = self.get_double_spin_box("doubleSpinBox_origin")
|
self._origin_value = self.get_double_spin_box("doubleSpinBox_origin")
|
||||||
|
|
||||||
self._begin_dir = self.get_combobox_text("comboBox_begin_gl")
|
self._begin_dir = self.get_combobox_text("comboBox_begin_gl")
|
||||||
self._end_dir = self.get_combobox_text("comboBox_end_gl")
|
self._end_dir = self.get_combobox_text("comboBox_end_gl")
|
||||||
|
self._orientation = self.get_checked_id_button_group("buttonGroup_orientation")
|
||||||
|
|
||||||
super().accept()
|
super().accept()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -336,6 +336,7 @@ class GeometryWindow(PamhyrWindow):
|
||||||
"origin": dlg.origin,
|
"origin": dlg.origin,
|
||||||
"directrices": [dlg.begin_dir, dlg.end_dir],
|
"directrices": [dlg.begin_dir, dlg.end_dir],
|
||||||
"origin_value": dlg.origin_value,
|
"origin_value": dlg.origin_value,
|
||||||
|
"orientation": dlg.orientation,
|
||||||
}
|
}
|
||||||
self._update_kp(data)
|
self._update_kp(data)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
|
||||||
|
|
@ -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, QDoubleSpinBox,
|
QLabel, QDoubleSpinBox, QButtonGroup,
|
||||||
)
|
)
|
||||||
from PyQt5.QtCore import (
|
from PyQt5.QtCore import (
|
||||||
QTime, QDateTime,
|
QTime, QDateTime,
|
||||||
|
|
@ -498,6 +498,17 @@ class ASubWindowFeatures(object):
|
||||||
qdate = QDateTime.fromString(date.isoformat(), "yyyy-MM-ddThh:mm:ss")
|
qdate = QDateTime.fromString(date.isoformat(), "yyyy-MM-ddThh:mm:ss")
|
||||||
self.find(QDateTimeEdit, name).setDateTime(qdate)
|
self.find(QDateTimeEdit, name).setDateTime(qdate)
|
||||||
|
|
||||||
|
def get_checked_id_button_group(self, name: str):
|
||||||
|
"""Get current checked button id in a buttonGroup
|
||||||
|
|
||||||
|
Args:
|
||||||
|
name: The buttonGroup component name
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Current checked id
|
||||||
|
"""
|
||||||
|
return self.find(QButtonGroup, name).checkedId()
|
||||||
|
|
||||||
|
|
||||||
# Top level interface
|
# Top level interface
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,37 +6,23 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>340</width>
|
<width>381</width>
|
||||||
<height>204</height>
|
<height>302</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Dialog</string>
|
<string>Dialog</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="layoutDirection">
|
||||||
|
<enum>Qt::LeftToRight</enum>
|
||||||
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_4">
|
<layout class="QGridLayout" name="gridLayout_4">
|
||||||
<item row="1" 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>
|
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QGroupBox" name="groupBox_3">
|
<widget class="QGroupBox" name="groupBox_3">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Distance computation</string>
|
<string>Distance computation</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
<item row="3" column="1">
|
|
||||||
<widget class="QComboBox" name="comboBox_end_gl">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0">
|
<item row="3" column="0">
|
||||||
<widget class="QLabel" name="label_6">
|
<widget class="QLabel" name="label_6">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
|
|
@ -47,11 +33,17 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="5" column="1">
|
||||||
<widget class="QComboBox" name="comboBox_begin_gl">
|
<widget class="QRadioButton" name="radioButton_1">
|
||||||
<property name="enabled">
|
<property name="text">
|
||||||
<bool>true</bool>
|
<string>Upstream to downstream</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<attribute name="buttonGroup">
|
||||||
|
<string notr="true">buttonGroup_orientation</string>
|
||||||
|
</attribute>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="2" column="0">
|
||||||
|
|
@ -67,20 +59,6 @@
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QComboBox" name="comboBox_origin"/>
|
<widget class="QComboBox" name="comboBox_origin"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="label_3">
|
|
||||||
<property name="text">
|
|
||||||
<string>Origin</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="label_4">
|
|
||||||
<property name="text">
|
|
||||||
<string>Origin value</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
<item row="1" column="1">
|
||||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_origin">
|
<widget class="QDoubleSpinBox" name="doubleSpinBox_origin">
|
||||||
<property name="decimals">
|
<property name="decimals">
|
||||||
|
|
@ -94,9 +72,80 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Origin</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QComboBox" name="comboBox_begin_gl">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="text">
|
||||||
|
<string>Origin value</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="9" column="1">
|
||||||
|
<widget class="QRadioButton" name="radioButton_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Downstream to upstream</string>
|
||||||
|
</property>
|
||||||
|
<attribute name="buttonGroup">
|
||||||
|
<string notr="true">buttonGroup_orientation</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QComboBox" name="comboBox_end_gl">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<widget class="QLabel" name="label_7">
|
||||||
|
<property name="text">
|
||||||
|
<string>Orientation</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<widget class="QRadioButton" name="radioButton_0">
|
||||||
|
<property name="layoutDirection">
|
||||||
|
<enum>Qt::LeftToRight</enum>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Keep current</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<attribute name="buttonGroup">
|
||||||
|
<string notr="true">buttonGroup_orientation</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" 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>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
|
@ -134,4 +183,7 @@
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
</connections>
|
</connections>
|
||||||
|
<buttongroups>
|
||||||
|
<buttongroup name="buttonGroup_orientation"/>
|
||||||
|
</buttongroups>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue