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

boundary conditions: Add model scheme and window scheme.

Showing with 353 additions and 1 deletion
+353 -1
# -*- 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
......@@ -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
......
# -*- 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()
# -*- 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)
......@@ -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 #
......
<?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>
<?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>
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