mirror of https://gitlab.com/pamhyr/pamhyr2
Network: Fix missing file and pep8.
parent
46b943c800
commit
5fec95cc4d
|
|
@ -112,7 +112,7 @@ class FrictionList(PamhyrModelList):
|
|||
frictions = list(
|
||||
filter(
|
||||
lambda f: ((rk_min <= f.begin_rk <= rk_max) or
|
||||
(rk_min <= f.end_rk <= rk_max)),
|
||||
(rk_min <= f.end_rk <= rk_max)),
|
||||
self._lst))
|
||||
|
||||
for ind, friction in enumerate(frictions):
|
||||
|
|
|
|||
|
|
@ -446,6 +446,7 @@ class RiverReach(Edge):
|
|||
|
||||
return new_reach1, new_reach2
|
||||
|
||||
|
||||
class River(Graph):
|
||||
_sub_classes = [
|
||||
StricklersList,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,91 @@
|
|||
# ProfileDialog.py -- Pamhyr
|
||||
# Copyright (C) 2025 INRAE
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import logging
|
||||
import random
|
||||
|
||||
from tools import logger_exception
|
||||
|
||||
from View.Tools.PamhyrWindow import PamhyrDialog
|
||||
from View.Network.translate import NetworkTranslate
|
||||
|
||||
from PyQt5.QtGui import (
|
||||
QKeySequence,
|
||||
)
|
||||
|
||||
from PyQt5.QtCore import (
|
||||
Qt, QVariant, QAbstractTableModel,
|
||||
QCoreApplication, QModelIndex, pyqtSlot,
|
||||
)
|
||||
|
||||
from PyQt5.QtWidgets import (
|
||||
QDialogButtonBox, QPushButton, QLineEdit,
|
||||
QFileDialog, QTableView, QAbstractItemView,
|
||||
QUndoStack, QShortcut, QAction, QItemDelegate,
|
||||
QComboBox, QVBoxLayout, QHeaderView, QTabWidget,
|
||||
QTextEdit,
|
||||
)
|
||||
|
||||
logger = logging.getLogger()
|
||||
|
||||
|
||||
class SelectProfileDialog(PamhyrDialog):
|
||||
_pamhyr_ui = "SelectProfile"
|
||||
_pamhyr_name = "Select profile"
|
||||
|
||||
def __init__(self, study=None, config=None,
|
||||
reach=None, trad=None, parent=None):
|
||||
self._trad = trad
|
||||
if self._trad is not None:
|
||||
name = trad["dialog_select_profile_title"]
|
||||
|
||||
super(SelectProfileDialog, self).__init__(
|
||||
title=name,
|
||||
study=study,
|
||||
config=config,
|
||||
options=[],
|
||||
parent=parent
|
||||
)
|
||||
|
||||
self._reach = reach
|
||||
self._profile = None
|
||||
|
||||
self.setup_combobox()
|
||||
|
||||
def setup_combobox(self):
|
||||
self.combobox_add_items(
|
||||
"comboBox",
|
||||
list(
|
||||
map(
|
||||
lambda p: p.display_name(),
|
||||
self._reach.reach.profiles)))
|
||||
|
||||
def accept(self):
|
||||
profile = self.get_combobox_text("comboBox")
|
||||
|
||||
self._profile = next(
|
||||
filter(
|
||||
lambda p: p.display_name() == profile,
|
||||
self._reach.reach.profiles
|
||||
)
|
||||
)
|
||||
|
||||
super(SelectProfileDialog, self).accept()
|
||||
|
||||
def reject(self):
|
||||
self.close()
|
||||
|
|
@ -117,6 +117,7 @@ class DelEdgeCommand(QUndoCommand):
|
|||
def redo(self):
|
||||
self._graph.remove_edge(self._edge)
|
||||
|
||||
|
||||
class SplitEdgeCommand(QUndoCommand):
|
||||
def __init__(self, graph, edge, profile):
|
||||
QUndoCommand.__init__(self)
|
||||
|
|
@ -139,6 +140,7 @@ class SplitEdgeCommand(QUndoCommand):
|
|||
self._new_r1.set_as_not_deleted()
|
||||
self._new_r2.set_as_not_deleted()
|
||||
|
||||
|
||||
class SetCommand(QUndoCommand):
|
||||
def __init__(self, element, column, new_value):
|
||||
QUndoCommand.__init__(self)
|
||||
|
|
|
|||
|
|
@ -46,9 +46,12 @@ class NetworkTranslate(MainTranslate):
|
|||
"Network", "Delete node reservoir"
|
||||
)
|
||||
|
||||
self._dict["menu_del_edge"] = _translate("Network", "Delete the reach")
|
||||
self._dict["menu_split_edge"] = _translate("Network", "Split the reach")
|
||||
self._dict["menu_ena_edge"] = _translate("Network", "Enable the reach")
|
||||
self._dict["menu_del_edge"] = _translate("Network",
|
||||
"Delete the reach")
|
||||
self._dict["menu_split_edge"] = _translate("Network",
|
||||
"Split the reach")
|
||||
self._dict["menu_ena_edge"] = _translate("Network",
|
||||
"Enable the reach")
|
||||
self._dict["menu_dis_edge"] = _translate("Network",
|
||||
"Disable the reach")
|
||||
self._dict["menu_rev_edge"] = _translate(
|
||||
|
|
|
|||
|
|
@ -0,0 +1,67 @@
|
|||
<?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>400</width>
|
||||
<height>76</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<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="QComboBox" name="comboBox"/>
|
||||
</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