diff --git a/src/Model/BoundaryCondition/BoundaryCondition.py b/src/Model/BoundaryCondition/BoundaryCondition.py new file mode 100644 index 0000000000000000000000000000000000000000..806bceeb178af775761cda7ec7edeb0513daae1a --- /dev/null +++ b/src/Model/BoundaryCondition/BoundaryCondition.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- + +from Model.Except import NotImplementedMethodeError + +class BoundaryCondition(object): + def __init__(self, name:str = ""): + super(BoundaryCondition, self).__init__() + + self._name = name + self._type = "" + self._node = None + self._data = None + + @property + def name(self): + return self._name + + @name.setter + def name(self, name): + self._name = name + + @property + def bctype(self): + return self._type + + @property + def node(self): + return self._node + + @node.setter + def node(self, node): + self._node = node + + def has_node(self): + return self._node is not None + + def is_define(self): + return self._data is not None diff --git a/src/Model/River.py b/src/Model/River.py index a386cbaec9f34b8d8a2f1d6fdd933d0203e7c61a..daaf0afb88612e0d79355e08aedef33e996b0412 100644 --- a/src/Model/River.py +++ b/src/Model/River.py @@ -7,6 +7,8 @@ from Model.Network.Graph import Graph from Model.Geometry.Profile import Profile from Model.Geometry.Reach import Reach +from Model.BoundaryCondition.BoundaryCondition import BoundaryCondition + class RiverNode(Node): def __init__(self, id:str, name:str, x:float, y:float): @@ -51,6 +53,7 @@ class River(Graph): self._edge_ctor = RiverReach self._current_reach = None + self._boundary_condition = [] def has_current_reach(self): return self._current_reach is not None diff --git a/src/View/BoundaryCondition/BoundaryConditionWindow.py b/src/View/BoundaryCondition/BoundaryConditionWindow.py new file mode 100644 index 0000000000000000000000000000000000000000..13f3f2884d44632e14e65c3880bd0ac78c73f7fa --- /dev/null +++ b/src/View/BoundaryCondition/BoundaryConditionWindow.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- + +from View.ASubWindow import ASubMainWindow +from View.ListedSubWindow import ListedSubWindow + +from PyQt5.QtCore import ( + Qt, QVariant, QAbstractTableModel, +) + +from PyQt5.QtWidgets import ( + QDialogButtonBox, QPushButton, QLineEdit, + QFileDialog, QTableView, QAbstractItemView, +) + +from View.BoundaryCondition.EditBoundaryConditionWindow import EditBoundaryConditionWindow + +class BoundaryConditionWindow(ASubMainWindow, ListedSubWindow): + def __init__(self, title="BoundaryConditions", study=None, parent=None): + super(BoundaryConditionWindow, self).__init__( + name=title, ui="BoundaryConditions", parent=parent + ) + + self._study = study + + self.ui.setWindowTitle(title) + + def edit(self): + win = EditBoundaryConditionWindow(data=None, parent=self) + win.show() diff --git a/src/View/BoundaryCondition/EditBoundaryConditionWindow.py b/src/View/BoundaryCondition/EditBoundaryConditionWindow.py new file mode 100644 index 0000000000000000000000000000000000000000..c3943440811bd6bca76154c7d0c1a52d6112d26e --- /dev/null +++ b/src/View/BoundaryCondition/EditBoundaryConditionWindow.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +from View.ASubWindow import ASubMainWindow +from View.ListedSubWindow import ListedSubWindow + +from PyQt5.QtCore import ( + Qt, QVariant, QAbstractTableModel, +) + +from PyQt5.QtWidgets import ( + QDialogButtonBox, QPushButton, QLineEdit, + QFileDialog, QTableView, QAbstractItemView, +) + + +class EditBoundaryConditionWindow(ASubMainWindow, ListedSubWindow): + def __init__(self, title="Edit BoundaryConditions", data=None, parent=None): + super(EditBoundaryConditionWindow, self).__init__( + name=title, ui="EditBoundaryConditions", parent=parent + ) + + self._data = data + + self.ui.setWindowTitle(title) diff --git a/src/View/MainWindow.py b/src/View/MainWindow.py index bf8f80d5f1a83ccf8c68ae7814e6ffe2b9c4c89f..a37a6a9eda1a13c4f40c4337397ab470cf7d4b42 100644 --- a/src/View/MainWindow.py +++ b/src/View/MainWindow.py @@ -22,6 +22,7 @@ from View.Main.NewStudyWindow import NewStudyWindow from View.Main.AboutWindow import AboutWindow from View.Network.NetworkWindow import NetworkWindow from View.Geometry.GeometryWindow import GeometryWindow +from View.BoundaryCondition.BoundaryConditionWindow import BoundaryConditionWindow from Model.Study import Study @@ -114,7 +115,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit): "action_toolBar_geometry": self.open_geometry, "action_toolBar_mesh": lambda: self.open_dummy("Mesh"), "action_toolBar_run_meshing_tool": lambda: self.open_dummy("Lancement mailleur externe"), - "action_toolBar_boundary_cond": lambda: self.open_dummy("Condition Limites"), + "action_toolBar_boundary_cond": self.open_boundary_cond, "action_toolBar_lateral_contrib": lambda: self.open_dummy("Apport Lateraux"), "action_toolBar_spills": lambda: self.open_dummy("Deversement"), "action_toolBar_sections": lambda: self.open_dummy("Tronçons"), @@ -315,6 +316,11 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit): "Geometry edition need a reach selected " "into river network window to work on it") + def open_boundary_cond(self): + self.bound = BoundaryConditionWindow(study = self.model, parent=self) + self.bound.show() + + # TODO: Delete me ! ############### # DUMMY STUFF # diff --git a/src/View/ui/BoundaryConditions.ui b/src/View/ui/BoundaryConditions.ui new file mode 100644 index 0000000000000000000000000000000000000000..8a0f8f962687b9a6df0057fbc166206932967c99 --- /dev/null +++ b/src/View/ui/BoundaryConditions.ui @@ -0,0 +1,134 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>MainWindow</class> + <widget class="QMainWindow" name="MainWindow"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>800</width> + <height>450</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="windowTitle"> + <string>MainWindow</string> + </property> + <property name="locale"> + <locale language="English" country="Europe"/> + </property> + <widget class="QWidget" name="centralwidget"> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QSplitter" name="splitter"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <widget class="QTableView" name="tableView"/> + <widget class="QWidget" name="verticalLayoutWidget"> + <layout class="QVBoxLayout" name="verticalLayout"/> + </widget> + </widget> + </item> + </layout> + </widget> + <widget class="QMenuBar" name="menubar"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>800</width> + <height>22</height> + </rect> + </property> + </widget> + <widget class="QToolBar" name="toolBar"> + <property name="windowTitle"> + <string>toolBar</string> + </property> + <attribute name="toolBarArea"> + <enum>TopToolBarArea</enum> + </attribute> + <attribute name="toolBarBreak"> + <bool>false</bool> + </attribute> + <addaction name="action_add"/> + <addaction name="action_del"/> + <addaction name="action_edit"/> + <addaction name="action_sort"/> + </widget> + <action name="action_add"> + <property name="checkable"> + <bool>false</bool> + </property> + <property name="icon"> + <iconset> + <normaloff>ressources/gtk-add.png</normaloff>ressources/gtk-add.png</iconset> + </property> + <property name="text"> + <string>Add</string> + </property> + <property name="toolTip"> + <string>Add a new boundary condition or lateral contribution</string> + </property> + <property name="shortcut"> + <string>Ctrl+N</string> + </property> + </action> + <action name="action_del"> + <property name="icon"> + <iconset> + <normaloff>ressources/gtk-remove.png</normaloff>ressources/gtk-remove.png</iconset> + </property> + <property name="text"> + <string>Delete</string> + </property> + <property name="toolTip"> + <string>Delete current selected rows</string> + </property> + <property name="shortcut"> + <string>Ctrl+D</string> + </property> + </action> + <action name="action_edit"> + <property name="icon"> + <iconset> + <normaloff>ressources/edit.png</normaloff>ressources/edit.png</iconset> + </property> + <property name="text"> + <string>Edit</string> + </property> + <property name="toolTip"> + <string>Edit boundary condition or lateral contribution</string> + </property> + <property name="shortcut"> + <string>Ctrl+E</string> + </property> + </action> + <action name="action_sort"> + <property name="icon"> + <iconset> + <normaloff>ressources/gtk-sort-ascending.png</normaloff>ressources/gtk-sort-ascending.png</iconset> + </property> + <property name="text"> + <string>Sort</string> + </property> + <property name="toolTip"> + <string>Sort boundary condition by name</string> + </property> + </action> + </widget> + <resources/> + <connections/> +</ui> diff --git a/src/View/ui/EditBoundaryConditions.ui b/src/View/ui/EditBoundaryConditions.ui new file mode 100644 index 0000000000000000000000000000000000000000..6a36a552034f3178ae21bdc080da60ba65e2873a --- /dev/null +++ b/src/View/ui/EditBoundaryConditions.ui @@ -0,0 +1,118 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>MainWindow</class> + <widget class="QMainWindow" name="MainWindow"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>800</width> + <height>450</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="windowTitle"> + <string>MainWindow</string> + </property> + <property name="locale"> + <locale language="English" country="Europe"/> + </property> + <widget class="QWidget" name="centralwidget"> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QSplitter" name="splitter"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <widget class="QTableView" name="tableView"/> + <widget class="QWidget" name="verticalLayoutWidget"> + <layout class="QVBoxLayout" name="verticalLayout"/> + </widget> + </widget> + </item> + </layout> + </widget> + <widget class="QMenuBar" name="menubar"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>800</width> + <height>22</height> + </rect> + </property> + </widget> + <widget class="QToolBar" name="toolBar"> + <property name="windowTitle"> + <string>toolBar</string> + </property> + <attribute name="toolBarArea"> + <enum>TopToolBarArea</enum> + </attribute> + <attribute name="toolBarBreak"> + <bool>false</bool> + </attribute> + <addaction name="action_add"/> + <addaction name="action_del"/> + <addaction name="action_sort"/> + </widget> + <action name="action_add"> + <property name="checkable"> + <bool>false</bool> + </property> + <property name="icon"> + <iconset> + <normaloff>ressources/gtk-add.png</normaloff>ressources/gtk-add.png</iconset> + </property> + <property name="text"> + <string>Add</string> + </property> + <property name="toolTip"> + <string>Add a new point in boundary condition or lateral contribution</string> + </property> + <property name="shortcut"> + <string>Ctrl+N</string> + </property> + </action> + <action name="action_del"> + <property name="icon"> + <iconset> + <normaloff>ressources/gtk-remove.png</normaloff>ressources/gtk-remove.png</iconset> + </property> + <property name="text"> + <string>Delete</string> + </property> + <property name="toolTip"> + <string>Delete current selected rows</string> + </property> + <property name="shortcut"> + <string>Ctrl+D</string> + </property> + </action> + <action name="action_sort"> + <property name="icon"> + <iconset> + <normaloff>ressources/gtk-sort-ascending.png</normaloff>ressources/gtk-sort-ascending.png</iconset> + </property> + <property name="text"> + <string>Sort</string> + </property> + <property name="toolTip"> + <string>Sort boundary condition point</string> + </property> + </action> + </widget> + <resources/> + <connections/> +</ui>