Commit bbe12786 authored by Pierre-Antoine Rouby's avatar Pierre-Antoine Rouby
Browse files

Merge branch 'master' of gitlab-ssh.irstea.fr:theophile.terraz/pamhyr

Showing with 116 additions and 44 deletions
+116 -44
......@@ -371,7 +371,8 @@ class MeshingWithMageMailleurTT(AMeshingTool):
lplan: bool = False,
lm: int = 3,
linear: bool = False,
origin_value=0.0):
origin_value = 0.0,
orientation = 0):
if reach is None or len(reach.profiles) == 0:
return reach
......@@ -400,7 +401,7 @@ class MeshingWithMageMailleurTT(AMeshingTool):
f"{str(step)} " +
f"{limites[0]} {limites[1]} " +
f"{directrices[0]} {directrices[1]} " +
f"{lplan} {lm} {linear} " +
f"{orientation} {lm} {linear} " +
f"{origin} "
)
proc.start(
......@@ -413,7 +414,7 @@ class MeshingWithMageMailleurTT(AMeshingTool):
"update_kp", step,
limites[0], limites[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 (
QDialogButtonBox, QComboBox, QUndoStack, QShortcut,
QDoubleSpinBox,
QDoubleSpinBox, QButtonGroup,
)
......@@ -50,12 +50,7 @@ class UpdateKPDialog(PamhyrDialog):
self._init_default_values()
def _init_default_values(self):
self._space_step = 50.0
self._lplan = False
self._lm = "3"
self._linear = False
self._begin_cs = -1
self._end_cs = -1
self._orientation = 0
self._begin_dir = "un"
self._end_dir = "np"
self._origin = self._reach.profile(0)
......@@ -72,6 +67,15 @@ class UpdateKPDialog(PamhyrDialog):
self.find(QComboBox, "comboBox_origin").currentIndexChanged.connect(
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):
origin = self.get_combobox_text("comboBox_origin")
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_end_gl", self._end_dir)
@property
def orientation(self):
return self._orientation
@property
def origin(self):
return self._origin
......@@ -133,11 +141,10 @@ class UpdateKPDialog(PamhyrDialog):
def accept(self):
origin = self.get_combobox_text("comboBox_origin")
self._origin = self.profiles.index(origin)
self._origin_value = self.get_double_spin_box("doubleSpinBox_origin")
self._begin_dir = self.get_combobox_text("comboBox_begin_gl")
self._end_dir = self.get_combobox_text("comboBox_end_gl")
self._orientation = self.get_checked_id_button_group("buttonGroup_orientation")
super().accept()
......
......@@ -336,6 +336,7 @@ class GeometryWindow(PamhyrWindow):
"origin": dlg.origin,
"directrices": [dlg.begin_dir, dlg.end_dir],
"origin_value": dlg.origin_value,
"orientation": dlg.orientation,
}
self._update_kp(data)
except Exception as e:
......
......@@ -35,7 +35,7 @@ from PyQt5.QtWidgets import (
QRadioButton, QComboBox, QFileDialog,
QMessageBox, QTableView, QAction,
QDateTimeEdit, QWidget, QPlainTextEdit,
QLabel, QDoubleSpinBox,
QLabel, QDoubleSpinBox, QButtonGroup,
)
from PyQt5.QtCore import (
QTime, QDateTime,
......@@ -501,6 +501,17 @@ class ASubWindowFeatures(object):
qdate = QDateTime.fromString(date.isoformat(), "yyyy-MM-ddThh:mm:ss")
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
......
......@@ -6,37 +6,23 @@
<rect>
<x>0</x>
<y>0</y>
<width>340</width>
<height>204</height>
<width>381</width>
<height>302</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<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">
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Distance computation</string>
</property>
<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">
<widget class="QLabel" name="label_6">
<property name="enabled">
......@@ -47,11 +33,17 @@
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="comboBox_begin_gl">
<property name="enabled">
<bool>true</bool>
<item row="5" column="1">
<widget class="QRadioButton" name="radioButton_1">
<property name="text">
<string>Upstream to downstream</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroup_orientation</string>
</attribute>
</widget>
</item>
<item row="2" column="0">
......@@ -67,6 +59,19 @@
<item row="0" column="1">
<widget class="QComboBox" name="comboBox_origin"/>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBox_origin">
<property name="decimals">
<number>4</number>
</property>
<property name="minimum">
<double>-99999999.000000000000000</double>
</property>
<property name="maximum">
<double>99999999.000000000000000</double>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
......@@ -74,6 +79,13 @@
</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">
......@@ -81,22 +93,59 @@
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBox_origin">
<property name="decimals">
<number>4</number>
<item row="9" column="1">
<widget class="QRadioButton" name="radioButton_2">
<property name="text">
<string>Downstream to upstream</string>
</property>
<property name="minimum">
<double>-99999999.000000000000000</double>
<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>
<property name="maximum">
<double>99999999.000000000000000</double>
</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>
</widget>
</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>
</widget>
<resources/>
......@@ -134,4 +183,7 @@
</hints>
</connection>
</connections>
<buttongroups>
<buttongroup name="buttonGroup_orientation"/>
</buttongroups>
</ui>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment