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

IC: Add generator dialog.

Showing with 126 additions and 7 deletions
+126 -7
......@@ -196,7 +196,7 @@ class InitialConditions(object):
key = lambda p: p.kp
)
def generate_growing_constante_draft(self, draft:int):
def generate_growing_constante_draft(self, draft:float):
self._data = []
profiles = self._reach.reach.profiles
......
......@@ -388,10 +388,11 @@ class ASubMainWindow(QMainWindow, ASubWindowFeatures, WindowToolKit):
)
self.name = name
self.parent = parent
self.parent.sub_win_add(name, self)
if self.parent is not None:
self.parent.sub_win_add(name, self)
def closeEvent(self, event):
if not self.parent is None:
if self.parent is not None:
self.parent.sub_win_del(self.name)
def find(self, qtype, name):
......@@ -418,10 +419,11 @@ class ASubWindow(QDialog, ASubWindowFeatures, WindowToolKit):
)
self.name = name
self.parent = parent
self.parent.sub_win_add(name, self)
if self.parent is not None:
self.parent.sub_win_add(name, self)
def closeEvent(self, event):
if not self.parent is None:
if self.parent is not None:
self.parent.sub_win_del(self.name)
def find(self, qtype, name):
......
# -*- 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 DraftDialog(ASubWindow, ListedSubWindow):
def __init__(self, title="Draft", parent=None):
super(DraftDialog, self).__init__(
name=title, ui="InitialConditions_Dialog_Generator_Draft", parent=parent
)
self.value = None
def accept(self):
self.value = self.find(QDoubleSpinBox, "doubleSpinBox").value()
super().accept()
def reject(self):
self.close()
......@@ -34,6 +34,7 @@ from View.Plot.MplCanvas import MplCanvas
from View.InitialConditions.PlotDKP import PlotDKP
from View.InitialConditions.PlotFlow import PlotFlow
from View.InitialConditions.translate import *
from View.InitialConditions.DialogDraft import DraftDialog
_translate = QCoreApplication.translate
......@@ -207,5 +208,8 @@ class InitialConditionsWindow(ASubMainWindow, ListedSubWindow):
self._update_plot()
def generate_growing_constante_draft(self):
self._table.generate("growing", 1)
self._update_plot()
dlg = DraftDialog(parent=self)
if dlg.exec():
value = dlg.value
self._table.generate("growing", value)
self._update_plot()
<?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>194</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>Draft</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="doubleSpinBox"/>
</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>
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