mirror of https://gitlab.com/pamhyr/pamhyr2
Initial cond: Add Discharge generator.
parent
d9176c6d83
commit
6250b0e1b0
|
|
@ -226,3 +226,7 @@ class InitialConditions(object):
|
||||||
reverse = not is_reverse,
|
reverse = not is_reverse,
|
||||||
key = lambda d: d['kp']
|
key = lambda d: d['kp']
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def generate_discharge(self, discharge:float):
|
||||||
|
for d in self._data:
|
||||||
|
d['flow'] = discharge
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from View.ASubWindow import ASubWindow
|
||||||
|
from View.ListedSubWindow import ListedSubWindow
|
||||||
|
|
||||||
|
from PyQt5.QtGui import (
|
||||||
|
QKeySequence,
|
||||||
|
)
|
||||||
|
|
||||||
|
from PyQt5.QtCore import (
|
||||||
|
Qt, QVariant, QAbstractTableModel,
|
||||||
|
)
|
||||||
|
|
||||||
|
from PyQt5.QtWidgets import (
|
||||||
|
QDialogButtonBox, QComboBox, QUndoStack, QShortcut,
|
||||||
|
QDoubleSpinBox,
|
||||||
|
)
|
||||||
|
|
||||||
|
class DischargeDialog(ASubWindow, ListedSubWindow):
|
||||||
|
def __init__(self, title="Discharge", parent=None):
|
||||||
|
super(DischargeDialog, self).__init__(
|
||||||
|
name=title, ui="InitialConditions_Dialog_Generator_Discharge", parent=parent
|
||||||
|
)
|
||||||
|
|
||||||
|
self.value = None
|
||||||
|
|
||||||
|
def accept(self):
|
||||||
|
self.value = self.find(QDoubleSpinBox, "doubleSpinBox").value()
|
||||||
|
super().accept()
|
||||||
|
|
||||||
|
def reject(self):
|
||||||
|
self.close()
|
||||||
|
|
@ -160,5 +160,7 @@ class GenerateCommand(QUndoCommand):
|
||||||
self._ics.data = self._copy
|
self._ics.data = self._copy
|
||||||
|
|
||||||
def redo(self):
|
def redo(self):
|
||||||
#if self._generator == "growing":
|
if self._generator == "growing":
|
||||||
self._ics.generate_growing_constante_draft(self._param)
|
self._ics.generate_growing_constante_draft(self._param)
|
||||||
|
elif self._generator == "discharge":
|
||||||
|
self._ics.generate_discharge(self._param)
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ from View.InitialConditions.PlotDKP import PlotDKP
|
||||||
from View.InitialConditions.PlotFlow import PlotFlow
|
from View.InitialConditions.PlotFlow import PlotFlow
|
||||||
from View.InitialConditions.translate import *
|
from View.InitialConditions.translate import *
|
||||||
from View.InitialConditions.DialogDraft import DraftDialog
|
from View.InitialConditions.DialogDraft import DraftDialog
|
||||||
|
from View.InitialConditions.DialogDischarge import DischargeDialog
|
||||||
|
|
||||||
_translate = QCoreApplication.translate
|
_translate = QCoreApplication.translate
|
||||||
|
|
||||||
|
|
@ -131,6 +132,10 @@ class InitialConditionsWindow(ASubMainWindow, ListedSubWindow):
|
||||||
self.generate_growing_constante_draft
|
self.generate_growing_constante_draft
|
||||||
)
|
)
|
||||||
|
|
||||||
|
self.find(QPushButton, "pushButton_generate_2").clicked.connect(
|
||||||
|
self.generate_discharge
|
||||||
|
)
|
||||||
|
|
||||||
self.undo_sc.activated.connect(self.undo)
|
self.undo_sc.activated.connect(self.undo)
|
||||||
self.redo_sc.activated.connect(self.redo)
|
self.redo_sc.activated.connect(self.redo)
|
||||||
self.copy_sc.activated.connect(self.copy)
|
self.copy_sc.activated.connect(self.copy)
|
||||||
|
|
@ -213,3 +218,10 @@ class InitialConditionsWindow(ASubMainWindow, ListedSubWindow):
|
||||||
value = dlg.value
|
value = dlg.value
|
||||||
self._table.generate("growing", value)
|
self._table.generate("growing", value)
|
||||||
self._update_plot()
|
self._update_plot()
|
||||||
|
|
||||||
|
def generate_discharge(self):
|
||||||
|
dlg = DischargeDialog(parent=self)
|
||||||
|
if dlg.exec():
|
||||||
|
value = dlg.value
|
||||||
|
self._table.generate("discharge", value)
|
||||||
|
self._update_plot()
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,88 @@
|
||||||
|
<?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>284</width>
|
||||||
|
<height>80</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Dialog</string>
|
||||||
|
</property>
|
||||||
|
<property name="locale">
|
||||||
|
<locale language="English" country="Europe"/>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Discharge</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDoubleSpinBox" name="doubleSpinBox">
|
||||||
|
<property name="decimals">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>999.999000000000024</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</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/>
|
||||||
|
<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>
|
||||||
Loading…
Reference in New Issue